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


PHP Base::instance方法代码示例

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


在下文中一共展示了Base::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: set_password

 /**
  * crypt password
  * Defines whether to use bcrypt or salted MD5
  * @param $val
  * @return string
  */
 public function set_password($val)
 {
     $f3 = \Base::instance();
     if (!$val) {
         $userDetails = new self();
         $userDetails->load(array('username = ?', $f3->get('POST.username')));
         $val = $userDetails->password;
         return $val;
     } else {
         $hash_engine = $f3->get('password_hash_engine');
         switch ($hash_engine) {
             case 'bcrypt':
                 $crypt = \Bcrypt::instance();
                 $val = $crypt->hash($val);
                 break;
             case 'md5':
                 // fall-through
             // fall-through
             default:
                 $val = md5($val . $f3->get('password_md5_salt'));
                 break;
         }
         return $val;
     }
 }
开发者ID:alienwithin,项目名称:OWASP-mth3l3m3nt-framework,代码行数:31,代码来源:user.php

示例2: get

 function get()
 {
     $f3 = \Base::instance();
     $f3->set('AUTOLOAD', $f3->get('AUTOLOAD') . ';app/cortex/');
     $f3->set('QUIET', false);
     $dbs = array('sql' => new \DB\SQL('mysql:host=localhost;port=3306;dbname=fatfree', 'fatfree', ''), 'jig' => new \DB\Jig('data/'), 'mongo' => new \DB\Mongo('mongodb://localhost:27017', 'testdb'));
     $results = array();
     // Test Syntax
     foreach ($dbs as $type => $db) {
         $test = new \Test_Syntax();
         $results = array_merge((array) $results, (array) $test->run($db, $type));
     }
     // Test Relations
     foreach ($dbs as $type => $db) {
         $f3->set('DB', $db);
         $test = new \Test_Relation();
         $results = array_merge((array) $results, (array) $test->run($db, $type));
     }
     // Test Filter
     foreach ($dbs as $type => $db) {
         $f3->set('DB', $db);
         $test = new \Test_Filter();
         $results = array_merge((array) $results, (array) $test->run($db, $type));
     }
     // Further Common Tests
     if (isset($dbs['sql'])) {
         $test = new \Test_Common();
         $f3->set('DB', $dbs['sql']);
         $results = array_merge((array) $results, (array) $test->run());
     }
     $f3->set('results', $results);
 }
开发者ID:tysongg,项目名称:pathfinder,代码行数:32,代码来源:cortex.php

示例3: __construct

 function __construct() {
     $f3 = Base::instance();
     $dbh = new PDO($f3->get('db_dns') . $f3->get('db_name'), $f3->get('db_user'), $f3->get('db_pass'));
     $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     $this->f3 = $f3;
     $this->db = $dbh;
 }
开发者ID:hendrosteven,项目名称:f3-template,代码行数:7,代码来源:Controller.php

示例4: __construct

 public function __construct()
 {
     $this->f3 = \Base::instance();
     $this->supportedLanguages = $this->f3->get('SUPPORTED_LANGUAGES');
     $this->fallback = $this->f3->get('FALLBACK');
     $this->setLanguage($this->detectLanguage());
 }
开发者ID:fredleroy,项目名称:muscEtPlume,代码行数:7,代码来源:LanguageService.php

示例5: __construct

 function __construct()
 {
     $f3 = Base::instance();
     $db = new DB\SQL($f3->get('db_dns') . $f3->get('db_name'), $f3->get('db_user'), $f3->get('db_pass'));
     $this->f3 = $f3;
     $this->db = $db;
 }
开发者ID:TomGB,项目名称:f3-crud,代码行数:7,代码来源:Controller.php

示例6: GetPass

 function GetPass()
 {
     $key = \Base::instance()->get('APP_KEY');
     $crypt = new \Helper\Crypt($key);
     $text = $this->get('root_pass');
     return $crypt->decrypt($text);
 }
