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


PHP temp_path函数代码示例

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


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

示例1: init

 protected function init()
 {
     $settings = Settings::instance();
     if (!strlen($settings->profile_id)) {
         throw new ApplicationException(trans('rainlab.googleanalytics::lang.strings.notconfigured'));
     }
     if (!$settings->gapi_key) {
         throw new ApplicationException(trans('rainlab.googleanalytics::lang.strings.keynotuploaded'));
     }
     $client = new Google_Client();
     /*
      * Set caching
      */
     $cache = new Google_Cache_File(temp_path() . '/Google_Client');
     $client->setCache($cache);
     /*
      * Set assertion credentials
      */
     $auth = json_decode($settings->gapi_key->getContents(), true);
     $client->setAuthConfig($auth);
     $client->addScope(Google_Service_Analytics::ANALYTICS_READONLY);
     if ($client->isAccessTokenExpired()) {
         $client->refreshTokenWithAssertion();
     }
     $this->client = $client;
     $this->service = new Google_Service_Analytics($client);
     $this->viewId = 'ga:' . $settings->profile_id;
 }
开发者ID:andytan2624,项目名称:andytan.net,代码行数:28,代码来源:Analytics.php

示例2: speak

 public function speak($lang = 'en', $text = 'text not provided')
 {
     // Create temp path
     $uxmsTtsTempPath = temp_path(Configs::get('temp_name'));
     if (!File::isDirectory($uxmsTtsTempPath)) {
         if (!File::makeDirectory($uxmsTtsTempPath)) {
             throw new ApplicationException('Unable to create temp directory: ' . $uxmsTtsTempPath);
         }
     }
     // Create storage path
     $uxmsTtsStoragePath = storage_path() . '/app/' . Configs::get('final_audio_folder_name');
     if (!File::isDirectory($uxmsTtsStoragePath)) {
         if (!File::makeDirectory($uxmsTtsStoragePath)) {
             throw new ApplicationException('Unable to create storage directory: ' . $uxmsTtsStoragePath);
         }
     }
     // Check if saved audios will be using and if it exists in stor dir
     if (Configs::get('use_saved_files')) {
         if (File::exists($uxmsTtsStoragePath . '/' . md5($text) . '.mp3')) {
             return $this->tts->getAudioElementOrUri(md5($text));
         }
     }
     // Lets create the speech
     $this->tts->text($lang, $text)->saveFile(false);
     // Do not forget to activate puging from settings..
     if (Configs::get('purge_temp')) {
         $this->tts->clearTemp();
     }
     return $this->tts->getAudioElementOrUri();
 }
开发者ID:uxmsdevs,项目名称:tts,代码行数:30,代码来源:UxmsTTS.php

示例3: fromUrl

 /**
  * Download remote file and save to temp.
  *
  * @param  string
  * @return  File
  * @throws  SystemException  If file could not be downloaded
  */
 public function fromUrl($url)
 {
     $this->source = $url;
     $fileName = basename(parse_url($url, PHP_URL_PATH));
     $localFile = temp_path('images') . '/' . $fileName;
     $response = Http::get($url, function ($http) use($localFile) {
         $http->toFile($localFile);
     });
     if ($response->code == 200) {
         $this->data = $localFile;
         $this->tempFile = $localFile;
     }
     return $this;
 }
开发者ID:anqqa,项目名称:oc-gallery-plugin,代码行数:21,代码来源:File.php

示例4: init

 /**
  * Initialize this singleton.
  */
 protected function init()
 {
     $this->pluginManager = PluginManager::instance();
     $this->versionManager = VersionManager::instance();
     $this->tempDirectory = temp_path();
     $this->baseDirectory = base_path();
     $this->disableCoreUpdates = Config::get('cms.disableCoreUpdates', false);
     $this->bindContainerObjects();
     /*
      * Ensure temp directory exists
      */
     if (!File::isDirectory($this->tempDirectory)) {
         File::makeDirectory($this->tempDirectory, 0777, true);
     }
 }
开发者ID:janusnic,项目名称:23copperleaf,代码行数:18,代码来源:UpdateManager.php

示例5: getSystemWarnings

 protected function getSystemWarnings()
 {
     $warnings = [];
     $writablePaths = [temp_path(), themes_path(), storage_path(), storage_path('app'), storage_path('logs'), storage_path('framework'), storage_path('cms'), storage_path('cms/cache'), storage_path('cms/twig'), storage_path('cms/combiner')];
     $requiredExtensions = ['GD' => extension_loaded('gd'), 'fileinfo' => extension_loaded('fileinfo'), 'Zip' => class_exists('ZipArchive'), 'cURL' => function_exists('curl_init') && defined('CURLOPT_FOLLOWLOCATION'), 'OpenSSL' => function_exists('openssl_random_pseudo_bytes')];
     foreach ($writablePaths as $path) {
         if (!is_writable($path)) {
             $warnings[] = Lang::get('backend::lang.warnings.permissions', ['name' => '<strong>' . $path . '</strong>']);
         }
     }
     foreach ($requiredExtensions as $extension => $installed) {
         if (!$installed) {
             $warnings[] = Lang::get('backend::lang.warnings.extension', ['name' => '<strong>' . $extension . '</strong>']);
         }
     }
     return $warnings;
 }
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:17,代码来源:Status.php

示例6: store

 /**
  * Create the report
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $file = Input::file('file');
     $filename = $file->getClientOriginalName();
     $file->move(temp_path(), $filename);
     $filename = str_replace('.ZIP', '.zip', $filename);
     $unzipSuccess = Unzip(temp_path() . "/{$filename}", temp_path());
     $contents = file_get_contents(temp_path() . "/report_generator.json");
     $report_info = json_decode($contents, true);
     $input = array('name' => $report_info['name'], 'author' => $report_info['author'], 'version' => $report_info['version'], 'website' => $report_info['website'], 'modules' => json_encode($report_info['modules']), 'show_calendars' => $report_info['show_calendars']);
     if ($report_generator = ReportGenerator::where('name', '=', $input['name'])->first()) {
         $report_generator->update($input);
     } else {
         $report_generator = ReportGenerator::create($input);
     }
     return Redirect::to("{$this->link_type}/report-generators")->with('success_message', trans('success_messages.report_generator_install'));
 }
开发者ID:doptor,项目名称:doptor,代码行数:22,代码来源:ReportGeneratorController.php

示例7: import

 public function import($theme, $data = [], $sessionKey = null)
 {
     @set_time_limit(3600);
     $this->theme = $theme;
     $this->fill($data);
     try {
         $file = $this->uploaded_file()->withDeferred($sessionKey)->first();
         if (!$file) {
             throw new ApplicationException('There is no file attached to import!');
         }
         $themePath = $this->theme->getPath();
         $tempPath = temp_path() . '/' . uniqid('oc');
         $zipName = uniqid('oc');
         $zipPath = temp_path() . '/' . $zipName;
         File::put($zipPath, $file->getContents());
         if (!@mkdir($tempPath)) {
             throw new ApplicationException('Unable to create directory ' . $tempPath);
         }
         Zip::extract($zipPath, $tempPath);
         // if (File::isFile($tempPath.'/theme.yaml')) {
         //     File::copy($tempPath.'/theme.yaml', $themePath.'/theme.yaml');
         // }
         if (File::isDirectory($tempPath . '/meta')) {
             $this->copyDirectory($tempPath . '/meta', $themePath . '/meta');
         }
         foreach ($this->folders as $folder) {
             if (!array_key_exists($folder, $this->getFoldersOptions())) {
                 continue;
             }
             $this->copyDirectory($tempPath . '/' . $folder, $themePath . '/' . $folder);
         }
         File::deleteDirectory($tempPath);
         File::delete($zipPath);
         $file->delete();
     } catch (Exception $ex) {
         if (!empty($tempPath) && File::isDirectory($tempPath)) {
             File::deleteDirectory($tempPath);
         }
         if (!empty($zipPath) && File::isFile($zipPath)) {
             File::delete($zipPath);
         }
         throw $ex;
     }
 }
开发者ID:rafasashi,项目名称:sd-laravel,代码行数:44,代码来源:ThemeImport.php

示例8: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     // get random file name and file extension
     $path = temp_path(str_random());
     $originalExtension = substr(strrchr($this->argument('url'), '.'), 1);
     // download file and store it
     $this->info('Downloading the file...' . PHP_EOL);
     $response = $this->client->get($this->argument('url'), ['verify' => storage_path('app/wildcard_ccu_edu_tw')]);
     $this->filesystem->put("{$path}.{$originalExtension}", $response->getBody()->getContents());
     // extract the file
     $this->info('Extracting the file...' . PHP_EOL);
     (new PharData("{$path}.{$originalExtension}"))->decompress();
     (new PharData("{$path}.tar"))->extractTo(temp_path());
     // delete non-used files
     $this->info('Deleting non-used the file...' . PHP_EOL);
     $this->filesystem->delete(["{$path}.{$originalExtension}", "{$path}.tar", temp_path('index.html')]);
     $this->filesystem->delete($this->filesystem->glob(temp_path('*e.html')));
     $this->info('Succeed!');
 }
开发者ID:BePsvPT,项目名称:CCU,代码行数:24,代码来源:DownloadCoursesArchive.php

示例9: getMedia

 public function getMedia($mediaId)
 {
     $query = ['media_id' => $mediaId];
     $result = $this->httpGet(static::MEDIA_GET_URL, $query, [], true, false);
     $contentType = $result->getHeader('Content-Type')[0];
     if (strpos($contentType, 'application/json') !== false) {
         $result = $this->processHttpResult($result);
         return $this->processWechatApiResult($result);
     }
     $contentDisposition = $result->getHeader('Content-disposition')[0];
     preg_match('#filename="(.*)"#', $contentDisposition, $matches);
     $filename = $matches[1];
     $tempDir = temp_path(uniqid());
     if (!is_dir($tempDir)) {
         mkdir($tempDir);
     }
     $tempPath = $tempDir . '/' . $filename;
     file_put_contents($tempPath, $result->getBody());
     return new File($tempPath);
 }
开发者ID:xjchengo,项目名称:october-corp-wechat-module,代码行数:20,代码来源:Media.php

示例10: init

 protected function init()
 {
     $settings = Settings::instance();
     if (!strlen($settings->project_name)) {
         throw new ApplicationException(Lang::get('rainlab.googleanalytics::lang.exceptions.google_api_not_configured'));
     }
     if (!$settings->gapi_key) {
         throw new ApplicationException(Lang::get('rainlab.googleanalytics::lang.exceptions.google_api_key_not_uploaded'));
     }
     $tmpDir = temp_path() . '/Google_Client';
     $this->client = new Google_Client();
     $this->client->setApplicationName($settings->project_name);
     $this->client->setClassConfig('Google_Cache_File', 'directory', $tmpDir);
     /*
      * Set assertion credentials
      */
     $this->client->setAssertionCredentials(new Google_Auth_AssertionCredentials($settings->app_email, array(Google_Service_Analytics::ANALYTICS_READONLY), $settings->gapi_key->getContents()));
     $this->client->setClientId($settings->client_id);
     $this->service = new Google_Service_Analytics($this->client);
     $this->viewId = 'ga:' . $settings->profile_id;
 }
