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


PHP Base::getConfig方法代码示例

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


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

示例1: load

 public static function load($path = '')
 {
     if (!empty($path) and !in_array($path, self::$loaded)) {
         $path = !empty($path) ? '\\' . trim($path, '\\') : '';
         $lang_class = '\\GCore' . $path . '\\Locales\\EnGb\\Lang';
         $cutsom_lang = '\\GCore' . $path . '\\Locales\\' . Str::camilize(str_replace('-', '_', strtolower(Base::getConfig('site_language', 'en-gb')))) . '\\Lang';
         if (class_exists($cutsom_lang)) {
             if (class_exists($lang_class)) {
                 //load default language as well
                 $lang_class_loaded = new \ReflectionClass($lang_class);
                 self::$translations = array_merge((array) self::$translations, $lang_class_loaded->getConstants(), $lang_class_loaded->getStaticProperties());
                 self::$loaded[] = $path;
             }
             $lang_class = $cutsom_lang;
         }
         if (!class_exists($lang_class)) {
             return false;
         }
         $lang_class_loaded = new \ReflectionClass($lang_class);
         self::$translations = array_merge((array) self::$translations, $lang_class_loaded->getConstants(), $lang_class_loaded->getStaticProperties());
         self::$loaded[] = $path;
         return true;
     }
     return false;
 }
开发者ID:ejailesb,项目名称:repo_empr,代码行数:25,代码来源:lang.php

示例2: deleteAll

 function deleteAll($conditions, $params = array())
 {
     if (!empty($this->cache) and Base::getConfig('cache') >= 1 and Base::getConfig('cache_query') >= 1) {
         $cache = Cache::getInstance($this->tablename . '.queries');
         $cache->destroy();
     }
     return parent::deleteAll($conditions, $params);
 }
开发者ID:ejailesb,项目名称:repo_empr,代码行数:8,代码来源:gmodel.php

示例3: getInstance

 public static function getInstance($domain = 'gcore', $params = array(), $engine = 'file')
 {
     $domain = !empty($domain) ? $domain : 'gcore';
     $engine = func_num_args() > 2 ? $engine : Base::getConfig('cache_engine');
     if (empty(self::$instances[$engine][$domain])) {
         $class = '\\GCore\\Libs\\CacheEngines\\' . Str::camilize($engine);
         self::$instances[$engine][$domain] = new $class($domain, $params);
     }
     return self::$instances[$engine][$domain];
 }
开发者ID:ejailesb,项目名称:repo_empr,代码行数:10,代码来源:cache.php

示例4: getInstance

 public static function getInstance($options = array())
 {
     if (!empty($options)) {
         $db_adapter_class = '\\GCore\\Libs\\DatabaseAdapters\\' . Str::camilize(Base::getConfig('db_adapter', 'pdo'));
         $new_object = new $db_adapter_class($options);
         return $new_object;
     } else {
         return false;
     }
 }
开发者ID:vstorm83,项目名称:propertease,代码行数:10,代码来源:database_object.php

示例5: _setOptions

 public static function _setOptions($options = array())
 {
     if (empty($options)) {
         $options['user'] = Base::getConfig('db_user');
         $options['pass'] = Base::getConfig('db_pass');
         $options['name'] = Base::getConfig('db_name');
         $options['host'] = Base::getConfig('db_host');
         $options['type'] = Base::getConfig('db_type');
         $options['prefix'] = Base::getConfig('db_prefix');
     }
     return $options;
 }
开发者ID:ejailesb,项目名称:repo_empr,代码行数:12,代码来源:database.php

示例6: getInstance

 public static function getInstance($options = array())
 {
     if (!empty($options)) {
         $db_adapter_class = '\\GCore\\Libs\\DatabaseAdapters\\' . Str::camilize(Base::getConfig('db_adapter', 'pdo'));
         $new_object = new $db_adapter_class($options);
         $new_object->_initialize($options);
         //$db_processor_class = '\GCore\Libs\DatabaseProcessors\\'.Str::camilize($new_object->db_type);
         //$new_object->processor = new $db_processor_class();
         return $new_object;
     } else {
         return false;
     }
 }
开发者ID:ejailesb,项目名称:repo_empr,代码行数:13,代码来源:database_object.php

