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


PHP Application::basePath方法代码示例

本文整理汇总了PHP中Illuminate\Foundation\Application::basePath方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::basePath方法的具体用法?PHP Application::basePath怎么用?PHP Application::basePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Foundation\Application的用法示例。


在下文中一共展示了Application::basePath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: JSUrl

 public function JSUrl()
 {
     if (!count($this->_js)) {
         return '';
     }
     $url = $this->app->make('url')->to($this->app->config->get('combiner.javascript.route')) . '/';
     $basedir = $this->app->basePath() . DIRECTORY_SEPARATOR . $this->app->config->get('combiner.javascript.path');
     $count = 0;
     foreach ($this->_js as $file) {
         if (file_exists($basedir . DIRECTORY_SEPARATOR . $file)) {
             $url .= ($count ? ',' : '') . str_replace('/', '~', $file);
             $count++;
         }
     }
     return sprintf('%s/%d/', $url, $count);
 }
开发者ID:hp197,项目名称:combiner,代码行数:16,代码来源:Combiner.php

示例2: basePath

 /**
  * Get the base path of the Laravel installation.
  *
  * @return string 
  * @static 
  */
 public static function basePath()
 {
     return \Illuminate\Foundation\Application::basePath();
 }
开发者ID:satriashp,项目名称:tour,代码行数:10,代码来源:_ide_helper.php

示例3: exportTranslations

    public function exportTranslations($group, $recursing = 0)
    {
        // TODO: clean up this recursion crap
        // this can come from the command line
        $ltm_translations = $this->getTranslationsTableName();
        if (!$recursing) {
            $this->clearErrors();
            $group = self::fixGroup($group);
        }
        if ($group && $group !== '*') {
            $this->getConnection()->affectingStatement("DELETE FROM {$ltm_translations} WHERE is_deleted = 1");
        } elseif (!$recursing) {
            $this->getConnection()->affectingStatement("DELETE FROM {$ltm_translations} WHERE is_deleted = 1 AND `group` = ?", [$group]);
        }
        $inDatabasePublishing = $this->inDatabasePublishing();
        if ($inDatabasePublishing < 3 && $inDatabasePublishing && ($inDatabasePublishing < 2 || !$recursing)) {
            if ($group && $group !== '*') {
                $this->getConnection()->affectingStatement(<<<SQL
UPDATE {$ltm_translations} SET saved_value = value, status = ? WHERE (saved_value <> value || status <> ?) AND `group` = ?
SQL
, [Translation::STATUS_SAVED_CACHED, Translation::STATUS_SAVED, $group]);
                $translations = $this->translation->query()->where('status', '<>', Translation::STATUS_SAVED)->where('group', '=', $group)->get(['group', 'key', 'locale', 'saved_value']);
            } else {
                $this->getConnection()->affectingStatement(<<<SQL
UPDATE {$ltm_translations} SET saved_value = value, status = ? WHERE (saved_value <> value || status <> ?)
SQL
, [Translation::STATUS_SAVED_CACHED, Translation::STATUS_SAVED]);
                $translations = $this->translation->query()->where('status', '<>', Translation::STATUS_SAVED)->get(['group', 'key', 'locale', 'saved_value']);
            }
            /* @var $translations Collection */
            $this->clearCache($group);
            $this->clearUsageCache(false, $group);
            $translations->each(function ($tr) {
                $this->cacheTranslation($tr->group . '.' . $tr->key, $tr->saved_value, $tr->locale);
            });
        }
        if (!$inDatabasePublishing || $inDatabasePublishing === 2 || $inDatabasePublishing === 3) {
            if (!in_array($group, $this->config(self::EXCLUDE_GROUPS_KEY))) {
                if ($group == '*') {
                    $this->exportAllTranslations(1);
                }
                if ($inDatabasePublishing !== 3) {
                    $this->clearCache($group);
                    $this->clearUsageCache(false, $group);
                }
                $tree = $this->makeTree($this->translation->where('group', $group)->whereNotNull('value')->orderby('key')->get());
                $configRewriter = new TranslationFileRewriter();
                $exportOptions = array_key_exists('export_format', $this->config()) ? TranslationFileRewriter::optionFlags($this->config('export_format')) : null;
                // Laravel 5.1
                $base_path = $this->app->basePath();
                $pathTemplateResolver = new PathTemplateResolver($this->files, $base_path, $this->config('language_dirs'), '5');
                $zipRoot = $base_path . $this->config('zip_root', mb_substr($this->app->langPath(), 0, -4));
                // Laravel 4.2
                //$base_path = base_path();
                //$pathTemplateResolver = new PathTemplateResolver($this->files, $base_path, $this->config('language_dirs'), '4');
                //$zipRoot = $base_path . $this->config('zip_root', mb_substr($this->app->make('path').'/lang', 0, -4));
                if (mb_substr($zipRoot, -1) === '/') {
                    $zipRoot = substr($zipRoot, 0, -1);
                }
                foreach ($tree as $locale => $groups) {
                    if (isset($groups[$group])) {
                        $translations = $groups[$group];
                        // use the new path mapping
                        $computedPath = $base_path . $pathTemplateResolver->groupFilePath($group, $locale);
                        $path = $computedPath;
                        if ($path) {
                            $configRewriter->parseSource($this->files->exists($path) ? $this->files->get($path) : '');
                            $output = $configRewriter->formatForExport($translations, $exportOptions);
                            if ($this->zipExporting) {
                                $pathPrefix = mb_substr($path, 0, mb_strlen($zipRoot));
                                $filePathName = $pathPrefix === $zipRoot ? mb_substr($path, mb_strlen($zipRoot)) : $path;
                                //$this->makeDirPath($filePathName);
                                $this->zipExporting->addFromString($filePathName, $output);
                            } else {
                                try {
                                    $this->makeDirPath($path);
                                    if (($result = $this->files->put($path, $output)) === false) {
                                        $this->errors[] = "Failed to write to {$path}";
                                    }
                                } catch (Exception $e) {
                                    $this->errors[] = $e->getMessage();
                                }
                            }
                        }
                    }
                }
                if (!$inDatabasePublishing) {
                    $this->translation->where('group', $group)->update(array('status' => Translation::STATUS_SAVED, 'saved_value' => new Expression('value')));
                }
            }
        }
    }
开发者ID:mean-cj,项目名称:laravel-translation-manager,代码行数:92,代码来源:Manager.php


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