src/Plugin/Admin.php
final public function saveParameters($post, $wizard = false)
	{
		$jname = $this->getJname();
		$result = false;
		try {
			if (!empty($jname)) {
				$db = Factory::getDBO();

				if (isset($post['source_url'])) {
					//check for trailing slash in URL, in order for us not to worry about it later
					$post['source_path'] = rtrim($post['source_path'], '/\\');
					$post['source_path'] .= '/';

					//now also check to see that the url starts with http:// or https://
					if (substr($post['source_url'], 0, 7) != 'http://' && substr($post['source_url'], 0, 8) != 'https://') {
						if (substr($post['source_url'], 0, 1) != '/') {
							$post['source_url'] = 'http://' . $post['source_url'];
						}
					}
				}
				if (isset($post['source_path'])) {
					if (!empty($post['source_path'])) {
						$post['source_path'] = rtrim($post['source_path'], '/\\');
						$post['source_path'] .= '/';

						if (!is_dir($post['source_path'])) {
							Framework::raise(LogLevel::WARNING, Text::_('SOURCE_PATH_NOT_FOUND'));
						}
					}
				}

				if ($wizard) {
					//data submitted by the wizard so merge the data with existing params if they do indeed exist

					$query = $db->getQuery(true)
						->select('params')
						->from('#__jfusion')
						->where('name = ' . $db->quote($jname));

					$db->setQuery($query);
					$params = $db->loadResult();
					$params = new Registry($params);

					$existing_params = $params->toArray();
					if (is_array($existing_params)) {
						$post = array_merge($existing_params, $post);
					}
				}

				$data = new Registry($post);
				//set the current parameters in the jfusion table

				$query = $db->getQuery(true)
					->update('#__jfusion')
					->set('params = ' . $db->quote($data->toString()))
					->where('name = ' . $db->quote($jname));

				$db->setQuery($query);

				$db->execute();

				//reset the params instance for this plugin
				Factory::getParams($jname, true);
				$result = true;
			}
		} catch (Exception $e ) {
			//there was an error saving the parameters
			Framework::raise(LogLevel::ERROR, $e, $jname);
		}
		return $result;
	}
final public function saveParameters($post, $wizard = false)
	{
		$jname = $this->getJname();
		$result = false;
		try {
			if (!empty($jname)) {
				$db = Factory::getDBO();

				if (isset($post['source_url'])) {
					//check for trailing slash in URL, in order for us not to worry about it later
					$post['source_path'] = rtrim($post['source_path'], '/\\');
					$post['source_path'] .= '/';

					//now also check to see that the url starts with http:// or https://
					if (substr($post['source_url'], 0, 7) != 'http://' && substr($post['source_url'], 0, 8) != 'https://') {
						if (substr($post['source_url'], 0, 1) != '/') {
							$post['source_url'] = 'http://' . $post['source_url'];
						}
					}
				}
				if (isset($post['source_path'])) {
					if (!empty($post['source_path'])) {
						$post['source_path'] = rtrim($post['source_path'], '/\\');
						$post['source_path'] .= '/';

						if (!is_dir($post['source_path'])) {
							Framework::raise(LogLevel::WARNING, Text::_('SOURCE_PATH_NOT_FOUND'));
						}
					}
				}

				if ($wizard) {
					//data submitted by the wizard so merge the data with existing params if they do indeed exist

					$query = $db->getQuery(true)
						->select('params')
						->from('#__jfusion')
						->where('name = ' . $db->quote($jname));

					$db->setQuery($query);
					$params = $db->loadResult();
					$params = new Registry($params);

					$existing_params = $params->toArray();
					if (is_array($existing_params)) {
						$post = array_merge($existing_params, $post);
					}
				}

				$data = new Registry($post);
				//set the current parameters in the jfusion table

				$query = $db->getQuery(true)
					->update('#__jfusion')
					->set('params = ' . $db->quote($data->toString()))
					->where('name = ' . $db->quote($jname));

				$db->setQuery($query);

				$db->execute();

				//reset the params instance for this plugin
				Factory::getParams($jname, true);
				$result = true;
			}
		} catch (Exception $e ) {
			//there was an error saving the parameters
			Framework::raise(LogLevel::ERROR, $e, $jname);
		}
		return $result;
	}
final public function saveParameters ( $ post , $ wizard = false ) { $ jname = $ this -> getJname ( ) ; $ result = false ; try { if ( ! empty ( $ jname ) ) { $ db = Factory :: getDBO ( ) ; if ( isset ( $ post [ 'source_url' ] ) ) { //check for trailing slash in URL, in order for us not to worry about it later $ post [ 'source_path' ] = rtrim ( $ post [ 'source_path' ] , '/\\' ) ; $ post [ 'source_path' ] .= '/' ; //now also check to see that the url starts with http:// or https:// if ( substr ( $ post [ 'source_url' ] , 0 , 7 ) != 'http://' && substr ( $ post [ 'source_url' ] , 0 , 8 ) != 'https://' ) { if ( substr ( $ post [ 'source_url' ] , 0 , 1 ) != '/' ) { $ post [ 'source_url' ] = 'http://' . $ post [ 'source_url' ] ; } } } if ( isset ( $ post [ 'source_path' ] ) ) { if ( ! empty ( $ post [ 'source_path' ] ) ) { $ post [ 'source_path' ] = rtrim ( $ post [ 'source_path' ] , '/\\' ) ; $ post [ 'source_path' ] .= '/' ; if ( ! is_dir ( $ post [ 'source_path' ] ) ) { Framework :: raise ( LogLevel :: WARNING , Text :: _ ( 'SOURCE_PATH_NOT_FOUND' ) ) ; } } } if ( $ wizard ) { //data submitted by the wizard so merge the data with existing params if they do indeed exist $ query = $ db -> getQuery ( true ) -> select ( 'params' ) -> from ( '#__jfusion' ) -> where ( 'name = ' . $ db -> quote ( $ jname ) ) ; $ db -> setQuery ( $ query ) ; $ params = $ db -> loadResult ( ) ; $ params = new Registry ( $ params ) ; $ existing_params = $ params -> toArray ( ) ; if ( is_array ( $ existing_params ) ) { $ post = array_merge ( $ existing_params , $ post ) ; } } $ data = new Registry ( $ post ) ; //set the current parameters in the jfusion table $ query = $ db -> getQuery ( true ) -> update ( '#__jfusion' ) -> set ( 'params = ' . $ db -> quote ( $ data -> toString ( ) ) ) -> where ( 'name = ' . $ db -> quote ( $ jname ) ) ; $ db -> setQuery ( $ query ) ; $ db -> execute ( ) ; //reset the params instance for this plugin Factory :: getParams ( $ jname , true ) ; $ result = true ; } } catch ( Exception $ e ) { //there was an error saving the parameters Framework :: raise ( LogLevel :: ERROR , $ e , $ jname ) ; } return $ result ; }
Saves the posted JFusion component variables

@param array  $post  Array of JFusion plugin parameters posted to the JFusion component
@param boolean $wizard Notes if function was called by wizardresult();

@return boolean returns true if successful and false if an error occurred
Saves the posted JFusion component variables