Fix gh-249 that caused the admin views to break in PHP 7.2 We also added VDM package import to the import of JCB packages
This commit is contained in:
@@ -52,6 +52,100 @@ abstract class ComponentbuilderHelper
|
||||
**/
|
||||
public static $snippetPath = 'https://raw.githubusercontent.com/vdm-io/Joomla-Component-Builder-Snippets/master/';
|
||||
public static $snippetsPath = 'https://api.github.com/repos/vdm-io/Joomla-Component-Builder-Snippets/git/trees/master';
|
||||
|
||||
/**
|
||||
* The packages paths
|
||||
**/
|
||||
public static $jcbGithubPackagesUrl = "https://api.github.com/repos/vdm-io/JCB-Packages/git/trees/master";
|
||||
public static $jcbGithubPackageUrl = "https://github.com/vdm-io/JCB-Packages/raw/master/";
|
||||
|
||||
// not needed at this time (maybe latter)
|
||||
public static $accessToken = "";
|
||||
|
||||
/**
|
||||
* get the github repo file list
|
||||
*
|
||||
* @return array on success
|
||||
*
|
||||
*/
|
||||
public static function getGithubRepoFileList($type, $target)
|
||||
{
|
||||
// get the current Packages (public)
|
||||
if (!$repoData = self::get($type))
|
||||
{
|
||||
if (self::urlExists($target))
|
||||
{
|
||||
$repoData = self::getFileContents($target);
|
||||
if (self::checkJson($repoData))
|
||||
{
|
||||
$test = json_decode($repoData);
|
||||
if (self::checkObject($test) && isset($test->tree) && self::checkArray($test->tree) )
|
||||
{
|
||||
// remember to set it
|
||||
self::set($type, $repoData);
|
||||
}
|
||||
// check if we have error message from github
|
||||
elseif ($errorMessage = self::githubErrorHandeler(array('error' => null), $test))
|
||||
{
|
||||
if (self::checkString($errorMessage['error']))
|
||||
{
|
||||
JFactory::getApplication()->enqueueMessage($errorMessage['error'], 'Error');
|
||||
}
|
||||
$repoData = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$repoData = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_EXIST', $target), 'Error');
|
||||
}
|
||||
}
|
||||
// check if we could find packages
|
||||
if (isset($repoData) && self::checkJson($repoData))
|
||||
{
|
||||
$repoData = json_decode($repoData);
|
||||
if (self::checkObject($repoData) && isset($repoData->tree) && self::checkArray($repoData->tree) )
|
||||
{
|
||||
return $repoData->tree;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the github error messages
|
||||
*
|
||||
* @return array of errors on success
|
||||
*
|
||||
*/
|
||||
protected static function githubErrorHandeler($message, &$github)
|
||||
{
|
||||
if (self::checkObject($github) && isset($github->message) && self::checkString($github->message))
|
||||
{
|
||||
// set the message
|
||||
$errorMessage = $github->message;
|
||||
// add the documentation URL
|
||||
if (isset($github->documentation_url) && self::checkString($github->documentation_url))
|
||||
{
|
||||
$errorMessage = $errorMessage.'<br />'.$github->documentation_url;
|
||||
}
|
||||
// check the message
|
||||
if (strpos($errorMessage, 'Authenticated') !== false)
|
||||
{
|
||||
// add little more help if it is an access token issue
|
||||
$errorMessage = JText::sprintf('COM_COMPONENTBUILDER_SBR_YOU_CAN_ADD_AN_BACCESS_TOKENB_TO_GETBIBLE_GLOBAL_OPTIONS_TO_MAKE_AUTHENTICATED_REQUESTS_AN_ACCESS_TOKEN_WITH_ONLY_PUBLIC_ACCESS_WILL_DO', $errorMessage);
|
||||
}
|
||||
// set error notice
|
||||
$message['error'] = $errorMessage;
|
||||
// we have error message
|
||||
return $message;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* The array of constant paths
|
||||
|
@@ -34,6 +34,7 @@ COM_COMPONENTBUILDER_OWNER_DETAILS_WAS_SET="Owner details was set"
|
||||
COM_COMPONENTBUILDER_OWNER_S="Owner: %s"
|
||||
COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS="Package Owner Details"
|
||||
COM_COMPONENTBUILDER_PACKAGE_OWNER_NOT_SET="Package Owner Not Set"
|
||||
COM_COMPONENTBUILDER_SBR_YOU_CAN_ADD_AN_BACCESS_TOKENB_TO_GETBIBLE_GLOBAL_OPTIONS_TO_MAKE_AUTHENTICATED_REQUESTS_AN_ACCESS_TOKEN_WITH_ONLY_PUBLIC_ACCESS_WILL_DO="%s<br />You can add an <b>access token<b/> to getBible global options to make authenticated requests. An access token with only public access will do."
|
||||
COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_BIMPORT_PROCESSB_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_BDOES_NOTB_HAVE_THE_KEY_THEY_CAN_SEE_BWHERE_TO_GET_ITB="Since the owner details are displayed during <b>import process</b> before adding the key, this way if the user/dev <b>does not</b> have the key they can see <b>where to get it</b>."
|
||||
COM_COMPONENTBUILDER_SINCE_THE_OWNER_DETAILS_ARE_DISPLAYED_DURING_IMPORT_PROCESS_BEFORE_ADDING_THE_KEY_THIS_WAY_IF_THE_USERDEV_DOES_NOT_HAVE_THE_KEY_THEY_CAN_SEE_WHERE_TO_GET_IT="Since the owner details are displayed during import process before adding the key, this way if the user/dev does not have the key they can see where to get it."
|
||||
COM_COMPONENTBUILDER_THAT_MEANS_ANYONE_WHO_HAS_THIS_PACKAGE_CAN_INSTALL_IT_INTO_JCB_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_BSETTINGSB_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_BEXPORT_KEYB="That means anyone who has this package can install it into JCB. To add an export key simply open the component, go to the tab called <b>settings</b>, bottom right there is a field called <b>Export Key</b>."
|
||||
@@ -50,6 +51,7 @@ COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_S="The package key is: %s"
|
||||
COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FIELD_COULD_NOT_BE_LOADED_FOR_BSB_SERVER="The private key field could not be loaded for <b>%s</b> server!"
|
||||
COM_COMPONENTBUILDER_THE_PRIVATE_KEY_FILE_COULD_NOT_BE_LOADEDFOUND_FOR_BSB_SERVER="The private key file could not be loaded/found for <b>%s</b> server!"
|
||||
COM_COMPONENTBUILDER_THE_SERVER_DETAILS_FOR_BID_SB_COULD_NOT_BE_RETRIEVED="The server details for <b>(ID: %s)</b> could not be retrieved!"
|
||||
COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_EXIST="The url (%s) set to retrieve the packages does not exist!"
|
||||
COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY="This package has no key."
|
||||
COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_BJCB_GLOBAL_OPTIONSB_GO_TO_THE_BCOMPANYB_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE="To change the package owner defaults. Open the <b>JCB Global Options</b>, go to the <b>Company</b> tab and add the correct company details there."
|
||||
COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE="To change the package owner defaults. Open the JCB Global Options, go to the Company tab and add the correct company details there."
|
||||
|
Reference in New Issue
Block a user