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


PHP Package::loaded方法代码示例

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


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

示例1: init

 /**
  * Initialize bootstrap
  */
 public static function init()
 {
     $autoload = \Config::get('bootstrap.assets.autoload', false);
     if (!$autoload) {
         return;
     }
     $path = \Config::get('bootstrap.assets.path', '');
     $use_min = \Config::get('bootstrap.assets.use_min', true);
     $css_file = $path . 'bootstrap';
     $js_file = $path . 'bootstrap';
     if ($use_min) {
         $css_file .= '.min';
         $js_file .= '.min';
     }
     $css_file .= '.css';
     $js_file .= '.js';
     // See if Casset package is used.
     if (\Package::loaded('casset')) {
         \Casset::css($css_file, !$use_min);
         \Casset::js($js_file, !$use_min);
     } else {
         \Asset::css($css_file);
         \Asset::js($js_file);
     }
 }
开发者ID:joel-depiltech,项目名称:fuel-bootstrap,代码行数:28,代码来源:bootstrap.php

示例2: __construct

 /**
  * Initialize class and forge a Sprockets Instance
  */
 public function __construct()
 {
     !\Package::loaded('sprockets') and \Package::load('sprockets');
     // When in console mode, DOCROOT is the path to the project root, not the public/
     $config = array('asset_compile_dir' => DOCROOT . 'public/assets/', 'force_minify' => true);
     static::$sprockets = \Sprockets::forge('default', $config);
 }
开发者ID:hemanexus,项目名称:fuel-sprockets,代码行数:10,代码来源:sprockets.php

示例3: execute

 /**
  * Queue job
  *
  * @param	mixed		$id			Supplier id
  * @param	string		$method		Method to run
  * @param	integer		$delay
  * @param	integer		$ttr		Time limit
  * @return	null
  */
 public function execute($id, $method, $delay = 0, $ttr = 300)
 {
     // Cast id
     is_numeric($id) and $id = (int) $id;
     // Job data
     $data = array('id' => $id, 'cached' => (bool) \Cli::option('cached', \Cli::option('c', false)), 'force' => (bool) \Cli::option('force', \Cli::option('f', false)), 'method' => $method);
     // Execute job immediately
     $execute = (bool) \Cli::option('execute', \Cli::option('e', false));
     // Use Queue if available (greater performance)
     if (\Package::loaded('queue')) {
         // Create queue data
         if ($execute) {
             // Initialize logger
             $logger = clone \Log::instance();
             // Get original handler
             $handler = $logger->popHandler();
             $handler->pushProcessor(new \Monolog\Processor\PsrLogMessageProcessor());
             $logger->pushHandler($handler);
             // Console handler
             $handler = new \Monolog\Handler\ConsoleHandler(\Monolog\Logger::NOTICE);
             $formatter = new \Monolog\Formatter\LineFormatter("%message% - %context%" . PHP_EOL, "Y-m-d H:i:s");
             $handler->setFormatter($formatter);
             $logger->pushHandler($handler);
             // Add other handlers to logger through Event trigger
             \Event::instance('queue')->trigger('logger', $logger);
             $queue = array('supplier', array('driver' => 'direct', 'logger' => $logger));
         } else {
             $queue = 'supplier';
         }
         $options = array('delay' => $delay, 'ttr' => $ttr);
         // Push job and data to queue
         \Queue::push($queue, 'Indigo\\Erp\\Stock\\Job_Supplier', $data, $options);
     } else {
         try {
             $job = new Job_Supplier();
             return $job->execute(null, $data);
         } catch (\Exception $e) {
             // TODO: process exceptions
         }
     }
 }
开发者ID:indigophp,项目名称:erp-stock-extra,代码行数:50,代码来源:supplier.php

示例4: _available

 protected function _available(array $available)
 {
     $count = array(0, 0);
     foreach ($available as $key => $value) {
         if (!empty($value) && is_array($value)) {
             $count[$key > 0 ? 1 : $key] += count($value);
             $value = array('key' => $key, 'ids' => $value, 'supplier_id' => $this->model->id);
             // Get job and queue
             $job = $this->get_config('available.job', 'Indigo\\Erp\\Stock\\Job_Supplier_Available');
             $queue = $this->get_config('available.queue', 'update');
             // Use Queue if available (greater performance)
             if (\Package::loaded('queue')) {
                 \Queue::push($queue, $job, $value);
             } else {
                 try {
                     $job = new $job();
                     $job->execute(null, $value);
                 } catch (\Exception $e) {
                 }
             }
         }
     }
     return $count;
 }
开发者ID:indigophp,项目名称:erp-stock-extra,代码行数:24,代码来源:driver.php

示例5: locate

 /**
  * Locates a given file in the search paths.
  *
  * @param   string  $dir       Directory to look in
  * @param   string  $file      File to find
  * @param   string  $ext       File extension
  * @param   bool    $multiple  Whether to find multiple files
  * @param   bool    $cache     Whether to cache this path or not
  * @return  mixed  Path, or paths, or false
  */
 public function locate($dir, $file, $ext = '.php', $multiple = false, $cache = true)
 {
     $found = $multiple ? array() : false;
     // absolute path requested?
     if ($file[0] === '/' or substr($file, 1, 2) === ':\\') {
         // if the base file does not exist, stick the extension to the back of it
         if (!is_file($file)) {
             $file .= $ext;
         }
         if (!is_file($file)) {
             // at this point, found would be either empty array or false
             return $found;
         }
         return $multiple ? array($file) : $file;
     }
     // determine the cache prefix
     if ($multiple) {
         // make sure cache is not used if the loaded package and module list is changed
         $cachekey = '';
         class_exists('Module', false) and $cachekey .= implode('|', \Module::loaded());
         $cachekey .= '|';
         class_exists('Package', false) and $cachekey .= implode('|', \Package::loaded());
         $cache_id = md5($cachekey) . '.';
     } else {
         $cache_id = 'S.';
     }
     $paths = array();
     // If a filename contains a :: then it is trying to be found in a namespace.
     // This is sometimes used to load a view from a non-loaded module.
     if ($pos = strripos($file, '::')) {
         // get the namespace path
         if ($path = \Autoloader::namespace_path('\\' . ucfirst(substr($file, 0, $pos)))) {
             $cache_id .= substr($file, 0, $pos);
             // and strip the classes directory as we need the module root
             $paths = array(substr($path, 0, -8));
             // strip the namespace from the filename
             $file = substr($file, $pos + 2);
         }
     } else {
         $paths = $this->paths;
         // get extra information of the active request
         if (class_exists('Request', false) and $request = \Request::active()) {
             $request->module and $cache_id .= $request->module;
             $paths = array_merge($request->get_paths(), $paths);
         }
     }
     // Merge in the flash paths then reset the flash paths
     $paths = array_merge($this->flash_paths, $paths);
     $this->clear_flash();
     $file = $this->prep_path($dir) . $file . $ext;
     $cache_id .= $file;
     if ($cache and $cached_path = $this->from_cache($cache_id)) {
         return $cached_path;
     }
     foreach ($paths as $dir) {
         $file_path = $dir . $file;
         if (is_file($file_path)) {
             if (!$multiple) {
                 $found = $file_path;
                 break;
             }
             $found[] = $file_path;
         }
     }
     if (!empty($found) and $cache) {
         $this->add_to_cache($cache_id, $found);
     }
     return $found;
 }
开发者ID:SainsburysTests,项目名称:sainsburys,代码行数:79,代码来源:finder.php


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