function makeupPages() { $pages_path = Manager::getPath('pages'); if (file_exists($pages_path)) { foreach (\File::allFiles($pages_path) as $file) { Manager::page(str_replace('.twig', '', $file->getFilename())); } } }
public function getStartupSeedFiles($db) { //$db is tenant or craiglorious $directory = database_path("seeds/csv_startup_data/" . $db); $files = \File::allFiles($directory); return $files; }
public function __construct() { // Carbon Language Carbon::setLocale('tr'); // create home page if non exist count(Menu::where('slug', '/anasayfa')->get()) == 0 ? Menu::create(['title' => 'Anasayfa', 'slug' => '/anasayfa', 'eng_title' => 'Home', 'eng_slug' => '/home'])->save() : null; // create config file if non exist !\File::exists(storage_path('.config')) ? \File::put(storage_path('.config'), json_encode(['brand' => 'Brand Name', 'mail' => '*****@*****.**', 'active' => 1, 'eng' => '0', 'one_page' => '0', 'googlemap' => '', 'header' => ''])) : null; $this->config = json_decode(\File::get(storage_path('.config'))); !\File::exists(storage_path('app/custom/css')) ? \File::makeDirectory(storage_path('app/custom/css'), 0755, true) : null; !\File::exists(storage_path('app/custom/js')) ? \File::makeDirectory(storage_path('app/custom/js'), 0755, true) : null; // get css & js files from custom folder // css $css = \File::allFiles(storage_path('app/custom/css')); if (!empty($css)) { foreach ($css as $cs) { $this->css[$cs->getCtime()] = $cs->getRelativePathname(); } // sort by date ksort($this->css); } // js $js = \File::allFiles(storage_path('app/custom/js')); if (!empty($js)) { foreach ($js as $j) { $this->js[$j->getCtime()] = $j->getRelativePathname(); } // sort by date ksort($this->js); } }
public function show($id) { $classified = Classified::find($id); $classifiedCategory = ClassifiedCategory::find($classified->classified_category_id); $classifiedImages = array(); if (File::exists(public_path() . '/uploads/' . $id)) { $classifiedImages = File::allFiles(public_path() . '/uploads/' . $id); } return View::make('classifieds.index', array('classified' => $classified, 'images' => $classifiedImages, 'classifiedCategory' => $classifiedCategory)); }
public function run() { $directory = 'storage/surveyimages'; $files = File::allFiles($directory); foreach ($files as $file) { $filename = explode("/", $file); // echo (string)$filename[2], "\n"; SurveyImage::firstOrCreate(array('images' => $filename[2])); } }
public function getLoadImages(Filesystem $filesystem) { $toJson = []; $files = \File::allFiles(public_path('uploads/all/')); /** @var \SplFileInfo $file */ foreach ($files as $file) { $toJson[] = ['image' => '/uploads/all/' . $file->getBasename(), 'thumb' => '/uploads/all/' . $file->getBasename()]; } return $toJson; }
/** * Get Existing Bill Templates */ protected function getExistingBillTemplates() { $path = __DIR__ . '/../../../../'; $billsTypes = \File::allFiles($path . "resources/components/bills"); $customPath = base_path() . '/resources/views/bills'; $customBillTypes = \File::isDirectory($customPath) ? \File::allFiles($customPath) : []; foreach (array_merge($billsTypes, $customBillTypes) as $billFile) { app('veer')->loadedComponents['billsTypes'][array_get(pathinfo($billFile), 'filename')] = array_get(pathinfo($billFile), 'filename'); } }
/** * * * @return array */ private function _getBundles() { $this->comment('Searching files...'); $bundles = array(); foreach (\File::allFiles(app_path('views')) as $file) { $this->getOutput()->write('.'); foreach (\Jboysen\LaravelGcc\GCCompiler::findHelperMatches(\File::get($file)) as $bundle) { $bundles[] = $bundle; } } $this->getOutput()->writeln('Done!'); return $bundles; }
public function getExcel() { $projects = []; $files = File::allFiles(base_path() . '/excelPlace/'); //$files = file('http://localhost:8888/excelPlace/'); //return $files; foreach ($files as $file) { if (pathinfo($file)['extension'] == "xlsx" || pathinfo($file)['extension'] == "xls") { $projects[pathinfo($file)['filename']] = pathinfo($file)['basename']; } } return $projects; }
public function getBrowse() { if (!Input::has('CKEditor')) { return App::abort(403, 'Unauthorized action.'); } $fnnumber = Input::get('CKEditorFuncNum'); $path = public_path() . '\\assets\\ckeditor\\upload\\thumbnail'; $allfiles = File::allFiles($path); $files = array(); foreach ($allfiles as $file) { array_push($files, basename((string) $file)); } return View::make('faq.filebrowse')->with(compact('files', 'fnnumber')); }
public function run() { $dir = dirname(dirname(dirname(__DIR__))); $dir = $dir . "\\makeyourikorma\\public\\img\\uniques\\"; echo "Directorio de iamgenes unicas: {$dir} \n"; $file_set = File::allFiles($dir); foreach ($file_set as $file) { $filename = (string) $file; $type = explode("\\", dirname($filename)); $type = $type[count($type) - 1]; $uri = str_replace("\\", '/', explode('img', $filename)[1]); $uri = 'img' . $uri; \DB::table('uniqueImages')->insert(array('route' => $uri, 'type' => $type)); } }
/** * Execute the console command. * * @return mixed */ public function handle() { if (is_dir(app_path('Http/Forms'))) { foreach (\File::allFiles(app_path('Http/Forms')) as $f) { $class = \App::getNamespace() . 'Http\\Forms\\' . str_replace('.php', '', $f->getFilename()); Register::container($class); } } //добавим геттеры в контейнеры //добавим сеттеры в контейнеры foreach (Register::$containers as $container) { $this->info($container); foreach ($this->form_element_methods_get as $method) { $params = $this->getMethodParams($container, $method); $this->putPhpDoc($container, 'string', $method, $params); } foreach ($this->form_element_methods_set as $method) { $params = $this->getMethodParams($container, $method); $this->putPhpDoc($container, $container, $method, $params); } } //добавим элементы в контейнеры $i = 0; foreach (Register::$elements as $name => $data) { $this->info(++$i . ') ' . $name); $class = Arr::get($data, 'class'); foreach (Register::$containers as $container) { $params = $this->getMethodParams($class, 'laraform'); $method = \Illuminate\Support\Str::camel('put_' . $name); $this->putPhpDoc($container, $class, $method, $params); } foreach ($this->form_element_methods_get as $method) { $params = $this->getMethodParams($class, $method); $this->putPhpDoc($class, 'string', $method, $params); } foreach ($this->form_element_methods_set as $method) { $params = $this->getMethodParams($class, $method); $this->putPhpDoc($class, $class, $method, $params); } } $data = $this->ret; $content = \View::make('quickform::ide-helper', ['data' => $data, 'tab' => "\t"]); file_put_contents(base_path() . '/_ide_helper_laraform.php', $content); $this->info('IDE helper сгенерирован для ' . count($this->classes) . ' элементов'); }
/** * lists all files in a public folder * * @param string * @return array lists all files */ public static function listPublicFiles($dir_rel, $prefix_url = false) { $list_files = array(); $dir_rel = '/' . $dir_rel; $dir_abs = public_path() . $dir_rel; if (\File::exists($dir_abs)) { $files = \File::allFiles($dir_abs); foreach ($files as $file) { $filename = (string) $dir_rel . $file->getRelativePathName(); if ($prefix_url) { $filename = \Config::get('app.url') . $filename; } $list_files[] = $filename; } asort($list_files); } return $list_files; }
public function run() { $dir = dirname(dirname(dirname(__DIR__))); $dir = $dir . "\\makeyourikorma\\public\\img\\variants\\"; echo "Directorio de iamgenes con variantes: {$dir} \n"; $file_set = File::allFiles($dir); foreach ($file_set as $file) { $filename = (string) $file; $uri = str_replace("\\", '/', explode('img', $filename)[1]); $uri = 'img' . $uri; $id_color = explode("\\", $filename); $id_color = $id_color[count($id_color) - 1]; $id_color = explode('.', $id_color); $id = $id_color[0]; $id_color = $id_color[1]; \DB::table('variantImages')->insert(array('route' => $uri, 'id_color' => $id_color, 'image_id' => $id)); } }
protected function setup() { $basePath = 'views/backend/'; $path = app_path($basePath); $files = File::allFiles($path); $arr = array(); foreach ($files as $file) { $filename = str_replace($path, '', str_replace('.tpl', '', (string) $file)); $tmp = array_filter(explode('/', $filename)); $content = File::get((string) $file, ''); $html = trim(preg_replace('/\\s+/', ' ', preg_replace('/<!-- (.*)-->/Uis', '', $content))); $dotpath = implode('.', $tmp); array_set($arr, $dotpath, $html); } $contents = 'var TPL = ' . json_encode($arr); $response = Response::make($contents, 200); $response->header('Content-Type', 'application/javascript'); return $response; }
/** * Run the database seeds. * * @return void */ public function run() { // Eloquent::unguard(); DB::table('pictures')->delete(); DB::statement("ALTER TABLE avatars AUTO_INCREMENT=1"); $dirUploads = public_path(env('UPLOAD_PICTURES', 'uploads')); $files = File::allFiles($dirUploads); foreach ($files as $file) { File::delete($file); } $products = Product::all(); foreach ($products as $product) { $uri = str_random(12) . '_370x235.jpg'; $fileName = file_get_contents('http://lorempixel.com/futurama/370/235'); $pathDirectory = $dirUploads . DIRECTORY_SEPARATOR . $uri; FILE::put($pathDirectory, $fileName); $mime = mime_content_type($dirUploads . DIRECTORY_SEPARATOR . $uri); Picture::create(['product_id' => $product->id, 'uri' => $uri, 'title' => $this->facker->name, 'mime' => $mime, 'size' => 200]); } }
/** * Copies file from one destination to another * * @param $destination * @param $source * @return bool */ protected function copy($destination, $source) { if (file_exists($source)) { if (is_dir($source)) { $files = \File::allFiles($source); foreach ($files as $file) { $fileName = $file->getFilename(); if ($file->getRelativePath() == "") { $this->copyFileTo($destination, $source . '/' . $fileName); } else { $this->copyFileTo($destination . '/' . $file->getRelativePath(), $source . '/' . $file->getRelativePath() . '/' . $fileName); } } return true; } $this->copyFileTo($destination, $source); return true; } return false; }
function css() { $ret = []; $prefix = 'blocks/' . $this->name . '/'; $suffix_breakpoints = Manager::getUrl($prefix); $dir_breakpoints = Manager::getPath($prefix); if (file_exists($dir_breakpoints)) { foreach (\File::allFiles($dir_breakpoints) as $css) { $fn = $css->getFilename(); $size = (int) $fn; if ($size) { $this->breakpoint($size); $ret[$size] = $suffix_breakpoints . $fn; } } } ksort($ret); if (file_exists(Manager::getPath($prefix . 'block.css'))) { $ret[] = Manager::getUrl($prefix . 'block.css'); } krsort($ret); return $ret; }
public function createSeeders() { //i need a list of seeders... $db = 'craiglorious'; $db = 'tenant'; $seed_file = database_path("seeds/" . $db . "/" . ucfirst($db) . "DatabaseSeeder.php"); $directory = database_path("migrations/" . $db); $output_file_path = database_path("seeds/" . $db . "/tables/"); $seeders = ''; $files = \File::allFiles($directory); $seeder_file_names = []; $calls = ''; foreach ($files as $file) { //get the name and make it a seeder... $seeder_name = basename((string) $file, '.php'); $seeder_parts = explode('_', $seeder_name); $name = ''; for ($i = 5; $i < sizeof($seeder_parts) - 1; $i++) { $name .= ucfirst($seeder_parts[$i]); } $name .= 'TableSeeder'; if ($name != 'PasswordResetsTableSeeder') { $calls .= '$this->call(\'' . $name . '\');' . PHP_EOL; $seeder_file_names[] = $name; } } $file_contents = file_get_contents($seed_file); $file_contents = str_replace("REPLACE;", $calls, $file_contents); file_put_contents($seed_file, $file_contents); foreach ($seeder_file_names as $name) { $template = "<?php\n\tuse Illuminate\\Database\\Seeder;\n\t\t\n\tclass " . $name . " extends Seeder \n\t{\n\t\tpublic function run()\n\t\t{\n\t\t}\n\t}"; $output_file = $output_file_path . $name . '.php'; //dd($output_file . PHP_EOL . $template); file_put_contents($output_file, $template); } }
public function listPages($page_path = '') { $paths = \Config::get('view.paths'); $path = $paths[0] . '/' . $this->viewPath(); if (!empty($page_path)) { $path .= '/' . $page_path; } $files = \File::allFiles($path); $pages = []; $ignore_paths = $this->config('ignore_paths', []); foreach ($files as $file) { $page = $file->getRelativePathname(); $exts = \View::getExtensions(); foreach ($exts as $ext => $name) { if (strpos($page, $ext) !== false) { $page = str_replace('.' . $ext, '', $page); } } if (!in_array($page, $ignore_paths)) { $pages[] = $page; } } return $pages; }
<?php /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | */ //foreach ( File::allFiles(__DIR__ . '/Routes') as $partial ) { // require_once $partial->getPathname(); //} /* |-------------------------------------------------------------------------- | API Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an api application. | */ foreach (File::allFiles(__DIR__ . '/Routes') as $partial) { require_once $partial->getPathname(); }
<?php /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ foreach (File::allFiles(__DIR__ . "/Routes") as $routesPartial) { require_once $routesPartial->getPathname(); }
@extends('page') @section('content') <div class="title-bar"> <div class="title"> <h3>Do pobrania</h3> </div> </div> <?php $directory = "resources/download"; $files = File::allFiles($directory); var_dump($files); foreach ($files as $file) { //echo (string)$file, "\n"; } ?> @stop
/** * Run the database seeds. * * @return void */ public function run() { Eloquent::unguard(); $algorithmsXmls = File::allFiles(public_path() . '/algorithms'); foreach ($algorithmsXmls as $algorithmsXml) { $dom = new DomDocument(); $dom->load($algorithmsXml); $root = $dom->documentElement; $modality = Modality::whereName($root->getAttribute('modality'))->first(); if (empty($modality)) { throw new Exception("Could not find modality! ({$algorithmsXml})"); } $protocolName = $root->getAttribute('protocol'); $protocol = Protocol::whereName($protocolName)->whereModalityId($modality->Id)->first(); if (empty($protocol)) { \Log::warning("Could not find protocol! ({$algorithmsXml})"); continue; } $arguments = []; $parameters = []; $description = ""; foreach ($root->childNodes as $node) { if (get_class($node) == 'DOMText') { continue; } switch ($node->nodeName) { case 'arguments': foreach ($node->childNodes as $argument) { if (get_class($argument) == 'DOMText') { continue; } $arguments[] = ['Name' => $argument->getAttribute('name')]; } break; case 'parameters': foreach ($node->childNodes as $parameter) { if (get_class($parameter) == 'DOMText') { continue; } $parameters[] = ['Name' => $parameter->getAttribute('name'), 'Type' => $parameter->getAttribute('type'), 'Value' => $parameter->hasAttribute('value') ? $parameter->getAttribute('value') : null]; } break; case 'description': $description = $node->textContent; break; default: throw new Exception("Unrecognized entry in algorithm XML - {$node->nodeName}! ({$algorithmsXml})"); } } $algorithm = new Algorithm(); $algorithm->content = $description; $resultName = $root->getAttribute('result'); $resultType = $root->getAttribute('type'); $result = Parameter::whereName($resultName)->first(); if (empty($result)) { $result = Parameter::create(['Name' => $resultName, 'Type' => $resultType]); } $algorithm->result()->associate($result); $algorithm->protocol()->associate($protocol); $algorithm->save(); foreach ($arguments as $argument) { $algorithm->arguments()->attach(Argument::create($argument)); } foreach ($parameters as $parameter) { $algorithm->attribute($parameter); } } }
<?php foreach (File::allFiles(__DIR__ . '/Acme/Filters') as $partial_route) { require $partial_route->getPathname(); }
/** * Get templates for a given type. These templates are stored in a template directory. The name for this template dir * is defined in the config file. * * @param $templateType * @return array with template names. */ public function getTemplates($templateType) { $templates = array(); // always add a please select option $templates[""] = \Lang::get("pageblok::pageblok.please.select"); /** * Get templates for template type. If template type is "blocks", we expect the user to have a directory "blocks" in his template folder. * The "blocks" folder contains templates for Blocks. */ $templatesFolder = \Pageblok::getTemplatesPath() . "/" . $templateType; // TODO: check if directory exists for given template type, otherwise select template from main template folder $themeFolder = \Config::get('pageblok::settings.theme'); $templateFolder = \Config::get('pageblok::settings.templates'); // get all templates from templates folder $templateList = \File::allFiles($templatesFolder); // first template option is NO TEMPLATE $templates[""] = \Lang::get('pageblok::app.no.template'); foreach ($templateList as $template) { $fileNameWithoutExtension = substr($template->getFileName(), 0, strpos($template->getFileName(), '.blade.php')); // construct fully qualified laravel view name $qualifiedTemplateName = "pageblok::" . $themeFolder . '.' . $templateFolder . '.' . $templateType . '.' . $fileNameWithoutExtension; // place it in a array $templates[$qualifiedTemplateName] = $fileNameWithoutExtension; } return $templates; }
/** * Minify all css files * * @param string $destination * @return void */ public function minify($destination = null) { print_r("Minifying...\n"); $buffer = ''; $destination = $destination ?: $this->_app['config']->get('lessy::destination'); $root = $this->_app['path'] . '/'; if (empty($destination)) { $destination = '../public/assets/css'; } $destination = $root . $destination; foreach (\File::allFiles($destination) as $File) { $buffer .= \File::get($File->getPathname()); \File::delete($File->getPathname()); } $buffer = preg_replace('!/\\*[^*]*\\*+([^/][^*]*\\*+)*/!', '', $buffer); $buffer = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $buffer); $buffer = preg_replace(array('(( )+{)', '({( )+)'), '{', $buffer); $buffer = preg_replace(array('(( )+})', '(}( )+)', '(;( )*})'), '}', $buffer); $buffer = preg_replace(array('(;( )+)', '(( )+;)'), ';', $buffer); \File::put($destination . '/styles.min.css', $buffer); }
private function checkMigrationName($class_name) { $file_name = snake_case($class_name); $all_migrations = \File::allFiles(base_path() . '/database/migrations'); foreach ($all_migrations as $file) { if (strpos($file->getBasename(), $file_name) !== false) { return false; } } return true; }
$pageVariables = $pagesRepository->findTemplateVariables($pageTemplates); $aboutPageData = ['variables' => $pageVariables, 'templates' => $pageTemplates, 'page' => $page, 'data' => []]; foreach ($pageVariables as $variable) { $aboutPageData['data'][$variable] = isset(${$variable}) ? ${$variable} : 'undefined'; } // print out the pages.about template... it will be a <script> tag // we will include it into the Templates JST below, it is treated // differently because of the php dynamic content it provides print view('devise::admin.pages.about', $aboutPageData)->render(); ?> <?php // handlebar templates are injected into our javascript // via the following code $templateDir = public_path() . '/packages/devisephp/cms/js/app/editor/templates'; $templates = $files = File::allFiles($templateDir); ?> <?php foreach ($templates as $template) { ?> <script type="text/x-handlebars-template" id="<?php echo relativeFileNameFromTemplate($template); ?> "> <?php echo file_get_contents($template); ?> </script> <?php }
<?php /* Input: $picturesPath String */ $pictures = File::allFiles($picturesPath); ?> <div class="slider-container slider-navigation_"> <ul class="slider-nav"> <?php $selectorCounter = 0; ?> @foreach($pictures as $key=>$picture) <?php $test = preg_match('/^\\d/', $picture->getFilename()); ?> @if( !$test ) <li class="slider-nav__item"> <a id="carousel-selector-{{$selectorCounter}}" class="@if($selectorCounter==0) selected @endif"> <img src="{{asset($picturesPath.'80x60_'.$picture->getFilename())}}" class="img-responsive"></a> </li> <?php $selectorCounter++; ?> @endif @endforeach </ul> </div> <style>