本文整理汇总了PHP中Ak::dir方法的典型用法代码示例。如果您正苦于以下问题:PHP Ak::dir方法的具体用法?PHP Ak::dir怎么用?PHP Ak::dir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ak
的用法示例。
在下文中一共展示了Ak::dir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getControllerViews
function _getControllerViews()
{
$view_files = Ak::dir(AK_VIEWS_DIR.DS.$this->class_to_clone, array('dirs'=>false));
foreach ($view_files as $k=>$view_file){
$view_files[$k] = str_replace('.tpl','',$view_file);
}
return $view_files;
}
示例2: test_should_get_all_controllers_with_their_actions
public function test_should_get_all_controllers_with_their_actions()
{
$available_controllers = (array) Ak::dir(AK_CONTROLLERS_DIR, array('dirs' => false));
$got = $this->menu_helper->_get_default_full_menu();
foreach ($available_controllers as $controller_filename) {
$controller_name = str_replace('_controller.php', '', $controller_filename);
$this->assertTrue(isset($got[$controller_name]));
}
$this->assertTrue(in_array('authenticate', $got['authentication']));
}
示例3: up_1
function up_1()
{
$this->files = Ak::dir(AK_ADMIN_PLUGIN_FILES_DIR, array('recurse'=> true));
empty($this->options['force']) ? $this->checkForCollisions($this->files) : null;
$this->copyAdminFiles();
echo "\nWe need some details for setting up the admin.\n\n ";
$this->modifyRoutes();
$this->relativizeStylesheetPaths();
$this->runMigration();
echo "\n\nInstallation completed\n";
}
示例4: clearAll
function clearAll($environment = AK_ENVIRONMENT)
{
$dummy = AkDbSchemaCache::_generateCacheFileName('dummy', $environment);
$dir = dirname($dummy);
$files = Ak::dir($dir);
foreach ($files as $file) {
if (is_file($dir.DS.$file)) {
@unlink($dir.DS.$file);
}
}
}
示例5: _getMenuOptionsForControllersInModule
function _getMenuOptionsForControllersInModule($type = 'admin')
{
$controllers = (Ak::dir(AK_CONTROLLERS_DIR.DS.$this->_controller->getModuleName(), array('dirs'=>false)));
sort($controllers);
$menu_options = array();
foreach ($controllers as $controller){
$controller_name = substr($controller,0,-15);
$menu_options[AkInflector::titleize($controller_name)] = array('id'=>$controller_name, 'url'=> array('controller'=>$controller_name));
}
$options_file = $this->_getMenuOptionsFile($type);
if(!file_exists($options_file)){
Ak::file_put_contents(AK_CONFIG_DIR.DS.$options_file, Ak::convert('array', 'yaml', array('default'=>$menu_options)));
}
return $menu_options;
}
示例6: _get_default_full_menu
function _get_default_full_menu()
{
$controller_file_names = Ak::dir(AK_CONTROLLERS_DIR, array('files' => false));
krsort($controller_file_names);
$menu_options = array();
foreach ($controller_file_names as $controller_file_name => $options) {
$controller_file_name = array_pop($options);
$controller_name = str_replace('.php', '', $controller_file_name);
if (file_exists(AK_CONTROLLERS_DIR . DS . $controller_file_name)) {
include_once AK_CONTROLLERS_DIR . DS . $controller_file_name;
$controller_class_name = AkInflector::classify($controller_name);
$menu_options[str_replace('_controller', '', $controller_name)] = $this->_get_this_class_methods($controller_class_name);
}
}
return $menu_options;
}
示例7: AkelosInstaller
function AkelosInstaller($options)
{
$default_options = array(
'source' => $this->_absolutePath(dirname(__FILE__).DIRECTORY_SEPARATOR.'..'),
'force' => false,
'skip' => false,
'quiet' => false,
'public_html' => false,
'dependencies' => false,
'version'=>false
);
$this->options = array_merge($default_options, $options);
if (isset($this->options['version']) && $this->options['version']!==false) {
die(file_get_contents('version.txt')."\n");
}
$this->options['directory'] = $this->_absolutePath(@$this->options['directory']);
if(empty($this->options['directory'])){
trigger_error('You must supply a valid destination path', E_USER_ERROR);
}
$this->source_tree = Ak::dir($this->options['source'],array('dirs'=>true,'recurse'=>true));
if(empty($this->options['dependencies'])){
$this->framework_dirs = array('lib', 'vendor', 'test');
foreach ($this->framework_dirs as $framework_dir){
foreach ($this->source_tree as $k => $v){
if(isset($v[$framework_dir])){
unset($this->source_tree[$k]) ;
}
}
}
}
$this->destination_tree = Ak::dir($this->options['directory'],array('dirs'=>true,'recurse'=>true));
}
示例8: autoInstallExtensions
function autoInstallExtensions()
{
$path = AK_APP_PLUGINS_DIR . DS . $this->plugin_name . DS . 'extensions';
$extensionFiles = Ak::dir($path, array('recurse' => true));
foreach ($extensionFiles as $extensionFile) {
$this->installExtensions('extensions' . DS . $extensionFile);
}
}
示例9: getApplicationHelpers
function getApplicationHelpers()
{
$helper_names = array();
if ($this->app_helpers == 'all') {
$available_helpers = Ak::dir(AK_HELPERS_DIR, array('dirs' => false));
$helper_names = array();
foreach ($available_helpers as $available_helper) {
$helper_names[AK_HELPERS_DIR . DS . $available_helper] = AkInflector::classify(substr($available_helper, 0, -10));
}
} elseif (!empty($this->app_helpers)) {
foreach (Ak::toArray($this->app_helpers) as $helper_name) {
$helper_names[AK_HELPERS_DIR . DS . AkInflector::underscore($helper_name) . '_helper.php'] = AkInflector::camelize($helper_name);
}
}
return $helper_names;
}
示例10: _findPlugins
/**
* Loads a list of existing plugins to $this->_available_plugins by inspecting the plugins directory.
*
* @return void
* @access private
*/
function _findPlugins()
{
$plugin_dirs = Ak::dir(AK_PLUGINS_DIR, array('dirs' => true, 'files' => false));
$this->_available_plugins = array();
foreach ($plugin_dirs as $plugin_dir){
$plugin_dir = array_pop($plugin_dir);
if($plugin_dir[0] != '.'){
$this->_available_plugins[] = $plugin_dir;
}
}
}
示例11: _getAvailableGenerators
function _getAvailableGenerators()
{
$generators = array();
foreach (Ak::dir(AK_SCRIPT_DIR . DS . 'generators', array('files' => false, 'dirs' => true)) as $folder) {
$generator = array_shift(array_keys($folder));
if (strstr($generator, '.php')) {
continue;
}
$generators[] = $generator;
}
return $generators;
}
示例12: _getAvailableTemplates
public function _getAvailableTemplates()
{
$path = $this->ActionMailer->getTemplatePath();
if (!isset($templates[$path])) {
$templates[$path] = array_map('basename', Ak::dir($path, array('dirs' => false)));
}
return $templates[$path];
}
示例13: rtrim
$file = AK_APP_DIR . DS . 'installers' . DS . rtrim(join('/', array_map(array('AkInflector', 'underscore'), explode('/', $installer . '/'))), '/') . '_installer.php';
function ak_print_available_installers($files, $preffix = '')
{
foreach ($files as $k => $file) {
if (is_string($file)) {
if (preg_match('/(.*)_installer\\.php$/', $file, $match)) {
echo ' * ' . $preffix . $match[1] . "\n";
}
} else {
ak_print_available_installers($file, $k . '::');
}
}
echo "\n";
}
if ($installer_class_name == 'Installer') {
$files = Ak::dir(AK_APP_DIR . DS . 'installers', array('recurse' => true));
if (empty($files)) {
echo Ak::t("\n Could not find installers at %dir \n", array('%dir' => AK_APP_DIR . DS . 'installers'));
} else {
echo Ak::t("\n You must supply a valid installer name like : \n");
echo Ak::t("\n > ./script/migrate my_installer_name install\n\n");
echo Ak::t(" Available installers are: \n\n");
ak_print_available_installers($files);
}
} elseif (!file_exists($file)) {
echo Ak::t("\n\n Could not locate the installer file %file\n\n", array('%file' => $file));
} else {
require_once $file;
if (!class_exists($installer_class_name)) {
echo Ak::t("\n\n Could not find load the installer. Class doesn't exists\n\n");
} else {
示例14: up_1
function up_1()
{
$this->files = Ak::dir(AK_SIFR_HELPER_PLUGIN_FILES_DIR, array('recurse' => true));
empty($this->options['force']) ? $this->checkForCollisions($this->files) : null;
$this->copySifrHelperFiles();
}
示例15: dir
function dir($path, $options = array())
{
$result = array();
$path = rtrim($path, '/\\');
$default_options = array('files' => true, 'dirs' => true, 'recurse' => false);
$options = array_merge($default_options, $options);
if (is_file($path)) {
$result = array($path);
} elseif (is_dir($path)) {
if ($id_dir = opendir($path)) {
while (false !== ($file = readdir($id_dir))) {
if ($file != "." && $file != ".." && $file != '.svn') {
if (!empty($options['files']) && !is_dir($path . DS . $file)) {
$result[] = $file;
} elseif (!empty($options['dirs'])) {
$result[][$file] = !empty($options['recurse']) ? Ak::dir($path . DS . $file, $options) : $file;
}
}
}
closedir($id_dir);
}
}
return array_reverse($result);
}