Keeping naming consistency resolved gh-265. Started adding the needed features for the new translation improvment gh-261

This commit is contained in:
Llewellyn van der Merwe 2018-04-15 22:21:34 +02:00
parent 4e7d4af1d3
commit dfff74989e
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
11 changed files with 181 additions and 26 deletions

View File

@ -126,11 +126,11 @@ Component Builder is mapped as a component in itself on my local development env
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](http://joomlacomponentbuilder.com)
+ *First Build*: 30th April, 2015
+ *Last Build*: 14th April, 2018
+ *Last Build*: 15th April, 2018
+ *Version*: 2.7.5
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+ *Line count*: **182437**
+ *Line count*: **182585**
+ *Field count*: **1012**
+ *File count*: **1199**
+ *Folder count*: **193**

View File

@ -126,11 +126,11 @@ Component Builder is mapped as a component in itself on my local development env
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](http://joomlacomponentbuilder.com)
+ *First Build*: 30th April, 2015
+ *Last Build*: 14th April, 2018
+ *Last Build*: 15th April, 2018
+ *Version*: 2.7.5
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
+ *Line count*: **182437**
+ *Line count*: **182585**
+ *Field count*: **1012**
+ *File count*: **1199**
+ *Folder count*: **193**

View File

@ -232,8 +232,8 @@
<action name="help_document.import" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_IMPORT" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_IMPORT_DESC" />
<action name="help_document.submenu" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_SUBMENU" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_SUBMENU_DESC" />
<action name="joomla_component.backup" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BACKUP_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BACKUP_BUTTON_ACCESS_DESC" />
<action name="joomla_component.export_components" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_COMPONENTS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_COMPONENTS_BUTTON_ACCESS_DESC" />
<action name="joomla_component.import_components" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_COMPONENTS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_COMPONENTS_BUTTON_ACCESS_DESC" />
<action name="joomla_component.export_jcb_packages" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_JCB_PACKAGES_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_JCB_PACKAGES_BUTTON_ACCESS_DESC" />
<action name="joomla_component.import_jcb_packages" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_JCB_PACKAGES_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_JCB_PACKAGES_BUTTON_ACCESS_DESC" />
<action name="joomla_component.access" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_ACCESS" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_ACCESS_DESC" />
<action name="joomla_component.batch" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_BATCH_USE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_BATCH_USE_DESC" />
<action name="joomla_component.create" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_CREATE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_CREATE_DESC" />
@ -247,6 +247,7 @@
<action name="joomla_component.edit.state" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_STATE" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_STATE_DESC" />
<action name="joomla_component.version" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_EDIT_VERSION_DESC" />
<action name="joomla_component.submenu" title="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU_DESC" />
<action name="language.build" title="COM_COMPONENTBUILDER_LANGUAGE_BUILD_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_LANGUAGE_BUILD_BUTTON_ACCESS_DESC" />
<action name="language_translation.access" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_ACCESS" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_ACCESS_DESC" />
<action name="language_translation.batch" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_BATCH_USE" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_BATCH_USE_DESC" />
<action name="language_translation.create" title="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_CREATE" description="COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_CREATE_DESC" />

View File

@ -107,5 +107,31 @@ class ComponentbuilderControllerLanguages extends JControllerAdmin
$message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED');
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=languages', false), $message, 'error');
return;
}
}
public function buildLanguages()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// check if user has the right
$user = JFactory::getUser();
if($user->authorise('core.create', 'com_componentbuilder'))
{
// get the model
$model = $this->getModel('languages');
if ($model->buildLanguages())
{
// set success message
$message = '<h1>'.JText::_('COM_COMPONENTBUILDER_IMPORT_SUCCESS').'</h1>';
$message .= '<p>'.JText::_('COM_COMPONENTBUILDER_ALL_THE_LANGUAGES_FOUND_IN_JOOMLA_WERE_SUCCESSFULLY_IMPORTED').'</p>';
// set redirect
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=languages', false);
$this->setRedirect($redirect_url, $message);
}
}
// set redirect
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=languages', false);
$this->setRedirect($redirect_url);
return false;
}
}

View File

