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

PHP get_temp_dir函数代码示例

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

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



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

示例1: __construct

 public function __construct(Replace $replace, DatabaseManager $dbm)
 {
     $this->errors = new \WP_Error();
     $this->backup_dir = get_temp_dir();
     $this->replace = $replace;
     $this->dbm = $dbm;
 }
开发者ID:s-hinse,项目名称:search-and-replace,代码行数:7,代码来源:DatabaseExporter.php


示例2: save_data_file

 /**
  * Save some CSV data to a file, and create a quasi-$_FILES entry for it.
  * @param string $data
  * @return string|array
  */
 private function save_data_file($data)
 {
     $test_filename = get_temp_dir() . '/test_' . uniqid() . '.csv';
     file_put_contents($test_filename, $data);
     $uploaded = array('type' => 'text/csv', 'file' => $test_filename);
     return $uploaded;
 }
开发者ID:gitter-badger,项目名称:tabulate-1,代码行数:12,代码来源:ImportTest.php


示例3: getThumbnail

 public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview)
 {
     $this->initCmd();
     if (is_null($this->cmd)) {
         return false;
     }
     $absPath = $fileview->toTmpFile($path);
     $tmpDir = get_temp_dir();
     $defaultParameters = ' --headless --nologo --nofirststartwizard --invisible --norestore -convert-to pdf -outdir ';
     $clParameters = \OCP\Config::getSystemValue('preview_office_cl_parameters', $defaultParameters);
     $exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath);
     $export = 'export HOME=/' . $tmpDir;
     shell_exec($export . "\n" . $exec);
     //create imagick object from pdf
     try {
         $pdf = new \imagick($absPath . '.pdf' . '[0]');
         $pdf->setImageFormat('jpg');
     } catch (\Exception $e) {
         unlink($absPath);
         unlink($absPath . '.pdf');
         \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
         return false;
     }
     $image = new \OC_Image();
     $image->loadFromData($pdf);
     unlink($absPath);
     unlink($absPath . '.pdf');
     return $image->valid() ? $image : false;
 }
开发者ID:olucao,项目名称:owncloud-core,代码行数:29,代码来源:office-cl.php


示例4: jb_doPostFacebook

function jb_doPostFacebook($status_msg)
{
    $username = get_option('facebook-account-username');
    $password = get_option('facebook-account-password');
    $firstname = get_option('facebook-account-firstname');
    $cookiejar = get_temp_dir() . $firstname . "-" . sha1(mt_rand()) . "-cookiejar.txt";
    $fp = fopen($cookiejar, "w+") or die("<BR><B>Unable to open cookie file {$cookiejar} for write!<BR>");
    fclose($fp);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'https://login.facebook.com/login.php?m&amp;next=http%3A%2F%2Fm.facebook.com%2Fhome.php');
    curl_setopt($ch, CURLOPT_POSTFIELDS, 'email=' . urlencode($username) . '&pass=' . urlencode($password) . '&login=Login');
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiejar);
    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3");
    curl_exec($ch);
    curl_setopt($ch, CURLOPT_POST, 0);
    curl_setopt($ch, CURLOPT_URL, 'http://m.facebook.com/home.php');
    $page = curl_exec($ch);
    curl_setopt($ch, CURLOPT_POST, 1);
    preg_match('/name="post_form_id" value="(.*)" \\/>' . ucfirst($firstname) . '/', $page, $form_id);
    curl_setopt($ch, CURLOPT_POSTFIELDS, 'post_form_id=' . $form_id[1] . '&status=' . urlencode($status_msg) . '&update=Update');
    curl_setopt($ch, CURLOPT_URL, 'http://m.facebook.com/home.php');
    curl_exec($ch);
    unlink($cookiejar);
    // Delete cookiefile
}
开发者ID:jonasbjork,项目名称:wp-cme,代码行数:31,代码来源:wp_cMe.php


