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


PHP application::get方法代码示例

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


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

示例1: __construct

 /**
  * Constructing cache object
  *
  * @param string $cache_link
  * @param string $class
  */
 public function __construct($cache_link = null, $class = null)
 {
     // if we need to use default link from application
     if (empty($cache_link)) {
         $cache_link = application::get(['flag', 'global', 'cache', 'default_cache_link']);
         if (empty($cache_link)) {
             throw new Exception('You must specify cache link and/or class!');
         }
     }
     // get object from factory
     $temp = factory::get(['cache', $cache_link]);
     // if we have class
     if (!empty($class) && !empty($cache_link)) {
         // replaces in case we have it as submodule
         $class = str_replace('.', '_', trim($class));
         // if we are replacing database connection with the same link we
         // need to manually close connection
         if (!empty($temp['object']) && $temp['class'] != $class) {
             $object = $temp['object'];
             $object->close();
             unset($this->object);
         }
         $this->object = new $class($cache_link);
         // putting every thing into factory
         factory::set(['cache', $cache_link], ['object' => $this->object, 'class' => $class]);
     } else {
         if (!empty($temp['object'])) {
             $this->object = $temp['object'];
         } else {
             throw new Exception('You must specify cache link and/or class!');
         }
     }
 }
开发者ID:volodymyr-volynets,项目名称:framework,代码行数:39,代码来源:cache.php

示例2: __construct

 /**
  * Constructing crypt object
  *
  * @param string $db_link
  * @param string $class
  */
 public function __construct($crypt_link = null, $class = null, $options = [])
 {
     // if we need to use default link from application
     if ($crypt_link == null) {
         $crypt_link = application::get(['flag', 'global', 'crypt', 'default_crypt_link']);
         if (empty($crypt_link)) {
             throw new Exception('You must specify crypt link!');
         }
     }
     // get object from factory
     $temp = factory::get(['crypt', $crypt_link]);
     // if we have class
     if (!empty($class) && !empty($crypt_link)) {
         // replaces in case we have it as submodule
         $class = str_replace('.', '_', trim($class));
         // creating new class
         unset($this->object);
         $this->object = new $class($crypt_link, $options);
         factory::set(['crypt', $crypt_link], ['object' => $this->object, 'class' => $class]);
     } else {
         if (!empty($temp['object'])) {
             $this->object = $temp['object'];
         } else {
             throw new Exception('You must specify crypt link and/or class!');
         }
     }
 }
开发者ID:volodymyr-volynets,项目名称:framework,代码行数:33,代码来源:crypt.php

示例3: init

 /**
  * Initializing i18n
  *
  * @param array $options
  */
 public static function init($options = [])
 {
     $i18n = application::get('flag.global.i18n') ?? [];
     $i18n = array_merge_hard($i18n, $options ?? []);
     // determine final language
     $languages = factory::model('numbers_backend_i18n_languages_model_languages')->get();
     $final_language = application::get('flag.global.__language_code') ?? session::get('numbers.entity.format.language_code') ?? $i18n['language_code'] ?? 'sys';
     if (empty($languages[$final_language])) {
         $final_language = 'sys';
         $i18n['rtl'] = 0;
     }
     // put settings into system
     if (!empty($languages[$final_language])) {
         foreach ($languages[$final_language] as $k => $v) {
             $k = str_replace('lc_language_', '', $k);
             if (in_array($k, ['code', 'inactive'])) {
                 continue;
             }
             if (empty($v)) {
                 continue;
             }
             $i18n[$k] = $v;
         }
     }
     $i18n['language_code'] = $final_language;
     self::$options = $i18n;
     session::set('numbers.entity.format.language_code', $final_language);
     application::set('flag.global.i18n', $i18n);
     self::$initialized = true;
     // initialize the module
     return factory::submodule('flag.global.i18n.submodule')->init($i18n);
 }
开发者ID:volodymyr-volynets,项目名称:framework,代码行数:37,代码来源:i18n.php

示例4: action_index

 public function action_index()
 {
     // clear buffer
     helper_ob::clean_all();
     // validating
     do {
         $options = application::get('flag.numbers.backend.cron.base');
         // token
         if (!empty($options['token']) && request::input('token') != $options['token']) {
             break;
         }
         // ip
         if (!empty($options['ip']) && !in_array(request::ip(), $options['ip'])) {
             break;
         }
         // get date parts
         $date_parts = format::now('parts');
         print_r($date_parts);
         echo "GOOD\n";
     } while (0);
     // we need to validate token
     //$token = request::input('token');
     echo "OK\n";
     // exit
     exit;
 }