@ -894,6 +894,7 @@ COM_COMPONENTBUILDER_ALL="All"
COM_COMPONENTBUILDER_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER="All is good, please check again latter."
COM_COMPONENTBUILDER_ALL_IS_GOOD_THERE_IS_NO_NOTICE_AT_THIS_TIME="All is good, there is no notice at this time."
COM_COMPONENTBUILDER_ALL_OF_THESE_PACKAGES_ARE_A_FULLY_DEVELOPEDMAPPED_COMPONENTS_FOR_JCB_THEY_CAN_BE_SEEN_AS_DEMO_CONTENT_OR_BASE_IMAGES_FROM_WHICH_TO_START_YOUR_PROJECTBR_ALWAYS_MAKE_SURE_YOU_ARE_ON_THE_LATEST_VERSION_OF_JCB_BEFORE_IMPORTING_ANY_OF_THESE_PACKAGES_SHOULD_ANY_OF_THEM_FAIL_TO_IMPORT_A_S_PLEASE_LET_US_KNOWA="All of these packages are a fully developed/mapped components for JCB. They can be seen as demo content, or base images from which to start your project.<br />Always make sure you are on the latest version of JCB before importing any of these packages, should any of them fail to import <a %s >please let us know</a>."
COM_COMPONENTBUILDER_ALL_THE_LANGUAGES_FOUND_IN_JOOMLA_WERE_SUCCESSFULLY_IMPORTED="All the languages found in Joomla were successfully imported."
COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE="All unsaved work on this page will be lost, are you sure you want to continue?"
COM_COMPONENTBUILDER_ALWAYS_ADD="Always Add"
COM_COMPONENTBUILDER_ALWAYS_INSURE_THAT_YOU_HAVE_YOUR_LOCAL_COMPONENTS_BACKED_UP_BY_MAKING_AN_EXPORT_OF_ALL_YOUR_LOCAL_COMPONENTS_BEFORE_IMPORTING_ANY_NEW_COMPONENTS_SMALLMAKE_BSUREB_TO_MOVE_THIS_ZIPPED_BACKUP_PACKAGE_OUT_OF_THE_TMP_FOLDER_BEFORE_DOING_AN_IMPORTSMALLBR_IF_YOU_ARE_IMPORTING_A_PACKAGE_OF_A_THREERD_PARTY_JCB_PACKAGE_DEVELOPER_BMAKE_SURE_IT_IS_A_REPUTABLE_JCB_PACKAGE_DEVELOPERSB="Always insure that you have your local components backed up, by making an export of all your local components before importing any new components. <small>(Make <b>SURE</b> to move this zipped backup package out of the tmp folder before doing an import)</small><br />If you are importing a package of a 3rd party JCB package developer, <b>make sure it is a reputable JCB package developers!</b>"
@ -939,6 +940,7 @@ COM_COMPONENTBUILDER_BSB_EMCOMPONENT_DETAILSEM="<b>%s</b> <em>component details<
COM_COMPONENTBUILDER_BSB_HAS_BEEN_IMPORTED="<b>%s</b> has been imported!"
COM_COMPONENTBUILDER_BSB_HAS_BEEN_UPDATED="<b>%s</b> has been updated!"
COM_COMPONENTBUILDER_BSB_WAS_FOUND="<b>%s</b> was found!"
COM_COMPONENTBUILDER_BUILD="Build"
COM_COMPONENTBUILDER_BUILDIN="Build-in"
COM_COMPONENTBUILDER_BULK="Bulk"
COM_COMPONENTBUILDER_BULK_GET_ALL_NEW_SNIPPETS="Bulk Get All New Snippets"
@ -3582,11 +3584,11 @@ COM_COMPONENTBUILDER_EXACT_LENGTH_ONLY_FOUR_TEXT_FIELD="Exact Length (only 4 tex
COM_COMPONENTBUILDER_EXAMPLE="Example"
COM_COMPONENTBUILDER_EXPORTIMPORT_DATA="Export/Import Data"
COM_COMPONENTBUILDER_EXPORT_COMPLETED="Export Completed!"
COM_COMPONENTBUILDER_EXPORT_COMPONENTS="Export Components"
COM_COMPONENTBUILDER_EXPORT_DATA="Export Data"
COM_COMPONENTBUILDER_EXPORT_DATA_DESC=" Allows users in this group to export data."
COM_COMPONENTBUILDER_EXPORT_FAILED="Export Failed"
COM_COMPONENTBUILDER_EXPORT_FAILED_PLEASE_TRY_AGAIN_LATTER="Export failed, please try again latter!"
COM_COMPONENTBUILDER_EXPORT_JCB_PACKAGES="Export JCB Packages"
COM_COMPONENTBUILDER_EXTRA_PROPERTIES_LIKE_LISTCLASS_ESCAPE_DISPLAY_VALIDATEBR_SMALLHERE_YOU_CAN_SET_THE_EXTRA_PROPERTIES_FOR_THIS_FIELDSMALL="Extra properties like (listclass, escape, display, validate)<br /><small>Here you can set the extra properties for this field</small>"
COM_COMPONENTBUILDER_FIELD="Field"
COM_COMPONENTBUILDER_FIELDS="Fields"
@ -4123,7 +4125,6 @@ COM_COMPONENTBUILDER_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_
COM_COMPONENTBUILDER_HTWODATA_IS_CORRUPTHTWOTHIS_COULD_BE_DUE_TO_BROKEN_PACKAGE="<h2>Data is corrupt!</h2>This could be due to broken package!"
COM_COMPONENTBUILDER_HTWODATA_IS_CORRUPTHTWOTHIS_COULD_BE_DUE_TO_KEY_ERROR_OR_BROKEN_PACKAGE="<h2>Data is corrupt!</h2>This could be due to key error, or broken package!"
COM_COMPONENTBUILDER_ICON="Icon"
COM_COMPONENTBUILDER_IMPORT_COMPONENTS="Import Components"
COM_COMPONENTBUILDER_IMPORT_CONTINUE="Continue"
COM_COMPONENTBUILDER_IMPORT_DATA="Import Data"
COM_COMPONENTBUILDER_IMPORT_DATA_DESC=" Allows users in this group to import data."
@ -4136,6 +4137,7 @@ COM_COMPONENTBUILDER_IMPORT_FROM_UPLOAD="Upload"
COM_COMPONENTBUILDER_IMPORT_FROM_URL="URL"
COM_COMPONENTBUILDER_IMPORT_GET_BOTTON="Get File"
COM_COMPONENTBUILDER_IMPORT_IGNORE_COLUMN="-- Ignore This Column --"
COM_COMPONENTBUILDER_IMPORT_JCB_PACKAGES="Import JCB Packages"
COM_COMPONENTBUILDER_IMPORT_LINK_FILE_TO_TABLE_COLUMNS="Link File to Table Columns"
COM_COMPONENTBUILDER_IMPORT_MSG_DOES_NOT_HAVE_A_VALID_FILE_TYPE="Does not have a valid file type."
COM_COMPONENTBUILDER_IMPORT_MSG_ENTER_A_URL="Please enter a url."
@ -4372,8 +4374,8 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_BUY_LINK_DESCRIPTION="Enter link wh
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_BUY_LINK_HINT="http://www.example.com/buy-keys"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_BUY_LINK_LABEL="Buy Link<br /><small>(to get key)</small>"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_BUY_LINK_MESSAGE="Error! Please add link here."
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_COMPONENTS_BUTTON_ACCESS="Joomla Component Export Components Button Access"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_COMPONENTS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the export components button."
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_JCB_PACKAGES_BUTTON_ACCESS="Joomla Component Export JCB Packages Button Access"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_JCB_PACKAGES_BUTTON_ACCESS_DESC=" Allows the users in this group to access the export jcb packages button."
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_KEY="Export Key"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_KEY_DESCRIPTION="The key used to lock the data during export."
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_KEY_HINT="Export Key Here"
@ -4389,8 +4391,8 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ID="Id"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMAGE="Image"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMAGE_DESCRIPTION="The component image (product box) for the dashboard and install page, must be 300px X 300px."
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMAGE_LABEL="Component Image"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_COMPONENTS_BUTTON_ACCESS="Joomla Component Import Components Button Access"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_COMPONENTS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the import components button."
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_JCB_PACKAGES_BUTTON_ACCESS="Joomla Component Import JCB Packages Button Access"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_JCB_PACKAGES_BUTTON_ACCESS_DESC=" Allows the users in this group to access the import jcb packages button."
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JAVASCRIPT="Javascript"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JAVASCRIPT_DESCRIPTION="Add your JavaScript here! [Do not add the script tags]"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_JAVASCRIPT_HINT="// JavaScript for the entire back-end"
@ -4696,6 +4698,8 @@ COM_COMPONENTBUILDER_LANGUAGES_N_ITEMS_UNPUBLISHED="%s Languages unpublished."
COM_COMPONENTBUILDER_LANGUAGES_N_ITEMS_UNPUBLISHED_1="%s Language unpublished."
COM_COMPONENTBUILDER_LANGUAGES_SUBMENU="Languages Submenu"
COM_COMPONENTBUILDER_LANGUAGES_SUBMENU_DESC="Allows the users in this group to update the submenu of the language"
COM_COMPONENTBUILDER_LANGUAGE_BUILD_BUTTON_ACCESS="Language Build Button Access"
COM_COMPONENTBUILDER_LANGUAGE_BUILD_BUTTON_ACCESS_DESC=" Allows the users in this group to access the build button."
COM_COMPONENTBUILDER_LANGUAGE_CREATED_BY_DESC="The user that created this Language."
COM_COMPONENTBUILDER_LANGUAGE_CREATED_BY_LABEL="Created By"
COM_COMPONENTBUILDER_LANGUAGE_CREATED_DATE_DESC="The date this Language was created."
@ -5340,6 +5344,7 @@ COM_COMPONENTBUILDER_NO_FILES_LINKED="No Files Linked"
COM_COMPONENTBUILDER_NO_FOUND="No Found"
COM_COMPONENTBUILDER_NO_ITEM_FOUND="No Item Found"
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_NO_LANGUAGES_UPDATE_SERVER_FOUND="No Languages Update server found."
COM_COMPONENTBUILDER_NO_NEED_TO_GET_IT_SINCE_IT_IS_ALREADY_IN_SYNC_WITH_YOUR_LOCAL_VERSION="No need to get it since it is already in sync with your local version"
COM_COMPONENTBUILDER_NO_RESULTS_MATCH="No results match"
COM_COMPONENTBUILDER_NO_SNIPPETS_WERE_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN="No snippets were selected, please make a selection and try again!"

