當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。