本文整理汇总了PHP中File::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP File::__construct方法的具体用法?PHP File::__construct怎么用?PHP File::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类File
的用法示例。
在下文中一共展示了File::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($filename, $originalFilename = null, $mimeType = null, $error = null)
{
$this->originalFilename = basename($originalFilename);
$this->mimeType = $mimeType;
$this->error = $error ?: UPLOAD_ERR_OK;
return parent::__construct($filename);
}
示例2:
/**
* @param Title|string|bool $title
* @param ForeignApiRepo $repo
* @param array $info
* @param bool $exists
*/
function __construct($title, $repo, $info, $exists = false)
{
parent::__construct($title, $repo);
$this->mInfo = $info;
$this->mExists = $exists;
$this->assertRepoDefined();
}
示例3: __construct
public function __construct($path, $sharedItem, $isLink = false)
{
parent::__construct($sharedItem->getPath());
$this->sharedItem = $sharedItem;
$this->linkPath = $path;
$this->isLink = $isLink;
}
示例4: __construct
/**
* Constructor
*
* @param string $content_id Content id */
protected function __construct($content_id)
{
$db = AbstractDb::getObject();
// Init values
$row = null;
parent::__construct($content_id);
$content_id = $db->escapeString($content_id);
$sql = "SELECT * FROM content_file_image WHERE pictures_id='{$content_id}'";
$db->execSqlUniqueRes($sql, $row, false);
if ($row == null) {
/*
* Since the parent Content exists, the necessary data in
* content_group had not yet been created
*/
$sql = "INSERT INTO content_file_image (pictures_id) VALUES ('{$content_id}')";
$db->execSqlUpdate($sql, false);
$sql = "SELECT * FROM content_file_image WHERE pictures_id='{$content_id}'";
$db->execSqlUniqueRes($sql, $row, false);
if ($row == null) {
throw new Exception(_("The content with the following id could not be found in the database: ") . $content_id);
}
}
$this->mBd =& $db;
$this->pictures_row = $row;
$this->configEnableEditFilename(false);
$this->configEnableEditMimeType(false);
}
示例5: __construct
public function __construct(\stdClass $data)
{
parent::__construct($data);
$this->receiveData("thumb", null, "PhotoSize", true);
$this->checkData("file_name", false, true);
$this->checkData("mime_type", false, true);
}
示例6: __construct
/**
* Construct a new CSV object for the specified file.
*
* The specified path needn't exist and can be a relative or an absolute path.
* The field separator is set to ',', the char the values are enclosed with is set to '"'.
* Excel compatibility mode is turned off by default. Default mode for read and write access is
* Unicode.
*
* FTP fallback is activated automatically for this class.
*
* @param string Path to a CSV file
* @param boolean Shall we read/write header data? true = yes, false = no
*/
public function __construct($file, $headers = false) {
parent::__construct($file, true);
$this->headers = (boolean) $headers;
$this->sep = ',';
$this->quote = '"';
$this->compat = false;
$this->setFileMode();
}
示例7: __construct
/**
* @param string $filename
* @return void
*/
public function __construct($filename)
{
parent::__construct($filename);
// Don't extend all these great directory features to lowly files
if ($this->isFile()) {
throw new \Exception("Invalid directory '{$filename}'");
}
}
示例8: __construct
/**
*
* @param string $path
* @param string $prefix
*/
public function __construct($path = null, $prefix = 'cassea_')
{
$path = !is_null($path) & is_writable($path) ? $path : (is_writable($s = sys_get_temp_dir()) ? $s : (is_writable($p = ini_get('upload_tmp_dir')) ? $p : Config::get('root_dir') . Config::get('temp_dir')));
if (!is_writable($path)) {
throw new FileSystemException('Temporary directory not writable: ' . $path);
}
parent::__construct(tempnam($path, $prefix), true);
}
示例9: array
function __construct($parent, $id, $args = array())
{
if (!isset($args['accept_types'])) {
$args['accept_types'] = array('jpg', 'jpeg', 'png', 'gif');
}
$this->special_args('versions', $args, true);
parent::__construct($parent, $id, $args);
}
示例10: __construct
public function __construct($path)
{
parent::__construct($path);
//make sure log file and parent directory exists
if (!$this->exists()) {
$this->touch(true);
}
}
示例11: __construct
protected function __construct($path, $mimetype = null)
{
parent::__construct($path, $mimetype);
$this->set_quality(self::$_DEFAULT_QUALITY);
$this->_tmp_path = tempnam(sys_get_temp_dir(), 'image');
$this->_image = imagecreatefromstring(file_get_contents($this->_path));
$this->_update_temp_file();
}
示例12: __construct
public function __construct()
{
$handle = tmpfile();
$metaDatas = stream_get_meta_data($handle);
$tmpFilename = $metaDatas['uri'];
parent::__construct($tmpFilename);
$this->handle = $handle;
}
示例13: __construct
/**
* Accepts the information of the uploaded file as provided by the PHP global $_FILES.
*
* The file object is only created when the uploaded file is valid (i.e. when the
* isValid() method returns true). Otherwise the only methods that could be called
* on an UploadedFile instance are:
*
* * getClientOriginalName,
* * getClientMimeType,
* * isValid,
* * getError.
*
* Calling any other method on an non-valid instance will cause an unpredictable result.
*
* @param string $path The full temporary path to the file
* @param string $originalName The original file name
* @param string $mimeType The type of the file as provided by PHP
* @param int $size The file size
* @param int $error The error constant of the upload (one of PHP's UPLOAD_ERR_XXX constants)
* @param bool $test Whether the test mode is active
*
* @throws FileException If file_uploads is disabled
* @throws FileNotFoundException If the file does not exist
*/
public function __construct($path, $originalName, $mimeType = null, $size = null, $error = null, $test = false)
{
$this->originalName = $this->getName($originalName);
$this->mimeType = $mimeType ?: 'application/octet-stream';
$this->size = $size;
$this->error = $error ?: UPLOAD_ERR_OK;
$this->test = (bool) $test;
parent::__construct($path, UPLOAD_ERR_OK === $this->error);
}
示例14: __construct
/**
* TemporaryFile constructor.
*
* @param string $folderPath テンポラリフォルダを作成するフォルダパス。指定されなければテンポラリフォルダを作成する
*/
public function __construct($folderPath = null)
{
if ($folderPath === null) {
$this->_tmpFolder = new TemporaryFolder();
$folderPath = $this->_tmpFolder->path;
}
$fileName = Security::hash(mt_rand() . microtime(), 'md5');
register_shutdown_function(array($this, 'delete'));
parent::__construct($folderPath . DS . $fileName, true);
}
示例15: __construct
public function __construct(array $data)
{
if (!isset($data['name'])) {
throw new \InvalidArgumentException("Input array does not contain the 'name' key");
}
if (!isset($data['tmp_name'])) {
throw new \InvalidArgumentException("Input array does not contain the 'tmp_name' key");
}
parent::__construct($data['name'], $data['tmp_name']);
}