本文整理汇总了PHP中unknown_type::getGUID方法的典型用法代码示例。如果您正苦于以下问题:PHP unknown_type::getGUID方法的具体用法?PHP unknown_type::getGUID怎么用?PHP unknown_type::getGUID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unknown_type
的用法示例。
在下文中一共展示了unknown_type::getGUID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: twitter_api_update_user_avatar
/**
* Pull in the latest avatar from twitter.
*
* @param unknown_type $user
* @param unknown_type $file_location
*/
function twitter_api_update_user_avatar($user, $file_location)
{
// twitter's images have a few suffixes:
// _normal
// _resonably_small
// _mini
// the twitter app here returns _normal. We want standard, so remove the suffix.
// @todo Should probably check that it's an image file.
$file_location = str_replace('_normal.jpg', '.jpg', $file_location);
$sizes = array('topbar' => array(16, 16, TRUE), 'tiny' => array(25, 25, TRUE), 'small' => array(40, 40, TRUE), 'medium' => array(100, 100, TRUE), 'large' => array(200, 200, FALSE), 'master' => array(550, 550, FALSE));
$filehandler = new ElggFile();
$filehandler->owner_guid = $user->getGUID();
foreach ($sizes as $size => $dimensions) {
$image = get_resized_image_from_existing_file($file_location, $dimensions[0], $dimensions[1], $dimensions[2]);
$filehandler->setFilename("profile/{$user->guid}{$size}.jpg");
$filehandler->open('write');
$filehandler->write($image);
$filehandler->close();
}
// update user's icontime
$user->icontime = time();
return TRUE;
}
示例2: facebook_connect_update_user_avatar
/**
* Pull in the latest avatar from facebook.
*
* @param unknown_type $user
* @param unknown_type $file_location
*/
function facebook_connect_update_user_avatar($user, $file_location)
{
global $CONFIG;
$tempfile = $CONFIG->dataroot . $user->getGUID() . 'img.jpg';
$imgContent = file_get_contents($file_location);
$fp = fopen($tempfile, "w");
fwrite($fp, $imgContent);
fclose($fp);
$sizes = array('topbar' => array(16, 16, TRUE), 'tiny' => array(25, 25, TRUE), 'small' => array(40, 40, TRUE), 'medium' => array(100, 100, TRUE), 'large' => array(200, 200, FALSE), 'master' => array(550, 550, FALSE));
$filehandler = new ElggFile();
$filehandler->owner_guid = $user->getGUID();
foreach ($sizes as $size => $dimensions) {
$image = get_resized_image_from_existing_file($tempfile, $dimensions[0], $dimensions[1], $dimensions[2]);
$filehandler->setFilename("profile/{$user->guid}{$size}.jpg");
$filehandler->open('write');
$filehandler->write($image);
$filehandler->close();
}
// update user's icontime
$user->icontime = time();
return TRUE;
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:28,代码来源:facebook_connect.php
示例3: createRandomAnnotations
/**
* Creates random annotations on $entity
*
* @param unknown_type $entity
* @param unknown_type $max
*/
public function createRandomAnnotations($entity, $max = 1)
{
$annotations = array();
for ($i = 0; $i < $max; $i++) {
$name = 'test_annotation_name_' . rand();
$value = rand();
$id = create_annotation($entity->getGUID(), $name, $value, 'integer', $entity->getGUID());
$annotations[] = elgg_get_annotation_from_id($id);
}
return $annotations;
}