Example #1
0
 /**
  * @param $name
  *
  * @return string
  */
 public static function get($name)
 {
     if (!self::$cache_loaded[$name]) {
         $obj = new self($name);
         self::$cache[$name] = $obj->getValue();
         self::$cache_loaded[$name] = true;
     }
     return self::$cache[$name];
 }
Example #2
0
 public static function getValueFor($code)
 {
     if (!isset(self::$_values[$code])) {
         $config = new self();
         $config->find($code, "code");
         self::$_values[$code] = $config->getValue();
     }
     return self::$_values[$code];
 }
Example #3
0
 /**
  * Gets the array value from the provided value DOM element
  * @param DOMElement $element The DOM element of the value
  * @return array
  * @throws zibo\library\xmlrpc\exception\XmlRpcException when the provided element does not contain a data element
  */
 private function parseArrayElement(DOMElement $element)
 {
     $dataElement = $element->childNodes->item(0);
     if (!$dataElement) {
         throw new XmlRpcException('Invalid array value, no data found');
     }
     $valueElements = $dataElement->childNodes;
     $result = array();
     foreach ($valueElements as $valueElement) {
         $parameter = new self($valueElement);
         $result[] = $parameter->getValue();
     }
     return $result;
 }
Example #4
0
 /**
  * Subtracts the given value from this value.
  *
  * @param float|int|string|BigNumber $value The value to subtract.
  * @return BigNumber
  */
 public function subtract($value)
 {
     if (!$value instanceof self) {
         $value = new self($value, $this->getScale(), false);
     }
     $newValue = bcsub($this->getValue(), $value->getValue(), $this->getScale());
     return $this->assignValue($newValue);
 }
 /**
  * Check if extradebug mode is activate
  */
 static function isExtradebugActive()
 {
     $fConfig = new self();
     return $fConfig->getValue('extradebug');
 }
Example #6
0
 public function fetchValueByShortname($shortname, $organisation_id = 1)
 {
     global $db;
     $query = "SELECT * FROM `settings` \n                    WHERE `shortname` = ? AND \n                    (`organisation_id` = ? OR `organisation_id` IS NULL)\n                    ORDER BY CASE WHEN `organisation_id` IS NULL THEN 1 ELSE 0 END, `organisation_id` ASC";
     $result = $db->GetRow($query, array($shortname, $organisation_id));
     if ($result) {
         $self = new self($result);
         return $self->getValue();
     } else {
         return false;
     }
 }
Example #7
0
 public static function selectbox($fieldName, $dataOptions, $args = '')
 {
     if (empty($dataOptions) || !is_array($dataOptions)) {
         return false;
     }
     $Field = new self($fieldName, $args);
     $value = $Field->getValue();
     $name = $Field->getName();
     $html_options = $Field->getHtmlOptions();
     if (!empty($html_options['multiple'])) {
         $name .= '[]';
     }
     $options[] = '<select name="' . $name . '" ' . $html_options . '>';
     foreach ($dataOptions as $optionKey => $optionValue) {
         if ($value == $optionKey) {
             $selected = 'selected="selected"';
         } elseif (is_array($value) and in_array($optionKey, $value)) {
             $selected = 'selected="selected"';
         } else {
             $selected = '';
         }
         $options[] = '<option value="' . $optionKey . '" ' . $selected . '>' . $optionValue . '</option>';
     }
     $options[] = '</select>';
     $separator = empty($args['separator']) ? '' : $args['separator'];
     return implode($separator, $options);
 }