开发者ID:joris-vdlp,项目名称:googleanalytics-plugin,代码行数:21,代码来源:Analytics.php

示例11: installLanguageFile

 public function installLanguageFile($file)
 {
     $filename = $this->uploadLanguageFile($file);
     $filename = str_replace('.ZIP', '.zip', $filename);
     $canonical = str_replace('.zip', '', $filename);
     $temp_import_path = temp_path() . '/translations_import/' . $canonical . '/';
     if (File::exists($temp_import_path)) {
         File::deleteDirectory($temp_import_path);
     }
     $unzipSuccess = Unzip("{$this->temp_path}{$filename}", $temp_import_path);
     if (!$unzipSuccess) {
         throw new Exception("The language file {$filename} couldn\\'t be extracted.");
     }
     if (!File::exists("{$temp_import_path}language.json")) {
         throw new Exception('language.json doesn\'t exist in the language file');
     }
     $language_config = json_decode(file_get_contents("{$temp_import_path}/language.json"), true);
     $language_dir = $this->language_path . $language_config['code'];
     File::copyDirectory($temp_import_path . 'lang', $language_dir);
     // Import the translations from file to database
     $this->translation_manager->importTranslations();
     return $language_config;
 }
开发者ID:doptor,项目名称:doptor,代码行数:23,代码来源:LanguageService.php

