• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP temp_path函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: checkCacheFolder

 /**
  * Create cache folder if not exists
  *
  * @param $ident
  */
 private function checkCacheFolder($ident)
 {
     $cacheFolder = temp_path($this->cachePathPrefix . '/');
     if (!file_exists($cacheFolder)) {
         mkdir($cacheFolder);
     }
     if (!$ident) {
         $ident = $this->undefinedFolderName;
     }
     $identFolder = temp_path($this->cachePathPrefix . '/' . $ident . '/');
     if (!file_exists($identFolder)) {
         mkdir($identFolder);
     }
 }
开发者ID:vojtasvoboda,项目名称:oc-cnbrates-plugin,代码行数:19,代码来源:CnbDataProvider.php


示例17: processExportData

 /**
  * Converts a data collection to a CSV file.
  */
 protected function processExportData($columns, $results, $options)
 {
     /*
      * Validate
      */
     if (!$results) {
         throw new ApplicationException('There was no data supplied to export');
     }
     /*
      * Parse options
      */
     $defaultOptions = ['useOutput' => false, 'fileName' => 'export.csv', 'delimiter' => null, 'enclosure' => null, 'escape' => null];
     $options = array_merge($defaultOptions, $options);
     $columns = $this->exportExtendColumns($columns);
     /*
      * Prepare CSV
      */
     $csv = CsvWriter::createFromFileObject(new SplTempFileObject());
     if ($options['delimiter'] !== null) {
         $csv->setDelimiter($options['delimiter']);
     }
     if ($options['enclosure'] !== null) {
         $csv->setEnclosure($options['enclosure']);
     }
     if ($options['escape'] !== null) {
         $csv->setEscape($options['escape']);
     }
     /*
      * Add headers
      */
     $headers = $this->getColumnHeaders($columns);
     $csv->insertOne($headers);
     /*
      * Add records
      */
     foreach ($results as $result) {
         $data = $this->matchDataToColumns($result, $columns);
         $csv->insertOne($data);
     }
     /*
      * Output
      */
     if ($options['useOutput']) {
         $csv->output($options['fileName']);
     }
     /*
      * Save for download
      */
     $csvName = uniqid('oc');
     $csvPath = temp_path() . '/' . $csvName;
     $output = $csv->__toString();
     File::put($csvPath, $output);
     return $csvName;
 }
开发者ID:GeGeek,项目名称:october,代码行数:57,代码来源:ExportModel.php


示例18: getStoragePath

 /**
  * Returns the absolute path for a image copy.
  *
  * @param $size
  *
  * @return string
  */
 protected function getStoragePath($size)
 {
     $path = temp_path('public/' . $this->getPartitionDirectory());
     if (!FileHelper::isDirectory($path)) {
         FileHelper::makeDirectory($path, 0777, true, true);
     }
     $storagePath = $path . $this->getStorageFilename($size);
     $this->sourceSet->push($size, $storagePath);
     return $storagePath;
 }
开发者ID:OFFLINE-GmbH,项目名称:oc-responsive-images-plugin,代码行数:17,代码来源:ResponsiveImage.php


示例19: cleanup

 /**
  * Cleans up the temporary files/folders from temporary directory
  */
 public function cleanup()
 {
     File::deleteDirectory($this->full_path);
     File::delete(temp_path() . '/' . $this->filename);
 }
开发者ID:ratno,项目名称:Doptor,代码行数:8,代码来源:ThemeInstaller.php


示例20: clearTemp

 /**
  * Clears the temp dir
  *
  * @param string $which
  * @return Tts
  */
 public function clearTemp($which = '*')
 {
     $uxmsTtsTempPath = temp_path(Configs::get('temp_name'));
     try {
         if ($which == '*') {
             array_map('unlink', glob($uxmsTtsTempPath . "/{$which}"));
         } else {
             array_map('unlink', glob($uxmsTtsTempPath . "/{$which}_*"));
         }
     } catch (\Exception $e) {
     }
     return $this;
 }
开发者ID:uxmsdevs,项目名称:tts,代码行数:19,代码来源:Tts.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP tempdir函数代码示例发布时间:2022-05-23
下一篇:
PHP temizle函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap