/** * Bootstrap the application services. * * @return void */ public function boot() { view()->composer(['front.header', 'admin.header'], function ($view) { $languages = []; $folders = File::directories(base_path('resources/lang/')); foreach ($folders as $folder) { $languages[] = str_replace('\\', '', last(explode('/', $folder))); } $view->with('languages', $languages); }); view()->composer('front.header', function ($view) { $apps = Application::all(); $view->with('apps', $apps); }); view()->composer('admin.news.form', function ($view) { $categories = ['update' => trans('news.category.update'), 'maintenance' => trans('news.category.maintenance'), 'event' => trans('news.category.event'), 'contest' => trans('news.category.contest'), 'other' => trans('news.category.other')]; $view->with('categories', $categories); }); view()->composer('front.widgets', function ($view) { $client_status = @fsockopen(settings('server_ip', '127.0.0.1'), 6543, $errCode, $errStr, 1) ? TRUE : FALSE; $worlds = DB::connection('account')->table('worlds')->get(); $view->with('client_status', $client_status)->with('worlds', $worlds); }); view()->composer('admin.donate.settings', function ($view) { $view->with('currencies', trans('donate.currency')); }); }
public function getAlbumsList() { $directoryPath = $this->getAlbumsFolderLocation(); $albums_list = array(); $list = null; if (File::exists($directoryPath)) { $list = File::directories($directoryPath); } if ($list != null) { foreach ($list as $album) { $locationExplode = explode("/", $album); $folderName = end($locationExplode); if (!StringUtils::getInstance()->startsWith($folderName, "hidden_")) { if ($this->isAlbumList($album)) { $titleFilePath = $album . DIRECTORY_SEPARATOR . "title.txt"; if (File::exists($titleFilePath)) { array_push($albums_list, $album); } } else { array_push($albums_list, $album); } } } } return $albums_list; }
/** * Execute the console command. * * @return mixed */ public function handle() { if (!($projectName = $this->argument('projectName'))) { $this->info("O Nome do projeto é obrigatorio"); exit; } if (File::directories('../' . $projectName)) { $this->info("----- Instalando o DebugBar -----"); //shell_exec('cd ../' . $projectName . '/ && composer require barryvdh/laravel-debugbar'); //echo shell_exec(' ls ../projeto1' ); //$output = shell_exec('php composer.phar require barryvdh/laravel-debugbar'); $this->info("----- Instalando o illuminate/html -----"); // shell_exec('cd ../' . $projectName . '/ && composer require illuminate/html'); $this->info("----- Instalando o datatables-oracle -----"); //shell_exec('cd ../' . $projectName . '/ && composer require yajra/laravel-datatables-oracle'); $this->info("----- Instalando o prettus/l5-repository -----"); //shell_exec('cd ../' . $projectName . '/ && composer require prettus/l5-repository'); $this->info("----- Instalando o Vendor prettus/l5-repository -----"); //shell_exec('cd ../' . $projectName . '/ && php artisan vendor:publish'); /* * Copio o arquivo app.php já com os prividers e */ //$this->copyFile('app.php', $projectName, 'path'); /* * Aplico uma namespace */ $this->info("----- Aplicando NamesPace Serbinario -----"); shell_exec('cd ../' . $projectName . '/ && php artisan app:name Serbinario'); } }
/** * Return folders in path * * @param string $path * * @return mixed */ public function getFolders($path) { $folders = File::directories($this->getPath($path)); return array_map(function ($val) { return $this->sanitizePath($val); }, $folders); }
/** * Bootstrap the application services. * * @return void */ public function boot() { if (is_dir(app_path('Modules'))) { $getAllModules = array_map('class_basename', File::directories(app_path('Modules'))); $disableModules = config("module.disable"); $modules = array_diff($getAllModules, $disableModules); foreach ($modules as $module) { $routes = app_path('Modules') . '/' . $module . '/routes.php'; $views = app_path('Modules') . '/' . $module . '/Views'; $lang = app_path('Modules') . '/' . $module . '/Lang'; $helper = app_path('Modules') . '/' . $module . '/helper.php'; if (file_exists($routes)) { include $routes; } if (file_exists($helper)) { include $helper; } if (is_dir($views)) { $this->loadViewsFrom($views, $module); } if (is_dir($lang)) { $this->loadTranslationsFrom($lang, $module); } } } }
public function isAlbumList($location) { $directories = File::directories($location); if (sizeof($directories) > 0) { return true; } else { return false; } }
/** * Get list of folders as json to populate treeview * * @return mixed */ public function getFolders() { $directories = File::directories(base_path(Config::get('sfm.dir'))); $final_array = []; foreach ($directories as $directory) { if (basename($directory) != "thumbs") { $final_array[] = basename($directory); } } return View::make("filemanager::tree")->with('dirs', $final_array); }
/** * Get list of folders as json to populate treeview * * @return mixed */ public function getFolders() { $directories = File::directories(base_path($this->file_location)); $final_array = []; foreach ($directories as $directory) { if (basename($directory) != "thumbs") { $final_array[] = basename($directory); } } return View::make("laravel-filemanager::tree")->with('dirs', $final_array); }
private function registerActiveThemeVendorNamespaces($directory) { $themeVendorDirectory = "{$directory}/views/vendor"; if (!File::exists($themeVendorDirectory)) { return; } $vendorDirectories = File::directories($themeVendorDirectory); foreach ($vendorDirectories as $vendorDirectory) { $vendor = str_replace("{$themeVendorDirectory}/", '', $vendorDirectory); $this->app['view']->prependNamespace($vendor, $vendorDirectory); } }
public function images() { $images = File::files('uploads'); $directories = File::directories('uploads'); foreach ($directories as $directory) { $directory_images = File::files($directory); $images = array_merge($images, $directory_images); } if (Request::ajax()) { return $images; } return view('admin.images', compact('images')); }
/** * Execute the console command. * * @return mixed */ public function handle() { $ignoreInput = str_replace(' ', '', $this->option('ignore')); $ignoreInput = explode(',', $ignoreInput); $migrate = new SqlMigrations(); $migrate->ignore($ignoreInput); if (File::directories('../' . $this->argument('dirProject'))) { $migrate->dirProject($this->argument('dirProject')); $migrate->convert($this->argument('database')); $migrate->write(); $this->info('Migration Created Successfully'); } }
/** * Execute the command. * * @return void */ public function handle() { // get paths of registered namespace hints // e.g user in @lang('user::myview') resolving to app/Modules/User/Resources $resDirs = Config::get('langcheck.usehints') ? Lang::getHints() : array(); $resDirs[base_path() . '/resources/lang'] = 'app'; // check each resource directory foreach ($resDirs as $path => $hint) { // skip vendor directories if (Config::get('langcheck.skipvendor') && strpos($path, "vendor/") !== false) { continue; } // generate path relative to project root $shortPath = substr($path, strlen(base_path() . '/')); $this->info("Checking '{$shortPath}'..."); // load translation files into arrays $langDirs = File::directories($path); $languageData = array(); foreach ($langDirs as $langDir) { $langCode = basename($langDir); $arrays = File::files($langDir); foreach ($arrays as $file) { $fileName = basename($file); $languageData[$langCode][$fileName] = File::getRequire($file); } } // compare language arrays with each other and find missing entries foreach ($languageData as $langCodeA => $langArraysA) { foreach ($langArraysA as $fileNameA => $langArrayA) { foreach ($languageData as $langCodeB => $langArraysB) { if ($langCodeA == $langCodeB) { continue; } if (array_key_exists($fileNameA, $langArraysB)) { $result = $this->array_diff_key_recursive($langArrayA, $langArraysB[$fileNameA]); if (!empty($result)) { $keys = implode($this->arrayKeysRecursive($result), ', '); $this->error(" * File '{$fileNameA}':"); $this->error(" - Locale '{$langCodeB}' missing [{$keys}] existing in locale '{$langCodeA}'"); } } else { $this->error(" * File '{$fileNameA}' existing in locale '{$langCodeA}' is missing for locale '{$langCodeB}'"); } } } } $this->info(''); } }
/** * Bootstrap the application services. * @return void */ public function boot() { $menu = NULL; $path = public_path() . '/reportico/projects'; $directory_list = File::directories($path); foreach ($directory_list as $list_key => $value) { $file_list = glob($value . '/*.xml'); foreach ($file_list as $key => $value) { $file = pathinfo($value); $report = $file['filename']; $directory = $file['dirname']; $project = substr($directory, strrpos($directory, '/') + 1); $menu[$project][] = $report; } } View::share('report_menu', $menu); }
/** * Get the images to load for a selected folder * * @return mixed */ public function getImages() { if (Input::has('base')) { $files = File::files(base_path($this->file_location . Input::get('base'))); $all_directories = File::directories(base_path($this->file_location . Input::get('base'))); } else { $files = File::files(base_path($this->file_location)); $all_directories = File::directories(base_path($this->file_location)); } $directories = []; foreach ($all_directories as $directory) { if (basename($directory) != "thumbs") { $directories[] = basename($directory); } } $file_info = []; foreach ($files as $file) { $file_name = $file; $file_size = number_format(Image::make($file)->filesize() / 1024, 2, ".", ""); if ($file_size > 1000) { $file_size = number_format(Image::make($file)->filesize() / 1024, 2, ".", "") . " Mb"; } else { $file_size = $file_size . " Kb"; } $file_created = filemtime($file); $file_type = Image::make($file)->mime(); $file_info[] = ['name' => $file_name, 'size' => $file_size, 'created' => $file_created, 'type' => $file_type]; } if (Session::has('lfm_type') && Session::get('lfm_type') == "Images") { $dir_location = Config::get('lfm.images_url'); } else { $dir_location = Config::get('lfm.files_url'); } if (Input::get('show_list') == 1) { return View::make('laravel-filemanager::images-list')->with('directories', $directories)->with('base', Input::get('base'))->with('file_info', $file_info)->with('dir_location', $dir_location); } else { return View::make('laravel-filemanager::images')->with('files', $files)->with('directories', $directories)->with('base', Input::get('base'))->with('dir_location', $dir_location); } }
public function makeOverviewMenu() { $headfolder = $this->ask('what is the name of your head folder where the packages are stored in?'); $list = File::directories($headfolder); echo "packages contains ", count($list), " directories."; /* foreach ($list as $directory => $value) { printf("directory : " . $directory . ' - vendor : ' . $value . PHP_EOL); } */ foreach ($list as $directory) { //printf($directory . PHP_EOL); $pieces = explode('\\', $directory); //print_r($pieces); $folderarray[] = $pieces[1]; //staat er tijdelijk in voor onderbreking //printf($pieces); } //$folderarray[count($list)] = "Choice this if you don't have a vendor folder yet"; //print_r($folderarray); if (count($list) == 0) { $vendor = $this->ask('what is the name of the vendor?'); $name = $this->ask('What is the name of the package'); //$this->startMenu($vendor); $this->call('packager:new', ['vendor' => $vendor, 'name' => $name]); } else { $choiceVendors = $this->choice('What is the name of your vendor?', $folderarray); switch ($choiceVendors) { case 0: ''; break; default: ''; break; } } }
/** * Bootstrap the application services. * * @return void */ public function boot() { view()->composer(['front.header', 'admin.header'], function ($view) { $languages = []; $folders = File::directories(base_path('resources/lang/')); foreach ($folders as $folder) { $languages[] = str_replace('\\', '', last(explode('/', $folder))); } $view->with('languages', $languages); }); view()->composer('front.header', function ($view) { $apps = Application::all(); $view->with('apps', $apps); }); view()->composer('admin.news.form', function ($view) { $categories = ['update' => trans('news.category.update'), 'maintenance' => trans('news.category.maintenance'), 'event' => trans('news.category.event'), 'contest' => trans('news.category.contest'), 'other' => trans('news.category.other')]; $view->with('categories', $categories); }); view()->composer(['admin.shop.form', 'admin.management.mailer'], function ($view) { $masks = [0 => trans('shop.masks.0'), 1 => trans('shop.masks.1'), trans('shop.equipment') => [2 => trans('shop.masks.armor.2'), 16 => trans('shop.masks.armor.16'), 64 => trans('shop.masks.armor.64'), 128 => trans('shop.masks.armor.128'), 256 => trans('shop.masks.armor.256'), 8 => trans('shop.masks.armor.8')], trans('shop.fashion') => [8192 => trans('shop.masks.fashion.8192'), 16384 => trans('shop.masks.fashion.16384'), 32768 => trans('shop.masks.fashion.32768'), 65536 => trans('shop.masks.fashion.65536')], trans('shop.accessories') => [1536 => trans('shop.masks.accessories.1536'), 4 => trans('shop.masks.accessories.4'), 32 => trans('shop.masks.accessories.32')], trans('shop.charms') => [1048576 => trans('shop.masks.charms.1048576'), 2097152 => trans('shop.masks.charms.2097152')], 262144 => trans('shop.masks.262144'), 524288 => trans('shop.masks.524288'), 4096 => trans('shop.masks.4096')]; $view->with('masks', $masks); }); view()->composer('admin.donate.settings', function ($view) { $view->with('currencies', trans('donate.currency')); }); view()->composer('front.widgets', function ($view) { $gms = []; foreach (DB::table('auth')->select('userid')->distinct()->get() as $gm) { $gms[] = User::find($gm->userid); } $view->with('gms', $gms); }); if (Schema::hasTable('pweb_settings')) { view()->share('api', new API()); } view()->share('agent', new Agent()); }
public function getFiles($img = true) { if (Input::has('base') && strpos(Input::has('base'), '..') === false) { $files = File::files(base_path(Config::get('sfm.dir') . Input::get('base'))); $all_directories = File::directories(base_path(Config::get('sfm.dir') . Input::get('base'))); } else { $files = File::files(base_path(Config::get('sfm.dir'))); $all_directories = File::directories(base_path(Config::get('sfm.dir'))); } $filter_images = Input::get('filter') == 'images'; $directories = []; foreach ($all_directories as $directory) { if (basename($directory) != ".thumbs") { $directories[] = basename($directory); } } $file_info = []; $finfo = new \finfo(FILEINFO_MIME); foreach ($files as $file) { $file_name = $file; $ext = strtolower(pathinfo($file, PATHINFO_EXTENSION)); $is_image = in_array($ext, ['jpeg', 'jpg', 'png', 'gif']); if ($filter_images && !$is_image) { continue; } $file_created = filemtime($file); $file_type = explode(';', $finfo->file($file))[0]; $file_info[] = ['basename' => basename($file_name), 'name' => $file_name, 'size' => $this->formatSize(filesize($file)), 'created' => $file_created, 'type' => $file_type, 'ext' => $ext, 'icon' => Icons::getIcon($ext), 'image' => $is_image]; } $dir_location = Config::get('sfm.url'); if (Input::get('show_list') == 1) { return View::make('filemanager::images-list')->with('directories', $directories)->with('base', Input::get('base'))->with('file_info', $file_info)->with('dir_location', $dir_location); } else { return View::make('filemanager::images')->with('files', $file_info)->with('directories', $directories)->with('base', Input::get('base'))->with('dir_location', $dir_location); } }
private function listFolders() { //lists directories full path $list = FileFacade::directories(public_path('files')); //keep only name foreach ($list as $key => $value) { $list[$key] = preg_replace('/^.*\\//', '', $value) . '/'; } array_unshift($list, '/'); //set keys $folders = []; foreach ($list as $key => $value) { $folders[$value] = $value; } return $folders; }
/** * Gets a list of the available locales. * * @return array */ private function getLocales() { // Get the locales from the files on disk $locales = File::directories(base_path('resources/lang/')); array_walk($locales, function (&$locale) { $locale = basename($locale); }); return $locales; }
public function getAvailableLanguages() { $languages = []; $directories = File::directories(base_path() . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'lang'); foreach ($directories as $directory) { $lang = explode(DIRECTORY_SEPARATOR, $directory); $lang = end($lang); $languages[$lang] = Lang::get('general.' . $lang); } return $languages; }
public function getDirectories($path) { $thumb_folder_name = Config::get('lfm.thumb_folder_name'); $all_directories = File::directories($path); $arr_dir = []; foreach ($all_directories as $directory) { $dir_name = $this->getFileName($directory); if ($dir_name['short'] !== $thumb_folder_name) { $arr_dir[] = $dir_name; } } return $arr_dir; }