Futher improved the JCB package manager, so to be more stable and give enough information about selected packages
This commit is contained in:
@@ -2042,57 +2042,47 @@ abstract class ComponentbuilderHelper
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static $pkOwnerSearch = array(
|
||||
'company' => 'COM_COMPONENTBUILDER_EMCOMPANYEM_BSB',
|
||||
'owner' => 'COM_COMPONENTBUILDER_EMOWNEREM_BSB',
|
||||
'website' => 'COM_COMPONENTBUILDER_EMWEBSITEEM_BSB',
|
||||
'email' => 'COM_COMPONENTBUILDER_EMEMAILEM_BSB',
|
||||
'license' => 'COM_COMPONENTBUILDER_EMLICENSEEM_BSB',
|
||||
'copyright' => 'COM_COMPONENTBUILDER_EMCOPYRIGHTEM_BSB'
|
||||
);
|
||||
|
||||
/**
|
||||
* get the JCB package owner details display
|
||||
**/
|
||||
public static function getPackageOwnerDetailsDisplay(&$info, $trust = false)
|
||||
{
|
||||
$hasOwner = false;
|
||||
$ownerDetails = '<h2 class="module-title nav-header">' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS') . '</h2>';
|
||||
$ownerDetails .= '<ul>';
|
||||
if (isset($info['getKeyFrom']['company']) && self::checkString($info['getKeyFrom']['company']))
|
||||
// load the list items
|
||||
foreach (self::$pkOwnerSearch as $key => $li)
|
||||
{
|
||||
$owner = $info['getKeyFrom']['company'];
|
||||
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMCOMPANYEM_BSB', $info['getKeyFrom']['company']) . '</li>';
|
||||
}
|
||||
// add value only if set
|
||||
if (isset($info['getKeyFrom']['owner']) && self::checkString($info['getKeyFrom']['owner']))
|
||||
{
|
||||
if (!isset($owner))
|
||||
if ($value = self::getPackageOwnerValue($key, $info))
|
||||
{
|
||||
$owner = $info['getKeyFrom']['owner'];
|
||||
$ownerDetails .= '<li>' . JText::sprintf($li, $value) . '</li>';
|
||||
// check if we have a owner/source name
|
||||
if (('owner' === $key || 'company' === $key) && !$hasOwner)
|
||||
{
|
||||
$hasOwner = true;
|
||||
$owner = $value;
|
||||
}
|
||||
}
|
||||
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMOWNEREM_BSB', $info['getKeyFrom']['owner']) . '</li>';
|
||||
}
|
||||
// add value only if set
|
||||
if (isset($info['getKeyFrom']['website']) && self::checkString($info['getKeyFrom']['website']))
|
||||
{
|
||||
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMWEBSITEEM_BSB', $info['getKeyFrom']['website']) . '</li>';
|
||||
}
|
||||
// add value only if set
|
||||
if (isset($info['getKeyFrom']['email']) && self::checkString($info['getKeyFrom']['email']))
|
||||
{
|
||||
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMEMAILEM_BSB', $info['getKeyFrom']['email']) . '</li>';
|
||||
}
|
||||
// add value only if set
|
||||
if (isset($info['getKeyFrom']['license']) && self::checkString($info['getKeyFrom']['license']))
|
||||
{
|
||||
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMLICENSEEM_BSB', $info['getKeyFrom']['license']) . '</li>';
|
||||
}
|
||||
// add value only if set
|
||||
if (isset($info['getKeyFrom']['copyright']) && self::checkString($info['getKeyFrom']['copyright']))
|
||||
{
|
||||
$ownerDetails .= '<li>' . JText::sprintf('COM_COMPONENTBUILDER_EMCOPYRIGHTEM_BSB', $info['getKeyFrom']['copyright']) . '</li>';
|
||||
}
|
||||
}
|
||||
$ownerDetails .= '</ul>';
|
||||
|
||||
// provide some details to how the user can get a key
|
||||
if (isset($info['getKeyFrom']['buy_link']) && self::checkString($info['getKeyFrom']['buy_link']))
|
||||
if ($hasOwner && isset($info['getKeyFrom']['buy_link']) && self::checkString($info['getKeyFrom']['buy_link']))
|
||||
{
|
||||
$ownerDetails .= '<hr />';
|
||||
$ownerDetails .= JText::sprintf('COM_COMPONENTBUILDER_BGET_THE_KEY_FROMB_A_CLASSBTN_BTNPRIMARY_HREFS_TARGET_BLANK_TITLEGET_A_KEY_FROM_SSA', $info['getKeyFrom']['buy_link'], $owner, $owner);
|
||||
}
|
||||
// add more custom links
|
||||
elseif (isset($info['getKeyFrom']['buy_links']) && self::checkArray($info['getKeyFrom']['buy_links']))
|
||||
elseif ($hasOwner && isset($info['getKeyFrom']['buy_links']) && self::checkArray($info['getKeyFrom']['buy_links']))
|
||||
{
|
||||
$buttons = array();
|
||||
foreach ($info['getKeyFrom']['buy_links'] as $keyName => $link)
|
||||
@@ -2102,25 +2092,57 @@ abstract class ComponentbuilderHelper
|
||||
$ownerDetails .= '<hr />';
|
||||
$ownerDetails .= implode('<br />', $buttons);
|
||||
}
|
||||
|
||||
// return the owner details
|
||||
if (!isset($owner) && !$trust)
|
||||
if (!$hasOwner)
|
||||
{
|
||||
$ownerDetails = '<h2 style="color: #922924;">' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS_NOT_FOUND') . '</h2>';
|
||||
$ownerDetails .= '<p style="color: #922924;">' . JText::_('COM_COMPONENTBUILDER_BE_CAUTIOUS_DO_NOT_CONTINUE_UNLESS_YOU_TRUST_THE_ORIGIN_OF_THIS_PACKAGE') . '</p>';
|
||||
}
|
||||
elseif (!isset($owner) && $trust)
|
||||
{
|
||||
$ownerDetails = '';
|
||||
$ownerDetails = '<h2>' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS_NOT_FOUND') . '</h2>';
|
||||
if (!$trust)
|
||||
{
|
||||
$ownerDetails .= '<p style="color: #922924;">' . JText::_('COM_COMPONENTBUILDER_BE_CAUTIOUS_DO_NOT_CONTINUE_UNLESS_YOU_TRUST_THE_ORIGIN_OF_THIS_PACKAGE') . '</p>';
|
||||
}
|
||||
}
|
||||
return $ownerDetails;
|
||||
}
|
||||
|
||||
public static function getPackageOwnerValue($key, &$info)
|
||||
{
|
||||
$source = (isset($info['source']) && isset($info['source'][$key])) ? 'source' : ((isset($info['getKeyFrom']) && isset($info['getKeyFrom'][$key])) ? 'getKeyFrom' : false);
|
||||
if ($source && self::checkString($info[$source][$key]))
|
||||
{
|
||||
return $info[$source][$key];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the JCB package component key status
|
||||
**/
|
||||
public static function getPackageComponentsKeyStatus(&$info)
|
||||
{
|
||||
// check the package key status
|
||||
if (!isset($info['key']))
|
||||
{
|
||||
if (isset($info['getKeyFrom']) && isset($info['getKeyFrom']['owner']))
|
||||
{
|
||||
// this just confirms it for older packages
|
||||
$info['key'] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// this just confirms it for older packages
|
||||
$info['key'] = false;
|
||||
}
|
||||
}
|
||||
return $info['key'];
|
||||
}
|
||||
|
||||
/**
|
||||
* get the JCB package component details display
|
||||
**/
|
||||
public static function getPackageComponentsDetailsDisplay(&$info)
|
||||
{
|
||||
// check if these components need a key
|
||||
$needKey = self::getPackageComponentsKeyStatus($info);
|
||||
if (isset($info['name']) && self::checkArray($info['name']))
|
||||
{
|
||||
$cAmount = count((array) $info['name']);
|
||||
@@ -2141,6 +2163,14 @@ abstract class ComponentbuilderHelper
|
||||
$display[] = '<div class="well well-small ' . $class2 . '">';
|
||||
$display[] = '<h2 class="module-title nav-header">';
|
||||
$display[] = JText::sprintf('COM_COMPONENTBUILDER_BSB_EMCOMPONENT_DETAILSEM', $value . ' v' . $info['component_version'][$key]);
|
||||
if ($needKey)
|
||||
{
|
||||
$display[] = ' - <em>' . JText::sprintf('COM_COMPONENTBUILDER_PAIDLOCKED') . '</em>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$display[] = ' - <em>' . JText::sprintf('COM_COMPONENTBUILDER_FREEOPEN') . '</em>';
|
||||
}
|
||||
$display[] = '</h2><p>';
|
||||
$display[] = $info['short_description'][$key];
|
||||
$display[] = '</p><ul><li>';
|
||||
@@ -2171,7 +2201,7 @@ abstract class ComponentbuilderHelper
|
||||
}
|
||||
return implode("\n",$display);
|
||||
}
|
||||
return '<div>'.JText::_('COM_COMPONENTBUILDER_COPYRIGHT').'</div>';
|
||||
return '<div>'.JText::_('COM_COMPONENTBUILDER_NO_COMPONENT_DETAILS_FOUND_SO_IT_IS_NOT_SAFE_TO_CONTINUE').'</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -23,14 +23,15 @@ COM_COMPONENTBUILDER_EMAUTHOREM_BSB="<em>Author</em>: <b>%s</b>"
|
||||
COM_COMPONENTBUILDER_EMCOMPANYEM_BSB="<em>Company:</em> <b>%s</b>"
|
||||
COM_COMPONENTBUILDER_EMCOMPANY_NAMEEM_BSB="<em>Company Name</em>: <b>%s</b>"
|
||||
COM_COMPONENTBUILDER_EMCOPYRIGHTEM_BSB="<em>Copyright:</em> <b>%s</b>"
|
||||
COM_COMPONENTBUILDER_EMEMAILEM_BSB="<em>Email:</em> <b>%s</b>"
|
||||
COM_COMPONENTBUILDER_EMEMAILEM_BSB="<em>Email</em>: <b>%s</b>"
|
||||
COM_COMPONENTBUILDER_EMLICENSEEM_BSB="<em>License:</em> <b>%s</b>"
|
||||
COM_COMPONENTBUILDER_EMOWNEREM_BSB="<em>Owner:</em> <b>%s</b>"
|
||||
COM_COMPONENTBUILDER_EMWEBSITEEM_BSB="<em>Website:</em> <b>%s</b>"
|
||||
COM_COMPONENTBUILDER_EMWEBSITEEM_BSB="<em>Website</em>: <b>%s</b>"
|
||||
COM_COMPONENTBUILDER_ERROR="Error!"
|
||||
COM_COMPONENTBUILDER_EXAMPLE="Example"
|
||||
COM_COMPONENTBUILDER_FILE="File"
|
||||
COM_COMPONENTBUILDER_FOLDER="Folder"
|
||||
COM_COMPONENTBUILDER_FREEOPEN="Free/Open"
|
||||
COM_COMPONENTBUILDER_GET_THE_KEY_FROM_BSB_FOR_A_CLASSBTN_BTNPRIMARY_HREFS_TARGET_BLANK_TITLEGET_A_KEY_FROM_SSA="Get the key from <b>%s</b> for <a class="btn btn-primary" href="%s" target="_blank" title="get a key from %s">%s</a>"
|
||||
COM_COMPONENTBUILDER_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BCOMPONENTBUILDERB_WILL_NOT_FUNCTION_CORRECTLYP="<h2>Curl Not Found!</h2><p>Please setup curl on your system, or <b>componentbuilder</b> will not function correctly!</p>"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDER_BACKUP_KEY="Joomla Component Builder - Backup Key"
|
||||
@@ -42,12 +43,14 @@ COM_COMPONENTBUILDER_LOCAL="Local"
|
||||
COM_COMPONENTBUILDER_NEW="New"
|
||||
COM_COMPONENTBUILDER_NOT_FOUND_OR_ACCESS_DENIED="Not found or access denied!"
|
||||
COM_COMPONENTBUILDER_NO_ACCESS_GRANTED="No Access Granted!"
|
||||
COM_COMPONENTBUILDER_NO_COMPONENT_DETAILS_FOUND_SO_IT_IS_NOT_SAFE_TO_CONTINUE="No component details found, so it is not safe to continue!"
|
||||
COM_COMPONENTBUILDER_NO_KEYS_WERE_FOUND_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY="No keys were found. To add an export key simply open the component, go to the tab called settings, bottom right there is a field called Export Key."
|
||||
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_DETAILS_NOT_FOUND="Package owner details not found!"
|
||||
COM_COMPONENTBUILDER_PACKAGE_OWNER_NOT_SET="Package Owner Not Set"
|
||||
COM_COMPONENTBUILDER_PAIDLOCKED="Paid/Locked"
|
||||
COM_COMPONENTBUILDER_PROPERTY="Property"
|
||||
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>."
|
||||
|
Reference in New Issue
Block a user