示例5: getThumbnail

 /**
  * {@inheritDoc}
  */
 public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview)
 {
     $this->initCmd();
     if (is_null($this->cmd)) {
         return false;
     }
     $absPath = $fileview->toTmpFile($path);
     $tmpDir = get_temp_dir();
     $defaultParameters = ' -env:UserInstallation=file://' . escapeshellarg($tmpDir . '/owncloud-' . \OC_Util::getInstanceId() . '/') . ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to pdf --outdir ';
     $clParameters = \OCP\Config::getSystemValue('preview_office_cl_parameters', $defaultParameters);
     $exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath);
     shell_exec($exec);
     //create imagick object from pdf
     $pdfPreview = null;
     try {
         list($dirname, , , $filename) = array_values(pathinfo($absPath));
         $pdfPreview = $dirname . '/' . $filename . '.pdf';
         $pdf = new \imagick($pdfPreview . '[0]');
         $pdf->setImageFormat('jpg');
     } catch (\Exception $e) {
         unlink($absPath);
         unlink($pdfPreview);
         \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
         return false;
     }
     $image = new \OC_Image();
     $image->loadFromData($pdf);
     unlink($absPath);
     unlink($pdfPreview);
     return $image->valid() ? $image : false;
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:34,代码来源:office.php


示例6: image_assets

 function image_assets()
 {
     // TODO: check if ziparchive is installed cms/cmsdev
     $zip = new ZipArchive();
     $ids = explode(',', $_GET['ids']);
     $name = $_GET['name'] . '.zip';
     $path = get_temp_dir() . $name;
     if ($zip->open($path, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE) !== TRUE) {
         die(json_encode(array('error' => 'Could not retrieve files.')));
     }
     foreach ($ids as $id) {
         $image = get_attached_file($id);
         if (file_exists($image)) {
             $zip->addFile($image, basename($image));
         } else {
             // die("File $filepath doesnt exit");
         }
     }
     $zip->close();
     header('Content-Type: application/zip');
     header('Content-disposition: attachment; filename=' . $name);
     header('Content-Length: ' . filesize($path));
     //TODO: alternate method to make zip file work?
     ob_clean();
     flush();
     readfile($path);
     wp_die();
 }
开发者ID:uweb,项目名称:story-central,代码行数:28,代码来源:gallery.php


示例7: setUp

 public function setUp()
 {
     $this->baseDir = get_temp_dir() . '/oc_tmp_test';
     if (!is_dir($this->baseDir)) {
         mkdir($this->baseDir);
     }
 }
开发者ID:Romua1d,项目名称:core,代码行数:7,代码来源:tempmanager.php


示例8: export

 public function export(FW_Backup_Interface_Feedback $feedback)
 {
     $db = new FW_Backup_Export_Database();
     $fs = new FW_Backup_Export_File_System();
     $zip_file = sprintf('%s/backup-full-%s.zip', get_temp_dir(), date('Y_m_d-H_i_s'));
     $tmp_file = array();
     try {
         touch($zip_file);
         $zip = new ZipArchive();
         if ($zip->open($zip_file) !== true) {
             throw new FW_Backup_Exception(__('Could not create .zip file', 'fw'));
         }
         $fs->append_zip($zip, ABSPATH, '', $feedback);
         $zip->addFile($tmp_file[] = $db->export_sql($feedback), 'database.txt');
         $feedback->set_task(__('Compressing files...', 'fw'));
         $zip->close();
     } catch (FW_Backup_Exception $exception) {
         unset($zip);
         unlink($zip_file);
     }
     array_map('unlink', $tmp_file);
     if (isset($exception)) {
         throw $exception;
     }
     return $zip_file;
 }
开发者ID:setcomunicacao,项目名称:setdigital,代码行数:26,代码来源:class-fw-backup-export-full.php


示例9: ninja_forms_csv_attachment

