当前位置: 首页>>代码示例>>PHP>>正文


PHP base_path函数代码示例

本文整理汇总了PHP中base_path函数的典型用法代码示例。如果您正苦于以下问题:PHP base_path函数的具体用法?PHP base_path怎么用?PHP base_path使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了base_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的base_path函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。