本文整理汇总了PHP中Persona::get_configuration_data方法的典型用法代码示例。如果您正苦于以下问题:PHP Persona::get_configuration_data方法的具体用法?PHP Persona::get_configuration_data怎么用?PHP Persona::get_configuration_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Persona
的用法示例。
在下文中一共展示了Persona::get_configuration_data方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch
function generate_inner_html()
{
switch ($this->mode) {
case PRI:
$this->outer_template = 'outer_private_side_module.tpl';
$tmp_file = dirname(__FILE__) . '/side_inner_public.tpl';
break;
default:
$tmp_file = dirname(__FILE__) . '/side_inner_public.tpl';
break;
}
$inner_html_gen =& new Template($tmp_file);
// See if we have a Flickr ID for $this->uid.
$flickr_id = Cache::getExtCache($this->uid, "flickr_id");
if ($flickr_id === NULL) {
// fetch all personas from the flickr service, and see if one of them has a filled in flickr_username_email field.
$persona = new Persona();
$flickr_persona_ids = $persona->get_user_persona_ids_with_service($this->uid, "Flickr");
foreach ($flickr_persona_ids as $flickr_persona_id) {
$persona = new Persona();
$persona->load((int) $flickr_persona_id);
$data = $persona->get_configuration_data();
if (!empty($data->flickr_username_email)) {
// found one!
$flickr_id = $data->flickr_username_email;
break;
}
}
if (!empty($flickr_id)) {
Cache::setExtCache($this->uid, "flickr_id", $flickr_id);
}
}
if (empty($flickr_id)) {
$pics = NULL;
} else {
// Fetch pics from cache if possible. If not cached, the inner HTML will call ajax/flickr_pics.php to fetch them.
$pics = Cache::getExtCache(0, "flickr_pics:{$flickr_id}");
}
$inner_html_gen->set('pics', $pics);
$inner_html_gen->set('flickr_id', $flickr_id);
$inner_html = $inner_html_gen->fetch();
return $inner_html;
}
示例2: can_see
public static function can_see($persona_id, $owner_uid, $viewer_uid)
{
Logger::log("Enter: function PersonaHelper::can_see() persona_id: {$persona_id}, owner_uid; {$owner_uid}, viewer_uid: {$viewer_uid}");
// load the persona to see it's privacy data
try {
$persona = new Persona();
$persona->load($persona_id);
} catch (PAException $e) {
Logger::Log($e->getMessage());
Logger::log("Exit: function PersonaHelper::can_see() with NULL");
return null;
// no persona!
}
$data = $persona->get_configuration_data();
$perm = intval($data->perm);
if ($viewer_uid == 0) {
// anon users don't have relations
$relation = 0;
// and are definetly not family
$in_family = 0;
} else {
if ($owner_uid == $viewer_uid) {
$relation = 2;
$in_family = 1;
} else {
// $relation = Relation::get_relation($owner_uid, $viewer_uid);
$relations = Relation::get_relations($owner_uid);
$relation = in_array($viewer_uid, $relations);
$in_family = Relation::is_relation_in_family($owner_uid, $viewer_uid);
}
}
Logger::log("PersonaHelper::can_see() perm: {$perm}, relation: {$relation}, in_family: {$in_family}");
if (!$perm) {
// permissions weren't set or are 0 == nobody
Logger::log("Exit: function PersonaHelper::can_see() with NULL");
return null;
} else {
if ($perm == 1) {
// show to world (everybody)
Logger::log("Exit: function PersonaHelper::can_see() with Persona");
return $persona;
} else {
if ($perm == 2) {
// show to relations
if ($relation) {
Logger::log("Exit: function PersonaHelper::can_see() with Persona");
return $persona;
}
} else {
if ($perm == 3) {
// show to family
if ($in_family) {
Logger::log("Exit: function PersonaHelper::can_see() with Persona");
return $persona;
}
} else {
Logger::log("Exit: function PersonaHelper::can_see() with NULL");
return null;
}
}
}
}
}
示例3: Persona
$data['agreetotos'] = 'no';
}
if ($myService == 'Flickr' && !isset($_POST['Flickr_agreetotos'])) {
$data['agreetotos'] = 'no';
}
if (isset($data['persona_id']) && $data['persona_id'] > 0) {
// load Persona
$persona = new Persona();
$persona->load($data['persona_id']);
// check if Persona belongs to user
if ($persona->user_id != $user->user_id) {
// TODO: make meaningfull error handling here
$msg = "The service couldn't be updated. It is not associated with your account.";
} else {
// edit the data
$persona->get_configuration_data();
$c =& $persona->configuration_data;
foreach ($data as $k => $v) {
$c->{$k} = $v;
$persona->{$k} = $v;
}
// save the bugger
$persona->save();
trigger_scraper($user, $persona);
$persona = NULL;
$c = NULL;
}
} else {
// we have not been passed a persona_id
// so we are creating a new one
$persona = new Persona();