开发者ID:volodymyr-volynets,项目名称:backend,代码行数:26,代码来源:execute.php

示例5: add

 /**
  * Add library to the application
  * 
  * @param string $library
  */
 public static function add($library)
 {
     $connected = application::get('flag.global.library.' . $library . '.connected');
     if (!$connected) {
         factory::submodule('flag.global.library.' . $library . '.submodule')->add();
         application::set('flag.global.library.' . $library . '.connected', true);
     }
 }
开发者ID:volodymyr-volynets,项目名称:framework,代码行数:13,代码来源:library.php

示例6: release

 /**
  * Release the lock
  * 
  * @param string $id
  * @return boolean
  */
 public static function release($id)
 {
     $temp_dir = application::get(array('directory', 'temp'));
     if (isset($temp_dir['dir'])) {
         return unlink($temp_dir['dir'] . '__lock_' . $id);
     }
     return true;
 }
开发者ID:volodymyr-volynets,项目名称:framework,代码行数:14,代码来源:lock.php

示例7: serve_media_if_exists

 /**
  * Serve js and/or css files, mostly used in development
  *
  * @param string $filename
  */
 public static function serve_media_if_exists($filename, $application_path)
 {
     // we need to remove question mark and all after it
     if (strpos($filename, '?') !== false) {
         $temp = explode('?', $filename);
         $filename = $temp[0];
     }
     // generated files first
     if (strpos($filename, '/numbers/media_generated/') === 0) {
         $filename = str_replace('/numbers/media_generated/application_', '', $filename);
         $filename = $application_path . str_replace('_', '/', $filename);
     } else {
         if (strpos($filename, '/numbers/media_submodules/') === 0) {
             $temp = str_replace('/numbers/media_submodules/', '', $filename);
             $temp = str_replace('_', '/', $temp);
             $filename = './../libraries/vendor/' . $temp;
         } else {
             // we must return, do not exit !!!
             return;
         }
     }
     // check if file exists on file system
     if (!file_exists($filename)) {
         return;
     }
     // we need to know extension of a file
     $ext = pathinfo($filename, PATHINFO_EXTENSION);
     if ($ext == 'css' || $ext == 'js') {
         $new = $filename;
         $flag_scss = false;
         if (strpos($filename, '.scss.css') !== false) {
             $new = str_replace('.scss.css', '.scss', $new);
             $flag_scss = true;
         }
         if (file_exists($new)) {
             if ($ext == 'js') {
                 header('Content-Type: application/javascript');
                 echo file_get_contents($new);
             }
             if ($ext == 'css') {
                 header('Content-type: text/css');
                 if (!$flag_scss) {
                     echo file_get_contents($new);
                 } else {
                     if (application::get('dep.submodule.numbers.frontend.media.scss')) {
                         $temp = numbers_frontend_media_scss_base::serve($new);
                         if ($temp['success']) {
                             echo $temp['data'];
                         }
                     }
                 }
             }
             exit;
         }
     }
 }
开发者ID:volodymyr-volynets,项目名称:framework,代码行数:61,代码来源:media.php

示例8: enabled

 /**
  * Indicator whether widgets are enabled
  *
  * @param string $widget
  * @return boolean
  */
 public static function enabled($widget)
 {
     if (!application::get('numbers.data', ['backend_exists' => true])) {
         return false;
     }
     if (!application::get("flag.global.widgets.{$widget}.submodule")) {
         return false;
     }
     return true;
 }
开发者ID:volodymyr-volynets,项目名称:framework,代码行数:16,代码来源:widgets.php

示例9: action_index

 public function action_index()
 {
     $id = application::get(['mvc', 'controller_id']);
     if ($id) {
         $result = url_tinyurl::get($id);
         if ($result['success']) {
             request::redirect($result['data']['url']);
         }
     }
 }
开发者ID:volodymyr-volynets,项目名称:backend,代码行数:10,代码来源:tinyurl.php

示例10: model

 /**
  * Model
  *
  * @param string $class
  */
 public static function model($class)
 {
     $temp = explode('__virtual__', $class);
     $last = array_pop($temp);
     // fetch submodule
     $submodule = application::get("flag.global.widgets.{$last}.submodule");
     $class = str_replace('.base__123', '', $submodule . '__123');
     $class = str_replace('.', '_', $class) . '_model_virtual_' . $last;
     // create an object
     $object = new $class(implode('__virtual__', $temp));
     return $object;
 }
开发者ID:volodymyr-volynets,项目名称:framework,代码行数:17,代码来源:models.php

