public function __construct($name, $title = null, $value = null) { parent::__construct($name, $title, $value); $upload = new FrontendUpload(); $upload->setName($name); $this->setUpload($upload); }
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'); }
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')); }
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')); }
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); }
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); }
/** * @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 }
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(); }
/** * 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)); }
/** * 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)); }
/** * @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); }
/** * 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); }
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')); }
public function __construct($name, $title = null, $value = null) { parent::__construct($name, $title, $value); $this->getValidator()->setAllowedExtensions(array('jpg', 'gif', 'png')); }