本文整理汇总了PHP中Lib类的典型用法代码示例。如果您正苦于以下问题:PHP Lib类的具体用法?PHP Lib怎么用?PHP Lib使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Lib类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: output
public function output()
{
$this->load->library('lib');
$lib = new Lib();
$test = $lib->test();
$data['json'] = $test;
$this->load->view('news/output', $data);
}
开发者ID:rjmcbdev,项目名称:My-first-Code-Igniter-App,代码行数:8,代码来源:news.php
示例2: view
public function view($viewname, $params)
{
$getpublic = new Lib();
$public = $getpublic->getPublic();
$checkuri = explode('/', $_SERVER['REQUEST_URI']);
$uri = $checkuri[2];
$withparams = $params;
$name = __DIR__ . '/../views/' . $viewname . '.php';
include __DIR__ . '/../views/MainView.php';
}
开发者ID:Equilibumq,项目名称:TaskProject,代码行数:10,代码来源:Lib.php
示例3: main
public function main()
{
$pageview = Lib::view('page');
$pages = $pageview->getPages();
$this->set('pageview', $pageview);
$this->set('pages', $pages);
}
开发者ID:jasonrey,项目名称:lab-page,代码行数:7,代码来源:index.php
示例4: display
public function display()
{
$this->main();
$body = $this->output();
$vars = array_merge(array('body' => $body, 'viewname' => $this->viewname, 'pagetitle' => $this->pagetitle, 'metakeywords' => $this->metakeywords, 'metadescription' => $this->metadescription, 'canonical' => $this->canonical, 'css' => $this->css, 'js' => $this->js), $this->vars);
echo Lib::output('common/dom', $vars);
}
开发者ID:jasonrey,项目名称:lab-page,代码行数:7,代码来源:view.php
示例5: main
public function main()
{
$this->meta[] = array('name' => 'google-signin-client_id', 'content' => Config::$googleClientId . '.apps.googleusercontent.com');
$cookie = Lib::cookie();
$identifier = $cookie->get(Lib::hash(Config::$userkey));
$user = Lib::table('user');
$isLoggedIn = !empty($identifier) && $user->load(array('identifier' => $identifier));
$this->set('user', $user);
$this->set('isLoggedIn', $isLoggedIn);
$this->js[] = $isLoggedIn ? 'inbox' : 'login';
if ($isLoggedIn) {
array_shift($this->js);
$id = Req::get('id');
if (empty($id)) {
Lib::redirect('index');
}
$report = Lib::table('report');
if (!$report->load($id)) {
$this->template = 'no-report';
return;
}
$report->init();
$assignees = Lib::model('user')->getProjectAssignees($report->project_id);
$projectTable = Lib::table('project');
$projectTable->load($report->project_id);
$this->set('report', $report);
$this->set('assignees', $assignees);
$this->set('project', $projectTable);
}
}
开发者ID:jasonrey,项目名称:project-test-report,代码行数:30,代码来源:report.php
示例6: arhive
public function arhive()
{
try {
$zip = new Zip();
$res = array();
foreach ($this->params->files as $n) {
$file = BasefileModel::createFromPath($n, false);
if ($file->type == 'folder') {
$this->arhiveRecursive($zip, $file, $file->name);
} else {
$zip->addFile($file->getContent(), Lib::convert($file->name, Cfg::get('charset'), Cfg::get('charsetZip')), $file->ctime());
}
$res[] = $file;
}
$c = count($res);
$name = 'arhive.zip';
if ($c == 1) {
$name = $res[0]->filename() . '.zip';
}
$zip->sendZip($name);
exit;
} catch (Exception $ex) {
Log::exception($ex);
echo gettext('Не возможно получить архив');
}
exit;
}
开发者ID:yesenfei,项目名称:extjs-file-manager,代码行数:27,代码来源:files.php
示例7: execute
public function execute()
{
$api = Lib::api('admin', array('response' => 'return', 'format' => 'php'));
$type = Req::get('type');
if (!is_callable(array($api, $type))) {
return Lib::redirect('error');
}
$result = $api->{$type}();
$options = array('view' => 'admin');
$ref = Req::post('ref');
if (!$result['state']) {
if (!empty($ref)) {
$options['ref'] = $ref;
}
} else {
$segments = explode('/', base64_decode(urldecode($ref)));
$base = array_shift($segments);
$type = array_shift($segments);
$subtype = array_shift($segments);
if (!empty($type)) {
$options['type'] = $type;
}
if (!empty($subtype)) {
$options['subtype'] = $subtype;
}
}
Lib::redirect('admin', $options);
}
开发者ID:jasonrey,项目名称:project-test-report,代码行数:28,代码来源:admin.php
示例8: saveAssignees
public function saveAssignees()
{
$keys = array('project', 'setting');
if (!Req::haspost($keys)) {
return $this->fail('Insufficient data.');
}
$identifier = Lib::cookie(Lib::hash(Config::$userkey));
$user = Lib::table('user');
$isLoggedIn = !empty($identifier) && $user->load(array('identifier' => $identifier));
if (!$isLoggedIn || $user->role != USER_ROLE_ADMIN) {
return $this->fail('You are not authorized.');
}
$project = Req::post('project');
$setting = json_decode(Req::post('setting'));
$projectTable = Lib::table('project');
if ($project !== 'all' && $project !== '-1' && !$projectTable->load(array('name' => $project))) {
return $this->fail('No such project.');
}
if ($project !== 'all') {
$projectAssignee = Lib::table('project_assignee');
$projectAssignee->load(array('user_id' => $setting->id, 'project_id' => $projectTable->id));
if ($setting->value) {
$projectAssignee->store();
} else {
$projectAssignee->delete();
}
}
return $this->success();
}
开发者ID:jasonrey,项目名称:project-test-report,代码行数:29,代码来源:project.php
示例9: display
public function display()
{
$this->main();
$body = $this->output();
$vars = array_merge(array('body' => $body, 'css' => $this->css, 'js' => $this->js, 'googlefont' => $this->googlefont, 'meta' => $this->meta), $this->vars);
echo Lib::output('common/html', $vars);
}
开发者ID:jasonrey,项目名称:project-test-report,代码行数:7,代码来源:view.php
示例10: main
public function main()
{
$this->set('backgroundPattern', '1001000110010111011001101100110111110000010101111101111111001011011001100100');
$this->set('hideHeader', true);
$this->set('pagetitle', 'Hello World');
$twitterHelper = Lib::helper('twitter');
$tweet = $twitterHelper->getLatestTweet('jasonkeorey');
$this->set('tweet', $tweet);
$now = new DateTime();
$currentDay = (int) $now->format('j');
$currentMonth = (int) $now->format('n');
$startYear = $endYear = $currentYear = (int) $now->format('Y');
if ($currentMonth < 7 || $currentMonth === 7 && $currentDay < 10) {
$startYear = $currentYear - 1;
} else {
$endYear = $currentYear + 1;
}
$startDate = new DateTime($startYear . '-07-10');
$endDate = new DateTime($endYear . '-07-10');
$totalDays = ($endDate->format('U') - $startDate->format('U')) / (60 * 60 * 24);
$elapsedDays = floor(($now->format('U') - $startDate->format('U')) / (60 * 60 * 24));
$expPercentage = floor($elapsedDays / $totalDays * 100);
$level = $currentYear - 1988;
$this->set('expPercentage', $expPercentage);
$this->set('level', $level);
}
开发者ID:jasonrey,项目名称:lab-page,代码行数:26,代码来源:about.php
示例11: Instance
static function Instance()
{
if (self::$_instance == NULL) {
self::$_instance = new Lib();
}
return self::$_instance;
}
开发者ID:,项目名称:,代码行数:7,代码来源:
示例12: __construct
public function __construct()
{
$expired = time() - Lib::GetSetting('sess.gc_maxlifetime');
$users = DBA::Open()->Query("SELECT * FROM " . USERS . " WHERE birthday != 0");
$this->count = $users->NumRows();
$this->users = $users->GetIterator();
$this->i = 1;
}
开发者ID:BackupTheBerlios,项目名称:k4bb,代码行数:8,代码来源:birthdays.class.php
示例13: __construct
public function __construct($data, $success = true, $message = '', $resultdata = true, $code = true)
{
$this->success = $success;
$this->message = $message;
$this->data = Lib::code($data);
if ($resultdata) {
$this->data = array('success' => $this->success, 'message' => $this->message, 'data' => $this->data);
}
}
开发者ID:yesenfei,项目名称:extjs-file-manager,代码行数:9,代码来源:response.php
示例14: to
public function to($userid)
{
$userTable = Lib::table('user');
$userTable->load($userid);
$table = Lib::table('slackuser');
if ($table->load(array('email' => $userTable->email))) {
$this->channel = '@' . $table->name;
}
}
开发者ID:jasonrey,项目名称:project-test-report,代码行数:9,代码来源:slack.php
示例15: main
public function main()
{
$filterProject = Req::get('project');
if (empty($filterProject)) {
$this->template = 'empty-project';
return;
}
$projectTable = Lib::table('project');
if (!$projectTable->load(array('name' => $filterProject))) {
$this->set('name', $filterProject);
$this->template = 'new-project';
return;
}
$this->meta[] = array('name' => 'google-signin-client_id', 'content' => Config::$googleClientId . '.apps.googleusercontent.com');
$cookie = Lib::cookie();
$identifier = $cookie->get(Lib::hash(Config::$userkey));
$user = Lib::table('user');
$isLoggedIn = !empty($identifier) && $user->load(array('identifier' => $identifier));
$this->set('user', $user);
$this->set('filterProject', $filterProject);
$this->set('filterSettingsProject', $filterProject);
$this->set('isLoggedIn', $isLoggedIn);
if (!$isLoggedIn) {
$this->js[] = 'login';
}
if ($isLoggedIn) {
$this->js[] = 'inbox';
$this->js[] = 'settings';
array_shift($this->js);
$userModel = Lib::model('user');
$assignees = $userModel->getProjectAssignees($projectTable->id);
$users = $userModel->getUsers();
$filterState = $cookie->get('filter-state', 'pending');
$filterAssignee = $cookie->get('filter-assignee', empty($assignees[$user->id]) ? 'all' : $user->id);
$filterSort = $cookie->get('filter-sort', 'asc');
$reportModel = Lib::model('report');
$reports = $reportModel->getItems(array('state' => constant('STATE_' . strtoupper($filterState)), 'assignee_id' => $filterAssignee, 'order' => 'date', 'direction' => $filterSort, 'project_id' => $projectTable->id));
$userSettingsTable = Lib::table('user_settings');
if (!$userSettingsTable->load(array('user_id' => $user->id, 'project_id' => $projectTable->id))) {
$userSettingsTable->load(array('user_id' => $user->id, 'project_id' => 0));
}
$userSettings = $userSettingsTable->getData();
if ($userSettings['color'] !== 'cyan' && $userSettings['color'] !== 'custom') {
$this->css[] = 'theme-' . str_replace(' ', '', $userSettings['color']);
}
$categories = Lib::model('category')->getCategories(['projectid' => $projectTable->id]);
$this->set('filterState', $filterState);
$this->set('filterAssignee', $filterAssignee);
$this->set('filterSort', $filterSort);
$this->set('reports', $reports);
$this->set('assignees', $assignees);
$this->set('userSettings', $userSettings);
$this->set('users', $users);
$this->set('projectTable', $projectTable);
$this->set('categories', $categories);
}
}
开发者ID:jasonrey,项目名称:project-test-report,代码行数:57,代码来源:embed.php
示例16: send
public static function send($data)
{
if (!$data['to'] || !$data['text']) {
return false;
}
$slackTable = Lib::table('slackuser');
if ($slackTable->load(['email' => $data['to']])) {
// Send slack
$slackMessage = Lib::helper('slack')->newMessage();
$slackMessage->channel = '@' . $slackTable->name;
$slackMessage->text = $data['text'];
$messageKeys = ['username', 'icon_emoji'];
foreach ($messageKeys as $mKey) {
if (!empty($data[$mKey])) {
$slackMessage->{$mKey} = $data[$mKey];
}
}
if (!empty($data['attachments'])) {
$attachmentKeys = ['fallback', 'color', 'title', 'title_link', 'text'];
foreach ($data['attachments'] as $attach) {
$attachment = $slackMessage->newAttachment();
foreach ($attachmentKeys as $aKey) {
if (!empty($attach[$aKey])) {
$attachment->{$aKey} = $attach[$aKey];
}
}
if (!empty($attach['fields'])) {
foreach ($attach['fields'] as $fieldKey => $fieldValue) {
$attachment->newField($fieldKey, $fieldValue);
}
}
}
}
$slackMessage->send();
} else {
// Send email
$mail = Lib::helper('mail')->newMessage();
$mail->recipientEmail = $data['to'];
$mail->subject = 'Report Notification';
$mail->body = '<p>' . $data['text'] . '</p>';
$attachments = '';
foreach ($data['attachments'] as $attach) {
if (empty($attach['title']) || empty($attach['title_link'])) {
continue;
}
$attachments .= '<p><a href="' . $attach['title_link'] . '">' . $attach['title'] . '</a></p>';
}
if (!empty($attachments)) {
$mail->body .= '<p><strong><u>Attachments</u></strong></p>';
$mail->body .= $attachments;
}
$mail->body .= '<p style="font-size: 10px;">Do not reply to this email.</p>';
$mail->send();
}
return true;
}
开发者ID:jasonrey,项目名称:project-test-report,代码行数:56,代码来源:notification.php
示例17: route
public function route($segments = array())
{
$name = array_shift($segments);
$method = array_shift($segments);
$api = Lib::api($name);
if (!is_callable(array($api, $method))) {
return Lib::api()->fail();
}
$api->{$method}($segments);
}
开发者ID:jasonrey,项目名称:lab-page,代码行数:10,代码来源:api.php
示例18: initTables
public function initTables()
{
$db = Lib::db();
foreach (glob(Config::getBasePath() . '/schemas/*.sql') as $file) {
$sql = file_get_contents($file);
$db->query($sql);
}
echo 'Completed';
exit;
}
开发者ID:jasonrey,项目名称:project-test-report,代码行数:10,代码来源:maintenance.php
示例19: getCategory
public function getCategory()
{
static $categories = [];
if (!isset($categories[$this->category_id])) {
$category = Lib::table('category');
$category->load($this->category_id);
$categories[$this->category_id] = $category;
}
return $categories[$this->category_id];
}
开发者ID:jasonrey,项目名称:project-test-report,代码行数:10,代码来源:report.php
示例20: env
public static function env()
{
if (Req::hasget('development')) {
Lib::cookie()->set('development', Req::get('development'));
}
if (Lib::cookie()->get('development')) {
return 'development';
}
return self::$env;
}
开发者ID:jasonrey,项目名称:lab-page,代码行数:10,代码来源:config.php
注:本文中的Lib类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论