本文整理汇总了PHP中pathang::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP pathang::getInstance方法的具体用法?PHP pathang::getInstance怎么用?PHP pathang::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pathang
的用法示例。
在下文中一共展示了pathang::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showMembers
public function showMembers()
{
$count = pathang::getInstance('pathang')->FEEDSTACK->MEMBER_COUNT;
$from = pathang::getInstance('request')->get('from');
if ($from) {
$members = pathang::GetModel('usermain')->listMembers($count, $from);
} else {
$members = pathang::GetModel('usermain')->listMembers($count);
}
$users = new stdClass();
foreach ($members as $a => $b) {
$temp = new stdClass();
foreach ($b as $x => $y) {
$temp->{$x} = $y;
}
$temp->image = '';
$temp->profile_link = ROOT . $temp->username;
$users->{$a} = $temp;
}
$result = pathang::GetHelper('userlog')->getUsersImage($users);
$basket = pathang::GetInstance('basket');
$basket->set('members', $result);
$basket->set('count', $count);
$basket->set('heading', 'Members');
if ($from) {
pathang::render('members', 'members_loadmore');
} else {
pathang::render('members');
}
}
示例2: krishna
public function krishna()
{
$request = pathang::getInstance('request');
$request->page = 'color';
$request->color = 'red';
pathang::render('sample', 'krishna');
}
示例3: main
public function main()
{
$tmpl = pathang::getInstance('packet')->get('tmpl');
if ($tmpl) {
pathang::display($tmpl);
}
}
示例4: theme
public function theme()
{
$request = pathang::getInstance('request');
$request->page = 'color';
$request->color = 'voilet';
pathang::render('sample', 'themes');
}
示例5: renderView
public function renderView()
{
$heading = "giving wings to developers !";
$data = "<p>Do you know... you can render this page in three different formats?</p>\n\t\t<p> For normal view with template its root_url/render, To get the json format you need to suffix .json to the url... \n\t\tlike this root_url/render.json and to display html version by excluding the template... suffix the url with .html ex: root_url/render.html</p>";
$basket = pathang::getInstance('basket');
$basket->set('heading', $heading);
$basket->set('message', $data);
}
示例6: main
public function main()
{
//openmenu based on page either 'feed','admin' or 'mainpage'
$page = strtoupper(pathang::getInstance('node')->get('n1'));
if ($page === 'FEED' || $page === 'ADMIN') {
pathang::display(strtolower($page));
} else {
pathang::display();
}
}
示例7: main
public function main()
{
$username = pathang::getInstance('node')->get('n1');
$uid = pathang::getModel('userlog')->getUserId($username);
pathang::GetInstance('request')->set('snippet', 1);
$following = pathang::getController('profile')->following();
$count = pathang::getModel('profile')->followingCount($uid);
pathang::GetInstance('packet')->Set('following', $following);
pathang::GetInstance('packet')->Set('count', $count);
pathang::display();
}
示例8: saveNotification
public function saveNotification($uid, $agent, $target, $action)
{
$time_stamp = date("Y-m-d H:i:s");
$status = 1;
//pdo object and table
$pdo = pathang::getInstance('pdo');
$table = 'notifications';
// sql insert statement
$sql = "INSERT INTO {$table} \r\n\t\t\t\t\t\t(uid,agent,target,action,time_stamp,status) \r\n\t\t\t\t VALUES ({$uid},{$agent},{$target},'{$action}','{$time_stamp}',{$status})";
$result = $pdo->exec($sql);
$insertId = $pdo->lastInsertId();
if ($insertId) {
return $insertId;
} else {
return false;
}
}
示例9: start
public static function start()
{
if (session_id() == '') {
session_start();
session_regenerate_id(true);
}
if (isset($_SESSION['timeout'])) {
$session_life = time() - $_SESSION['timeout'];
$expire = $_SESSION['expire'];
//echo $session_life.' '.$expire;
if ($session_life > $expire) {
self::destroy();
}
}
$pathang = pathang::getInstance('pathang');
$expire = $pathang->SITE->SESSION_EXPIRE;
self::expire($expire);
}
示例10: main
public function main()
{
//display menu as user/guest or admin
$n1 = pathang::getInstance('node')->get('n1');
$session = pathang::getInstance('session');
$liveuser = $session->get('liveuser');
if ($liveuser) {
$uid = $liveuser->id;
$unread = pathang::GetModel('profile')->getUnreadNotificationCount($uid);
pathang::getInstance('packet')->set('unread', $unread);
if ($liveuser->type == 1) {
pathang::display();
} else {
pathang::display('admin');
}
} else {
pathang::display('guest');
}
}
示例11: create_tables
public function create_tables($db_name, $host, $user, $pass)
{
$db = new PDO("mysql:host=localhost;dbname={$db_name}", $user, $pass);
$file = 'app/db.json';
if (file_exists($file)) {
$setting = json_decode(file_get_contents($file));
foreach ($setting as $key => $value) {
$db->exec($value);
}
}
//create admin
$request = pathang::GetInstance('request');
$name = ucwords($request->filterHTMLSQL('name'));
$username = $request->filterHTMLSQL('username');
$password = $request->filterHTMLSQL('password');
$email = $request->filterHTMLSQL('email');
$hash = md5($password);
$activation = 1;
$timestamp = date("Y-m-d H:i:s");
$feeds_per_page = pathang::getInstance('pathang')->FEEDSTACK->FEED_COUNT;
$access = 1;
$bio = "Hey people im a new entry to this website..hope to have fun..follow me to get updates.";
$image_type = 'server';
//pdo object and table
$pdo = $db;
$table = 'users';
// sql insert statement
$sql = "INSERT INTO {$table} \r\n\t\t\t\t\t\t(bio,image_type,name,username,password,email,type,block,\r\n\t\t\t\t\t\t activation,creation_timestamp,feeds_per_page,access,lastlogin_timestamp) \r\n\t\t\t\t VALUES ('{$bio}','{$image_type}','{$name}','{$username}','{$hash}','{$email}',2,0,\r\n\t\t\t\t \t\t '{$activation}','{$timestamp}',{$feeds_per_page},{$access},'{$timestamp}')";
// type 1 - users, type 2 - moderator, type 3 - administrator
// creation and lastlogin time is set to same value
// password is md5 hash of the given value
// activation is a random 8 char code
$result = $pdo->exec($sql);
$uid = $pdo->lastInsertId();
//self follow
$time_stamp = date("Y-m-d H:i:s");
$table = 'followers';
$follow_id = $uid;
// sql insert statement
$sql = "INSERT INTO {$table} \r\n\t\t\t\t\t\t(uid,follow_id,time_stamp) \r\n\t\t\t\t VALUES ({$uid},{$follow_id},'{$time_stamp}')";
$result = $pdo->exec($sql);
}
示例12: getCount
public function getCount($table)
{
//pdo object and table
$pdo = pathang::getInstance('pdo');
if ($table == 'followers') {
$sql = "SELECT count(*) 'count' \r\n\t\t\t\t\tFROM {$table} where uid!=follow_id";
} else {
// sql insert statement
$sql = "SELECT count(*) 'count' \r\n\t\t\t\t\tFROM {$table}";
}
//query and fetch the result
$res = $pdo->query($sql);
$result = $res->fetch(PDO::FETCH_ASSOC);
//if record found return activation else false
if ($result) {
return $result['count'];
} else {
return null;
}
}
示例13: time
padding:10px;
font-size: 20px;
}
.heading-name{
padding-top:10px;
padding-left: 5px;
}
.cancel{
background: #e74c3c;
}
.save{
background: #27ae60;
}
</style>
<?php
$username = pathang::getInstance('session')->get('liveuser')->username;
$image = ROOT . 'img/users/' . $username . '_original.jpg?' . time();
?>
<link rel="stylesheet" href="<?php
echo ROOT;
?>
lib/jcrop/css/jquery.Jcrop.min.css" type="text/css" />
<div class="root" root="<?php
echo ROOT;
?>
" access-token='<?php
echo pathang::GetInstance('session')->get('token');
?>
'></div>
<div class="crop-container">
<div class="inner-container">
示例14:
<!--
Logged in Page
_________________________________________
-User Page after login which displays the username
and logout button.
-->
<div class="box-userlog">
<?php
$liveuser = pathang::getInstance('session')->get('liveuser');
?>
<img src="<?php
echo $liveuser->image;
?>
" class="login-image"/ >
<h1>Hi
<a href="<?php
echo ROOT . $liveuser->username;
?>
">
<span style="color:#2980b9"><?php
echo $liveuser->name;
?>
</span>
</a>
</h1>
<h4><a href="<?php
echo ROOT;
?>
user/logout">Logout</a></h4>
示例15:
<?php
$username = pathang::getInstance('session')->get('liveuser')->username;
$unread = pathang::getInstance('packet')->get('unread');
?>
<ul class="menu-bar">
<a href="<?php
echo ROOT;
?>
" ><li><i class="fa fa-space fa-home"></i>Home</li></a>
<a href="<?php
echo ROOT;
?>
admin" ><li><i class="fa fa-space fa-dashboard"></i>Admin</li></a>
<a href="<?php
echo ROOT . $username;
?>
" ><li><i class="fa fa-space fa-user">
</i>Profile
<?php
if ($unread) {
?>
<span class="menu-unread"><i class="fa da-space fa-bell"></i> <?php
echo $unread;
?>
</span>
<?php
}
?>
</li>
</a>