本文整理汇总了PHP中UserHelper::isLoggedIn方法的典型用法代码示例。如果您正苦于以下问题:PHP UserHelper::isLoggedIn方法的具体用法?PHP UserHelper::isLoggedIn怎么用?PHP UserHelper::isLoggedIn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserHelper
的用法示例。
在下文中一共展示了UserHelper::isLoggedIn方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_profile_box
/**
* An ajax call to get the current logged-in-user's profile page when logged in.
* Loaded via ajax so the front page can be cached easily
* Loads a login box if the user is not logged in, and a profile
* box if they are
*/
public function get_profile_box()
{
if (UserHelper::isLoggedIn()) {
$this->load->view('global/_profile_box');
} else {
$this->load->view('global/_login_form');
}
}
示例2: rate
/**
* Rate a package
*/
public function rate($package_name)
{
$this->load->model('spark');
$this->load->model('rating');
$spark = Spark::getInfo($package_name);
if (!$spark) {
show_404();
}
if ($this->input->post('rating') && UserHelper::isLoggedIn()) {
$this->load->model('rating');
$this->rating->rate(UserHelper::getId(), $spark->id, $this->input->post('rating'));
} else {
$this->error("You are not logged in, or your request was invalid");
}
$this->success(array('ratings' => $this->rating->getRatings($spark->id)));
}
示例3: base_url
<td>Contributor</td>
<td>: <a href="<?php
echo base_url();
?>
contributors/<?php
echo $contributor->username;
?>
/profile"><?php
echo $contributor->username;
?>
</a></td>
</tr>
<tr>
<td>Email</td>
<td>: <?php
echo UserHelper::isLoggedIn() ? $contributor->email : "Log in to view";
?>
</td>
</tr>
<tr>
<td>Author Website</td>
<td>: <a target="_blank" href="<?php
echo prep_url($contributor->website);
?>
"><?php
echo $contributor->website;
?>
</a></td>
</tr>
<?php
if ($contribution->website) {
示例4: show
/**
* Show the public information page for a spark
* @param string $package_name The package being viewed
*/
public function show($package_name)
{
#UtilityHelper::tryPageCache();
$this->load->model('spark');
$this->load->model('rating');
$this->load->model('contributor');
$spark = Spark::getInfo($package_name);
if (!$spark) {
show_404();
}
$contributor = $spark->getContributor();
if ($spark->fork_id > 0) {
$forks = Spark::getForks($spark->fork_id);
array_unshift($forks, Spark::getById($spark->fork_id));
} else {
$forks = Spark::getForks($spark->id);
}
// Get the stats for this Spark
$data['stats'] = $spark->getStats($spark->id);
$this->load->helper('google_chart');
$data['contribution'] = $spark;
$data['contributor'] = $contributor;
$data['versions'] = $spark->getVersions(TRUE);
$data['versions_unverified'] = $spark->getVersions(FALSE);
$data['is_author'] = $contributor->id == UserHelper::getId();
$data['current_user_rating'] = FALSE;
$data['ratings'] = $this->rating->getRatings($spark->id);
$data['forks'] = $forks;
if (UserHelper::isLoggedIn()) {
$data['current_user_rating'] = $this->rating->getUserRating(UserHelper::getId(), $spark->id);
}
$this->load->view('packages/show', $data);
}