本文整理汇总了PHP中FileField::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP FileField::__construct方法的具体用法?PHP FileField::__construct怎么用?PHP FileField::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileField
的用法示例。
在下文中一共展示了FileField::__construct方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($name, $title = null, $value = null)
{
parent::__construct($name, $title, $value);
$upload = new FrontendUpload();
$upload->setName($name);
$this->setUpload($upload);
}
示例2: __construct
public function __construct($name, $title = null, $value = null)
{
$this->bffConfig = array_merge($this->bffConfig, self::config()->defaultConfig);
parent::__construct($name, $title, $value);
// filter out '' since this would be a regex problem on JS end
$this->getValidator()->setAllowedExtensions(array_filter(Config::inst()->get('File', 'allowed_extensions')));
$this->addExtraClass('filestyle');
}
示例3: array
function __construct($name, $title = null, $value = null)
{
Deprecation::notice('3.0', "Use UploadField with \$myField->allowedExtensions = array('jpg', 'gif', 'png')");
if (count(func_get_args()) > 3) {
Deprecation::notice('3.0', 'Use setRightTitle() and setFolderName() instead of constructor arguments');
}
parent::__construct($name, $title, $value);
$this->getValidator()->setAllowedExtensions(array('jpg', 'gif', 'png'));
}
示例4: __construct
public function __construct($name, $title = null, $value = null)
{
Deprecation::notice('3.0', "SimpleImageField is deprecated. Use UploadField with " . "\$myField->allowedExtensions = array('jpg', 'gif', 'png')", Deprecation::SCOPE_CLASS);
if (count(func_get_args()) > 3) {
Deprecation::notice('3.0', 'Use setRightTitle() and setFolderName() instead of constructor arguments', Deprecation::SCOPE_GLOBAL);
}
parent::__construct($name, $title, $value);
$this->getValidator()->setAllowedExtensions(array('jpg', 'gif', 'png'));
}
示例5: __construct
public function __construct($name, $title = null, $project = null, $value = null)
{
$this->project = $project;
$this->field_name = $name;
if (isset($project)) {
$fieldId = $name . 'ID';
$this->hasFileLoaded = $project->{$fieldId} != 0;
}
parent::__construct($name, $title, $value);
}
示例6: __construct
public function __construct($name, $title = null, $value = null)
{
$this->member = Member::currentUser();
$this->field_name = $name;
$fieldId = $name . 'ID';
$this->hasFileLoaded = $this->member->{$fieldId} != 0;
if ($this->hasFile()) {
$value = $this->member->Avatar();
}
parent::__construct($name, $title, $value);
}
示例7: __construct
/**
* @param string $name The internal field name, passed to forms.
* @param string $title The field label.
* @param SS_List $items If no items are defined, the field will try to auto-detect an existing relation on {@link $record},
* with the same name as the field name.
* @param Form $form Reference to the container form
*/
public function __construct($name, $title = null, SS_List $items = null)
{
// TODO thats the first thing that came to my head, feel free to change it
$this->addExtraClass('ss-upload');
// class, used by js
$this->addExtraClass('ss-uploadfield');
// class, used by css for uploadfield only
parent::__construct($name, $title);
if ($items) {
$this->setItems($items);
}
$this->getValidator()->setAllowedExtensions(array_filter(File::$allowed_extensions));
// filter out '' since this would be a regex problem on JS end
$this->getValidator()->setAllowedMaxFileSize(min(File::ini2bytes(ini_get('upload_max_filesize')), File::ini2bytes(ini_get('post_max_size'))));
// get the lower max size
}
示例8: array
function __construct($form_name, $name, $title = null, $configuration = array())
{
parent::__construct($name, $title);
if (isset($value)) {
$this->value = $value;
}
SWFUploadConfig::$form_name = $form_name;
if (!empty($configuration)) {
SWFUploadConfig::Configure($configuration);
}
$url = SWFUploadConfig::get_var('upload_url');
if (empty($url)) {
SWFUploadConfig::set_var('upload_url', Director::absoluteURL(Controller::curr()->Link('handleswfupload')));
}
SWFUploadConfig::Bootstrap();
}
示例9: __construct
/**
* Construct a new UploadField instance
*
* @param string $name The internal field name, passed to forms.
* @param string $title The field label.
* @param Form $form Reference to the container form
*/
public function __construct($name, $title = null)
{
$this->addExtraClass('ss-upload');
// class, used by js
$this->addExtraClass('ss-uploadfield');
// class, used by css for uploadfield only
$this->ufConfig = array_merge($this->ufConfig, self::config()->defaultConfig);
parent::__construct($name, $title);
// AssetField always uses rename replacement method
$this->getUpload()->setReplaceFile(false);
// filter out '' since this would be a regex problem on JS end
$this->getValidator()->setAllowedExtensions(array_filter(Config::inst()->get('File', 'allowed_extensions')));
// get the lower max size
$maxUpload = File::ini2bytes(ini_get('upload_max_filesize'));
$maxPost = File::ini2bytes(ini_get('post_max_size'));
$this->getValidator()->setAllowedMaxFileSize(min($maxUpload, $maxPost));
}
示例10: __construct
/**
* Construct a new UploadField instance
*
* @param string $name The internal field name, passed to forms.
* @param string $title The field label.
* @param SS_List $items If no items are defined, the field will try to auto-detect an existing relation on
* @link $record}, with the same name as the field name.
* @param Form $form Reference to the container form
*/
public function __construct($name, $title = null, SS_List $items = null)
{
// TODO thats the first thing that came to my head, feel free to change it
$this->addExtraClass('ss-upload');
// class, used by js
$this->addExtraClass('ss-uploadfield');
// class, used by css for uploadfield only
$this->ufConfig = array_merge($this->ufConfig, self::config()->defaultConfig);
parent::__construct($name, $title);
if ($items) {
$this->setItems($items);
}
// filter out '' since this would be a regex problem on JS end
$this->getValidator()->setAllowedExtensions(array_filter(Config::inst()->get('File', 'allowed_extensions')));
// get the lower max size
$maxUpload = File::ini2bytes(ini_get('upload_max_filesize'));
$maxPost = File::ini2bytes(ini_get('post_max_size'));
$this->getValidator()->setAllowedMaxFileSize(min($maxUpload, $maxPost));
}
示例11: __construct
/**
* @author Jeff Ober
* @param string $label the field's string label
* @param int $max_size the maximum upload size in bytes
* @param array $validators a list of callbacks to validate the field data
* @param array $attributes a list of key/value pairs representing HTML attributes
**/
public function __construct($label, $max_size, array $validators = array(), array $attributes = array())
{
parent::__construct($label, array('image/png', 'image/gif', 'image/jpg', 'image/jpeg'), $max_size, $validators, $attributes);
}
示例12: __construct
/**
* Constructor. Sets some default permissions
* @param string $name
* @param string $title
* @param string $value
* @param Form $form
*/
public function __construct($name, $title = null, $value = null, $form = null)
{
$instance = $this;
$this->permissions['upload'] = true;
$this->permissions['detach'] = true;
$this->permissions['delete'] = function () use($instance) {
return Injector::inst()->get('File')->canDelete() && $instance->isCMS();
};
$this->permissions['attach'] = function () use($instance) {
return $instance->isCMS();
};
parent::__construct($name, $title, $value, $form);
}
示例13:
function __construct($name, $title = null, $value = null, $form = null, $rightTitle = null, $folderName = null)
{
parent::__construct($name, $title, $value, $form, $rightTitle, $folderName);
$this->getValidator()->setAllowedExtensions(array('jpg', 'gif', 'png'));
}
示例14: __construct
public function __construct($name, $title = null, $value = null)
{
parent::__construct($name, $title, $value);
$this->getValidator()->setAllowedExtensions(array('jpg', 'gif', 'png'));
}