本文整理汇总了PHP中base_path函数的典型用法代码示例。如果您正苦于以下问题:PHP base_path函数的具体用法?PHP base_path怎么用?PHP base_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了base_path函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: checkFiles
/**
* Проверка файлов на различия, проверяется по размеру файла и наличие файла в ФС
* @retun array
*/
public function checkFiles()
{
$cachedFiles = Cache::remember(static::CACHE_KEY, Carbon::now()->addHours(6), function () {
$response = $this->request('https://api.github.com/repos/:rep/git/trees/:branch?recursive=true');
$response = json_decode($response, true);
$files = ['new_files' => [], 'diff_files' => [], 'third_party_plugins' => []];
if (isset($response['tree'])) {
foreach ($response['tree'] as $row) {
$filePath = base_path($row['path']);
if (!file_exists($filePath)) {
$files['new_files'][] = $this->getFileUrlByPath($row['path']);
continue;
}
$fileSize = filesize($filePath);
if (isset($row['size']) and $fileSize != $row['size']) {
$diff = $fileSize - $this->countFileLines($filePath) - $row['size'];
if ($diff > 1 or $diff < -1) {
$files['diff_files'][] = ['diff' => Text::bytes($diff), 'path' => $row['path'], 'url' => $this->buildRemoteUrl('https://raw.githubusercontent.com/:rep/:branch/' . $row['path'])];
}
}
}
return $files;
}
});
return $cachedFiles;
}
开发者ID:KodiComponents,项目名称:module-core,代码行数:30,代码来源:Updater.php
示例2: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
// Set directories
$inputPath = base_path('resources/views');
$outputPath = storage_path('gettext');
// Create $outputPath or empty it if already exists
if (File::isDirectory($outputPath)) {
File::cleanDirectory($outputPath);
} else {
File::makeDirectory($outputPath);
}
// Configure BladeCompiler to use our own custom storage subfolder
$compiler = new BladeCompiler(new Filesystem(), $outputPath);
$compiled = 0;
// Get all view files
$allFiles = File::allFiles($inputPath);
foreach ($allFiles as $f) {
// Skip not blade templates
$file = $f->getPathName();
if ('.blade.php' !== substr($file, -10)) {
continue;
}
// Compile the view
$compiler->compile($file);
$compiled++;
// Rename to human friendly
$human = str_replace(DIRECTORY_SEPARATOR, '-', ltrim($f->getRelativePathname(), DIRECTORY_SEPARATOR));
File::move($outputPath . DIRECTORY_SEPARATOR . sha1($file) . '.php', $outputPath . DIRECTORY_SEPARATOR . $human);
}
if ($compiled) {
$this->info("{$compiled} files compiled.");
} else {
$this->error('No .blade.php files found in ' . $inputPath);
}
}
开发者ID:nerea91,项目名称:laravel,代码行数:40,代码来源:GettextCommand.php
示例3: replaceDbName
protected static function replaceDbName($setupCommand)
{
$contents = file_get_contents(__DIR__ . '/../' . $setupCommand->getStubs() . '/.env.example');
$contents = str_replace('DB_DATABASE=homestead', 'DB_DATABASE=' . $setupCommand->getRepoName(), $contents);
file_put_contents(base_path() . '/.env', $contents);
$setupCommand->info(sprintf("Setup up .env to have settings"));
}
开发者ID:alfred-nutile-inc,项目名称:setup,代码行数:7,代码来源:SetupEnv.php
示例4: odsherredweb_preprocess_page
/**
* implements hook_preprocess_page()
*
**/
function odsherredweb_preprocess_page(&$variables)
{
$current_theme = variable_get('theme_default', 'none');
// Search form
$variables['simple_navigation_search'] = module_invoke('search', 'block_view', 'search');
// Navigation
$variables['sidebar_borger'] = _bellcom_generate_menu('menu-indhold', 'sidebar');
$variables['sidebar_erhverv'] = _bellcom_generate_menu('menu-erhverv', 'sidebar');
$variables['sidebar_politik'] = _bellcom_generate_menu('menu-politik', 'sidebar');
// Add the site structure term id to the page div
$node = node_load(arg(1));
if (is_object($node) && isset($node->field_os2web_spotbox_sitestruct)) {
$termParents = taxonomy_get_parents($node->field_os2web_spotbox_sitestruct[LANGUAGE_NONE][0]['tid']);
$termId = 'tid-' . $node->field_os2web_spotbox_sitestruct[LANGUAGE_NONE][0]['tid'];
$termIdParent = "";
if (!empty($termParents)) {
$termIdParent = 'tid-' . key($termParents);
}
$variables['attributes_array']['class'] = $termIdParent . ' ' . $termId;
}
// Paths
$variables['path_js'] = base_path() . drupal_get_path('theme', $current_theme) . '/js';
$variables['path_img'] = base_path() . drupal_get_path('theme', $current_theme) . '/images';
$variables['path_css'] = base_path() . drupal_get_path('theme', $current_theme) . '/css';
$variables['path_font'] = base_path() . drupal_get_path('theme', $current_theme) . '/font';
}
开发者ID:odsherred,项目名称:odsherred.dk,代码行数:30,代码来源:template.php
示例5: boot
/**
* Boot the service provider.
*/
public function boot()
{
/*
* Set the proper configuration separator since
* retrieving configuration values in packages
* changed from '::' to '.'
*/
$this::$packageConfigSeparator = '.';
/*
* Set the local inventory laravel version for easy checking
*/
$this::$laravelVersion = 5;
/*
* Load the inventory translations from the inventory lang folder
*/
$this->loadTranslationsFrom(__DIR__ . '/lang', 'inventory');
/*
* Assign the configuration as publishable, and tag it as 'config'
*/
$this->publishes([__DIR__ . '/config/config.php' => config_path('inventory.php')], 'config');
/*
* Assign the migrations as publishable, and tag it as 'migrations'
*/
$this->publishes([__DIR__ . '/migrations/' => base_path('database/migrations')], 'migrations');
}
开发者ID:johnny-human,项目名称:uhlelo,代码行数:28,代码来源:InventoryServiceProvider.php
示例6: handleGet
/**
* Asks the module to handle a GET (Read) request
*
* @param $view
* @param $args
* @return Response
*/
protected function handleGet($view, $args)
{
$artist = $view;
if (!isset($artist)) {
return new Response(array('message' => "The Hive Radio music artist cover API version {$this->VERSION}", 'usage' => "cover/[artist]"), 200);
} else {
if (\Cache::has("artist_cover_{$artist}")) {
return $this->buildImageResponse(\Cache::get("artist_cover_{$artist}"));
} else {
$youtube_response = file_get_contents("https://www.googleapis.com/youtube/v3/search?q={$artist}&key=" . \Config::get('icebreath.covers.youtube_api_key') . "&fields=items(id(kind,channelId),snippet(thumbnails(medium)))&part=snippet,id");
$youtube_json = json_decode($youtube_response, true);
$items = $youtube_json['items'];
$youtube_source = null;
for ($i = 0; $i < sizeof($items); $i++) {
if ((string) $items[$i]["id"]["kind"] != "youtube#channel") {
continue;
} else {
$youtube_source = $items[$i]["snippet"]["thumbnails"]["medium"]["url"];
break;
}
}
if (isset($youtube_source) && !empty($youtube_source)) {
$data = file_get_contents($youtube_source);
$expiresAt = Carbon::now()->addHours(\Config::get('icebreath.covers.cache_time'));
\Cache::put("artist_cover_{$artist}", $data, $expiresAt);
return $this->buildImageResponse($data);
}
return $this->buildImageResponse(\File::get(base_path() . '/' . \Config::get('icebreath.covers.not_found_img')));
}
}
}
开发者ID:hivemedia,项目名称:icebreath,代码行数:38,代码来源:covers.php
示例7: setUp
public function setUp()
{
parent::setUp();
include_once base_path() . '/tests/fixtures/plugins/database/tester/models/User.php';
include_once base_path() . '/tests/fixtures/plugins/database/tester/models/Author.php';
$this->runPluginRefreshCommand('Database.Tester');
}
开发者ID:nerijunior,项目名称:october,代码行数:7,代码来源:SoftDeleteModelTest.php
示例8: copyFile
/**
* @param $file
* @param $projectName
* @param $path
*/
public function copyFile($file, $projectName, $path)
{
$path = app_path();
$base = base_path();
echo $path . '/Util/' . $file . " - " . public_path();
File::copy($path . '/Util/app.php', '/home/paulo/Projetos/TesteSC/config/app.php');
}
开发者ID:serbinario,项目名称:scSerbinario,代码行数:12,代码来源:StartConfig.php
示例9: assets
function assets($name = "assets", $path_url = 0)
{
if ($path_url) {
return base_path() . config("path." . $name);
}
return asset(config("path." . $name));
}
开发者ID:rochimeiji96,项目名称:hubin,代码行数:7,代码来源:function.php
示例10: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire(Filesystem $files)
{
$langDirectory = base_path('resources' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR);
$diff = [];
foreach (ModulesLoader::getRegisteredModules() as $module) {
if (!is_dir($module->getLocalePath()) or !$module->isPublishable()) {
continue;
}
$locale = $this->input->getOption('locale');
foreach ($files->directories($module->getLocalePath()) as $localeDir) {
foreach ($files->allFiles($localeDir) as $localeFile) {
$vendorFileDir = $module->getKey() . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . $localeFile->getFilename();
$vendorFilePath = $langDirectory . $vendorFileDir;
if (file_exists($vendorFilePath)) {
$localArray = $files->getRequire($localeFile->getRealPath());
$vendorArray = $files->getRequire($vendorFilePath);
$array = array_keys_exists_recursive($localArray, $vendorArray);
$arrayDiff = '';
foreach (array_dot($array) as $key => $value) {
$arrayDiff .= "{$key}: {$value}\n";
}
if (empty($arrayDiff)) {
continue;
}
$diff[] = ['modules' . DIRECTORY_SEPARATOR . $vendorFileDir, 'vendor' . DIRECTORY_SEPARATOR . $vendorFileDir];
$diff[] = new TableSeparator();
$diff[] = [$arrayDiff, var_export(array_merge_recursive($array, $vendorArray), true)];
$diff[] = new TableSeparator();
}
}
}
}
$this->table($this->headers, $diff);
}
开发者ID:KodiComponents,项目名称:module-core,代码行数:39,代码来源:ModuleLocaleDiffCommand.php
示例11: setUp
public function setUp()
{
parent::setUp();
$this->modulePath = base_path('modules/Blog');
$this->finder = $this->app['files'];
$this->artisan('module:make', ['name' => ['Blog']]);
}
开发者ID:nwidart,项目名称:laravel-modules,代码行数:7,代码来源:GenerateMailCommandTest.php
示例12: __construct
/**
* Create a new command instance.
*
* @return void
*/
public function __construct($file = 'forever.js')
{
parent::__construct();
$this->file = $file;
$this->filePath = base_path($file);
$this->options = ['-l' => storage_path('logs/forever.log'), '-o' => storage_path('logs/forever.out.log'), '-e' => storage_path('logs/forever.err.log'), '--id' => strtolower(config('app.title')), '--append' => '', '--verbose' => ''];
}
开发者ID:multimedia-street,项目名称:forever,代码行数:12,代码来源:ForeverCommand.php
示例13: setPublishers
/**
* Set the Package Publishing
* @return void
*/
private function setPublishers()
{
// views
$this->publishes([__DIR__ . '/../Views/pages' => base_path('finch/pages')]);
// assets
$this->publishes([__DIR__ . '/../Assets' => public_path('campuslane/finch')], 'public');
}
开发者ID:campuslane,项目名称:finch,代码行数:11,代码来源:FinchServiceProvider.php
示例14: boot
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
// Paths
$path_views = __DIR__ . '/../resources/views';
$path_lang = __DIR__ . '/../resources/lang';
$path_middleware = __DIR__ . '/Middleware';
$path_assets = __DIR__ . '/../resources/assets';
// Publish Paths
$publish_path_views = base_path('resources/views/nonoesp/writing');
$publish_path_lang = base_path('resources/lang/nonoesp/writing');
$publish_path_middleware = base_path('app/Http/Middleware');
$publish_path_assets = base_path('public/nonoesp/writing');
$publish_path_config = config_path('writing.php');
// Publish Stuff
$this->publishes([$path_views => $publish_path_views], 'views');
$this->publishes([$path_lang => $publish_path_lang], 'lang');
//$this->publishes([$path_middleware => $publish_path_middleware,], 'middleware');
$this->publishes([$path_assets => $publish_path_assets], 'assets');
$this->publishes([__DIR__ . '/../config/config.php' => $publish_path_config], 'config');
$this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'writing');
// Views
if (is_dir($publish_path_views)) {
$this->loadViewsFrom($publish_path_views, 'writing');
// Load published views
} else {
$this->loadViewsFrom($path_views, 'writing');
}
// Translations
if (is_dir($publish_path_lang)) {
$this->loadTranslationsFrom($publish_path_lang, 'writing');
// Load published lang
} else {
$this->loadTranslationsFrom($path_lang, 'writing');
}
}
开发者ID:nonoesp,项目名称:laravel-writing,代码行数:40,代码来源:WritingServiceProvider.php
示例15: boot
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$this->loadViewsFrom(__DIR__ . '/views', 'maven');
$this->publishes([__DIR__ . '/migrations' => database_path('migrations')], 'migrations');
$this->loadTranslationsFrom(__DIR__ . 'translations', 'maven');
$this->publishes([__DIR__ . '/translations' => base_path('resources/lang/vendor/maven')], 'translations');
}
开发者ID:ujackson,项目名称:Maven,代码行数:12,代码来源:MavenServiceProvider.php
示例16: articleCrumbs
private function articleCrumbs($category)
{
$data = ['homeurl' => ViewHelper::webHost(), 'categoryUrl' => "/article/{$category->name}", 'category' => $category];
$file = base_path() . '/resources/views/frontend/article/_partial/crumbs.blade.php';
$view = view()->file($file, $data)->render();
return ViewHelper::markdownParse($view, ['<crumbs><h4>', '</h4></crumbs>']);
}
开发者ID:straysh,项目名称:straysh.info,代码行数:7,代码来源:ArticleController.php
示例17: __construct
/**
* Setup for Google API authorization to retrieve directory data
*/
function __construct()
{
// set config options
$clientId = Config::get('google.client_id');
$serviceAccountName = Config::get('google.service_account_name');
$delegatedAdmin = Config::get('google.admin_email');
$keyFile = base_path() . Config::get('google.key_file_location');
$appName = Config::get('google.app_name');
// array of scopes
$scopes = array('https://www.googleapis.com/auth/admin.directory.user', 'https://www.googleapis.com/auth/admin.directory.user.readonly');
// Create AssertionCredentails object for use with Google_Client
$creds = new \Google_Auth_AssertionCredentials($serviceAccountName, $scopes, file_get_contents($keyFile));
// set admin identity for API requests
$creds->sub = $delegatedAdmin;
// Create Google_Client to allow making API calls
$this->client = new \Google_Client();
$this->client->setApplicationName($appName);
$this->client->setClientId($clientId);
$this->client->setAssertionCredentials($creds);
if ($this->client->getAuth()->isAccessTokenExpired()) {
$this->client->getAuth()->refreshTokenWithAssertion($creds);
}
Cache::forever('service_token', $this->client->getAccessToken());
// Set instance of Directory object for making Directory API related calls
$this->service = new \Google_Service_Directory($this->client);
}
开发者ID:staciewilhelm,项目名称:denver-member-tracking,代码行数:29,代码来源:GoogleDirectory.php
示例18: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
// Start the progress bar
$bar = $this->helper->barSetup($this->output->createProgressBar(7));
$bar->start();
// Common variables
// Starting with vendor/package, optionally defined interactively
if ($this->option('i')) {
$vendor = $this->ask('What is the vendor name?', $this->argument('vendor'));
$name = $this->ask('What is the package name?', $this->argument('name'));
$this->info('The language file will be generated and will be put in all folders at the same time');
$nameLanguage = $this->ask('What will be the name of the language file?', $this->argument('nameLanguageFile'));
} else {
$vendor = $this->argument('vendor');
$name = $this->argument('name');
$nameLanguage = $this->argument('nameLanguageFile');
}
$namelowercase = strtolower($name);
//$path = getcwd() . '/packages/';
$path = base_path('packages/');
$this->info($path);
$fullPath = $path . $vendor . '/' . $name;
$this->info($fullPath);
$pathResourcesLangFolder = $fullPath . '/src/Resources/Lang';
$this->info($pathResourcesLangFolder);
$this->generateController($vendor, $name, $pathResourcesLangFolder, $bar, $nameLanguage);
$bar->finish();
$this->info('Controller created successfully!');
$this->output->newLine(2);
$bar = null;
}
开发者ID:filipveschool,项目名称:packagegenerator,代码行数:36,代码来源:MakeLanguageCommand.php
示例19: findTranslations
public function findTranslations($path = null)
{
$path = $path ?: base_path();
$keys = array();
$functions = array('trans', 'trans_choice', 'Lang::get', 'Lang::choice', 'Lang::trans', 'Lang::transChoice', '@lang', '@choice');
$pattern = "(" . implode('|', $functions) . ")" . "\\(" . "[\\'\"]" . "(" . "[a-zA-Z0-9_-]+" . "([.][^)]+)+" . ")" . "[\\'\"]" . "[\\),]";
// Close parentheses or new parameter
// Find all PHP + Twig files in the app folder, except for storage
$finder = new Finder();
$finder->in($path)->exclude('storage')->name('*.php')->name('*.twig')->files();
/** @var \Symfony\Component\Finder\SplFileInfo $file */
foreach ($finder as $file) {
// Search the current file for the pattern
if (preg_match_all("/{$pattern}/siU", $file->getContents(), $matches)) {
// Get all matches
foreach ($matches[2] as $key) {
$keys[] = $key;
}
}
}
// Remove duplicates
$keys = array_unique($keys);
// Add the translations to the database, if not existing.
foreach ($keys as $key) {
// Split the group and item
list($group, $item) = explode('.', $key, 2);
$this->missingKey('', $group, $item);
}
// Return the number of found translations
return count($keys);
}
开发者ID:txandy,项目名称:laravel-translation-manager,代码行数:31,代码来源:Manager.php
示例20: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
//Model::unguard();
// DB::statement('SET FOREIGN_KEY_CHECKS = 0');
// \App\Provinsi::truncate();
// DB::statement('SET FOREIGN_KEY_CHECKS = 1');
// DB::statement('SET FOREIGN_KEY_CHECKS = 0');
// \App\Kabupaten::truncate();
// DB::statement('SET FOREIGN_KEY_CHECKS = 1');
// DB::statement('SET FOREIGN_KEY_CHECKS = 0');
// \App\Kecamatan::truncate();
// DB::statement('SET FOREIGN_KEY_CHECKS = 1');
DB::statement('SET FOREIGN_KEY_CHECKS = 0');
\App\Kelurahan::truncate();
DB::statement('SET FOREIGN_KEY_CHECKS = 1');
$this->call(ProvinsiPart1Seeder::class);
$classes = (require base_path() . '/vendor/composer/autoload_classmap.php');
foreach ($classes as $class) {
//if(strpos($class, 'Seeder') !== false && strpos($class, 'Kelurahan') == true)
if (strpos($class, 'Seeder') !== false && strpos($class, 'DatabaseSeeder') != true && strpos($class, 'ProvinsiPart1Seeder') != true) {
$seederClass = substr(last(explode('/', $class)), 0, -4);
//var_dump($seederClass);
$this->call($seederClass);
}
}
//Model::reguard();
}
开发者ID:permatis,项目名称:daerahLaravel,代码行数:32,代码来源:DatabaseSeeder.php
注:本文中的base_path函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论