示例11: delegate

 /**
  * Delegate arguments to submodule
  *
  * @param string $flag
  * @param string $submodule
  * @param array $arguments
  * @return mixed
  */
 public static function delegate($flag, $submodule, $arguments)
 {
     $options = application::get($flag . '.' . $submodule . '.options');
     if (!empty($options)) {
         // todo: maybe add to first array instead to first element in arguments
         $arguments[0] = array_merge_hard($options, $arguments[0]);
     }
     // we need to determine whether we need to use additional submodule
     if (application::get($flag . '.' . $submodule . '.submodule') && empty($arguments[0]['flag_call_previous_parent'])) {
         return call_user_func_array([self::submodule($flag . '.' . $submodule . '.submodule'), $submodule], $arguments);
     } else {
         return call_user_func_array([self::submodule($flag . '.submodule'), $submodule], $arguments);
     }
 }
开发者ID:volodymyr-volynets,项目名称:framework,代码行数:22,代码来源:factory.php

示例12: write

 /**
  * Write content to file and sets permissions
  * 
  * @param string $filename
  * @param mixed $data
  * @param int $permission
  * @param int $flags
  * @param boolean $relative
  */
 public static function write($filename, $data, $permission = 0777, $flags = LOCK_EX, $relative = true)
 {
     // if we have relative path we convert it to full path
     if ($relative && $filename[0] == '.') {
         $path = application::get('application.path_full');
         $info = pathinfo($filename);
         $filename = realpath($path . $info['dirname']) . '/' . $info['basename'];
     }
     // write file
     if (file_put_contents($filename, $data, $flags) !== false) {
         @chmod($filename, $permission);
         return true;
     }
     return false;
 }
开发者ID:volodymyr-volynets,项目名称:framework,代码行数:24,代码来源:file.php

示例13: get

 /**
  * Get translation
  *
  * @param string $i18n
  * @param string $text
  * @param array $options
  * @return string
  */
 public static function get($i18n, $text, $options = [])
 {
     $result = $text;
     // if we need to handle replaces, for example:
     // "Error occured on line [line_number]"
     if (!empty($options['replace'])) {
         foreach ($options['replace'] as $k => $v) {
             $result = str_replace($k, $v, $result);
         }
     }
     // todo: add debug mode, maybe append i18n
     if (debug::$debug && application::get('flag.global.__content_type') == 'text/html') {
         $result .= ' <span style="color:blue">i</span>';
     }
     return $result;
 }
开发者ID:volodymyr-volynets,项目名称:backend,代码行数:24,代码来源:base.php

示例14: send

 /**
  * Send an email
  *
  * Usage example:
  *
  * 	$result = mail::send([
  * 		'to' => 'test@localhost',
  *		'cc' => 'cc@localhost',
  *		'bcc' => 'bcc@localhost',
  *		'subject' => 'test subject',
  * 		'message' => 'test message',
  * 		'attachments' => [
  *	 		['path' => 'path to file', 'name' => 'test.txt'],
  * 			['data' => '!!!data!!!', 'name' => 'test.txt', 'type' => 'plain/text']
  * 		]
  * 	]);
  *
  * @param array $options
  */
 public static function send($options)
 {
     $result = ['success' => false, 'error' => []];
     // mail delivery first
     $mail_delivery_class = application::get('flag.global.mail.delivery.submodule', ['class' => 1]);
     if (empty($mail_delivery_class)) {
         throw new Exception('You need to specify mail delivery submodule');
     }
     $mail_delivery_object = new $mail_delivery_class();
     $temp = $mail_delivery_object->send($options);
     if (!$temp['success']) {
         array_merge3($result['error'], $temp['error']);
     } else {
         $result['success'] = true;
     }
     return $result;
 }
开发者ID:volodymyr-volynets,项目名称:framework,代码行数:36,代码来源:mail.php

示例15: __construct

 /**
  * Constructing object
  *
  * @throws Exception
  */
 public function __construct()
 {
     // we need to determine db link
     if (empty($this->db_link)) {
         // get from flags first
         if (!empty($this->db_link_flag)) {
             $this->db_link = application::get($this->db_link_flag);
         }
         // get default link
         if (empty($this->db_link)) {
             $this->db_link = application::get('flag.global.db.default_db_link');
         }
         // if we could not determine the link we throw exception
         if (empty($this->db_link)) {
             throw new Exception('Could not determine db link in function!');
         }
     }
 }
开发者ID:volodymyr-volynets,项目名称:framework,代码行数:23,代码来源:function.php


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