function ninja_forms_csv_attachment($sub_id)
{
    global $ninja_forms_processing;
    // make sure this form is supposed to attach a CSV
    if (1 == $ninja_forms_processing->get_form_setting('admin_attach_csv') and 'submit' == $ninja_forms_processing->get_action()) {
        // convert submission id to array
        $sub_ids = array($sub_id);
        // create CSV content
        $csv_content = ninja_forms_export_subs_to_csv($sub_ids, true);
        // create temporary file
        $path = tempnam(get_temp_dir(), 'Sub');
        $temp_file = fopen($path, 'r+');
        // write to temp file
        fwrite($temp_file, $csv_content);
        fclose($temp_file);
        // find the directory we will be using for the final file
        $path = pathinfo($path);
        $dir = $path['dirname'];
        $basename = $path['basename'];
        // create name for file
        $new_name = apply_filters('ninja_forms_submission_csv_name', 'ninja-forms-submission');
        // remove a file if it already exists
        if (file_exists($dir . '/' . $new_name . '.csv')) {
            unlink($dir . '/' . $new_name . '.csv');
        }
        // move file
        rename($dir . '/' . $basename, $dir . '/' . $new_name . '.csv');
        $file1 = $dir . '/' . $new_name . '.csv';
        // add new file to array of existing files
        $files = $ninja_forms_processing->get_form_setting('admin_attachments');
        array_push($files, $file1);
        $ninja_forms_processing->update_form_setting('admin_attachments', $files);
    }
}
开发者ID:brunolampada,项目名称:foss4g2014-wordpress,代码行数:34,代码来源:attachment-csv.php


示例10: setUp

 public function setUp()
 {
     $this->tmpDir = get_temp_dir() . '/filestoragecommon';
     if (!file_exists($this->tmpDir)) {
         mkdir($this->tmpDir);
     }
     $this->instance = new OC_Filestorage_CommonTest(array('datadir' => $this->tmpDir));
 }
开发者ID:ryanshoover,项目名称:core,代码行数:8,代码来源:commontest.php


示例11: getCacheDir

 protected static function getCacheDir()
 {
     $cache_dir = get_temp_dir() . '/owncloud-' . \OC_Util::getInstanceId() . '/';
     if (!is_dir($cache_dir)) {
         mkdir($cache_dir);
     }
     return $cache_dir;
 }
开发者ID:samj1912,项目名称:repo,代码行数:8,代码来源:fileglobal.php


示例12: _app_gcal_client_temp_dir_lookup

 /**
  * Wrapper for Google Client cache filepath + open_basedir restriction resolution.
  */
 function _app_gcal_client_temp_dir_lookup($params)
 {
     if (!function_exists('get_temp_dir')) {
         return $params;
     }
     $params['ioFileCache_directory'] = get_temp_dir() . 'Google_Client';
     return $params;
 }
开发者ID:hamednourhani,项目名称:baharloo-appoitment,代码行数:11,代码来源:default_filters.php


示例13: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->baseDir = get_temp_dir() . $this->getUniqueID('/oc_tmp_test');
     if (!is_dir($this->baseDir)) {
         mkdir($this->baseDir);
     }
 }
开发者ID:adolfo2103,项目名称:hcloudfilem,代码行数:8,代码来源:tempmanager.php


示例14: tmpDir

 /**
  * Finds a writable tmp directory.
  *
  * @since 150329 Improving tmp directory detection.
  *
  * @throws \exception On any failure.
  *
  * @return string Writable tmp directory.
  */
 public function tmpDir()
 {
     $tmp_dir = $this->nSeps(get_temp_dir());
     if (!$tmp_dir || !@is_dir($tmp_dir) || !@is_writable($tmp_dir)) {
         throw new \exception(__('Unable to find a writable tmp directory.', 'comment-mail'));
     }
     return $tmp_dir;
     // Writable tmp directory.
 }
开发者ID:websharks,项目名称:comment-mail,代码行数:18,代码来源:UtilsFs.php


示例15: getTempFile

 /**
  * Caller should handle removal of the temp file when finished.
  *
  * @param string $ext The extension to be given to the temp file.
  *
  * @return string A temp file with the given extension.
  */
 public static function getTempFile($ext = 'png')
 {
     static $base = null;
     static $tmp;
     if (is_null($base)) {
         $base = md5(time());
         $tmp = untrailingslashit(get_temp_dir());
     }
     return $tmp . DIRECTORY_SEPARATOR . wp_unique_filename($tmp, $base . '.' . $ext);
 }
