當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Libraries::paths方法代碼示例

本文整理匯總了PHP中lithium\core\Libraries::paths方法的典型用法代碼示例。如果您正苦於以下問題:PHP Libraries::paths方法的具體用法?PHP Libraries::paths怎麽用?PHP Libraries::paths使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在lithium\core\Libraries的用法示例。


在下文中一共展示了Libraries::paths方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testPathTemplateWithGlobBrace

 public function testPathTemplateWithGlobBrace()
 {
     Libraries::paths(array('analysis' => array('{:library}\\analysis\\*{Docblock,Debugger}')));
     $analysis = list($docblock, $debugger) = Libraries::locate('analysis', null, array('recursive' => false, 'format' => false));
     $this->assertCount(2, $analysis);
     $this->assertPattern('/Docblock\\.php/', $docblock);
     $this->assertPattern('/Debugger\\.php/', $debugger);
 }
開發者ID:jianoll,項目名稱:lithium,代碼行數:8,代碼來源:LibrariesTest.php

示例2: _init

 /**
  * Exercise initialization.
  *
  * @return void
  */
 public function _init()
 {
     parent::_init();
     Libraries::paths(array('exercises' => '{:library}\\extensions\\exercises\\{:name}'));
     $exercises = Libraries::locate('exercises');
     foreach ($exercises as $exercise) {
         $this->_exercises[$this->exerciseName($exercise)] = $exercise;
     }
 }
開發者ID:raisinbread,項目名稱:li3_exercises,代碼行數:14,代碼來源:Learn.php

示例3: setUp

 public function setUp()
 {
     Libraries::paths(array('models' => '{:library}\\tests\\mocks\\data\\model\\{:name}Model'));
     $this->classes = array('response' => 'lithium\\tests\\mocks\\console\\MockResponse');
     $this->_backup['cwd'] = getcwd();
     $this->_backup['_SERVER'] = $_SERVER;
     $_SERVER['argv'] = array();
     $this->collection = $this->getCollection('li3_ensureindex\\tests\\mocks\\data\\model\\MockModel');
     $this->collection->deleteIndexes();
 }
開發者ID:knodes,項目名稱:li3_ensureindex,代碼行數:10,代碼來源:EnsureIndexesTest.php

示例4: testPathTemplate

 public function testPathTemplate()
 {
     $expected = array('{:app}/libraries/{:name}', '{:root}/libraries/{:name}');
     $result = Libraries::paths('libraries');
     $this->assertEqual($expected, $result);
     $this->assertNull(Libraries::locate('authAdapter', 'Form'));
     $paths = Libraries::paths();
     $test = array('authAdapter' => array('lithium\\security\\auth\\adapter\\{:name}'));
     Libraries::paths($test);
     $this->assertEqual($paths + $test, Libraries::paths());
     $class = Libraries::locate('authAdapter', 'Form');
     $expected = 'lithium\\security\\auth\\adapter\\Form';
     $this->assertEqual($expected, $class);
 }
開發者ID:kdambekalns,項目名稱:framework-benchs,代碼行數:14,代碼來源:LibrariesTest.php

示例5: import

 public function import()
 {
     Libraries::paths(array('neons' => array('{:library}\\data\\{:class}\\{:name}.neon')));
     $libraries = Libraries::get(null, 'name');
     $data = array();
     $namespaces = true;
     foreach ($libraries as $library) {
         $files = Libraries::locate('neons', null, compact('namespaces', 'library'));
         if (!empty($files)) {
             $data[$library] = $files;
         }
     }
     return compact('data');
 }
開發者ID:bruensicke,項目名稱:radium,代碼行數:14,代碼來源:RadiumController.php

示例6: mkdir

<?php

use lithium\core\Libraries;
$path = Libraries::get(true, 'path') . '/webroot/themes/default';
if (!is_dir($path)) {
    mkdir($path);
    rename(Libraries::get(true, 'path') . '/views', $path . '/views');
}
$existing = Libraries::paths('helper');
Libraries::paths(array('helper' => array_merge(array('{:library}\\extensions\\helper\\{:class}\\{:name}', '{:library}\\template\\helper\\{:class}\\{:name}' => array('libraries' => 'li3_themes')), (array) $existing)));
require __DIR__ . '/bootstrap/media.php';
require __DIR__ . '/bootstrap/errors.php';
開發者ID:CINEMUR,項目名稱:li3_themes,代碼行數:12,代碼來源:bootstrap.php