开发者ID:karepwes,项目名称:OcsPanels,代码行数:7,代码来源:server.php

示例7: displayEdit

 protected function displayEdit()
 {
     $item = $this->getItem();
     if (empty($item) || $item->product_type != 'giftcards') {
         \Dsc\System::addMessage('Item is not a giftcard', 'error');
         $this->app->reroute('/admin/shop/giftcards');
     }
     $f3 = \Base::instance();
     $flash = \Dsc\Flash::instance();
     $variants = array();
     if ($flashed_variants = $flash->old('variants')) {
         foreach ($flashed_variants as $variant) {
             $key = implode("-", (array) $variant['attributes']);
             if (empty($key)) {
                 $key = $variant['id'];
             }
             $variants[$key] = $variant;
         }
     }
     $old = array_merge($flash->get('old'), array('variants' => $variants));
     $flash->store($old);
     $model = new \Shop\Models\Categories();
     $categories = $model->getList();
     \Base::instance()->set('categories', $categories);
     \Base::instance()->set('selected', 'null');
     $all_tags = $this->getModel()->getTags();
     \Base::instance()->set('all_tags', $all_tags);
     $this->app->set('meta.title', 'Edit Gift Card | Shop');
     $view = \Dsc\System::instance()->get('theme');
     $view->event = $view->trigger('onDisplayShopProductsEdit', array('item' => $this->getItem(), 'tabs' => array(), 'content' => array()));
     echo $view->render('Shop\\Admin\\Views::giftcards/edit.php');
 }
开发者ID:dioscouri,项目名称:f3-shop,代码行数:32,代码来源:GiftCard.php

示例8: __construct

 /**
  * init the model
  */
 public function __construct()
 {
     $f3 = \Base::instance();
     $this->table = $f3->get('db_table_prefix') . $this->table;
     $this->db = 'DB';
     parent::__construct();
     // validation & error handler
     $class = get_called_class();
     // PHP 5.3 bug
     $saveHandler = function (\DB\Cortex $self) use($class) {
         $valid = true;
         foreach ($self->getFieldConfiguration() as $field => $conf) {
             if (isset($conf['type'])) {
                 $val = $self->get($field);
                 $model = strtolower(str_replace('\\', '.', $class));
                 // check required fields
                 if (isset($conf['required'])) {
                     $valid = \Validation::instance()->required($val, $field, 'error.' . $model . '.' . $field);
                 }
                 // check unique
                 if (isset($conf['unique'])) {
                     $valid = \Validation::instance()->unique($self, $val, $field, 'error.' . $model . '.' . $field);
                 }
                 if (!$valid) {
                     break;
                 }
             }
         }
         return $valid;
     };
     $this->beforesave($saveHandler);
 }
开发者ID:xfra35,项目名称:fabulog,代码行数:35,代码来源:base.php

示例9: createpost

 public function createpost()
 {
     // Log-in stuff
     $f3 = \Base::instance();
     $this->_requireLogin();
     $user = $f3->get('user');
 }
开发者ID:KindlyFire,项目名称:SquareMS-Web,代码行数:7,代码来源:create.php

示例10: index

 public function index()
 {
     $f3 = \Base::instance();
     $this->_requireLogin();
     $user = $f3->get('user');
     $user_obj = $f3->get('user_obj');
     $user_org_links = $f3->get('user_org_links');
     $db = $f3->get('db.instance');
     $tickets = $db->exec('SELECT * FROM support_tickets WHERE memberId = ? ORDER BY id DESC', $user['id']);
     foreach ($tickets as $id => $ticket) {
         $result = $db->exec('SELECT COUNT(*) AS `count` FROM support_tickets_msg WHERE ticketId = ?', $ticket['id']);
         $tickets[$id]['messages_count'] = $result[0]['count'];
         // Assigned or not ?
         if ($ticket['assignedUserId'] != 0) {
             $assignedUser = new User();
             $assignedUser->load($ticket['assignedUserId']);
             $tickets[$id]['assignedUser'] = $assignedUser->cast();
         }
     }
     $f3->set('tickets', $tickets);
     $active_tickets = $db->exec("SELECT * FROM support_tickets WHERE memberId = ? AND status != 'closed'", $user['id']);
     $f3->set('active_tickets', $active_tickets);
     $closed_tickets = $db->exec("SELECT * FROM support_tickets WHERE memberId = ? AND status = 'closed'", $user['id']);
     $f3->set('closed_tickets', $closed_tickets);
     $f3->set('target', 'support/index.html');
     $this->_render('base.html');
 }
