Commit bf4e4d96 by pupi1985

Added remote metadata.json file support to plugins and themes

parent fc1014f2
......@@ -52,4 +52,15 @@ class Q2A_Util_Metadata
return array();
}
/**
* Fetch metadata information from an URL
* @param string $url URL linking to a metadata.json file
* @return array The metadata fetched from the file
*/
public function fetchFromUrl($url)
{
$content = qa_retrieve_url($url);
return $this->getArrayFromJson($content);
}
}
\ No newline at end of file
......@@ -22,12 +22,12 @@
require_once QA_INCLUDE_DIR.'app/admin.php';
$uri = qa_post_text('uri');
$type = (qa_post_text('type') === 'Theme' ? 'Theme' : 'Plugin');
$version = qa_post_text('version');
$metadata = qa_addon_metadata(qa_retrieve_url($uri), $type);
$metadataUtil = new Q2A_Util_Metadata();
$metadata = $metadataUtil->fetchFromUrl($uri);
if (strlen(@$metadata['version'])) {
if (strcmp($metadata['version'], $version)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment