/** * @param null $url */ function save($url = null) { if (!JSession::checkToken('post')) { $this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error'); $this->setRedirect(KunenaRoute::_($this->baseurl, false)); return; } $properties = $this->config->getProperties(); //Todo: fix depricated value foreach (JRequest::get('post', JREQUEST_ALLOWHTML) as $postsetting => $postvalue) { if (\Joomla\String\String::strpos($postsetting, 'cfg_') === 0) { //remove cfg_ and force lower case if (is_array($postvalue)) { $postvalue = implode(',', $postvalue); } $postname = \Joomla\String\String::strtolower(\Joomla\String\String::substr($postsetting, 4)); // No matter what got posted, we only store config parameters defined // in the config class. Anything else posted gets ignored. if (array_key_exists($postname, $properties)) { $this->config->set($postname, $postvalue); } } } $this->config->save(); $this->app->enqueueMessage(JText::_('COM_KUNENA_CONFIGSAVED')); if (empty($url)) { $this->setRedirect(KunenaRoute::_($this->kunenabaseurl, false)); return; } $this->setRedirect(KunenaRoute::_($url, false)); }
/** * Return part of a string without break words. * * <code> * $offset = 0; * $length = 25; * $content = "If you can dream it, you can do it." * * $string = new Prism\String(); * $string->substr($offset, $length); * * echo $string; * </code> * * @param integer $offset * @param integer $length * * @return self */ public function substr($offset, $length) { $pos = JString::strpos($this->content, ' ', $length); $this->content = JString::substr($this->content, $offset, $pos); return $this; }