/** * Get a configuration value. * * Config Value names should be CamelCase */ public static function get($name, $default = null) { if (array_key_exists($name, self::$cache)) { return self::$cache[$name]; } if (array_key_exists('application.' . $name, self::$cache)) { return self::$cache['application.' . $name]; } if (defined('BACKEND_WITH_DATABASE') && BACKEND_WITH_DATABASE) { $value = Value::get($name, null); //Retrieved from the DB if (!is_null($value)) { self::$cache[$name] = $value; return $value; } } $name = explode('.', $name); if (count($name) == 1) { array_unshift($name, 'application'); } //Check the config file $result = Backend::getConfig($name, $default); self::$cache[implode('.', $name)] = $result; return $result; }
public function html_display($result) { $result = parent::html_display($result); if (Value::get(get_class($this) . '_commented', true) && Component::isActive('Comment')) { if ($result instanceof DBObject) { $comments = Comment::getComments($result->getMeta('table'), $result->getMeta('id')); Backend::addContent(Render::renderFile('comments.tpl.php', array('comment_list' => $comments))); if (Permission::check('create', 'comment')) { $values = array('foreign_table' => $result->getMeta('table'), 'foreign_id' => $result->getMeta('id')); Backend::addContent(Render::renderFile('comment.add.tpl.php', $values)); } } } return $result; }
/** * @covers Classes\Value\Value::set * @todo Implement testSet(). */ public function testSet_1() { $this->object->set('One'); $this->assertEquals('One', $this->object->get()); }
public static function checkParameters($parameters) { $parameters = parent::checkParameters($parameters); if (Controller::$action == 'display') { $parameters[1] = array_key_exists(1, $parameters) ? $parameters[1] : 0; $parameters[2] = array_key_exists(2, $parameters) ? $parameters[2] : Value::get('TagContentListLength', 10); } else { if (in_array(Controller::$action, array('display'))) { if (!isset(Controller::$parameters[0])) { $parameters[1] = 0; } if (!isset(Controller::$parameters[2])) { $parameters[2] = Value::get('list_length', 5); } } } return $parameters; }
/** * @covers Classes\Value\Value::set * @todo Implement testSet(). */ public function testSet_1() { $this->object->set(5.5); $this->assertEquals(5.5, $this->object->get()); }
/** * Get value * * @return integer */ public function get() { return (int) parent::get(); }