Fixed gh-510 so that snippets are imported from github correctly.

This commit is contained in:
Llewellyn van der Merwe 2020-01-05 23:19:20 +02:00
parent f67dbfdd53
commit 68c040eebb
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
4 changed files with 9 additions and 3 deletions

View File

@ -148,7 +148,7 @@ TODO
+ *Version*: 2.10.10 + *Version*: 2.10.10
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **280701** + *Line count*: **280707**
+ *Field count*: **1503** + *Field count*: **1503**
+ *File count*: **1769** + *File count*: **1769**
+ *Folder count*: **280** + *Folder count*: **280**

View File

@ -148,7 +148,7 @@ TODO
+ *Version*: 2.10.10 + *Version*: 2.10.10
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **280701** + *Line count*: **280707**
+ *Field count*: **1503** + *Field count*: **1503**
+ *File count*: **1769** + *File count*: **1769**
+ *Folder count*: **280** + *Folder count*: **280**

View File

@ -4765,6 +4765,7 @@ COM_COMPONENTBUILDER_EQUAL="Equal"
COM_COMPONENTBUILDER_EQUAL_MEANS_THAT_THE_COMMUNITY_PLAN_WITH_THE_SAME_NAME_CATEGORY_AND_TYPE_AND_YOUR_LOCAL_PLAN_WITH_THE_SAME_NAME_CATEGORY_AND_TYPE_HAS_THE_SAME_BCREATIONB_AND_BMODIFIED_DATEB="Equal means that the community plan (with the same name, category and type) and your local plan (with the same name, category and type) has the same <b>creation</b> and <b>modified date</b>." COM_COMPONENTBUILDER_EQUAL_MEANS_THAT_THE_COMMUNITY_PLAN_WITH_THE_SAME_NAME_CATEGORY_AND_TYPE_AND_YOUR_LOCAL_PLAN_WITH_THE_SAME_NAME_CATEGORY_AND_TYPE_HAS_THE_SAME_BCREATIONB_AND_BMODIFIED_DATEB="Equal means that the community plan (with the same name, category and type) and your local plan (with the same name, category and type) has the same <b>creation</b> and <b>modified date</b>."
COM_COMPONENTBUILDER_EQUAL_MEANS_THAT_THE_COMMUNITY_SNIPPET_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE_AND_YOUR_LOCAL_SNIPPET_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE_HAS_THE_SAME_BCREATIONB_AND_BMODIFIED_DATEB="Equal means that the community snippet (with the same name, library and type) and your local snippet (with the same name, library and type) has the same <b>creation</b> and <b>modified date</b>." COM_COMPONENTBUILDER_EQUAL_MEANS_THAT_THE_COMMUNITY_SNIPPET_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE_AND_YOUR_LOCAL_SNIPPET_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE_HAS_THE_SAME_BCREATIONB_AND_BMODIFIED_DATEB="Equal means that the community snippet (with the same name, library and type) and your local snippet (with the same name, library and type) has the same <b>creation</b> and <b>modified date</b>."
COM_COMPONENTBUILDER_ERROR="Error" COM_COMPONENTBUILDER_ERROR="Error"
COM_COMPONENTBUILDER_ERROR_BR_S="Error! <br />%s"
COM_COMPONENTBUILDER_ERROR_THE_PATH_HAS_A_MISMATCH_AND_COULD_THEREFORE_NOT_RETRIEVE_THE_SNIPPET_FROM_GITHUB="Error! The path has a mismatch and could therefore not retrieve the snippet from gitHub!" COM_COMPONENTBUILDER_ERROR_THE_PATH_HAS_A_MISMATCH_AND_COULD_THEREFORE_NOT_RETRIEVE_THE_SNIPPET_FROM_GITHUB="Error! The path has a mismatch and could therefore not retrieve the snippet from gitHub!"
COM_COMPONENTBUILDER_ERROR_THE_SNIPPET_IS_FAULTY_AND_COULD_NOT_BE_SAVED="Error! The snippet is faulty and could not be saved." COM_COMPONENTBUILDER_ERROR_THE_SNIPPET_IS_FAULTY_AND_COULD_NOT_BE_SAVED="Error! The snippet is faulty and could not be saved."
COM_COMPONENTBUILDER_ERROR_YOU_DO_NOT_HAVE_ACCESS_TO_THE_SNIPPETS="Error! You do not have access to the snippets." COM_COMPONENTBUILDER_ERROR_YOU_DO_NOT_HAVE_ACCESS_TO_THE_SNIPPETS="Error! You do not have access to the snippets."

View File

@ -3389,10 +3389,15 @@ class ComponentbuilderModelAjax extends JModelList
// set url // set url
$url = ComponentbuilderHelper::$snippetPath.rawurlencode($base_path); $url = ComponentbuilderHelper::$snippetPath.rawurlencode($base_path);
// get the snippets // get the snippets
if (($snippet = ComponentbuilderHelper::getGithubRepoData('lib_snippet_' . $base_path, $url)) !== false) if (($snippet = ComponentbuilderHelper::getGithubRepoData('lib_snippet_' . $base_path, $url, null, 'array')) !== false)
{ {
return $this->saveSnippet($snippet, $status, $user); return $this->saveSnippet($snippet, $status, $user);
} }
// see if we have any errors from github
if (ComponentbuilderHelper::checkArray(ComponentbuilderHelper::$githubRepoDataErrors))
{
return array('message' => JText::sprintf('COM_COMPONENTBUILDER_ERROR_BR_S', implode('<br />', ComponentbuilderHelper::$githubRepoDataErrors)), 'status' => 'danger');
}
return array('message' => JText::_('COM_COMPONENTBUILDER_ERROR_THE_PATH_HAS_A_MISMATCH_AND_COULD_THEREFORE_NOT_RETRIEVE_THE_SNIPPET_FROM_GITHUB'), 'status' => 'danger'); return array('message' => JText::_('COM_COMPONENTBUILDER_ERROR_THE_PATH_HAS_A_MISMATCH_AND_COULD_THEREFORE_NOT_RETRIEVE_THE_SNIPPET_FROM_GITHUB'), 'status' => 'danger');
} }
return array('message' => JText::_('COM_COMPONENTBUILDER_ERROR_YOU_DO_NOT_HAVE_ACCESS_TO_THE_SNIPPETS'), 'status' => 'danger'); return array('message' => JText::_('COM_COMPONENTBUILDER_ERROR_YOU_DO_NOT_HAVE_ACCESS_TO_THE_SNIPPETS'), 'status' => 'danger');