示例12: export

 public function export($theme, $data = [])
 {
     $this->theme = $theme;
     $this->fill($data);
     try {
         $themePath = $this->theme->getPath();
         $tempPath = temp_path() . '/' . uniqid('oc');
         $zipName = uniqid('oc');
         $zipPath = temp_path() . '/' . $zipName;
         if (!File::makeDirectory($tempPath)) {
             throw new ApplicationException('Unable to create directory ' . $tempPath);
         }
         if (!File::makeDirectory($metaPath = $tempPath . '/meta')) {
             throw new ApplicationException('Unable to create directory ' . $metaPath);
         }
         File::copy($themePath . '/theme.yaml', $tempPath . '/theme.yaml');
         File::copyDirectory($themePath . '/meta', $metaPath);
         foreach ($this->folders as $folder) {
             if (!array_key_exists($folder, $this->getFoldersOptions())) {
                 continue;
             }
             File::copyDirectory($themePath . '/' . $folder, $tempPath . '/' . $folder);
         }
         Zip::make($zipPath, $tempPath);
         File::deleteDirectory($tempPath);
     } catch (Exception $ex) {
         if (strlen($tempPath) && File::isDirectory($tempPath)) {
             File::deleteDirectory($tempPath);
         }
         if (strlen($zipPath) && File::isFile($zipPath)) {
             File::delete($zipPath);
         }
         throw $ex;
     }
     return $zipName;
 }
开发者ID:betes-curieuses-design,项目名称:ElieJosiePhotographie,代码行数:36,代码来源:ThemeExport.php

示例13: generateZip

 /**
  * Generate a zip file of the module
  * @param $module_alias
  * @return string
  */
 private function generateZip($module_alias)
 {
     $zip_file = temp_path() . "/{$module_alias}.zip";
     $this->Zip(temp_path() . "/{$module_alias}/", $zip_file, false);
     File::deleteDirectory(temp_path() . "/{$module_alias}/");
     return $zip_file;
 }
开发者ID:ratno,项目名称:Doptor,代码行数:12,代码来源:ModuleBuilder.php

示例14: getTempPath

 /**
  * Define the internal working path, override this method to define.
  */
 public function getTempPath()
 {
     $path = temp_path() . '/uploads';
     if (!FileHelper::isDirectory($path)) {
         FileHelper::makeDirectory($path, 0777, true, true);
     }
     return $path;
 }
开发者ID:mechiko,项目名称:staff-october,代码行数:11,代码来源:File.php

示例15: getReportGenerator

 /**
  * Create the report generator for download
  * @param  $input
  * @return
  */
 private function getReportGenerator($input)
 {
     if (isset($input['id'])) {
         unset($input['id']);
     }
     if (isset($input['created_by'])) {
         unset($input['created_by']);
     }
     if (isset($input['updated_by'])) {
         unset($input['updated_by']);
     }
     if (isset($input['created_at'])) {
         unset($input['created_at']);
     }
     if (isset($input['updated_at'])) {
         unset($input['updated_at']);
     }
     $report_alias = Str::slug($input['name'], '_');
     $report_file = temp_path() . "/report_generator.json";
     file_put_contents($report_file, json_encode($input));
     $zip_file = temp_path() . "/report_{$report_alias}.zip";
     Zip(temp_path() . "/report_generator.json", $zip_file, false);
     return $zip_file;
 }
开发者ID:doptor,项目名称:doptor,代码行数:29,代码来源:ReportBuilderController.php


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