* is `true` if dialog from can be canceled and is `false` otherwise
* @var bool
*/
- protected $__isCancelable = true;
+ protected $isCancelable = true;
/**
* Sets whether the dialog from can be canceled and return this document.
* @return static this document
*/
public function cancelable($cancelable = true) {
- $this->__isCancelable = $cancelable;
+ $this->isCancelable = $cancelable;
return $this;
}
public function getAction() {
// do not throw exception if no action has been set as a dialog
// form does not require an action to be set
- if ($this->__action === null) {
- $this->__action = '';
+ if ($this->action === null) {
+ $this->action = '';
}
- return $this->__action;
+ return $this->action;
}
/**
* @return bool
*/
public function isCancelable() {
- return $this->__isCancelable;
+ return $this->isCancelable;
}
}
* `action` property of the HTML `form` element
* @var string
*/
- protected $__action;
+ protected $action;
/**
- * form mode (see `self::FORM_MODE_*` constants)
- * @var null|string
+ * data handler for this document
+ * @var IFormDataHandler
*/
- protected $__formMode;
+ protected $dataHandler;
/**
- * `method` property of the HTML `form` element
- * @var string
+ * encoding type of this form
+ * @var null|
*/
- protected $__method = 'post';
+ protected $enctype = '';
/**
- * global form prefix that is prepended to form elements' names and ids to
- * avoid conflicts with other forms
- * @var string
+ * is `true` if form document has already been built and is `false` otherwise
+ * @var bool
*/
- protected $__prefix;
+ protected $isBuilt = false;
/**
- * request data of the form's field
- * @var null|array
+ * form mode (see `self::FORM_MODE_*` constants)
+ * @var null|string
*/
- protected $__requestData;
+ protected $formMode;
/**
- * data handler for this document
- * @var IFormDataHandler
+ * `method` property of the HTML `form` element
+ * @var string
*/
- protected $dataHandler;
+ protected $method = 'post';
/**
- * encoding type of this form
- * @var null|
+ * global form prefix that is prepended to form elements' names and ids to
+ * avoid conflicts with other forms
+ * @var string
*/
- protected $enctype = '';
+ protected $prefix;
/**
- * is `true` if form document has already been built and is `false` otherwise
- * @var bool
+ * request data of the form's field
+ * @var null|array
*/
- protected $isBuilt = false;
+ protected $requestData;
/**
* Cleans up the form document before the form document object is destroyed.
* @inheritDoc
*/
public function action($action) {
- $this->__action = $action;
+ $this->action = $action;
return $this;
}
* @inheritDoc
*/
public function formMode($formMode) {
- if ($this->__formMode !== null) {
+ if ($this->formMode !== null) {
throw new \BadMethodCallException("Form mode has already been set");
}
throw new \InvalidArgumentException("Unknown form mode '{$formMode}' given.");
}
- $this->__formMode = $formMode;
+ $this->formMode = $formMode;
return $this;
}
* @inheritDoc
*/
public function getAction() {
- if ($this->__action === null) {
+ if ($this->action === null) {
throw new \BadMethodCallException("Action has not been set.");
}
- return $this->__action;
+ return $this->action;
}
/**
* @inheritDoc
*/
public function getFormMode() {
- if ($this->__formMode === null) {
- $this->__formMode = self::FORM_MODE_CREATE;
+ if ($this->formMode === null) {
+ $this->formMode = self::FORM_MODE_CREATE;
}
- return $this->__formMode;
+ return $this->formMode;
}
/**
* @inheritDoc
*/
public function getMethod() {
- return $this->__method;
+ return $this->method;
}
/**
* @inheritDoc
*/
public function getPrefix() {
- if ($this->__prefix === null) {
+ if ($this->prefix === null) {
return '';
}
- return $this->__prefix . '_';
+ return $this->prefix . '_';
}
/**
* @inheritDoc
*/
public function getRequestData($index = null) {
- if ($this->__requestData === null) {
- $this->__requestData = $_POST;
+ if ($this->requestData === null) {
+ $this->requestData = $_POST;
}
if ($index !== null) {
- if (!isset($this->__requestData[$index])) {
+ if (!isset($this->requestData[$index])) {
throw new \InvalidArgumentException("Unknown request data with index '" . $index . "'.");
}
- return $this->__requestData[$index];
+ return $this->requestData[$index];
}
- return $this->__requestData;
+ return $this->requestData;
}
/**
* @inheritDoc
*/
public function loadValuesFromObject(IStorableObject $object) {
- if ($this->__formMode === null) {
+ if ($this->formMode === null) {
$this->formMode(self::FORM_MODE_UPDATE);
}
throw new \InvalidArgumentException("Invalid method '{$method}' given.");
}
- $this->__method = $method;
+ $this->method = $method;
return $this;
}
public function prefix($prefix) {
static::validateId($prefix);
- $this->__prefix = $prefix;
+ $this->prefix = $prefix;
return $this;
}
* @inheritDoc
*/
public function readValues() {
- if ($this->__requestData === null) {
- $this->__requestData = $_POST;
+ if ($this->requestData === null) {
+ $this->requestData = $_POST;
}
return $this->defaultReadValues();
* @inheritDoc
*/
public function requestData(array $requestData) {
- if ($this->__requestData !== null) {
+ if ($this->requestData !== null) {
throw new \BadMethodCallException('Request data has already been set.');
}
- $this->__requestData = $requestData;
+ $this->requestData = $requestData;
return $this;
}
* parent node of this node
* @var IFormParentNode
*/
- protected $__parent;
+ protected $parent;
/**
* Returns the form document this node belongs to.
* @throws \BadMethodCallException if the parent node has not been set previously
*/
public function getParent() {
- if ($this->__parent === null) {
+ if ($this->parent === null) {
throw new \BadMethodCallException("Before getting the parent node of '{$this->getId()}', it must be set.");
}
- return $this->__parent;
+ return $this->parent;
}
/**
* @return static this node
*/
public function parent(IFormParentNode $parentNode) {
- if ($this->__parent !== null) {
+ if ($this->parent !== null) {
throw new \BadMethodCallException("The parent node of '{$this->getId()}' has already been set.");
}
- $this->__parent = $parentNode;
+ $this->parent = $parentNode;
return $this;
}
* description of this element
* @var string
*/
- protected $__description;
+ protected $description;
/**
* label of this element
* @var string
*/
- protected $__label;
+ protected $label;
/**
* Sets the description of this element using the given language item
* and returns this element. If `null` is passed, the element description
* is removed.
- *
+ *
* @param null|string $languageItem language item containing the element description or `null` to unset description
* @param array $variables additional variables used when resolving the language item
* @return static this element
- *
+ *
* @throws \InvalidArgumentException if the given description is no or otherwise is invalid
*/
public function description($languageItem = null, array $variables = []) {
throw new \InvalidArgumentException("Cannot use variables when unsetting description of element '{$this->getId()}'");
}
- $this->__description = null;
+ $this->description = null;
}
else {
if (!is_string($languageItem)) {
throw new \InvalidArgumentException("Given description language item is no string, " . gettype($languageItem) . " given.");
}
- $this->__description = WCF::getLanguage()->getDynamicVariable($languageItem, $variables);
+ $this->description = WCF::getLanguage()->getDynamicVariable($languageItem, $variables);
}
return $this;
/**
* Returns the description of this element or `null` if no description has been set.
- *
+ *
* @return null|string element description
*/
public function getDescription() {
- return $this->__description;
+ return $this->description;
}
/**
* @return null|string element label
*/
public function getLabel() {
- return $this->__label;
+ return $this->label;
}
/**
throw new \InvalidArgumentException("Cannot use variables when unsetting label of element '{$this->getId()}'");
}
- $this->__label = null;
+ $this->label = null;
}
else {
if (!is_string($languageItem)) {
throw new \InvalidArgumentException("Given description language item is no string, " . gettype($languageItem) . " given.");
}
- $this->__label = WCF::getLanguage()->getDynamicVariable($languageItem, $variables);
+ $this->label = WCF::getLanguage()->getDynamicVariable($languageItem, $variables);
}
return $this;
* additional attributes of this node
* @var array
*/
- protected $__attributes = [];
+ protected $attributes = [];
/**
* `true` if this node is available and `false` otherwise
* @var bool
*/
- protected $__available = true;
+ protected $available = true;
/**
* CSS classes of this node
* @var string[]
*/
- protected $__classes = [];
-
- /**
- * id of the form node
- * @var string
- */
- protected $__id;
+ protected $classes = [];
/**
* dependencies of this node
*/
protected $dependencies = [];
+ /**
+ * id of the form node
+ * @var string
+ */
+ protected $id;
+
/**
* is `true` if node has already been populated and is `false` otherwise
* @var bool
public function addClass($class) {
static::validateClass($class);
- if (!in_array($class, $this->__classes)) {
- $this->__classes[] = $class;
+ if (!in_array($class, $this->classes)) {
+ $this->classes[] = $class;
}
return $this;
throw new \InvalidArgumentException("Value argument is of invalid type, " . gettype($value) . ".");
}
- $this->__attributes[$name] = $value;
+ $this->attributes[$name] = $value;
return $this;
}
* @return static this node
*/
public function available($available = true) {
- $this->__available = $available;
+ $this->available = $available;
return $this;
}
throw new \InvalidArgumentException("Unknown attribute '{$name}' requested.");
}
- return $this->__attributes[$name];
+ return $this->attributes[$name];
}
/**
* @return array additional node attributes
*/
public function getAttributes() {
- return $this->__attributes;
+ return $this->attributes;
}
/**
* @return string[] CSS classes of node
*/
public function getClasses() {
- return $this->__classes;
+ return $this->classes;
}
/**
* @throws \BadMethodCallException if no id has been set
*/
public function getId() {
- if ($this->__id === null) {
+ if ($this->id === null) {
throw new \BadMethodCallException("Id has not been set.");
}
- return $this->__id;
+ return $this->id;
}
/**
public function hasAttribute($name) {
static::validateAttribute($name);
- return isset($this->__attributes[$name]);
+ return isset($this->attributes[$name]);
}
/**
public function hasClass($class) {
static::validateClass($class);
- return array_search($class, $this->__classes) !== false;
+ return array_search($class, $this->classes) !== false;
}
/**
public function id($id) {
static::validateId($id);
- if ($this->__id !== null) {
+ if ($this->id !== null) {
throw new \BadMethodCallException("Id has already been set.");
}
- $this->__id = $id;
+ $this->id = $id;
return $this;
}
* @see IFormNode::available()
*/
public function isAvailable() {
- if ($this->__available && $this instanceof IFormParentNode) {
+ if ($this->available && $this instanceof IFormParentNode) {
/** @var IFormChildNode $child */
foreach ($this as $child) {
if ($child->isAvailable()) {
return false;
}
- return $this->__available;
+ return $this->available;
}
/**
public function removeAttribute($name) {
static::validateAttribute($name);
- unset($this->__attributes[$name]);
+ unset($this->attributes[$name]);
return $this;
}
public function removeClass($class) {
static::validateClass($class);
- $index = array_search($class, $this->__classes);
+ $index = array_search($class, $this->classes);
if ($index !== false) {
- unset($this->__classes[$index]);
+ unset($this->classes[$index]);
}
return $this;
* child nodes of this node
* @var IFormChildNode[]
*/
- protected $__children = [];
+ protected $children = [];
/**
* current iterator index
public function appendChild(IFormChildNode $child) {
$this->validateChild($child);
- $this->__children[] = $child;
+ $this->children[] = $child;
$child->parent($this);
* @return IFormChildNode[] children of this node
*/
public function children() {
- return $this->__children;
+ return $this->children;
}
/**
* @return int number of children
*/
public function count() {
- return count($this->__children);
+ return count($this->children);
}
/**
* @return IFormChildNode current child node
*/
public function current() {
- return $this->__children[$this->index];
+ return $this->children[$this->index];
}
/**
* @return null|IFormParentNode iterator for the current child node
*/
public function getChildren() {
- $node = $this->__children[$this->index];
+ $node = $this->children[$this->index];
if ($node instanceof IFormParentNode) {
return $node;
}
* @return bool
*/
public function hasChildren() {
- return !empty($this->__children);
+ return !empty($this->children);
}
/**
$didInsertNode = false;
foreach ($this->children() as $index => $existingChild) {
if ($existingChild->getId() === $referenceNodeId) {
- array_splice($this->__children, $index, 0, [$child]);
+ array_splice($this->children, $index, 0, [$child]);
$child->parent($this);
* @return bool
*/
public function valid() {
- return isset($this->__children[$this->index]);
+ return isset($this->children[$this->index]);
}
/**
* `true` if this field is auto-focused and `false` otherwise
* @var bool
*/
- protected $__autoFocus = false;
+ protected $autoFocus = false;
/**
* name of the object property this field represents
* @var null|string
*/
- protected $__objectProperty;
+ protected $objectProperty;
/**
* `true` if this field has to be filled out and returns `false` otherwise
* @var bool
*/
- protected $__required = false;
-
- /**
- * value of the field
- * @var mixed
- */
- protected $__value;
+ protected $required = false;
/**
* name of the template used to output this field
*/
protected $validators = [];
+ /**
+ * value of the field
+ * @var mixed
+ */
+ protected $value;
+
/**
* @inheritDoc
*/
* @inheritDoc
*/
public function autoFocus($autoFocus = true) {
- $this->__autoFocus = $autoFocus;
+ $this->autoFocus = $autoFocus;
return $this;
}
* @inheritDoc
*/
public function getObjectProperty() {
- if ($this->__objectProperty !== null) {
- return $this->__objectProperty;
+ if ($this->objectProperty !== null) {
+ return $this->objectProperty;
}
return $this->getId();
* @inheritDoc
*/
public function getValue() {
- return $this->__value;
+ return $this->value;
}
/**
* @inheritDoc
*/
public function isAutoFocused() {
- return $this->__autoFocus;
+ return $this->autoFocus;
}
/**
* @inheritDoc
*/
public function isRequired() {
- return $this->__required;
+ return $this->required;
}
/**
*/
public function objectProperty($objectProperty) {
if ($objectProperty === '') {
- $this->__objectProperty = null;
+ $this->objectProperty = null;
}
else {
static::validateId($objectProperty);
- $this->__objectProperty = $objectProperty;
+ $this->objectProperty = $objectProperty;
}
return $this;
* @return static
*/
public function required($required = true) {
- $this->__required = $required;
+ $this->required = $required;
return $this;
}
* @inheritDoc
*/
public function value($value) {
- $this->__value = $value;
+ $this->value = $value;
return $this;
}
use TPlaceholderFormField;
use TSuffixedFormField;
- /**
- * step value for the input element
- * @var null|number
- */
- protected $__step;
-
/**
* is `true` if only integer values are supported
* @var bool
*/
protected $integerValues = false;
+ /**
+ * step value for the input element
+ * @var null|number
+ */
+ protected $step;
+
/**
* @inheritDoc
*/
* @return number|string
*/
public function getStep() {
- if ($this->__step === null) {
- $this->__step = $this->getDefaultStep();
+ if ($this->step === null) {
+ $this->step = $this->getDefaultStep();
}
- return $this->__step;
+ return $this->step;
}
/**
if ($value !== '') {
if ($this->integerValues) {
- $this->__value = intval($value);
+ $this->value = intval($value);
}
else {
- $this->__value = floatval($value);
+ $this->value = floatval($value);
}
}
}
}
}
- $this->__step = $step;
+ $this->step = $step;
return $this;
}
* @inheritDoc
*/
public function getSaveValue() {
- return $this->__value ? 1 : 0;
+ return $this->value ? 1 : 0;
}
/**
*/
public function readValue() {
if ($this->getDocument()->hasRequestData($this->getPrefixedId())) {
- $this->__value = $this->getDocument()->getRequestData($this->getPrefixedId()) === '1';
+ $this->value = $this->getDocument()->getRequestData($this->getPrefixedId()) === '1';
}
return $this;
* `true` if the entered class must exist
* @var bool
*/
- protected $__classExists = true;
+ protected $classExists = true;
/**
* name of the interface the entered class must implement
* @var string
*/
- protected $__implementedInterface = '';
+ protected $implementedInterface = '';
/**
* `true` if the entered class must be instantiable
* @var bool
*/
- protected $__instantiable = true;
+ protected $instantiable = true;
/**
* name of the class the entered class must extend
* @var string
*/
- protected $__parentClass = '';
+ protected $parentClass = '';
/**
* Creates a new instance of `ClassNameFormField`.
* @return static this field
*/
public function classExists($classExists = true) {
- $this->__classExists = $classExists;
+ $this->classExists = $classExists;
return $this;
}
* @return bool
*/
public function getClassExists() {
- return $this->__classExists;
+ return $this->classExists;
}
/**
* @return string
*/
public function getImplementedInterface() {
- return $this->__implementedInterface;
+ return $this->implementedInterface;
}
/**
* @return string
*/
public function getParentClass() {
- return $this->__parentClass;
+ return $this->parentClass;
}
/**
throw new \InvalidArgumentException("Interface '{$interface}' does not exist.");
}
- $this->__implementedInterface = $interface;
+ $this->implementedInterface = $interface;
if ($this->getDescription() === null) {
$this->description(
'wcf.form.field.className.description.interface',
- ['interface' => $this->__implementedInterface]
+ ['interface' => $this->implementedInterface]
);
}
* @return static this field
*/
public function instantiable($instantiable = true) {
- $this->__instantiable = $instantiable;
+ $this->instantiable = $instantiable;
return $this;
}
* @return bool
*/
public function isInstantiable() {
- return $this->__instantiable;
+ return $this->instantiable;
}
/**
throw new \InvalidArgumentException("Class '{$parentClass}' does not exist.");
}
- $this->__parentClass = $parentClass;
+ $this->parentClass = $parentClass;
if ($this->getDescription() === null) {
$this->description(
'wcf.form.field.className.description.parentClass',
- ['parentClass' => $this->__parentClass]
+ ['parentClass' => $this->parentClass]
);
}
* date time format of the save value
* @var string
*/
- protected $__saveValueFormat = null;
+ protected $saveValueFormat = null;
/**
* is `true` if not only the date, but also the time can be set
* @var bool
*/
- protected $__supportsTime = false;
+ protected $supportsTime = false;
/**
* @inheritDoc
* @return string
*/
public function getSaveValueFormat() {
- if ($this->__saveValueFormat === null) {
- $this->__saveValueFormat = 'U';
+ if ($this->saveValueFormat === null) {
+ $this->saveValueFormat = 'U';
}
- return $this->__saveValueFormat;
+ return $this->saveValueFormat;
}
/**
*/
public function readValue() {
if ($this->getDocument()->hasRequestData($this->getPrefixedId()) && is_string($this->getDocument()->getRequestData($this->getPrefixedId()))) {
- $this->__value = $this->getDocument()->getRequestData($this->getPrefixedId());
+ $this->value = $this->getDocument()->getRequestData($this->getPrefixedId());
- if ($this->__value === '') {
- $this->__value = null;
+ if ($this->value === '') {
+ $this->value = null;
}
}
* @return static
*/
public function saveValueFormat($saveValueFormat) {
- if ($this->__saveValueFormat !== null) {
+ if ($this->saveValueFormat !== null) {
throw new \BadMethodCallException("Save value type has already been set.");
}
throw new \InvalidArgumentException("Invalid date time format '{$saveValueFormat}'.", 0, $e);
}
- $this->__saveValueFormat = $saveValueFormat;
+ $this->saveValueFormat = $saveValueFormat;
return $this;
}
* @return static thsi field
*/
public function supportTime($supportsTime = true) {
- $this->__supportsTime = $supportsTime;
+ $this->supportsTime = $supportsTime;
return $this;
}
* @return bool
*/
public function supportsTime() {
- return $this->__supportsTime;
+ return $this->supportsTime;
}
/**
*/
public function readValue() {
if ($this->getDocument()->hasRequestData($this->getPrefixedId())) {
- $this->__value = $this->getDocument()->getRequestData($this->getPrefixedId());
+ $this->value = $this->getDocument()->getRequestData($this->getPrefixedId());
}
return $this;
$value = $this->getDocument()->getRequestData($this->getPrefixedId());
if (is_array($value)) {
- $this->__value = array_unique(ArrayUtil::trim($value));
+ $this->value = array_unique(ArrayUtil::trim($value));
}
}
switch ($this->getSaveValueType()) {
case self::SAVE_VALUE_TYPE_ARRAY:
if (is_array($value)) {
- $this->__value = $value;
+ $this->value = $value;
}
else {
throw new \InvalidArgumentException("Given value is no array, '" . gettype($value) . "' given.");
case self::SAVE_VALUE_TYPE_CSV:
if (is_string($value)) {
- $this->__value = explode(',', $value);
+ $this->value = explode(',', $value);
}
else {
throw new \InvalidArgumentException("Given value is no string, '" . gettype($value) . "' given.");
case self::SAVE_VALUE_TYPE_NSV:
if (is_string($value)) {
- $this->__value = explode("\n", $value);
+ $this->value = explode("\n", $value);
}
else {
throw new \InvalidArgumentException("Given value is no string, '" . gettype($value) . "' given.");
case self::SAVE_VALUE_TYPE_SSV:
if (is_string($value)) {
- $this->__value = explode(' ', $value);
+ $this->value = explode(' ', $value);
}
else {
throw new \InvalidArgumentException("Given value is no string, '" . gettype($value) . "' given.");
* number of rows of the textarea
* @var int
*/
- protected $__rows = 10;
+ protected $rows = 10;
/**
* @inheritDoc
* @return int number of textarea rows
*/
public function getRows() {
- return $this->__rows;
+ return $this->rows;
}
/**
throw new \InvalidArgumentException("Given number of rows is not positive.");
}
- $this->__rows = $rows;
+ $this->rows = $rows;
return $this;
}
$value = $this->getDocument()->getRequestData($this->getPrefixedId());
if (is_array($value)) {
- $this->__value = $value;
+ $this->value = $value;
}
else if (!$this->isNullable()) {
- $this->__value = [];
+ $this->value = [];
}
}
$value = $this->getDocument()->getRequestData($this->getPrefixedId());
if (is_string($value)) {
- $this->__value = $value;
+ $this->value = $value;
}
}
* @inheritDoc
*/
public function getSaveValue() {
- if ($this->__value !== null) {
- $index = array_search($this->__value, array_keys($this->getOptions()));
+ if ($this->value !== null) {
+ $index = array_search($this->value, array_keys($this->getOptions()));
if ($index !== false) {
return $index + 1;
return null;
}
- return $this->__value;
+ return $this->value;
}
/**
public function options($options, $nestedOptions = false, $labelLanguageItems = true) {
parent::options($options, $nestedOptions, $labelLanguageItems);
- $this->__options = [0 => WCF::getLanguage()->get('wcf.form.field.showOrder.firstPosition')] + $this->__options;
+ $this->options = [0 => WCF::getLanguage()->get('wcf.form.field.showOrder.firstPosition')] + $this->options;
if ($nestedOptions) {
- array_unshift($this->__nestedOptions, [
+ array_unshift($this->nestedOptions, [
'depth' => 0,
'label' => WCF::getLanguage()->get('wcf.form.field.showOrder.firstPosition'),
'value' => 0
$value = $this->getDocument()->getRequestData($this->getPrefixedId());
if (is_string($value)) {
- $this->__value = $value;
+ $this->value = $value;
}
}
* `true` if this field's options are filterable by the user
* @var bool
*/
- protected $__filterable = false;
+ protected $filterable = false;
/**
* Sets if the selection options can be filtered by the user so that they
* @return static this node
*/
public function filterable($filterable = true) {
- $this->__filterable = $filterable;
+ $this->filterable = $filterable;
return $this;
}
* @return bool
*/
public function isFilterable() {
- return $this->__filterable;
+ return $this->filterable;
}
}
* `true` if this field supports i18n input and `false` otherwise
* @var bool
*/
- protected $__i18n = false;
+ protected $i18n = false;
/**
* `true` if this field requires i18n input and `false` otherwise
* @var bool
*/
- protected $__i18nRequired = false;
+ protected $i18nRequired = false;
/**
* pattern for the language item used to save the i18n values
* @var null|string
*/
- protected $__languageItemPattern;
+ protected $languageItemPattern;
/**
* Returns additional template variables used to generate the html representation
throw new \BadMethodCallException("You can only get the language item pattern for fields with i18n enabled.");
}
- if ($this->__languageItemPattern === null) {
+ if ($this->languageItemPattern === null) {
throw new \BadMethodCallException("Language item pattern has not been set.");
}
- return $this->__languageItemPattern;
+ return $this->languageItemPattern;
}
/**
return '';
}
- return $this->__value;
+ return $this->value;
}
/**
* @return II18nFormField this field
*/
public function i18n($i18n = true) {
- $this->__i18n = $i18n;
+ $this->i18n = $i18n;
return $this;
}
* @return static this field
*/
public function i18nRequired($i18nRequired = true) {
- $this->__i18nRequired = $i18nRequired;
+ $this->i18nRequired = $i18nRequired;
$this->i18n();
return $this;
* @return bool
*/
public function isI18n() {
- return $this->__i18n;
+ return $this->i18n;
}
/**
* @return bool
*/
public function isI18nRequired() {
- return $this->__i18nRequired;
+ return $this->i18nRequired;
}
/**
throw new \InvalidArgumentException("Given pattern is invalid.");
}
- $this->__languageItemPattern = $pattern;
+ $this->languageItemPattern = $pattern;
return $this;
}
$this->setStringValue($value);
}
else {
- $this->__value = $value;
+ $this->value = $value;
}
}
$value = $this->getDocument()->getRequestData($this->getPrefixedId());
if (is_string($value)) {
- $this->__value = StringUtil::trim($value);
+ $this->value = StringUtil::trim($value);
}
}
* `true` if the value of this field is immutable and `false` otherwise
* @var bool
*/
- protected $__immutable = false;
-
+ protected $immutable = false;
+
/**
* Sets whether the value of this field is immutable and returns this field.
*
* @return static this field
*/
public function immutable($immutable = true) {
- $this->__immutable = $immutable;
+ $this->immutable = $immutable;
return $this;
}
* @return bool
*/
public function isImmutable() {
- return $this->__immutable;
+ return $this->immutable;
}
}
* maximum of the field value
* @var null|number
*/
- protected $__maximum;
+ protected $maximum;
/**
* Returns the maximum of the values of this field or `null` if no maximum
* @return null|number
*/
public function getMaximum() {
- return $this->__maximum;
+ return $this->maximum;
}
/**
}
}
- $this->__maximum = $maximum;
+ $this->maximum = $maximum;
return $this;
}
* maximum length of the field value
* @var null|int
*/
- protected $__maximumLength;
+ protected $maximumLength;
/**
* Returns the maximum length of the values of this field or `null` if no placeholder
* @return null|int
*/
public function getMaximumLength() {
- return $this->__maximumLength;
+ return $this->maximumLength;
}
/**
}
}
- $this->__maximumLength = $maximumLength;
+ $this->maximumLength = $maximumLength;
return $this;
}
* minimum of the field value
* @var null|int
*/
- protected $__minimum;
+ protected $minimum;
/**
* Returns the minimum of the values of this field or `null` if no minimum
* @return null|number
*/
public function getMinimum() {
- return $this->__minimum;
+ return $this->minimum;
}
/**
}
}
- $this->__minimum = $minimum;
+ $this->minimum = $minimum;
return $this;
}
* minimum length of the field value
* @var null|int
*/
- protected $__minimumLength;
+ protected $minimumLength;
/**
* Returns the minimum length of the values of this field or `null` if no placeholder
* @return null|int
*/
public function getMinimumLength() {
- return $this->__minimumLength;
+ return $this->minimumLength;
}
/**
}
}
- $this->__minimumLength = $minimumLength;
+ $this->minimumLength = $minimumLength;
return $this;
}
* maximum number of values that can be selected or set
* @var int
*/
- protected $__maximumMultiples = IMultipleFormField::NO_MAXIMUM_MULTIPLES;
+ protected $maximumMultiples = IMultipleFormField::NO_MAXIMUM_MULTIPLES;
/**
* minimum number of values that can be selected or set
* @var int
*/
- protected $__minimumMultiples = 0;
+ protected $minimumMultiples = 0;
/**
* `true` if this field allows multiple values to be selected or set and `false` otherwise
* @var bool
*/
- protected $__multiple = false;
+ protected $multiple = false;
/**
* Returns `true` if multiple values can be selected or set and returns `false`
* @return bool
*/
public function allowsMultiple() {
- return $this->__multiple;
+ return $this->multiple;
}
/**
* @return int maximum number of values
*/
public function getMaximumMultiples() {
- return $this->__maximumMultiples;
+ return $this->maximumMultiples;
}
/**
* @return int minimum number of values
*/
public function getMinimumMultiples() {
- return $this->__minimumMultiples;
+ return $this->minimumMultiples;
}
/**
}
}
- $this->__maximumMultiples = $maximum;
+ $this->maximumMultiples = $maximum;
return $this;
}
throw new \InvalidArgumentException("The given minimum number of values '{$minimum}' is greater than the set maximum number of values '{$this->getMaximumMultiples()}'.");
}
- $this->__minimumMultiples = $minimum;
+ $this->minimumMultiples = $minimum;
return $this;
}
* @return static this field
*/
public function multiple($multiple = true) {
- $this->__multiple = $multiple;
+ $this->multiple = $multiple;
return $this;
}
* `true` if this field supports `null` as its value and `false` otherwise
* @var bool
*/
- protected $__nullable = false;
+ protected $nullable = false;
/**
* Returns `true` if this field supports `null` as its value and returns `false`
* @return bool
*/
public function isNullable() {
- return $this->__nullable;
+ return $this->nullable;
}
/**
* @return static this node
*/
public function nullable($nullable = true) {
- $this->__nullable = $nullable;
+ $this->nullable = $nullable;
return $this;
}
* object type
* @var null|ObjectType
*/
- protected $__objectType;
+ protected $objectType;
/**
* Returns the object type.
* @throws \BadMethodCallException if object type has not been set
*/
public function getObjectType() {
- if ($this->__objectType === null) {
+ if ($this->objectType === null) {
throw new \BadMethodCallException("Object type has not been set.");
}
- return $this->__objectType;
+ return $this->objectType;
}
/**
* @throws InvalidObjectTypeException if given object type name is invalid
*/
public function objectType($objectType) {
- if ($this->__objectType !== null) {
+ if ($this->objectType !== null) {
throw new \BadMethodCallException("Object type has already been set.");
}
throw new \UnexpectedValueException("Unknown definition name '{$this->getObjectTypeDefinition()}'.");
}
- $this->__objectType = ObjectTypeCache::getInstance()->getObjectTypeByName($this->getObjectTypeDefinition(), $objectType);
- if ($this->__objectType === null) {
+ $this->objectType = ObjectTypeCache::getInstance()->getObjectTypeByName($this->getObjectTypeDefinition(), $objectType);
+ if ($this->objectType === null) {
throw new InvalidObjectTypeException($objectType, $this->getObjectTypeDefinition());
}
* ids of the packages considered for this field
* @var int[]
*/
- protected $__packageIDs = [];
+ protected $packageIDs = [];
/**
* Returns the ids of the packages considered for this field. An empty
* @return int[]
*/
public function getPackageIDs() {
- return $this->__packageIDs;
+ return $this->packageIDs;
}
/**
}
}
- $this->__packageIDs = $packageIDs;
+ $this->packageIDs = $packageIDs;
return $this;
}
* placeholder value of this element
* @var string
*/
- protected $__placeholder;
+ protected $placeholder;
/**
* Returns the placeholder value of this field or `null` if no placeholder has
* @return null|string
*/
public function getPlaceholder() {
- return $this->__placeholder;
+ return $this->placeholder;
}
/**
throw new \InvalidArgumentException("Cannot use variables when unsetting placeholder of field '{$this->getId()}'");
}
- $this->__placeholder = null;
+ $this->placeholder = null;
}
else {
if (!is_string($languageItem)) {
throw new \InvalidArgumentException("Given placeholder language item is no string, " . gettype($languageItem) . " given.");
}
- $this->__placeholder = WCF::getLanguage()->getDynamicVariable($languageItem, $variables);
+ $this->placeholder = WCF::getLanguage()->getDynamicVariable($languageItem, $variables);
}
return $this;
* structured options array used to generate the form field output
* @var null|array
*/
- protected $__nestedOptions;
+ protected $nestedOptions;
/**
* possible options to select
* @var null|array
*/
- protected $__options;
+ protected $options;
/**
* Returns a structured array that can be used to generate the form field output.
throw new \BadMethodCallException("Nested options are not supported.");
}
- return $this->__nestedOptions;
+ return $this->nestedOptions;
}
/**
* @throws \BadMethodCallException if no options have been set
*/
public function getOptions() {
- return $this->__options;
+ return $this->options;
}
/**
*/
public function isAvailable() {
// selections without any possible values are not available
- return !empty($this->__options) && parent::isAvailable();
+ return !empty($this->options) && parent::isAvailable();
}
/**
$options = $dboOptions;
}
- $this->__options = [];
+ $this->options = [];
if ($nestedOptions) {
foreach ($options as $key => &$option) {
if (!is_array($option)) {
if (!is_string($option['value']) && !is_numeric($option['value'])) {
throw new \InvalidArgumentException("Nested option with key '{$key}' contain invalid value of type " . gettype($option['label']) . ".");
}
- else if (isset($this->__options[$option['value']])) {
+ else if (isset($this->options[$option['value']])) {
throw new \InvalidArgumentException("Options values must be unique, but '{$option['value']}' appears at least twice as value.");
}
// save value
- $this->__options[$option['value']] = $option['label'];
+ $this->options[$option['value']] = $option['label'];
// validate depth
if (!is_int($option['depth'])) {
}
unset($option);
- $this->__nestedOptions = $options;
+ $this->nestedOptions = $options;
}
else {
foreach ($options as $value => $label) {
throw new \InvalidArgumentException("Options contain invalid label of type " . gettype($label) . ".");
}
- if (isset($this->__options[$value])) {
+ if (isset($this->options[$value])) {
throw new \InvalidArgumentException("Options values must be unique, but '{$value}' appears at least twice as value.");
}
$label = WCF::getLanguage()->getDynamicVariable($label);
}
- $this->__options[$value] = $label;
+ $this->options[$value] = $label;
}
- // ensure that `$this->__nestedOptions` is always populated
+ // ensure that `$this->nestedOptions` is always populated
// for form field that support nested options
if ($this->supportsNestedOptions()) {
- $this->__nestedOptions = [];
+ $this->nestedOptions = [];
- foreach ($this->__options as $value => $label) {
- $this->__nestedOptions[] = [
+ foreach ($this->options as $value => $label) {
+ $this->nestedOptions[] = [
'depth' => 0,
'label' => $label,
'value' => $value
}
}
- if ($this->__nestedOptions === null) {
- $this->__nestedOptions = [];
+ if ($this->nestedOptions === null) {
+ $this->nestedOptions = [];
}
return $this;
* suffix of this field
* @var null|string
*/
- protected $__suffix;
+ protected $suffix;
/**
* Returns the suffix of this field or `null` if no suffix has been set.
* @return null|string
*/
public function getSuffix() {
- return $this->__suffix;
+ return $this->suffix;
}
/**
throw new \InvalidArgumentException("Cannot use variables when unsetting suffix of field '{$this->getId()}'");
}
- $this->__suffix = null;
+ $this->suffix = null;
}
else {
if (!is_string($languageItem)) {
throw new \InvalidArgumentException("Given suffix language item is no string, " . gettype($languageItem) . " given.");
}
- $this->__suffix = WCF::getLanguage()->getDynamicVariable($languageItem, $variables);
+ $this->suffix = WCF::getLanguage()->getDynamicVariable($languageItem, $variables);
}
return $this;
* identifier used to autosave the field value; if empty, autosave is disabled
* @var string
*/
- protected $__autosaveId = '';
+ protected $autosaveId = '';
/**
* last time the field has been edited; if `0`, the last edit time is unknown
* @var int
*/
- protected $__lastEditTime = 0;
+ protected $lastEditTime = 0;
/**
* input processor containing the wysiwyg text
* @return WysiwygFormField this field
*/
public function autosaveId($autosaveId) {
- $this->__autosaveId = $autosaveId;
+ $this->autosaveId = $autosaveId;
return $this;
}
* @return string
*/
public function getAutosaveId() {
- return $this->__autosaveId;
+ return $this->autosaveId;
}
/**
* @return int
*/
public function getLastEditTime() {
- return $this->__lastEditTime;
+ return $this->lastEditTime;
}
/**
* @return WysiwygFormField this field
*/
public function lastEditTime($lastEditTime) {
- $this->__lastEditTime = $lastEditTime;
+ $this->lastEditTime = $lastEditTime;
return $this;
}
$value = $this->getDocument()->getRequestData($this->getPrefixedId());
if (is_string($value)) {
- $this->__value = StringUtil::trim($value);
+ $this->value = StringUtil::trim($value);
}
}
use TObjectTypeFormField;
/**
- * name of/filter for the name(s) of the shown acl option categories
+ * name of/filter for the name(s) of the shown acl option categories
* @var null|string
*/
- protected $__categoryName;
+ protected $categoryName;
/**
* id of the edited object or `null` if no object is edited
throw new \InvalidArgumentException("Invalid category name given.");
}
- $this->__categoryName = $categoryName;
+ $this->categoryName = $categoryName;
return $this;
}
* @return null|string
*/
public function getCategoryName() {
- return $this->__categoryName;
+ return $this->categoryName;
}
/**
$value = $this->getDocument()->getRequestData($this->getPrefixedId());
if (is_array($value)) {
- $this->__value = $value;
+ $this->value = $value;
}
}
/**
* @inheritDoc
*/
- protected $__value = [];
+ protected $value = [];
/**
* @inheritDoc
*/
public function readValue() {
if ($this->getDocument()->hasRequestData($this->getPrefixedId()) && is_array($this->getDocument()->getRequestData($this->getPrefixedId()))) {
- $this->__value = $this->getDocument()->getRequestData($this->getPrefixedId());
+ $this->value = $this->getDocument()->getRequestData($this->getPrefixedId());
}
}
* node whose availability depends on the value of a field
* @var IFormNode
*/
- protected $__dependentNode;
+ protected $dependentNode;
/**
* field the availability of the node dependents on
* @var IFormField
*/
- protected $__field;
+ protected $field;
/**
* id of the dependency
* @var string
*/
- protected $__id;
+ protected $id;
/**
* name of the template containing the dependency JavaScript code
* @inheritDoc
*/
public function dependentNode(IFormNode $node) {
- $this->__dependentNode = $node;
+ $this->dependentNode = $node;
return $this;
}
* @inheritDoc
*/
public function field(IFormField $field) {
- $this->__field = $field;
+ $this->field = $field;
return $this;
}
* @inheritDoc
*/
public function getDependentNode() {
- if ($this->__dependentNode === null) {
+ if ($this->dependentNode === null) {
throw new \BadMethodCallException("Dependent node has not been set.");
}
- return $this->__dependentNode;
+ return $this->dependentNode;
}
/**
* @inheritDoc
*/
public function getField() {
- if ($this->__field === null) {
+ if ($this->field === null) {
throw new \BadMethodCallException("Field has not been set.");
}
- return $this->__field;
+ return $this->field;
}
/**
* @inheritDoc
*/
public function getId() {
- return $this->__id;
+ return $this->id;
}
/**
throw new \InvalidArgumentException("Invalid id '{$id}' given.");
}
- $this->__id = $id;
+ $this->id = $id;
return $this;
}
* `false`
* @var bool
*/
- protected $__isNegated = false;
+ protected $negate = false;
/**
* possible values the field may have for the dependency to be met
* @var null|array
*/
- protected $__values;
+ protected $values;
/**
* @inheritDoc
* @throws \BadMethodCallException if no values have been set
*/
public function getValues() {
- if ($this->__values === null) {
+ if ($this->values === null) {
throw new \BadMethodCallException("Values have not been set for dependency '{$this->getId()}' on node '{$this->getDependentNode()->getId()}'.");
}
- return $this->__values;
+ return $this->values;
}
/**
* @return bool
*/
public function isNegated() {
- return $this->__isNegated;
+ return $this->negate;
}
/**
* @return static $this this dependency
*/
public function negate($negate = true) {
- $this->__isNegated = $negate;
+ $this->negate = $negate;
return $this;
}
}
}
- $this->__values = $values;
+ $this->values = $values;
return $this;
}
/**
* @inheritDoc
*/
- protected $__value = [];
+ protected $value = [];
/**
* @inheritDoc
*/
public function readValue() {
if ($this->getDocument()->hasRequestData($this->getPrefixedId()) && is_array($this->getDocument()->getRequestData($this->getPrefixedId()))) {
- $this->__value = $this->getDocument()->getRequestData($this->getPrefixedId());
+ $this->value = $this->getDocument()->getRequestData($this->getPrefixedId());
}
else {
- $this->__value = [];
+ $this->value = [];
}
}
/**
* @inheritDoc
*/
- protected $__value = [];
+ protected $value = [];
/**
* names of package installation plugins that support the `application`
*/
public function readValue() {
if ($this->getDocument()->hasRequestData($this->getPrefixedId()) && is_array($this->getDocument()->getRequestData($this->getPrefixedId()))) {
- $this->__value = $this->getDocument()->getRequestData($this->getPrefixedId());
+ $this->value = $this->getDocument()->getRequestData($this->getPrefixedId());
}
else {
- $this->__value = [];
+ $this->value = [];
}
}
/**
* @inheritDoc
*/
- protected $__value = [];
+ protected $value = [];
/**
* @inheritDoc
*/
public function readValue() {
if ($this->getDocument()->hasRequestData($this->getPrefixedId()) && is_array($this->getDocument()->getRequestData($this->getPrefixedId()))) {
- $this->__value = $this->getDocument()->getRequestData($this->getPrefixedId());
+ $this->value = $this->getDocument()->getRequestData($this->getPrefixedId());
}
else {
- $this->__value = [];
+ $this->value = [];
}
}
/**
* @inheritDoc
*/
- protected $__value = [];
+ protected $value = [];
/**
* @inheritDoc
*/
public function readValue() {
if ($this->getDocument()->hasRequestData($this->getPrefixedId()) && is_array($this->getDocument()->getRequestData($this->getPrefixedId()))) {
- $this->__value = $this->getDocument()->getRequestData($this->getPrefixedId());
+ $this->value = $this->getDocument()->getRequestData($this->getPrefixedId());
}
else {
- $this->__value = [];
+ $this->value = [];
}
}
$tags = TagEngine::getInstance()->getObjectTags($this->getObjectType()->objectType, $objectID, $languageIDs);
- $this->__value = [];
+ $this->value = [];
foreach ($tags as $tag) {
- $this->__value[] = $tag->name;
+ $this->value[] = $tag->name;
}
return $this;
$value = $this->getDocument()->getRequestData($this->getPrefixedId());
if (is_array($value)) {
- $this->__value = ArrayUtil::trim($value);
+ $this->value = ArrayUtil::trim($value);
}
}
if (is_string($value)) {
if ($this->allowsMultiple()) {
- $this->__value = ArrayUtil::trim(explode(',', $value));
+ $this->value = ArrayUtil::trim(explode(',', $value));
}
else {
- $this->__value = StringUtil::trim($value);
+ $this->value = StringUtil::trim($value);
}
}
}
$value = $this->getDocument()->getRequestData($this->getPrefixedId());
if (is_string($value)) {
- $this->__value = $value;
+ $this->value = $value;
}
}