开发者ID:WildCodeSchool,项目名称:projet-maison_ados_dreux,代码行数:17,代码来源:class-util.php


示例16: convertLocal

 /**
  * convert via openOffice hosted on the same server
  * @param string $input
  * @param string $targetFilter
  * @param string $targetExtension
  * @return string
  */
 protected static function convertLocal($input, $targetFilter, $targetExtension)
 {
     $infile = \OCP\Files::tmpFile();
     $outdir = \OCP\Files::tmpFolder();
     $cmd = Helper::findOpenOffice();
     $params = ' --headless --convert-to ' . $targetFilter . ' --outdir ' . escapeshellarg($outdir) . ' --writer ' . escapeshellarg($infile) . ' -env:UserInstallation=file://' . escapeshellarg(get_temp_dir() . '/owncloud-' . \OC_Util::getInstanceId() . '/');
     file_put_contents($infile, $input);
     shell_exec($cmd . $params);
     $output = file_get_contents($outdir . '/' . basename($infile) . '.' . $targetExtension);
     return $output;
 }
开发者ID:Ebimedia,项目名称:owncloud,代码行数:18,代码来源:converter.php


示例17: setTempPath

 public static function setTempPath($sFilePath = '')
 {
     $_sDir = get_temp_dir();
     $sFilePath = basename($sFilePath);
     if (empty($sFilePath)) {
         $sFilePath = time() . '.tmp';
     }
     $sFilePath = $_sDir . wp_unique_filename($_sDir, $sFilePath);
     touch($sFilePath);
     return $sFilePath;
 }
开发者ID:jaime5x5,项目名称:seamless-donations,代码行数:11,代码来源:AdminPageFramework_WPUtility_File.php


示例18: fetch

 public function fetch($storage_file, FW_Backup_Interface_Feedback $feedback)
 {
     if (!$storage_file instanceof FW_Backup_Storage_File_Local) {
         throw new FW_Backup_Exception('$backup_file should be of class FW_Backup_File_Local');
     }
     $tmp = tempnam(get_temp_dir(), 'backup');
     if (!@copy($storage_file->get_path(), $tmp)) {
         $error = error_get_last();
         throw new FW_Backup_Exception(sprintf(__('copy(%s, %s) failed with message "%s"', 'fw'), $storage_file->get_path(), $tmp, $error['message']));
     }
     return $tmp;
 }
开发者ID:chrisuehlein,项目名称:couponsite,代码行数:12,代码来源:class-fw-extension-backup-storage-local.php


示例19: create_temp_file

 /**
  * Create temp file
  *
  * @since 3.1
  * @param string $filename the attachment filename
  * @param string $file the file to write
  * @return string $filename
  */
 private function create_temp_file($filename, $file)
 {
     // prepend the temp directory
     $filename = get_temp_dir() . $filename;
     // create the file
     touch($filename);
     // open the file, write file, and close it
     $handle = @fopen($filename, 'w+');
     @fwrite($handle, $file);
     @fclose($handle);
     // make sure the temp file is removed after the email is sent
     $this->temp_filename = $filename;
     register_shutdown_function(array($this, 'unlink_temp_file'));
     return $filename;
 }
开发者ID:daanbakker1995,项目名称:vanteun,代码行数:23,代码来源:class-wc-customer-order-csv-export-method-email.php


示例20: addFolder

 /**
  * add an empty folder to the archive
  * @param string path
  * @return bool
  */
 function addFolder($path)
 {
     $tmpBase = get_temp_dir() . '/';
     if (substr($path, -1, 1) != '/') {
         $path .= '/';
     }
     if ($this->fileExists($path)) {
         return false;
     }
     mkdir($tmpBase . $path);
     $result = $this->tar->addModify(array($tmpBase . $path), '', $tmpBase);
     rmdir($tmpBase . $path);
     $this->fileList = false;
     return $result;
 }
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:20,代码来源:tar.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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