开发者ID:KindlyFire,项目名称:SquareMS-Web,代码行数:27,代码来源:index.php

示例11: reroute

 function reroute($url)
 {
     if ($this->dry()) {
         Base::instance()->reroute($url);
     }
     return $this;
 }
开发者ID:karepwes,项目名称:OcsPanels,代码行数:7,代码来源:model.php

示例12: libraryBookFavMenu

 public static function libraryBookFavMenu(array $menu, array $counter, $sub)
 {
     \Base::instance()->set('menu_upper', $menu);
     \Base::instance()->set('counter', $counter);
     \Base::instance()->set('sub', $sub);
     return \Template::instance()->render('usercp/menu_upper.html');
 }
开发者ID:eFiction,项目名称:v5_1-vaporware,代码行数:7,代码来源:usercp.php

示例13: getItemsTransactionsByDateTime

 public function getItemsTransactionsByDateTime()
 {
     $operator = Base::instance()->get('PARAMS[operator]');
     $date = Base::instance()->get('PARAMS[date]');
     $time = Base::instance()->get('PARAMS[time]');
     echo json_encode(ItemTransaction::getItemsTransactionsByDateTime($operator, $date, $time));
 }
开发者ID:selesdepselesnul,项目名称:CAI,代码行数:7,代码来源:ItemTransactionController.php

示例14: render

 function render()
 {
     // Clean all output given first
     while (ob_get_level()) {
         ob_end_clean();
     }
     $f3 = \Base::instance();
     $f3->set('headline', 'Error ' . $f3->get('ERROR.code'));
     $f3->set('text', $f3->get('ERROR.text'));
     $f3->set('ESCAPE', false);
     if ($f3->get('AJAX')) {
         die(json_encode(array('error' => $f3->get('ERROR.text'))));
     }
     if ($f3->get('ERROR.code') == 400) {
         \Flash::instance()->addMessage($f3->get('ERROR.text'), 'warning');
         $f3->set('HALT', false);
         return;
     } elseif ($f3->get('ERROR.code') == 404) {
         $f3->set('headline', 'Page not found');
     } elseif ($f3->get('ERROR.code') == 405) {
         $f3->set('headline', 'This action is not allowed');
     } elseif ($f3->get('ERROR.code') == 500) {
         $f3->set('headline', 'Internal Server Error');
         if ($f3->get('DEV')) {
             $f3->set('trace', $f3->highlight($f3->get('ERROR.trace')));
         }
         @mail($f3->get('error_mail'), 'Mth3l3m3nt Framework Error', $f3->get('ERROR.text') . "\n\n" . $f3->get('ERROR.trace'));
     }
     $f3->set('LAYOUT', 'error.html');
     $f3->set('HALT', true);
     echo \Template::instance()->render('themes/default/layout.html');
 }
开发者ID:kimkiogora,项目名称:mth3l3m3nt-framework,代码行数:32,代码来源:error.php

示例15: select

 public function select()
 {
     $f3 = \Base::instance();
     $this->_requireLogin();
     $f3->set('SESSION.selected_organisation', $f3->get('PARAMS.id'));
     $f3->reroute('/organisations');
 }
开发者ID:KindlyFire,项目名称:SquareMS-Web,代码行数:7,代码来源:select.php


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