当前位置: 首页>>代码示例>>PHP>>正文


PHP FileField::__construct方法代码示例

本文整理汇总了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);
 }
开发者ID:lekoala,项目名称:silverstripe-form-extras,代码行数:7,代码来源:FrontendFileField.php

示例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');
 }
开发者ID:EduardMa,项目名称:silverstripe-bootstrap_extra_fields,代码行数:8,代码来源:BootstrapFileField.php

示例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'));
 }
开发者ID:nomidi,项目名称:sapphire,代码行数:9,代码来源:SimpleImageField.php

示例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'));
 }
开发者ID:normann,项目名称:sapphire,代码行数:9,代码来源:SimpleImageField.php

示例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);
 }
开发者ID:helpfulrobot,项目名称:chitosystems-bootstrap-fields,代码行数:10,代码来源:BootstrapFileField.php

示例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);
 }
开发者ID:helpfulrobot,项目名称:chitosystems-bootstrap-fields,代码行数:11,代码来源:BootstrapImageField.php

示例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
 }
开发者ID:prostart,项目名称:cobblestonepath,代码行数:23,代码来源:UploadField.php

示例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();
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:16,代码来源:SWFUploadField.php

示例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));
 }
开发者ID:guttmann,项目名称:silverstripe-framework,代码行数:24,代码来源:AssetField.php

示例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));
 }
开发者ID:hemant-chakka,项目名称:awss,代码行数:28,代码来源:UploadField.php

示例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);
 }
开发者ID:sodabrew,项目名称:phorms,代码行数:11,代码来源:fields.php

示例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);
 }
开发者ID:rasstislav,项目名称:silverstripe-dropzone,代码行数:20,代码来源:FileAttachmentField.php

示例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'));
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:5,代码来源:SimpleImageField.php

示例14: __construct

 public function __construct($name, $title = null, $value = null)
 {
     parent::__construct($name, $title, $value);
     $this->getValidator()->setAllowedExtensions(array('jpg', 'gif', 'png'));
 }
开发者ID:helpfulrobot,项目名称:andrelohmann-silverstripe-legacyfields,代码行数:5,代码来源:SimpleImageField.php


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