fetchpluginlist method
This commit is contained in:
		
				
					committed by
					
						
						Steffen Schröder
					
				
			
			
				
	
			
			
			
						parent
						
							df65f9f2cc
						
					
				
				
					commit
					03da64decb
				
			@@ -36,6 +36,10 @@ class PluginManager {
 | 
			
		||||
 | 
			
		||||
		$this->pluginMenu = new PluginMenu($maniaControl);
 | 
			
		||||
		$this->maniaControl->configurator->addMenu($this->pluginMenu);
 | 
			
		||||
 | 
			
		||||
		/*$this->fetchPluginList(function ($data) {
 | 
			
		||||
			var_dump($data);
 | 
			
		||||
		});*/
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
@@ -339,4 +343,23 @@ class PluginManager {
 | 
			
		||||
		$pluginStatement->close();
 | 
			
		||||
		return $active;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * Fetch the plugin list of the ManiaControl Website
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param      $function
 | 
			
		||||
	 * @param bool $ignoreVersion
 | 
			
		||||
	 */
 | 
			
		||||
	private function fetchPluginList($function) {
 | 
			
		||||
		$url = ManiaControl::URL_WEBSERVICE . 'plugins';
 | 
			
		||||
 | 
			
		||||
		$this->maniaControl->fileReader->loadFile($url, function ($dataJson, $error) use (&$function) {
 | 
			
		||||
			$data = json_decode($dataJson);
 | 
			
		||||
			if (!$data || !isset($data[0])) {
 | 
			
		||||
				return;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			call_user_func($function, $data[0]);
 | 
			
		||||
		});
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user