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


PHP Persona::load方法代码示例

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


在下文中一共展示了Persona::load方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:43,代码来源:FlickrModule.php

示例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;
                 }
             }
         }
     }
 }
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:63,代码来源:PersonaHelper.php

示例3: Persona

     if (preg_match($sreg, $k)) {
         $field = preg_replace($sreg, '', $k);
         $data[$field] = $v;
     }
 }
 // special for ckeckbox
 if ($myService == 'Facebook' && !isset($_POST['Facebook_agreetotos'])) {
     $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);
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:31,代码来源:external.php

示例4: uid

if ($_SESSION['user']['id']) {
    $uid = (int) $_SESSION['user']['id'];
} else {
    // ah-ah no WAY :)
    Logger::log(__FILE__ . ": No Session for this visit");
}
if (!$uid || !$persona_id) {
    $msg = __FILE__ . ": No IDs for uid({$uid}) or persona_id({$persona_id}) passed";
    Logger::log($msg);
    print "ERROR: User not logged in.";
    exit;
}
// load the persona
$persona = new Persona();
try {
    $persona->load($persona_id);
} catch (Exception $e) {
    $msg = __FILE__ . ": persona({$persona_id}) does not exist";
    Logger::log($msg);
    print "ERROR: " . $msg;
    exit;
}
// check to see if user owns it
if ($persona->user_id != $uid) {
    $msg = __FILE__ . ": User({$uid}) does not own persona({$persona_id})";
    Logger::log($msg);
    print "ERROR: " . $msg;
    exit;
}
// else show it
// print_r($persona);
开发者ID:CivicCommons,项目名称:oldBellCaPA,代码行数:31,代码来源:showpersonadata.php


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