示例7: login

 public static function login($credentials)
 {
     $session = Base::getSession();
     $username_field = Base::getConfig('username_field', 'username');
     if (isset($credentials[$username_field]) and isset($credentials['password'])) {
         $user_model = new \GCore\Admin\Models\User();
         $user = $user_model->find('first', array('conditions' => array($username_field => $credentials[$username_field])));
         if (!empty($user)) {
             $user_groups = Arr::getVal($user, array('GroupUser', '[n]', 'group_id'), self::get_public_groups());
             $user_groups_paths = Arr::getVal($user, array('Group', '[n]', 'path'), array());
             $user_inheritance = array();
             foreach ($user_groups_paths as $user_groups_path) {
                 $user_inheritance = array_merge($user_inheritance, array_filter(explode('.', $user_groups_path)));
             }
             $user_inheritance = array_unique($user_inheritance);
             $user = $user['User'];
             $password_correct = self::check_password($credentials['password'], $user['password']);
             if (!$password_correct) {
                 $session->setFlash('error', l_('AUTHENTICATE_INCORRECT_LOGIN_CREDENTIALS'));
                 return false;
             }
             if (!empty($user['activation'])) {
                 $session->setFlash('error', l_('AUTHENTICATE_ACCOUNT_NOT_ACTIVATED'));
                 return false;
             }
             if ($user['blocked'] == 1) {
                 $session->setFlash('error', l_('AUTHENTICATE_ACCOUNT_BLOCKED'));
                 return false;
             }
             //account is found and can login, insert session data
             $user_session = array();
             $user_session['id'] = $user['id'];
             $user_session['name'] = $user['name'];
             $user_session['username'] = $user['username'];
             $user_session['email'] = $user['email'];
             $user_session['last_login'] = $user['last_visit'];
             $user_session['logged_in'] = 1;
             $user_session['groups'] = $user_groups;
             $user_session['inheritance'] = $user_inheritance;
             //get referer
             $referer = $session->get('_referer');
             $session->restart();
             $session->set('_referer', $referer);
             $session->set('user', array_merge($session->get('user', array()), $user_session));
             if (Base::getConfig('session_handler', 'php') == 'database') {
                 $session_model = new \GCore\Admin\Models\Session();
                 //$update = $session_model->updateAll(array('user_id' => $user['id'], 'site' => GCORE_SITE), array('session_id' => $session->get_id()));
                 $insert_status = $session_model->save(array('session_id' => $session->get_id(), 'user_id' => $user['id'], 'site' => GCORE_SITE, 'ip_address' => $_SERVER['REMOTE_ADDR'], 'user_agent' => $_SERVER['HTTP_USER_AGENT'], 'last_activity' => time()), array('new' => true));
             }
             //update last visit
             $user_model->updateAll(array('last_visit' => date('Y-m-d H:i:s', time())), array('id' => $user['id']), array('modified' => false));
             //after login hook
             $hook_results = Event::trigger('on_after_user_login');
             return true;
         } else {
             $session->setFlash('error', l_('AUTHENTICATE_INCORRECT_LOGIN_CREDENTIALS'));
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:ejailesb,项目名称:repo_empr,代码行数:62,代码来源:authenticate.php

示例8: _destroy

 protected function _destroy()
 {
     session_destroy();
     $return = !session_id();
     if ($return and isset($_COOKIE[session_name()])) {
         //remove any session presence in the cookies
         setcookie(session_name(), '', 0, Base::getConfig('cookie_path', ''), Base::getConfig('cookie_domain', ''));
     }
     return $return;
 }
开发者ID:vstorm83,项目名称:propertease,代码行数:10,代码来源:session.php

示例9: loadFields

 function loadFields()
 {
     $cached = false;
     if (Base::getConfig('cache') >= 1 and Base::getConfig('cache_dbinfo') >= 1) {
         $cache = Cache::getInstance('db_tables_info', array('expiration' => Base::getConfig('dbinfo_cache_expiry', 43200)), 'file');
         $this->table_fields = $cache->get($this->tablename . '.columns');
         if (!empty($this->table_fields)) {
             $cached = true;
         }
     }
     if (empty($this->table_fields)) {
         $this->table_fields = $this->dbo->getTableColumns($this->tablename);
     }
     if (!$cached and Base::getConfig('cache') >= 1 and Base::getConfig('cache_dbinfo') >= 1) {
         $cache = Cache::getInstance('db_tables_info', array('expiration' => Base::getConfig('dbinfo_cache_expiry', 43200)), 'file');
         $cache->set($this->tablename . '.columns', $this->table_fields);
     }
 }
开发者ID:ejailesb,项目名称:repo_empr,代码行数:18,代码来源:model.php

示例10: getTitle

 function getTitle()
 {
     if (Base::getConfig('prepend_site_title', 1) == 1) {
         array_unshift($this->title, Base::getConfig('site_title'));
     }
     return '<title>' . implode(' - ', array_filter($this->title)) . '</title>';
 }
开发者ID:iFactoryDigital,项目名称:gympieradiology,代码行数:7,代码来源:document.php

示例11: page

 public static function page($alias = '')
 {
     $page = \GCore\Controllers\Pages::_find($alias);
     if (!empty($page)) {
         Request::set('_Route.page', $page['Page']);
         //set page title
         if ((bool) Base::getConfig('append_page_title', 1) === true) {
             $doc = Document::getInstance();
             $doc->setTitle($page['Page']['title']);
         }
         //pass more page params
         Request::set('_Route.index', $page['Page']['id']);
         if ($page['Page']['default'] == 1) {
             Request::set('_Route.default', 1);
         }
         $params = array('extension' => $page['Page']['extension'], 'controller' => $page['Page']['controller'], 'action' => $page['Page']['action'], 'params' => $page['Page']['params']);
         if (!empty($page['Page']['params'])) {
             foreach ($page['Page']['params'] as $k => $v) {
                 $params[$k] = $v;
             }
         }
         return $params;
     }
     return array();
 }
开发者ID:ejailesb,项目名称:repo_empr,代码行数:25,代码来源:route.php

示例12: output

 function output()
 {
     echo $this->buffer;
     if (Base::getConfig('debug', 0)) {
         \GCore\Loader::debug();
     }
 }
开发者ID:vstorm83,项目名称:propertease,代码行数:7,代码来源:app_j.php

示例13: authorized

 public static function authorized($path, $action = 'access', $owner_id = null, $user_id = null)
 {
     $user = Base::getUser();
     //owner admin access
     if ((int) $user['id'] === 1) {
         return true;
     }
     //login/logout can be always accessed
     if (($path == '\\GCore\\Admin\\Controllers\\Users' or $path == '\\GCore\\Controllers\\Users') and ($action == 'login' or $action == 'logout')) {
         return true;
     }
     $groups = Authenticate::get_user_groups($user_id);
     if (!empty($owner_id) and $owner_id == $user['id']) {
         $groups[] = 'owner';
     }
     $return = false;
     //build search branches based on current loaded class
     if (is_array($path)) {
         $tests = $path;
     } else {
         $branches = explode("\\", $path);
         $tests = array();
         for ($i = 0; $i = count($branches) - 1; $i++) {
             $tests[] = implode("\\", $branches);
             array_pop($branches);
         }
     }
     //check cache
     $cache = (bool) Base::getConfig('cache_permissions');
     if ($cache === true) {
         $session = Base::getSession();
         $cached_permissions = $session->get('acos_permissions.' . $user['id'], array());
         if (in_array('owner', $groups)) {
             $cache_key = md5(serialize($tests) . $action . $owner_id);
         } else {
             $cache_key = md5(serialize($tests) . $action);
         }
         if (array_key_exists($cache_key, $cached_permissions)) {
             $return = $cached_permissions[$cache_key];
             goto end;
         }
     }
     $paths_key = md5(serialize($tests));
     if (!isset(self::$lookups[$paths_key])) {
         $Acl_model = new \GCore\Admin\Models\Acl();
         $acls = $Acl_model->find('all', array('conditions' => array('aco' => $tests, 'enabled' => 1), 'order' => array('aco DESC')));
         self::$lookups[$paths_key] = $acls;
     } else {
         $acls = self::$lookups[$paths_key];
     }
     if (empty($acls)) {
         //no ACL results found matching this ACO
         $return = false;
         goto end;
     }
     foreach ($acls as $k => $acl) {
         $p_action = $action;
         if (!empty($acl['Acl']['rules'][$p_action])) {
             //main action rules found, goto permissions check
         } elseif (!empty($acl['Acl']['rules']['access'])) {
             //main action not found, but access action found, let's use it
             $p_action = 'access';
         } else {
             //neither the main action nor the default one found under this path, or maybe no permissions set, go to the next one.
             continue;
         }
         //check groups action's rules
         $result = self::check_rules($acl['Acl']['rules'][$p_action], $groups);
         if (!is_null($result)) {
             $return = $result;
             goto end;
         }
         //looks like all permissions in this path are not set or inheriting, go to next path
         continue;
     }
     //we looped all pathes with no matches, return denied
     $return = false;
     end:
     //store into cache
     if ($cache === true) {
         $session = Base::getSession();
         $cached_permissions = $session->get('acos_permissions.' . $user['id'], array());
         if (in_array('owner', $groups)) {
             $cache_key = md5(serialize($tests) . $action . $owner_id);
         } else {
             $cache_key = md5(serialize($tests) . $action);
         }
         $cached_permissions[$cache_key] = $return;
         $session->set('acos_permissions.' . $user['id'], $cached_permissions);
     } else {
         $session = Base::getSession();
         $session->set('acos_permissions.' . $user['id'], array());
     }
     return $return;
 }
开发者ID:ejailesb,项目名称:repo_empr,代码行数:95,代码来源:authorize.php

示例14: _paginate

 function _paginate()
 {
     $model_class = !empty($this->paginate_model) ? $this->paginate_model : null;
     if (empty($model_class)) {
         $alias = $this->get_main_model();
         if (!empty($alias)) {
             $model_class = $this->{$alias};
         } else {
             return;
         }
     }
     $prefix = '';
     if (!empty($this->paginate_prefix)) {
         $prefix = '.' . $this->paginate_prefix;
     }
     //check if we should process pagination
     if (!empty($model_class) and in_array('\\GCore\\Helpers\\Paginator', $this->helpers) or in_array('\\GCore\\Helpers\\Paginator', array_keys($this->helpers))) {
         $session = Base::getSession();
         $k = array_search('\\GCore\\Helpers\\Paginator', $this->helpers);
         if ($k !== false) {
             unset($this->helpers[$k]);
         }
         $page = Request::data(\GCore\Libs\Base::getConfig('page_url_param_name', 'page'), $session->get(get_class($this) . $prefix . '.' . $model_class->alias . '.page', 1));
         $page = $page < 1 ? 1 : $page;
         $active_limit = !empty($model_class->page_limit) ? $model_class->page_limit : Base::getConfig('list_limit', 30);
         $limit = Request::data('limit', $session->get(get_class($this) . $prefix . '.' . $model_class->alias . '.limit', $active_limit));
         if ($limit == 0 or $limit > Base::getConfig('max_list_limit', 1000)) {
             $limit = Base::getConfig('max_list_limit', 1000);
         }
         if (!empty($model_class->limit)) {
             $limit = $model_class->limit;
         }
         if (!empty($model_class->page)) {
             $page = $model_class->page;
         }
         $offset = ($page - 1) * (int) $limit;
         $total = !empty($this->paginate_total) ? $this->paginate_total : $model_class->find('count', array('cache' => true));
         $bad_page = false;
         if ($offset >= $total) {
             //$page = ceil($total/$limit);
             $bad_page = true;
             $page = ceil($total / $limit);
             $offset = $limit * ($page - 1);
         }
         $page = $page < 1 ? 1 : $page;
         $offset = $offset < 0 ? 0 : $offset;
         $this->helpers['\\GCore\\Helpers\\Paginator']['limit'] = $limit;
         $this->helpers['\\GCore\\Helpers\\Paginator']['page'] = $page;
         $this->helpers['\\GCore\\Helpers\\Paginator']['offset'] = $offset;
         $this->helpers['\\GCore\\Helpers\\Paginator']['page_param'] = \GCore\Libs\Base::getConfig('page_url_param_name', 'page');
         if (!$bad_page) {
             $session->set(get_class($this) . $prefix . '.' . $model_class->alias . '.page', $page);
         }
         $session->set(get_class($this) . $prefix . '.' . $model_class->alias . '.limit', $limit);
         $this->helpers['\\GCore\\Helpers\\Paginator']['total'] = $total;
         //page (limit and offset) should be set after the count query
         $model_class->page = $page;
         $model_class->page_limit = $limit;
     }
 }
开发者ID:ejailesb,项目名称:repo_empr,代码行数:60,代码来源:gcontroller.php

示例15: send

 public static function send($to = array(), $subject = '', $body = '', $attachments = array(), $other = array())
 {
     if (!class_exists('PHPMailer')) {
         require_once \GCore\C::get('GCORE_FRONT_PATH') . 'vendors' . DS . 'phpmailer' . DS . 'PHPMailerAutoload.php';
     }
     $mail = new \PHPMailer();
     $mail->CharSet = 'utf-8';
     //get recipients
     foreach ((array) $to as $address) {
         $mail->AddAddress(trim($address));
     }
     //subject
     $mail->Subject = $subject;
     //reply to
     $reply_name = !empty($other['reply_name']) ? $other['reply_name'] : Base::getConfig('mail_reply_name');
     $reply_email = !empty($other['reply_email']) ? $other['reply_email'] : Base::getConfig('mail_reply_email');
     if (!empty($reply_name) and !empty($reply_email)) {
         $mail->AddReplyTo($reply_email, $reply_name);
     }
     //from
     $from_name = !empty($other['from_name']) ? $other['from_name'] : Base::getConfig('mail_from_name');
     $from_email = !empty($other['from_email']) ? $other['from_email'] : Base::getConfig('mail_from_email');
     $mail->SetFrom($from_email, $from_name);
     //set custom headers
     if (!empty($other['custom'])) {
         foreach ($other['custom'] as $k => $v) {
             $mail->addCustomHeader($k . ': ' . $v);
         }
     }
     //set CC and BCC
     if (!empty($other['cc'])) {
         foreach ($other['cc'] as $k => $cc) {
             $mail->AddCC($cc);
         }
     }
     if (!empty($other['bcc'])) {
         foreach ($other['bcc'] as $k => $bcc) {
             $mail->AddBCC($bcc);
         }
     }
     if ((bool) Base::getConfig('smtp', 0) === true or Base::getConfig('mail_method', 'phpmail') == 'smtp') {
         $mail->IsSMTP();
         if (Base::getConfig('smtp_username') and Base::getConfig('smtp_password')) {
             $mail->SMTPAuth = true;
         }
         if (Base::getConfig('smtp_secure')) {
             $mail->SMTPSecure = Base::getConfig('smtp_secure');
         }
         $mail->Host = Base::getConfig('smtp_host');
         $mail->Port = Base::getConfig('smtp_port');
         $mail->Username = Base::getConfig('smtp_username');
         $mail->Password = Base::getConfig('smtp_password');
     } else {
         if (Base::getConfig('mail_method', 'phpmail') == 'sendmail') {
             $mail->IsSendmail();
         }
     }
     if (!isset($other['type']) or $other['type'] == 'html') {
         $mail->AltBody = strip_tags($body);
         //'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
         //$body = nl2br($body);
         //$mail->MsgHTML($body);
         $mail->Body = $body;
         $mail->IsHTML(true);
     } else {
         $mail->Body = $body;
         $mail->IsHTML(false);
     }
     $mail->SMTPDebug = (int) Base::getConfig('smtp_debug', 0);
     //attachments
     foreach ((array) $attachments as $attachment) {
         if (is_array($attachment) and !empty($attachment['path'])) {
             $attachment = array_merge(array('name' => basename($attachment['path']), 'type' => 'application/octet-stream', 'encoding' => 'base64'), $attachment);
             $mail->AddAttachment($attachment['path'], $attachment['name'], $attachment['encoding'], $attachment['type']);
         } else {
             $mail->AddAttachment($attachment);
         }
     }
     if (!$mail->Send()) {
         $session = Base::getSession();
         $session->setFlash('warning', 'Mailer Error: ' . $mail->ErrorInfo);
         return false;
     }
     return true;
 }
开发者ID:ejailesb,项目名称:repo_empr,代码行数:85,代码来源:mailer.php


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