View File

@ -480,10 +480,10 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU="Joomla Components Submenu"
COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_SUBMENU_DESC="Allows the users in this group to update the submenu of the joomla component"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BACKUP_BUTTON_ACCESS="Joomla Component Backup Button Access"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BACKUP_BUTTON_ACCESS_DESC=" Allows the users in this group to access the backup button."
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_COMPONENTS_BUTTON_ACCESS="Joomla Component Export Components Button Access"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_COMPONENTS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the export components button."
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_COMPONENTS_BUTTON_ACCESS="Joomla Component Import Components Button Access"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_COMPONENTS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the import components button."
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_JCB_PACKAGES_BUTTON_ACCESS="Joomla Component Export JCB Packages Button Access"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EXPORT_JCB_PACKAGES_BUTTON_ACCESS_DESC=" Allows the users in this group to access the export jcb packages button."
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_JCB_PACKAGES_BUTTON_ACCESS="Joomla Component Import JCB Packages Button Access"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_IMPORT_JCB_PACKAGES_BUTTON_ACCESS_DESC=" Allows the users in this group to access the import jcb packages button."
COM_COMPONENTBUILDER_LANGUAGES_ACCESS="Languages Access"
COM_COMPONENTBUILDER_LANGUAGES_ACCESS_DESC="Allows the users in this group to access access languages"
COM_COMPONENTBUILDER_LANGUAGES_BATCH_USE="Languages Batch Use"
@ -506,6 +506,8 @@ COM_COMPONENTBUILDER_LANGUAGES_IMPORT="Languages Import"
COM_COMPONENTBUILDER_LANGUAGES_IMPORT_DESC="Allows the users in this group to import import languages"
COM_COMPONENTBUILDER_LANGUAGES_SUBMENU="Languages Submenu"
COM_COMPONENTBUILDER_LANGUAGES_SUBMENU_DESC="Allows the users in this group to update the submenu of the language"
COM_COMPONENTBUILDER_LANGUAGE_BUILD_BUTTON_ACCESS="Language Build Button Access"
COM_COMPONENTBUILDER_LANGUAGE_BUILD_BUTTON_ACCESS_DESC=" Allows the users in this group to access the build button."
COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_ACCESS="Language Translations Access"
COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_ACCESS_DESC="Allows the users in this group to access access language translations"
COM_COMPONENTBUILDER_LANGUAGE_TRANSLATIONS_BATCH_USE="Language Translations Batch Use"

