public function supportI18n() {
return $this->supportI18n;
}
+
+ /**
+ * @see \wcf\system\option\IOptionType::compare()
+ */
+ public function compare() {
+ return 0;
+ }
}
public function getConditionData(Option $option, $newValue) {
return $newValue;
}
+
+ /**
+ * @see \wcf\system\option\IOptionType::compare()
+ */
+ public function compare($value1, $value2) {
+ if ($value1 == $value2) {
+ return 0;
+ }
+
+ return ($value1 === true) ? 1 : -1;
+ }
}
throw new UserInputException($option->optionName, 'validationFailed');
}
}
+
+ /**
+ * @see \wcf\system\option\IOptionType::compare()
+ */
+ public function compare($value1, $value2) {
+ if ($value1 == $value2) {
+ return 0;
+ }
+
+ return (strtotime($value1) > strtotime($value2)) ? 1 : -1;
+ }
}
$value = FileUtil::formatFileSize($value);
return parent::getFormElement($option, $value);
}
+
+ /**
+ * @see \wcf\system\option\IOptionType::compare()
+ */
+ public function compare($value1, $value2) {
+ if ($value1 == $value2) {
+ return 0;
+ }
+
+ return ($value1 > $value2) ? 1 : -1;
+ }
}
$newValue = str_replace(WCF::getLanguage()->get('wcf.global.decimalPoint'), '.', $newValue);
return floatval($newValue);
}
+
+ /**
+ * @see \wcf\system\option\IOptionType::compare()
+ */
+ public function compare($value1, $value2) {
+ if ($value1 == $value2) {
+ return 0;
+ }
+
+ return ($value1 > $value2) ? 1 : -1;
+ }
}
* @return boolean
*/
public function supportI18n();
+
+ /**
+ * Compares two values and returns a PHP-like comparison result.
+ *
+ * $value1 < $value2 => -1
+ * $value1 == $value2 => 0
+ * $value1 > $value2 => 1
+ *
+ *
+ * @param mixed $value1
+ * @param mixed $value2
+ * @return integer
+ */
+ public function compare($value1, $value2);
}
throw new UserInputException($option->optionName, 'tooHigh');
}
}
+
+ /**
+ * @see \wcf\system\option\IOptionType::compare()
+ */
+ public function compare($value1, $value2) {
+ if ($value1 == $value2) {
+ return 0;
+ }
+
+ return ($value1 > $value2) ? 1 : -1;
+ }
}
return $newValue;
}
+
+ /**
+ * @see \wcf\system\option\IOptionType::compare()
+ */
+ public function compare($value1, $value2) {
+ $value1 = explode("\n", StringUtil::unifyNewlines($value1));
+ $value2 = explode("\n", StringUtil::unifyNewlines($value2));
+
+ // check if value1 contains more elements than value2
+ $diff = array_diff($value1, $value2);
+ if (!empty($diff)) {
+ return 1;
+ }
+
+ // check if value1 contains less elements than value2
+ $diff = array_diff($value2, $value1);
+ if (!empty($diff)) {
+ return -1;
+ }
+
+ // both lists are equal
+ return 0;
+ }
}
}
}
}
+
+ /**
+ * @see \wcf\system\option\IOptionType::compare()
+ */
+ public function compare($value1, $value2) {
+ $value1 = explode(',', $value1);
+ $value2 = explode(',', $value2);
+
+ // handle special 'all' value
+ if (in_array('all', $value1)) {
+ if (in_array('all', $value2)) {
+ return 0;
+ }
+ else {
+ return 1;
+ }
+ }
+ else if (in_array('all', $value2)) {
+ return -1;
+ }
+
+ // check if value1 contains more BBCodes than value2
+ $diff = array_diff($value1, $value2);
+ if (!empty($diff)) {
+ return 1;
+ }
+
+ // check if value1 contains less BBCodes than value2
+ $diff = array_diff($value2, $value1);
+ if (!empty($diff)) {
+ return -1;
+ }
+
+ // both lists of BBCodes are equal
+ return 0;
+ }
}
return parent::merge($defaultValue, $groupValue);
}
}
+
+ /**
+ * @see \wcf\system\option\IOptionType::compare()
+ */
+ public function compare($value1, $value2) {
+ if ($value1 == $value2) {
+ return 0;
+ }
+
+ if ($value1 == -1) {
+ return 1;
+ }
+ else if ($value2 == -1) {
+ return -1;
+ }
+
+ return parent::compare($value1, $value2);
+ }
}
return min($defaultValue, $groupValue);
}
+
+ /**
+ * @see \wcf\system\option\IOptionType::compare()
+ */
+ public function compare($value1, $value2) {
+ if ($value1 == $value2) {
+ return 0;
+ }
+
+ if ($value1 == -1) {
+ return 1;
+ }
+ else if ($value2 == -1) {
+ return -1;
+ }
+
+ return ($value1 < $value2) ? 1 : -1;
+ }
}
return $groupValue;
}
+
+ /**
+ * @see \wcf\system\option\IOptionType::compare()
+ */
+ public function compare($value1, $value2) {
+ if ($value1 == $value2) {
+ return 0;
+ }
+
+ return ($value1 < $value2) ? 1 : -1;
+ }
}
return implode(',', array_unique(array_merge($defaultValue, $groupValue)));
}
+
+ /**
+ * @see \wcf\system\option\IOptionType::compare()
+ */
+ public function compare($value1, $value2) {
+ $value1 = explode(',', $value1);
+ $value2 = explode(',', $value2);
+
+ // check if value1 contains more elements than value2
+ $diff = array_diff($value1, $value2);
+ if (!empty($diff)) {
+ return 1;
+ }
+
+ // check if value1 contains less elements than value2
+ $diff = array_diff($value2, $value1);
+ if (!empty($diff)) {
+ return -1;
+ }
+
+ // both lists are equal
+ return 0;
+ }
}