示例7: find

 /**
  * Loads entities and records from file-based structure
  *
  * Trys to implement a similar method to load datasets not from database, but rather from
  * a file that holds all relevant model data and is laid into the filesystem of each library.
  * This allows for easy default-data to be loaded without using a database as backend.
  *
  * Put your files into `{:library}\data\{:class}\{:name}.neon` and let the content be found
  * with loading just the id or slug of that file.
  *
  * Attention: This feature is considered experimental and should be used with care. It might
  *            not work as expected. Also, not all features are implemented.
  *
  * If nothing is found, it just returns null or an empty array to ensure a falsey value.
  *
  * @param string|array $model fully namespaced model class, e.g. `radium\models\Contents`
  *                     can also be an array, in which case `key` and `source` must be given
  *                     according to the internal structure of `Model::meta()`.
  * @param string $type The find type, which is looked up in `Model::$_finders`. By default it
  *        accepts `all`, `first`, `list` and `count`. Later two are not implement, yet.
  * @param array $options Options for the query. By default, accepts:
  *        - `conditions`: The conditional query elements, e.g.
  *                 `'conditions' => array('published' => true)`
  *        - `fields`: The fields that should be retrieved. When set to `null`, defaults to
  *             all fields.
  *        - `order`: The order in which the data will be returned, e.g. `'order' => 'ASC'`.
  *        - `limit`: The maximum number of records to return.
  *        - `page`: For pagination of data.
  * @return mixed returns null or an empty array if nothing is found
  *               If `$type` is `first` returns null or the correct entity with given data
  *               If `$type` is `all` returns null or a DocumentSet object with loaded entities
  */
 public static function find($model, $type, array $options = array())
 {
     $defaults = array('conditions' => null, 'fields' => null);
     $options += $defaults;
     $paths = self::$_paths;
     Libraries::paths($paths);
     $meta = is_array($model) ? $model : $model::meta();
     $locate = sprintf('neons.%s', $meta['source']);
     $data = Libraries::locate($locate, null, array('namespaces' => true));
     $files = new Collection(compact('data'));
     unset($data);
     $files->each(function ($file) {
         return str_replace('\\', '/', $file) . 'neon';
     });
     extract($options);
     if (isset($conditions['slug'])) {
         $field = 'slug';
     }
     if (isset($conditions[$meta['key']])) {
         $field = $meta['key'];
     }
     if (!isset($field)) {
         $field = 'all';
         // var_dump($field);
         // return array();
     }
     $value = $conditions[$field];
     switch (true) {
         case is_string($value):
             $pattern = sprintf('/%s/', $value);
             break;
         case isset($value['like']):
             $pattern = $value['like'];
             break;
     }
     if (isset($pattern)) {
         $filter = function ($file) use($pattern) {
             return (bool) preg_match($pattern, $file);
         };
     }
     if (isset($filter)) {
         $files = $files->find($filter);
     }
     if (isset($order)) {
         // TODO: add sort
     }
     if ($type == 'count') {
         return count($files);
     }
     if ($type == 'list') {
         // TODO: implement me
     }
     if ($type == 'first' && count($files)) {
         $data = self::file($files->first());
         $data[$field] = $value;
         if ($model === 'radium\\models\\Configurations') {
             $data['value'] = Neon::encode($data['value']);
         }
         return $model::create($data);
     }
     // we found one (!) file with name 'all.neon', this is the entire set
     if ($type == 'all' && count($files) == 1 && substr($files->first(), -strlen('all.neon')) === 'all.neon') {
         $rows = self::file($files->first());
         $data = array();
         foreach ($rows as $row) {
             $data[] = $model::create($row);
         }
         if (is_array($model)) {
//.........這裏部分代碼省略.........
開發者ID:bruensicke,項目名稱:radium,代碼行數:101,代碼來源:Neon.php

示例8: array

<?php

use lithium\core\Libraries;
/**
 * Register paths for mail template helpers.
 */
$existing = Libraries::paths('helper');
Libraries::paths(array('helper' => array_merge(array('{:library}\\extensions\\helper\\{:class}\\{:name}', '{:library}\\template\\helper\\{:class}\\{:name}' => array('libraries' => 'li3_mailer')), (array) $existing)));
/**
 * Add paths for delivery transport adapters from this library (plugin).
 */
$existing = Libraries::paths('adapter');
$key = '{:library}\\{:namespace}\\{:class}\\adapter\\{:name}';
$existing[$key]['libraries'] = array_merge((array) $existing[$key]['libraries'], (array) 'li3_mailer');
Libraries::paths(array('adapter' => $existing));
/*
 * Ensure the mail template resources path exists.
 */
$path = Libraries::get(true, 'resources') . '/tmp/cache/mails';
if (!is_dir($path)) {
    mkdir($path);
}
/**
 * Load the file that configures the delivery system.
 */
require __DIR__ . '/bootstrap/delivery.php';
開發者ID:globus40000,項目名稱:li3_mailer,代碼行數:26,代碼來源:bootstrap.php

示例9: array

<?php
/**
 * Lithium: the most rad php framework
 *
 * @copyright     Copyright 2010, Union of RAD (http://union-of-rad.org)
 * @license       http://opensource.org/licenses/bsd-license.php The BSD License
 */

use lithium\core\Libraries;

/**
 * This adds the `'behavior'` type to the list of recognized class types. You can look up the
 * behaviors available to your application by running `Libraries::locate('behavior')`.
 */
Libraries::paths(array(
	'behavior' => array('{:library}\extensions\data\behavior\{:name}')
));

?>
開發者ID:nateabele,項目名稱:li3_behaviors,代碼行數:19,代碼來源:bootstrap.php

示例10: testServiceLocateAll

 public function testServiceLocateAll()
 {
     $result = Libraries::locate('tests');
     $this->assertTrue(count($result) > 30);
     $expected = array('lithium\\template\\view\\adapter\\File', 'lithium\\template\\view\\adapter\\Simple');
     $result = Libraries::locate('adapter.template.view');
     $this->assertEqual($expected, $result);
     $result = Libraries::locate('test.filter');
     $this->assertTrue(count($result) >= 4);
     $this->assertTrue(in_array('lithium\\test\\filter\\Affected', $result));
     $this->assertTrue(in_array('lithium\\test\\filter\\Complexity', $result));
     $this->assertTrue(in_array('lithium\\test\\filter\\Coverage', $result));
     $this->assertTrue(in_array('lithium\\test\\filter\\Profiler', $result));
     foreach (Libraries::paths() as $type => $paths) {
         if (count($paths) <= 1 || $type == 'libraries') {
             continue;
         }
         $this->assertTrue(count(Libraries::locate($type)) > 1);
     }
 }
開發者ID:EHER,項目名稱:monopolis,代碼行數:20,代碼來源:LibrariesTest.php

示例11: array

<?php

use lithium\core\Libraries;
Libraries::paths(array('resources' => array('{:library}\\controllers\\{:namespace}\\{:class}\\{:name}')));
Libraries::add("Mockery", array('path' => dirname(__DIR__) . '/libraries/mockery/library', 'prefix' => ''));
開發者ID:nateabele,項目名稱:li3_resources,代碼行數:5,代碼來源:bootstrap.php

示例12: array

<?php

/**
 * Lithium: the most rad php framework
 *
 * @copyright     Copyright 2011, Union of RAD (http://union-of-rad.org)
 * @license       http://opensource.org/licenses/bsd-license.php The BSD License
 */
use lithium\core\Libraries;
use lithium\g11n\Multibyte;
Libraries::paths(array('rules' => array('{:library}\\extensions\\qa\\rules\\{:class}\\{:name}', '{:library}\\qa\\rules\\{:class}\\{:name}' => array('libraries' => 'li3_quality'))));
Multibyte::config(array('li3_quality' => array('adapter' => 'Mbstring')));
開發者ID:unionofrad,項目名稱:li3_quality,代碼行數:12,代碼來源:bootstrap.php

示例13: dirname

<?php

use lithium\core\Libraries;
define('LI3_RESQUE_PATH', dirname(__DIR__));
define('LI3_RESQUE_LIB_PATH', LI3_RESQUE_PATH . '/libraries/Resque');
// load up third party lib
// Libraries::add('resque', array(
// 	'path' => LI3_RESQUE_LIB_PATH,
// 	'prefix' => false,
// 	'transform' => function($class, $config) {
// 		$class = str_replace("_", "/", $class);
// 		return "{$config['path']}/{$class}{$config['suffix']}";
// 	}
// ));
if (Libraries::paths('job') === null) {
    Libraries::paths(array('job' => '{:library}\\extensions\\job\\{:name}'));
}
if (file_exists(__DIR__ . '/../vendor/autoload.php')) {
    require __DIR__ . '/../vendor/autoload.php';
}
開發者ID:bruensicke,項目名稱:li3_resque,代碼行數:20,代碼來源:bootstrap.php

示例14: array

<?php

use lithium\core\Libraries;
// Adapters nested under security/access/adapters instead
// of under extensions until core has the paths changed.
Libraries::paths(array('adapter' => array_merge(Libraries::paths('adapter'), array('{:library}\\{:namespace}\\{:class}\\adapter\\{:name}'))));
開發者ID:atelierdisko,項目名稱:li3_access,代碼行數:6,代碼來源:bootstrap.php

示例15: testPathTemplateWithGlobBrace

 /**
  * @deprecated
  */
 public function testPathTemplateWithGlobBrace()
 {
     error_reporting(($original = error_reporting()) & ~E_USER_DEPRECATED);
     Libraries::paths(array('analysis' => array('{:library}\\analysis\\*{Docblock,Debugger}')));
     $analysis = list($docblock, $debugger) = Libraries::locate('analysis', null, array('recursive' => false, 'format' => false));
     $this->assertCount(2, $analysis);
     $this->assertPattern('/Docblock\\.php/', $docblock);
     $this->assertPattern('/Debugger\\.php/', $debugger);
     error_reporting($original);
 }
開發者ID:unionofrad,項目名稱:lithium,代碼行數:13,代碼來源:LibrariesTest.php


注:本文中的lithium\core\Libraries::paths方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。