View File

@ -50,6 +50,122 @@ class ComponentbuilderModelLanguages extends JModelList
}
parent::__construct($config);
}
/**
* Load all the languages found in Joomla into JCB
*
* @since 2.7.5
*
* @return bool true on success
*/
public function buildLanguages()
{
if ($languages = $this->getLanguages())
{
// make sure we have an array
if (ComponentbuilderHelper::checkArray($languages))
{
// get the model
$model = ComponentbuilderHelper::getModel('language');
foreach ($languages as $language)
{
// only load it is a package
if ('package' === $language->type)
{
// build array to store/update
$tmp = array();
$tmp['id'] = 0;
$tmp['name'] = (string) $language->name;
$tmp['langtag'] = (string) str_replace('pkg_', '', $language->element);
// check if already set
if ($id = ComponentbuilderHelper::getVar('language', $tmp['langtag'], 'langtag', 'id'))
{
$tmp['id'] = (int) $id;
}
// save update the language in the database
$model->save($tmp);
}
}
return true;
}
}
return false;
}
/**
* Gets an array of objects from the updatesite.
*
* @return object[] An array of results.
*
* @since 2.7.5
* @throws RuntimeException
*/
protected function getLanguages()
{
$updateSite = $this->getUpdateSite();
$http = new JHttp;
try
{
$response = $http->get($updateSite);
}
catch (RuntimeException $e)
{
$response = null;
}
if ($response === null || $response->code !== 200)
{
JFactory::getApplication()->enqueueMessage(JText::_('COM_COMPONENTBUILDER_NO_LANGUAGES_UPDATE_SERVER_FOUND'), 'warning');
return;
}
$updateSiteXML = simplexml_load_string($response->body);
$languages = array();
foreach ($updateSiteXML->extension as $extension)
{
$language = new stdClass;
foreach ($extension->attributes() as $key => $value)
{
$language->$key = (string) $value;
}
$languages[$language->name] = $language;
}
usort($languages, function($a, $b)
{
return strcmp($a->name, $b->name);
});
return $languages;
}
/**
* Get the Update Site
*
* @since 2.7.5
*
* @return string The URL of the Accredited Languagepack Updatesite XML
*/
private function getUpdateSite()
{
$db = $this->getDbo();
$query = $db->getQuery(true)
->select($db->qn('us.location'))
->from($db->qn('#__extensions', 'e'))
->where($db->qn('e.type') . ' = ' . $db->q('package'))
->where($db->qn('e.element') . ' = ' . $db->q('pkg_en-GB'))
->where($db->qn('e.client_id') . ' = 0')
->join('LEFT', $db->qn('#__update_sites_extensions', 'use') . ' ON ' . $db->qn('use.extension_id') . ' = ' . $db->qn('e.extension_id'))
->join('LEFT', $db->qn('#__update_sites', 'us') . ' ON ' . $db->qn('us.update_site_id') . ' = ' . $db->qn('use.update_site_id'));
return $db->setQuery($query)->loadResult();
}
/**

File diff suppressed because one or more lines are too long

View File

@ -134,10 +134,10 @@ class ComponentbuilderViewJoomla_components extends JViewLegacy
$dhtml = $layout->render(array('title' => $title));
$bar->appendButton('Custom', $dhtml, 'batch');
}
if ($this->user->authorise('joomla_component.export_components', 'com_componentbuilder'))
if ($this->user->authorise('joomla_component.export_jcb_packages', 'com_componentbuilder'))
{
// add Export Components button.
JToolBarHelper::custom('joomla_components.smartExport', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_COMPONENTS', false);
// add Export JCB Packages button.
JToolBarHelper::custom('joomla_components.smartExport', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_JCB_PACKAGES', false);
}
if ($this->user->authorise('joomla_component.backup', 'com_componentbuilder'))
{
@ -159,10 +159,10 @@ class ComponentbuilderViewJoomla_components extends JViewLegacy
JToolBarHelper::custom('joomla_components.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true);
}
}
if ($this->user->authorise('joomla_component.import_components', 'com_componentbuilder'))
if ($this->user->authorise('joomla_component.import_jcb_packages', 'com_componentbuilder'))
{
// add Import Components button.
JToolBarHelper::custom('joomla_components.smartImport', 'upload', '', 'COM_COMPONENTBUILDER_IMPORT_COMPONENTS', false);
// add Import JCB Packages button.
JToolBarHelper::custom('joomla_components.smartImport', 'upload', '', 'COM_COMPONENTBUILDER_IMPORT_JCB_PACKAGES', false);
}
if ($this->canDo->get('core.import') && $this->canDo->get('joomla_component.import'))

View File

@ -148,6 +148,11 @@ class ComponentbuilderViewLanguages extends JViewLegacy
{
JToolBarHelper::custom('languages.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true);
}
}
if ($this->user->authorise('language.build', 'com_componentbuilder'))
{
// add Build button.
JToolBarHelper::custom('languages.buildLanguages', 'joomla', '', 'COM_COMPONENTBUILDER_BUILD', false);
}
if ($this->canDo->get('core.import') && $this->canDo->get('language.import'))

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name>
<creationDate>14th April, 2018</creationDate>
<creationDate>15th April, 2018</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://joomlacomponentbuilder.com</authorUrl>