本文整理汇总了PHP中Kohana::list_files方法的典型用法代码示例。如果您正苦于以下问题:PHP Kohana::list_files方法的具体用法?PHP Kohana::list_files怎么用?PHP Kohana::list_files使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kohana
的用法示例。
在下文中一共展示了Kohana::list_files方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_list_files_returns_array_on_success_and_failure
/**
* Kohana::list_files() should return an array on success and an empty array on failure
*
* @test
* @covers Kohana::list_files
*/
public function test_list_files_returns_array_on_success_and_failure()
{
$files = Kohana::list_files('config');
$this->assertType('array', $files);
$this->assertGreaterThan(3, count($files));
$this->assertSame(array(), Kohana::list_files('geshmuck'));
}
示例2: _execute
/**
* Generates a help list for all tasks
*
* @return null
*/
protected function _execute(array $params)
{
$tasks = $this->_compile_task_list(Kohana::list_files('classes/task'));
$view = new View('minion/help/list');
$view->tasks = $tasks;
echo $view;
}
示例3: find_tests
/**
* Recurse into test directories to find all tests
*
* @param string sub directory (under any /tests dir) to (recursively) look for tests in
* @param array (optional) list of files to flatten (used for recursion)
* @return array flattened list of all test files
*/
public static function find_tests($directory = NULL, array $tests = NULL)
{
if (is_null($tests)) {
if (is_null($directory)) {
$tests_directory = "";
} else {
$tests_directory = 'tests' . DIRECTORY_SEPARATOR . trim($directory, DIRECTORY_SEPARATOR);
}
// Load tests from directory
$tests = Kohana::list_files($tests_directory);
// Load specified test case if found and make it first to run
if (dirname($tests_directory) !== basename($tests_directory) and $test_file = Kohana::find_file(dirname($tests_directory), basename($tests_directory))) {
array_unshift($tests, $test_file);
}
}
$flattened_tests = array();
foreach ($tests as $relative => $file) {
if (is_array($file)) {
$flattened_tests += self::find_tests(NULL, $file);
} else {
$flattened_tests[$relative] = $file;
}
}
return $flattened_tests;
}
示例4: index
public function index()
{
// Require Zend_Amf_Server
require_once 'Zend/Amf/Server.php';
// *ZAMFBROWSER IMPLEMENTATION*
// Require the ZendAmfServiceBrowser class, required to retrieve the list of methods on the ZendAMF server.
require_once Kohana::find_file('vendor/ZamfBrowser', 'ZendAmfServiceBrowser');
// Start Server
$server = new Zend_Amf_Server();
// $server->addDirectory( SHAREDPATH.Kohana::config('zendamf.services_path') );
$services_path = APPPATH . Kohana::config('zendamf.services_path');
$files = Kohana::list_files($services_path, FALSE);
foreach ($files as $file) {
$class = pathinfo($file, PATHINFO_FILENAME);
$server->setClass($class);
}
// // do class mapping
$vo_path = APPPATH . Kohana::config('zendamf.vo_path');
$files = Kohana::list_files($vo_path, FALSE);
foreach ($files as $file) {
$class = pathinfo($file, PATHINFO_FILENAME);
$server->setClassMap($class, $class);
}
// *ZAMFBROWSER IMPLEMENTATION*
// Add the ZendAmfServiceBrowser class to the list of available classes.
$server->setClass("ZendAmfServiceBrowser");
// *ZAMFBROWSER IMPLEMENTATION*
// Set this reference the class requires to the server object.
// ZendAmfServiceBrowser::setAmfServer( $server );
ZendAmfServiceBrowser::$ZEND_AMF_SERVER = $server;
// Handle the AMF request
echo $server->handle();
}
示例5: getPlugins
/**
* Get plugins
*
* @return void
* @author Peter Bowyer
*/
function getPlugins()
{
$x = Kohana::list_files(PLUGPATH, false, PLUGPATH);
for ($i = 0; $i < count($x); $i++) {
$x[$i] = substr($x[$i], strlen(PLUGPATH . '/') - 1);
}
return $x;
}
示例6: fetch_seed_groups
public function fetch_seed_groups()
{
$groups = [];
$files = Kohana::list_files('database/seeds');
foreach ($files as $file => $path) {
$groups[] = substr($file, 15);
}
return $groups;
}
示例7: get_template_list
function get_template_list()
{
$f = Kohana::list_files('views/containers');
$arr = array();
foreach ($f as $file) {
$n = basename($file, ".php");
$arr[$n] = $n;
}
return $arr;
}
示例8: get_container_templates
/**
* get a list of container templates
*
* @return array
* @author Andy Bennett
*/
public static function get_container_templates()
{
$arr = array();
$l = Kohana::list_files('views/container');
foreach ($l as $f) {
$n = basename($f, ".php");
$arr[$n] = ucfirst($n);
}
return $arr;
}
示例9: action_i18n
/**
* Dump all i18n files
*/
public function action_i18n()
{
$files = Kohana::list_files('i18n');
$i18n = array();
foreach ($files as $key => $value) {
// Trim off "i18n/" and ".php"
$i18n[$key] = substr($key, 5, -strlen(EXT));
}
$this->template->content = View::factory('devtools/i18n', array('i18n' => $i18n));
}
示例10: _getTaskClasses
protected static function _getTaskClasses()
{
$aClasses = self::_getTaskClassesList(Kohana::list_files('classes/Task'));
foreach ($aClasses as $iKey => $sClass) {
if (!in_array('Interface_TaskLauncherTask', class_implements($sClass))) {
unset($aClasses[$iKey]);
}
}
return $aClasses;
}
示例11: find_local
/**
* @return array
*/
public static function find_local()
{
$patches_list = Kohana::list_files('patches', array(DOCROOT));
$installed_patches = self::installed();
$patches = array();
foreach ($patches_list as $path) {
$filename = pathinfo($path, PATHINFO_BASENAME);
if (!in_array($filename, $installed_patches)) {
$patches[$filename] = $path;
}
}
return $patches;
}
示例12: action_help
/**
* Prints out the help for a specific task
*
*/
public function action_help()
{
$tasks = Minion_Util::compile_task_list(Kohana::list_files('classes/minion/task'));
$view = NULL;
if (empty($this->_task)) {
$view = new View('minion/help/list');
$view->tasks = $tasks;
} else {
$inspector = new ReflectionClass($this->_retrieve_task());
list($description, $tags) = Minion_Util::parse_doccomment($inspector->getDocComment());
$view = View::factory('minion/help/task')->set('description', $description)->set('tags', (array) $tags)->set('task', $this->_task);
}
echo $view;
}
示例13: __construct
public function __construct($name, $directory)
{
$this->name = $name;
$files = Kohana::list_files($directory);
foreach ($files as $file) {
if (!is_file($file)) {
continue;
}
if (substr_compare($file, 'Base_Test' . EXT, strlen($file) - strlen('Base_Test' . EXT)) !== 0) {
PHPUnit_Util_Filter::addFileToFilter($file);
$this->addTestFile($file);
}
}
}
示例14: _get_models
public function _get_models()
{
$initial_classes = get_declared_classes();
foreach (Kohana::list_files('models') as $file) {
include_once $file;
}
$classes = array_diff(get_declared_classes(), $initial_classes);
$models = array();
foreach ($classes as $class) {
if (is_subclass_of($class, 'ORM')) {
$models[] = new $class();
}
}
return $models;
}
示例15: merge_resources
/**
* Method to merge resources
* It finds out all the controllers and adds the basenames to the acl config array
* as resources only if the key doesnot already exists
*/
private function merge_resources()
{
$controllers = Kohana::list_files('classes/controller');
// controllers can also be nested, so just flatten the array
$controllers = Arr::flatten($controllers);
foreach ($controllers as $controller) {
$resource = basename($controller, '.php');
if (self::is_resource_ignored($resource) || array_key_exists($resource, $this->_acl)) {
continue;
}
$this->_acl[$resource] = array();
}
ksort($this->_acl);
return $this;
}