protected function _getEmail() { if (!($email = SysParam::instance()->getParam('contact_email', 'char'))) { $email = constant('ADMINISTRATOR_EMAIL'); } return $email; }
static public function instance() { if (!self :: $_instance) self :: $_instance = new SysParam(); return self :: $_instance; }
protected function _validPerform($request, $response) { $data = $this->dataspace->export(); $sys_param = SysParam::instance(); foreach ($this->params_type as $param_name => $param_type) { try { $sys_param->saveParam($param_name, $param_type, $data[$param_name]); } catch (SQLException $e) { throw $e; } catch (LimbException $e) { Debug::writeWarning('couldnt save sys parameter', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('param_name' => $param_name, 'param_type' => $param_type)); } } $request->setStatus(Request::STATUS_FORM_SUBMITTED); }
function testGetWrongTypeValue() { $sp =& SysParam :: instance(); $number = 123.053; $sp->saveParam('param_1', 'float', $number); try { $this->assertNull($sp->getParam('param_1', 'blabla')); } catch(LimbException $e) { $this->assertEqual($e->getMessage(), 'trying to get undefined type in sys_param'); $this->assertEqual($e->getAdditionalParams(), array ( 'type' => 'blabla', 'param' => 'param_1', ) ); } }
function getParam($name, $type) { $inst =& SysParam :: instance(); echo $inst->getParam($name, $type); }
public function getParam($name, $type) { echo SysParam :: instance()->getParam($name, $type); }