Spade
Mini Shell
| Directory:~$ /home/lmsyaran/public_html/joomla4/ |
| [Home] [System Details] [Kill Me] |
joomla/joomla.php000064400000015405151160402250010020 0ustar00<?php
/**
* @package Joomla.Plugin
* @subpackage Extension.Joomla
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Joomla! master extension plugin.
*
* @since 1.6
*/
class PlgExtensionJoomla extends JPlugin
{
/**
* @var integer Extension Identifier
* @since 1.6
*/
private $eid = 0;
/**
* @var JInstaller Installer object
* @since 1.6
*/
private $installer = null;
/**
* Load the language file on instantiation.
*
* @var boolean
* @since 3.1
*/
protected $autoloadLanguage = true;
/**
* Adds an update site to the table if it doesn't exist.
*
* @param string $name The friendly name of the site
* @param string $type The type of site (e.g. collection or
extension)
* @param string $location The URI for the site
* @param boolean $enabled If this site is enabled
*
* @return void
*
* @since 1.6
*/
private function addUpdateSite($name, $type, $location, $enabled)
{
$db = JFactory::getDbo();
// Look if the location is used already; doesn't matter what type
you can't have two types at the same address, doesn't make sense
$query = $db->getQuery(true)
->select('update_site_id')
->from('#__update_sites')
->where('location = ' . $db->quote($location));
$db->setQuery($query);
$update_site_id = (int) $db->loadResult();
// If it doesn't exist, add it!
if (!$update_site_id)
{
$query->clear()
->insert('#__update_sites')
->columns(array($db->quoteName('name'),
$db->quoteName('type'),
$db->quoteName('location'),
$db->quoteName('enabled')))
->values($db->quote($name) . ', ' .
$db->quote($type) . ', ' . $db->quote($location) . ',
' . (int) $enabled);
$db->setQuery($query);
if ($db->execute())
{
// Link up this extension to the update site
$update_site_id = $db->insertid();
}
}
// Check if it has an update site id (creation might have failed)
if ($update_site_id)
{
// Look for an update site entry that exists
$query->clear()
->select('update_site_id')
->from('#__update_sites_extensions')
->where('update_site_id = ' . $update_site_id)
->where('extension_id = ' . $this->eid);
$db->setQuery($query);
$tmpid = (int) $db->loadResult();
if (!$tmpid)
{
// Link this extension to the relevant update site
$query->clear()
->insert('#__update_sites_extensions')
->columns(array($db->quoteName('update_site_id'),
$db->quoteName('extension_id')))
->values($update_site_id . ', ' . $this->eid);
$db->setQuery($query);
$db->execute();
}
}
}
/**
* Handle post extension install update sites
*
* @param JInstaller $installer Installer object
* @param integer $eid Extension Identifier
*
* @return void
*
* @since 1.6
*/
public function onExtensionAfterInstall($installer, $eid)
{
if ($eid)
{
$this->installer = $installer;
$this->eid = $eid;
// After an install we only need to do update sites
$this->processUpdateSites();
}
}
/**
* Handle extension uninstall
*
* @param JInstaller $installer Installer instance
* @param integer $eid Extension id
* @param boolean $result Installation result
*
* @return void
*
* @since 1.6
*/
public function onExtensionAfterUninstall($installer, $eid, $result)
{
// If we have a valid extension ID and the extension was successfully
uninstalled wipe out any
// update sites for it
if ($eid && $result)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->delete('#__update_sites_extensions')
->where('extension_id = ' . $eid);
$db->setQuery($query);
$db->execute();
// Delete any unused update sites
$query->clear()
->select('update_site_id')
->from('#__update_sites_extensions');
$db->setQuery($query);
$results = $db->loadColumn();
if (is_array($results))
{
// So we need to delete the update sites and their associated updates
$updatesite_delete = $db->getQuery(true);
$updatesite_delete->delete('#__update_sites');
$updatesite_query = $db->getQuery(true);
$updatesite_query->select('update_site_id')
->from('#__update_sites');
// If we get results back then we can exclude them
if (count($results))
{
$updatesite_query->where('update_site_id NOT IN (' .
implode(',', $results) . ')');
$updatesite_delete->where('update_site_id NOT IN (' .
implode(',', $results) . ')');
}
// So let's find what update sites we're about to nuke and
remove their associated extensions
$db->setQuery($updatesite_query);
$update_sites_pending_delete = $db->loadColumn();
if (is_array($update_sites_pending_delete) &&
count($update_sites_pending_delete))
{
// Nuke any pending updates with this site before we delete it
// TODO: investigate alternative of using a query after the delete
below with a query and not in like above
$query->clear()
->delete('#__updates')
->where('update_site_id IN (' . implode(',',
$update_sites_pending_delete) . ')');
$db->setQuery($query);
$db->execute();
}
// Note: this might wipe out the entire table if there are no
extensions linked
$db->setQuery($updatesite_delete);
$db->execute();
}
// Last but not least we wipe out any pending updates for the extension
$query->clear()
->delete('#__updates')
->where('extension_id = ' . $eid);
$db->setQuery($query);
$db->execute();
}
}
/**
* After update of an extension
*
* @param JInstaller $installer Installer object
* @param integer $eid Extension identifier
*
* @return void
*
* @since 1.6
*/
public function onExtensionAfterUpdate($installer, $eid)
{
if ($eid)
{
$this->installer = $installer;
$this->eid = $eid;
// Handle any update sites
$this->processUpdateSites();
}
}
/**
* Processes the list of update sites for an extension.
*
* @return void
*
* @since 1.6
*/
private function processUpdateSites()
{
$manifest = $this->installer->getManifest();
$updateservers = $manifest->updateservers;
if ($updateservers)
{
$children = $updateservers->children();
}
else
{
$children = array();
}
if (count($children))
{
foreach ($children as $child)
{
$attrs = $child->attributes();
$this->addUpdateSite($attrs['name'],
$attrs['type'], trim($child), true);
}
}
else
{
$data = trim((string) $updateservers);
if ($data !== '')
{
// We have a single entry in the update server line, let us presume
this is an extension line
$this->addUpdateSite(JText::_('PLG_EXTENSION_JOOMLA_UNKNOWN_SITE'),
'extension', $data, true);
}
}
}
}
joomla/joomla.xml000064400000001461151160402250010026 0ustar00<?xml
version="1.0" encoding="utf-8"?>
<extension version="3.1" type="plugin"
group="extension" method="upgrade">
<name>plg_extension_joomla</name>
<author>Joomla! Project</author>
<creationDate>May 2010</creationDate>
<copyright>Copyright (C) 2005 - 2020 Open Source Matters. All rights
reserved.</copyright>
<license>GNU General Public License version 2 or later; see
LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.0.0</version>
<description>PLG_EXTENSION_JOOMLA_XML_DESCRIPTION</description>
<files>
<filename plugin="joomla">joomla.php</filename>
</files>
<languages>
<language
tag="en-GB">en-GB.plg_extension_joomla.ini</language>
<language
tag="en-GB">en-GB.plg_extension_joomla.sys.ini</language>
</languages>
</extension>
reservation/reservation.php000064400000001334151160402250012154
0ustar00<?php
/**
* @package Joomla.Plugin
* @subpackage Extension.Joomla
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Joomla! master extension plugin.
*
* @since 1.6
*/
class PlgExtensionReservation extends JPlugin
{
public function onExtensionAfterSave($option, $data)
{
$app= JFactory::getApplication();
$component= $app->input->get('component');
if ($component != 'com_reservation')
return false;
echo '<pre>';
var_dump('handle users groups');
echo '<pre>';
exit();
}
}
reservation/reservation.xml000064400000001264151160402250012167
0ustar00<?xml version="1.0" encoding="utf-8"?>
<extension version="1.0" type="plugin"
group="extension" method="upgrade">
<name>plg_extension_as_reservation</name>
<author>farhad shahbazi</author>
<creationDate>esf 99</creationDate>
<copyright>Copyright (C) 2005 - 2020 Open Source Matters. All rights
reserved.</copyright>
<license>GNU General Public License version 2 or later; see
LICENSE.txt</license>
<authorEmail>farhad.shahbazi0010@gmail.com</authorEmail>
<authorUrl>www.lmskaran.ir</authorUrl>
<version>1.0.0</version>
<description>PLG_EXTENSION_AS_RESERVATION_XML_DESCRIPTION</description>
<files>
<filename
plugin="reservation">reservation.php</filename>
</files>
</extension>
componentbuilderprivacycompiler/componentbuilderprivacycompiler.php000064400000113575151160402250022471
0ustar00<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR .
'/components/com_componentbuilder/helpers/componentbuilder.php');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Registry\Registry;
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use Joomla\CMS\Component\ComponentHelper;
/**
* Extension - Componentbuilder Privacy Compiler plugin.
*
* @package ComponentbuilderPrivacyCompiler
* @since 1.2.4
*/
class PlgExtensionComponentbuilderPrivacyCompiler extends CMSPlugin
{
/**
* Affects constructor behavior. If true, language files will be loaded
automatically.
*
* @var boolean
* @since 1.0.0
*/
protected $autoloadLanguage = true;
/**
* The language string builder
*
* @var array
*/
protected $languageArray = [];
/**
* Global switch to see if component have need of privacy plugin to be
loaded.
*
* @var boolean
* @since 1.0.0
*/
protected $loadPrivacy = false;
/**
* The Views Linked to Joomla Users
*
* @var array
* @since 1.0.0
*/
protected $activeViews = [];
/**
* The Views permission fields
*
* @var array
* @since 1.0.0
*/
protected $permissionFields = [];
/**
* Event Triggered in the compiler [on Before Model View Data]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onBeforeModelViewData(&$view)
{
// add the privacy
$view->params = (isset($view->params) &&
JsonHelper::check($view->params)) ? json_decode($view->params, true)
: $view->params;
if (ArrayHelper::check($view->params) &&
isset($view->params['privacy']) &&
ArrayHelper::check($view->params['privacy']) &&
isset($view->params['privacy']['activate'])
&& $view->params['privacy']['activate'] ==
1)
{
// activate the load of the privacy plugin
$this->loadPrivacy = true;
// load the admin view details
$this->activeViews[$view->id] = $view;
// add permissions
$view->addpermissions = (isset($view->addpermissions) &&
JsonHelper::check($view->addpermissions)) ?
json_decode($view->addpermissions, true) : null;
if (ArrayHelper::check($view->addpermissions))
{
$view->addpermissions = array_values($view->addpermissions);
// add the new permissions
$view->addpermissions[] = array('action' =>
'view.privacy.delete', 'implementation' => 3,
'title' => $view->name_list . ' Privacy Delete',
'description' => ' Allows the users in this group to
remove their personal data in ' . $view->name_list . ' via the
Joomla privacy suite.');
$view->addpermissions[] = array('action' =>
'view.privacy.access', 'implementation' => 3,
'title' => $view->name_list . ' Privacy Access',
'description' => ' Allows the users in this group to
access their personal data in ' . $view->name_list . ' via the
Joomla privacy suite.');
// convert back to json
$view->addpermissions = json_encode($view->addpermissions,
JSON_FORCE_OBJECT);
}
// add placeholders to view if not already set
if (!isset($this->activeViews[$view->id]->placeholders))
{
$this->activeViews[$view->id]->placeholders =
CFactory::_('Placeholder')->active;
}
}
}
/**
* Event Triggered in the compiler [on After Get]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onAfterGet()
{
// check if this component needs a privacy plugin loaded
if ($this->loadPrivacy)
{
$plugin = JPluginHelper::getPlugin('content',
'componentbuilderprivacytabs');
// check if this is json
if (isset($plugin->params) &&
JsonHelper::check($plugin->params))
{
// Convert the params field to an array.
$registry = new Registry;
$registry->loadString($plugin->params);
$plugin->params = $registry->toArray();
}
// now get the plugin ID if set
if (isset($plugin->params['plugin']) &&
$plugin->params['plugin'] > 0)
{
// if linked it will only load it once
CFactory::_('Joomlaplugin.Data')->set($plugin->params['plugin']);
}
else
{
Factory::getApplication()->enqueueMessage(Text::_('PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_PRIVACY_PLUGIN_SETUP_SO_THE_INTEGRATION_WITH_JOOMLA_PRIVACY_SUITE_COULD_NOT_BE_BUILD'),
'Warning');
$this->loadPrivacy= false;
}
}
}
/**
* Event Triggered in the compiler [on Before Update Files]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onBeforeUpdateFiles($compiler)
{
// check if privacy is to be loaded
if ($this->loadPrivacy &&
ArrayHelper::check($this->activeViews))
{
// get compiler defaults
$strictFieldExportPermissions =
CFactory::_('Config')->get('permission_strict_per_field',
false);
$exportTextOnly =
CFactory::_('Config')->get('export_text_only', 1);
// load the getPrivacyExport functions
foreach ($this->activeViews as $id => &$view)
{
// set permissions based on view
if
(isset($view->params['privacy']['permissions']))
{
CFactory::_('Config')->set('permission_strict_per_field',
(bool) $view->params['privacy']['permissions']);
}
// allow text only export
CFactory::_('Config')->set('export_text_only',
1);
// set view list name
$viewName_list = StringHelper::safe($view->name_list);
// set view single name
$viewName_single = StringHelper::safe($view->name_single);
// load the function
CFactory::_('Compiler.Builder.Content.Multi')->add($viewName_list
. '|MODELEXPORTMETHOD',
$compiler->setGetItemsModelMethod(
$viewName_single,
$viewName_list,
[
'functionName' => 'getPrivacyExport',
'docDesc' => 'Method to get data during an export
request.',
'type' => 'privacy'
]
)
);
// get the permissions building values for later if needed
if
(CFactory::_('Config')->get('permission_strict_per_field',
false) &&
isset($compiler->permissionFields[$viewName_single]) &&
ArrayHelper::check($compiler->permissionFields[$viewName_single]))
{
$this->permissionFields[$viewName_single] =
$compiler->permissionFields[$viewName_single];
}
}
// set compiler defaults
CFactory::_('Config')->set('permission_strict_per_field',
$strictFieldExportPermissions);
CFactory::_('Config')->set('export_text_only',
$exportTextOnly);
// add helper classes
$helper_strings = ['CUSTOM_HELPER_SCRIPT',
'SITE_CUSTOM_HELPER_SCRIPT',
'BOTH_CUSTOM_HELPER_SCRIPT'];
$privacy_events = [
'PrivacyCanRemoveData' => true,
'PrivacyExportRequest' => true,
'PrivacyRemoveData' => true
];
foreach ($helper_strings as $helper)
{
if (($helper_content =
CFactory::_('Compiler.Builder.Content.One')->get($helper)) !==
null &&
StringHelper::check($helper_content))
{
foreach ($privacy_events as $privacy_event => &$add)
{
// check if the even is overwriten
if (strpos($helper_content, 'public static function on' .
$privacy_event . '(') !== false)
{
$add = false;
}
}
}
}
// add the events still needed
CFactory::_('Compiler.Builder.Content.One')->add('BOTH_CUSTOM_HELPER_SCRIPT',
CFactory::_('Placeholder')->update_($this->getHelperMethod($privacy_events))
);
}
}
/**
* Event Triggered in the compiler [on Before Set Lang File Data]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onBeforeSetLangFileData()
{
if (ArrayHelper::check($this->languageArray))
{
foreach($this->languageArray as $key => $string)
{
CFactory::_('Language')->set('site', $key,
$string);
}
}
}
/**
* get the Helper methods needed to integrate with Joomla Privacy Suite
*
* @param string $helperMethods The helper methods string
*
* @return void
*
* @since 1.0
*/
protected function getHelperMethod(&$events)
{
$methods = '';
foreach ($events as $event => $add)
{
// check if the even should be added
if ($add)
{
// add the event
$this->{'set'.$event}($methods);
}
}
// only add header if there was events added
if (StringHelper::check($methods))
{
$methods = PHP_EOL . PHP_EOL . Indent::_(1) . "//" .
Line::_(__Line__, __Class__) . " <<<=== Privacy integration
with Joomla Privacy suite ===>>>" . PHP_EOL . $methods;
}
return $methods;
}
/**
* Set Privacy Can Remove Data
*
* @param string $methods The methods string
*
* @return void
*
*/
protected function setPrivacyCanRemoveData(&$methods)
{
$methods .= PHP_EOL . Indent::_(1) . "/**";
$methods .= PHP_EOL . Indent::_(1) . " * Performs validation to
determine if the data associated with a remove information request can be
processed";
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @param PrivacyPlugin
\$plugin The plugin being processed";
$methods .= PHP_EOL . Indent::_(1) . " * @param
PrivacyRemovalStatus \$status The status being set";
$methods .= PHP_EOL . Indent::_(1) . " * @param
PrivacyTableRequest \$request The request record being processed";
$methods .= PHP_EOL . Indent::_(1) . " * @param JUser
\$user The user account associated with this request if
available";
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @return
PrivacyRemovalStatus";
$methods .= PHP_EOL . Indent::_(1) . " */";
$methods .= PHP_EOL . Indent::_(1) . "public static function
onPrivacyCanRemoveData(&\$plugin, &\$status, &\$request,
&\$user)";
$methods .= PHP_EOL . Indent::_(1) . "{";
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__,
__Class__) . " Bucket to get all reasons why removal not
allowed";
$methods .= PHP_EOL . Indent::_(2) . "\$reasons = array();";
foreach ($this->activeViews as $view)
{
// set view single name
$viewName_single = StringHelper::safe($view->name_single);
// load the canDo from getActions helper method
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__,
__Class__) . " Check if user has permission to delete " .
$view->name_list;
// set the if statement based on the permission builder
$methods .= PHP_EOL . Indent::_(2) . "if
(!\$user->authorise('"
.
CFactory::_('Compiler.Creator.Permission')->getAction($viewName_single,
'core.delete')
. "', 'com_" . Placefix::_("component") .
"') && !\$user->authorise('"
.
CFactory::_('Compiler.Creator.Permission')->getAction($viewName_single,
'core.privacy.delete')
. "', 'com_" . Placefix::_("component") .
"'))";
$methods .= PHP_EOL . Indent::_(2) . "{";
// set language key
$lang_key = $view->placeholders[Placefix::_("LANG_PREFIX")]
. '_PRIVACY_CANT_REMOVE_' .
$view->placeholders[Placefix::_("VIEWS")];
// set language string
$this->languageArray[$lang_key] = "You do not have permission to
remove/delete ". $view->name_list . ".";
$methods .= PHP_EOL . Indent::_(3) . "\$reasons[] = JTe" .
"xt::_('" . $lang_key . "');";
$methods .= PHP_EOL . Indent::_(2) . "}";
// set language key
$lang_key = $view->placeholders[Placefix::_("LANG_PREFIX")]
. '_PRIVACY_CANT_REMOVE_CONTACT_SUPPORT';
}
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__,
__Class__) . " Check if any reasons were found not to allow
removal";
$methods .= PHP_EOL . Indent::_(2) . "if
(Super__"."_0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$reasons))";
$methods .= PHP_EOL . Indent::_(2) . "{";
$methods .= PHP_EOL . Indent::_(3) . "\$status->canRemove =
false;";
// set language string
$this->languageArray[$lang_key] = 'Please contact support for
more details.';
$methods .= PHP_EOL . Indent::_(3) . "\$status->reason =
implode(' ' . PHP_EOL, \$reasons) . ' ' . PHP_EOL .
JTe" . "xt::_('" . $lang_key . "');";
$methods .= PHP_EOL . Indent::_(2) . "}";
$methods .= PHP_EOL . Indent::_(2) . "return \$status;";
$methods .= PHP_EOL . Indent::_(1) . "}" . PHP_EOL;
}
/**
* Set Privacy Export Request
*
* @param string $methods The methods string
*
* @return void
*
*/
protected function setPrivacyExportRequest(&$methods)
{
$methods .= PHP_EOL . Indent::_(1) . "/**";
$methods .= PHP_EOL . Indent::_(1) . " * Processes an export request
for Joomla core user data";
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @param PrivacyPlugin
\$plugin The plugin being processed";
$methods .= PHP_EOL . Indent::_(1) . " * @param DomainArray
\$domains The array of domains";
$methods .= PHP_EOL . Indent::_(1) . " * @param
PrivacyTableRequest \$request The request record being processed";
$methods .= PHP_EOL . Indent::_(1) . " * @param JUser
\$user The user account associated with this request if
available";
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @return
PrivacyExportDomain[]";
$methods .= PHP_EOL . Indent::_(1) . " */";
$methods .= PHP_EOL . Indent::_(1) . "public static function
onPrivacyExportRequest(&\$plugin, &\$domains, &\$request,
&\$user)";
$methods .= PHP_EOL . Indent::_(1) . "{";
foreach ($this->activeViews as $view)
{
// set view list name
$viewName_list = StringHelper::safe($view->name_list);
// set view single name
$viewName_single = StringHelper::safe($view->name_single);
// load the canDo from getActions helper method
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__,
__Class__) . " Check if user has permission to access " .
$view->name_list;
// set the if statement based on the permission builder
$methods .= PHP_EOL . Indent::_(2) . "if
(\$user->authorise('"
.
CFactory::_('Compiler.Creator.Permission')->getGlobal($viewName_single,
'core.access')
. "', 'com_" . Placefix::_("component") .
"') || \$user->authorise('"
.
CFactory::_('Compiler.Creator.Permission')->getGlobal($viewName_single,
'core.privacy.access')
. "', 'com_" . Placefix::_("component") .
"'))";
$methods .= PHP_EOL . Indent::_(2) . "{";
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__,
__Class__) . " Get " . $view->name_single . "
domain";
$methods .= PHP_EOL . Indent::_(3) . "\$domains[] =
self::create" . ucfirst($viewName_list) . "Domain(\$plugin,
\$user);";
$methods .= PHP_EOL . Indent::_(2) . "}";
}
$methods .= PHP_EOL . Indent::_(2) . "return \$domains;";
$methods .= PHP_EOL . Indent::_(1) . "}" . PHP_EOL;
foreach ($this->activeViews as $view)
{
// set view list name
$viewName_list = StringHelper::safe($view->name_list);
// set view single name
$viewName_single = StringHelper::safe($view->name_single);
$methods .= PHP_EOL . Indent::_(1) . "/**";
$methods .= PHP_EOL . Indent::_(1) . " * Create the domain for the
" . $view->name_single;
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @param JTableUser
\$user The JTableUser object to process";
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @return
PrivacyExportDomain";
$methods .= PHP_EOL . Indent::_(1) . " */";
$methods .= PHP_EOL . Indent::_(1) . "protected static function
create" . ucfirst($viewName_list) . "Domain(&\$plugin,
&\$user)";
$methods .= PHP_EOL . Indent::_(1) . "{";
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__,
__Class__) . " create " . $view->name_list . "
domain";
$methods .= PHP_EOL . Indent::_(2) . "\$domain =
self::createDomain('" . $viewName_single . "',
'" . Placefix::_("component") . "_" .
$viewName_single . "_data');";
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__,
__Class__) . " get database object";
$methods .= PHP_EOL . Indent::_(2) . "\$db =
Factory::getDbo();";
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__,
__Class__) . " get all item ids of " . $view->name_list .
" that belong to this user";
$methods .= PHP_EOL . Indent::_(2) . "\$query =
\$db->getQuery(true)";
$methods .= PHP_EOL . Indent::_(3) .
"->select('id')";
$methods .= PHP_EOL . Indent::_(3) .
"->from(\$db->quoteName('#__" .
Placefix::_('component') . '_' . $viewName_single .
"'));";
// get via custom script
if (isset($view->params['privacy']['user_link'])
&& $view->params['privacy']['user_link'] ==
3)
{
$methods .= PHP_EOL . str_replace(array_keys($view->placeholders),
array_values($view->placeholders),
$view->params['privacy']['custom_link']);
}
// just another field
elseif
(isset($view->params['privacy']['user_link'])
&& $view->params['privacy']['user_link'] ==
2 &&
isset($view->params['privacy']['other_user_field']))
{
// get the field name
if (($field_name = $this->getFieldName($view->fields,
$view->params['privacy']['other_user_field'])) !==
false)
{
$methods .= PHP_EOL . Indent::_(2) .
"\$query->where(\$db->quoteName('" . $field_name .
"') . ' = ' . \$db->quote(\$user->id));";
}
else
{
// give a warning message (TODO)
// stop any from loading
$methods .= PHP_EOL . Indent::_(2) . "//" .
Line::_(__Line__, __Class__) . " ==== ERROR ===== ERROR ====== (field
name not found)";
$methods .= PHP_EOL . Indent::_(2) .
"\$query->where(\$db->quoteName('id') . ' =
-2'; //" . Line::_(__Line__, __Class__) . " <-- this will
never return any value. Check your [other user field] selected in the admin
view privacy tab.";
}
}
// get based on created by
else
{
$methods .= PHP_EOL . Indent::_(2) .
"\$query->where(\$db->quoteName('created_by') . '
= ' . \$db->quote(\$user->id));";
}
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__,
__Class__) . " get all items for the " . $view->name_list .
" domain";
$methods .= PHP_EOL . Indent::_(2) . "\$pks =
\$db->setQuery(\$query)->loadColumn();";
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__,
__Class__) . " get the " . $view->name_list . "
model";
$methods .= PHP_EOL . Indent::_(2) . "\$model =
self::getModel('" . $viewName_list . "',
JPATH_ADMINISTRATOR . '/components/com_" .
Placefix::_("component") . "');";
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__,
__Class__) . " Get all item details of " . $view->name_list .
" that belong to this user";
$methods .= PHP_EOL . Indent::_(2) . "\$items =
\$model->getPrivacyExport(\$pks, \$user);";
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__,
__Class__) . " check if we have items since permissions could block
the request";
$methods .= PHP_EOL . Indent::_(2) . "if
(Super__"."_0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$items))";
$methods .= PHP_EOL . Indent::_(2) . "{";
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__,
__Class__) . " Remove " . $view->name_single . " default
columns";
$methods .= PHP_EOL . Indent::_(3) . "foreach
(array('params', 'asset_id', 'checked_out',
'checked_out_time', 'created', 'created_by',
'modified', 'modified_by', 'published',
'ordering', 'access', 'version',
'hits') as \$column)";
$methods .= PHP_EOL . Indent::_(3) . "{";
$methods .= PHP_EOL . Indent::_(4) . "\$items =
ArrayHelper::dropColumn(\$items, \$column);";
$methods .= PHP_EOL . Indent::_(3) . "}";
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__,
__Class__) . " load the items into the domain object";
$methods .= PHP_EOL . Indent::_(3) . "foreach (\$items as
\$item)";
$methods .= PHP_EOL . Indent::_(3) . "{";
$methods .= PHP_EOL . Indent::_(4) .
"\$domain->addItem(self::createItemFromArray(\$item,
\$item['id']));";
$methods .= PHP_EOL . Indent::_(3) . "}";
$methods .= PHP_EOL . Indent::_(2) . "}";
$methods .= PHP_EOL . Indent::_(2) . "return \$domain;";
$methods .= PHP_EOL . Indent::_(1) . "}" . PHP_EOL;
}
// we must add these helper methods
$methods .= PHP_EOL . Indent::_(1) . "/**";
$methods .= PHP_EOL . Indent::_(1) . " * Create a new domain
object";
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @param string \$name
The domain's name";
$methods .= PHP_EOL . Indent::_(1) . " * @param string
\$description The domain's description";
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @return
PrivacyExportDomain";
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @since 3.9.0";
$methods .= PHP_EOL . Indent::_(1) . " */";
$methods .= PHP_EOL . Indent::_(1) . "protected static function
createDomain(\$name, \$description = '')";
$methods .= PHP_EOL . Indent::_(1) . "{";
$methods .= PHP_EOL . Indent::_(2) . "\$domain = new
PrivacyExportDomain;";
$methods .= PHP_EOL . Indent::_(2) . "\$domain->name =
\$name;";
$methods .= PHP_EOL . Indent::_(2) . "\$domain->description =
\$description;";
$methods .= PHP_EOL . PHP_EOL . Indent::_(2) . "return
\$domain;";
$methods .= PHP_EOL . Indent::_(1) . "}";
$methods .= PHP_EOL . PHP_EOL . Indent::_(1) . "/**";
$methods .= PHP_EOL . Indent::_(1) . " * Create an item object for
an array";
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @param array
\$data The array data to convert";
$methods .= PHP_EOL . Indent::_(1) . " * @param integer|null
\$itemId The ID of this item";
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @return
PrivacyExportItem";
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @since 3.9.0";
$methods .= PHP_EOL . Indent::_(1) . " */";
$methods .= PHP_EOL . Indent::_(1) . "protected static function
createItemFromArray(array \$data, \$itemId = null)";
$methods .= PHP_EOL . Indent::_(1) . "{";
$methods .= PHP_EOL . Indent::_(2) . "\$item = new
PrivacyExportItem;";
$methods .= PHP_EOL . Indent::_(2) . "\$item->id =
\$itemId;";
$methods .= PHP_EOL . PHP_EOL . Indent::_(2) . "foreach (\$data as
\$key => \$value)";
$methods .= PHP_EOL . Indent::_(2) . "{";
$methods .= PHP_EOL . Indent::_(3) . "if
(is_object(\$value))";
$methods .= PHP_EOL . Indent::_(3) . "{";
$methods .= PHP_EOL . Indent::_(4) . "\$value = (array)
\$value;";
$methods .= PHP_EOL . Indent::_(3) . "}";
$methods .= PHP_EOL . PHP_EOL . Indent::_(3) . "if
(is_array(\$value))";
$methods .= PHP_EOL . Indent::_(3) . "{";
$methods .= PHP_EOL . Indent::_(4) . "\$value = print_r(\$value,
true);";
$methods .= PHP_EOL . Indent::_(3) . "}";
$methods .= PHP_EOL . PHP_EOL . Indent::_(3) . "\$field = new
PrivacyExportField;";
$methods .= PHP_EOL . Indent::_(3) . "\$field->name =
\$key;";
$methods .= PHP_EOL . Indent::_(3) . "\$field->value =
\$value;";
$methods .= PHP_EOL . PHP_EOL . Indent::_(3) .
"\$item->addField(\$field);";
$methods .= PHP_EOL . Indent::_(2) . "}";
$methods .= PHP_EOL . PHP_EOL . Indent::_(2) . "return
\$item;";
$methods .= PHP_EOL . Indent::_(1) . "}" . PHP_EOL;
}
/**
* get the field name
*
* @param array $fields The fields array
* @param int $id The field id
*
* @return string The field name
*
*/
protected function getFieldName(&$fields, $id)
{
foreach ($fields as $field)
{
if ($field['field'] == $id)
{
return $field['base_name'];
}
}
return false;
}
/**
* Set Privacy Remove Data
*
* @param string $methods The methods string
*
* @return void
*
*/
protected function setPrivacyRemoveData(&$methods)
{
$methods .= PHP_EOL . Indent::_(1) . "/**";
$methods .= PHP_EOL . Indent::_(1) . " * Removes the data associated
with a remove information request";
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @param
PrivacyTableRequest \$request The request record being processed";
$methods .= PHP_EOL . Indent::_(1) . " * @param JUser
\$user The user account associated with this request if
available";
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @return void";
$methods .= PHP_EOL . Indent::_(1) . " */";
$methods .= PHP_EOL . Indent::_(1) . "public static function
onPrivacyRemoveData(&\$plugin, &\$request, &\$user)";
$methods .= PHP_EOL . Indent::_(1) . "{";
foreach ($this->activeViews as $view)
{
// set the anonymize switch
$anonymize = false;
if (isset($view->params['privacy']['anonymize'])
&& $view->params['privacy']['anonymize'] ==
1 &&
isset($view->params['privacy']['anonymize_fields'])
&&
ArrayHelper::check($view->params['privacy']['anonymize_fields'],
true))
{
// Anonymize the data
$anonymize = true;
}
// set view list name
$viewName_list = StringHelper::safe($view->name_list);
// set view single name
$viewName_single = StringHelper::safe($view->name_single);
// load the canDo from getActions helper method
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__,
__Class__) . " Check if user has permission to delet " .
$view->name_list;
// set the if statement based on the permission builder
$methods .= PHP_EOL . Indent::_(2) . "if
(\$user->authorise('"
.
CFactory::_('Compiler.Creator.Permission')->getAction($viewName_single,
'core.delete')
. "', 'com_" . Placefix::_("component") .
"') || \$user->authorise('"
.
CFactory::_('Compiler.Creator.Permission')->getAction($viewName_single,
'core.privacy.delete')
. "', 'com_" . Placefix::_("component") .
"'))";
$methods .= PHP_EOL . Indent::_(2) . "{";
// check if this is a plain delete, or it is a Anonymize
if ($anonymize)
{
// anonymize the data
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__,
__Class__) . " Anonymize " . $view->name_single . "
data";
$methods .= PHP_EOL . Indent::_(3) . "self::anonymize" .
ucfirst($viewName_list) . "Data(\$plugin, \$user);";
}
else
{
// just dump, delete the rows
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__,
__Class__) . " Remove " . $view->name_single . "
data";
$methods .= PHP_EOL . Indent::_(3) . "self::remove" .
ucfirst($viewName_list) . "Data(\$plugin, \$user);";
}
$methods .= PHP_EOL . Indent::_(2) . "}";
}
$methods .= PHP_EOL . Indent::_(1) . "}" . PHP_EOL;
foreach ($this->activeViews as $view)
{
// set the anonymize switch
$anonymize = false;
if (isset($view->params['privacy']['anonymize'])
&& $view->params['privacy']['anonymize'] ==
1 &&
isset($view->params['privacy']['anonymize_fields'])
&&
ArrayHelper::check($view->params['privacy']['anonymize_fields'],
true))
{
// Anonymize the data
$anonymize = true;
}
// set view list name
$viewName_list = StringHelper::safe($view->name_list);
// set view single name
$viewName_single = StringHelper::safe($view->name_single);
$methods .= PHP_EOL . Indent::_(1) . "/**";
// check if this is a plain delete, or it is a Anonymize
if ($anonymize)
{
// Anonymize the data
$methods .= PHP_EOL . Indent::_(1) . " * Anonymize the " .
$view->name_single . " data";
}
else
{
// Delete the rows
$methods .= PHP_EOL . Indent::_(1) . " * Remove the " .
$view->name_single . " data";
}
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @param JTableUser
\$user The JTableUser object to process";
$methods .= PHP_EOL . Indent::_(1) . " *";
$methods .= PHP_EOL . Indent::_(1) . " * @return void";
$methods .= PHP_EOL . Indent::_(1) . " */";
// check if this is a plain delete, or it is a Anonymize
if ($anonymize)
{
// Anonymize the data
$methods .= PHP_EOL . Indent::_(1) . "protected static function
anonymize" . ucfirst($viewName_list) . "Data(&\$plugin,
&\$user)";
}
else
{
// Delete the rows
$methods .= PHP_EOL . Indent::_(1) . "protected static function
remove" . ucfirst($viewName_list) . "Data(&\$plugin,
&\$user)";
}
$methods .= PHP_EOL . Indent::_(1) . "{";
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__,
__Class__) . " get database object";
$methods .= PHP_EOL . Indent::_(2) . "\$db =
Factory::getDbo();";
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__,
__Class__) . " get all item ids of " . $view->name_list .
" that belong to this user";
$methods .= PHP_EOL . Indent::_(2) . "\$query =
\$db->getQuery(true)";
$methods .= PHP_EOL . Indent::_(3) .
"->select('id')";
$methods .= PHP_EOL . Indent::_(3) .
"->from(\$db->quoteName('#__" .
Placefix::_('component') . '_' . $viewName_single .
"'));";
// get via custom script
if (isset($view->params['privacy']['user_link'])
&& $view->params['privacy']['user_link'] ==
3)
{
$methods .= PHP_EOL . str_replace(array_keys($view->placeholders),
array_values($view->placeholders),
$view->params['privacy']['custom_link']);
}
// just another field
elseif
(isset($view->params['privacy']['user_link'])
&& $view->params['privacy']['user_link'] ==
2 &&
isset($view->params['privacy']['other_user_field']))
{
// get the field name
if (($field_name = $this->getFieldName($view->fields,
$view->params['privacy']['other_user_field'])) !==
false)
{
$methods .= PHP_EOL . Indent::_(2) .
"\$query->where(\$db->quoteName('" . $field_name .
"') . ' = ' . \$db->quote(\$user->id));";
}
else
{
// give a warning message (TODO)
// stop any from loading
$methods .= PHP_EOL . Indent::_(2) . "//" .
Line::_(__Line__, __Class__) . " ==== ERROR ===== ERROR ====== (field
name not found)";
$methods .= PHP_EOL . Indent::_(2) .
"\$query->where(\$db->quoteName('id') . ' =
-2'; //" . Line::_(__Line__, __Class__) . " <-- this will
never return any value. Check your [other user field] selected in the admin
view privacy tab.";
}
}
// get based on created by
else
{
$methods .= PHP_EOL . Indent::_(2) .
"\$query->where(\$db->quoteName('created_by') . '
= ' . \$db->quote(\$user->id));";
}
$methods .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__,
__Class__) . " get all items for the " . $view->name_list .
" table that belong to this user";
$methods .= PHP_EOL . Indent::_(2) . "\$pks =
\$db->setQuery(\$query)->loadColumn();";
$methods .= PHP_EOL .PHP_EOL . Indent::_(2) . "if
(Super__"."_0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$pks))";
$methods .= PHP_EOL . Indent::_(2) . "{";
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__,
__Class__) . " get the " . $viewName_single . "
model";
$methods .= PHP_EOL . Indent::_(3) . "\$model =
self::getModel('" . $viewName_single . "',
JPATH_ADMINISTRATOR . '/components/com_" .
Placefix::_("component") . "');";
// check if this is a plain delete, or it is a Anonymize
if ($anonymize)
{
// build the pseudoanonymised data array
$_data_bucket = array();
$_random_bucket = array();
$_permission_bucket = array();
foreach
($view->params['privacy']['anonymize_fields'] as
$row)
{
if (($field_name = $this->getFieldName($view->fields,
$row['field'])) !== false)
{
if ('RANDOM' === $row['value'])
{
$_random_bucket[$field_name] = 8; // (TODO) make the size dynamic
}
$_data_bucket[] = PHP_EOL . Indent::_(4) . "'" .
$field_name . "' => '" . $row['value']
."'";
$_permission_bucket[$field_name] = $field_name;
}
}
// Anonymize the data
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__,
__Class__) . " this is the pseudoanonymised data array for " .
$view->name_list;
$methods .= PHP_EOL . Indent::_(3) . "\$pseudoanonymisedData =
array(";
$methods .= implode(',', $_data_bucket);
$methods .= PHP_EOL . Indent::_(3) . ");";
// add the permissional removal of values the user has not right to
view or access
$hasPermissional = false;
if (isset($this->permissionFields[$viewName_single]) &&
ArrayHelper::check($this->permissionFields[$viewName_single]))
{
foreach ($this->permissionFields[$viewName_single] as $fieldName
=> $permission_options)
{
if (!$hasPermissional &&
isset($_permission_bucket[$fieldName]))
{
foreach($permission_options as $permission_option => $fieldType)
{
if (!$hasPermissional)
{
switch ($permission_option)
{
case 'access':
case 'view':
case 'edit':
$hasPermissional = true;
break;
}
}
}
}
}
// add the notes and get the global switch
if ($hasPermissional)
{
$methods .= PHP_EOL . PHP_EOL . Indent::_(3) . "//" .
Line::_(__Line__, __Class__) . " Get global permissional control
activation. (default is inactive)";
$methods .= PHP_EOL . Indent::_(3) .
"\$strict_permission_per_field =
ComponentHelper::getParams('com_" .
Placefix::_("component") .
"')->get('strict_permission_per_field', 0);";
$methods .= PHP_EOL . Indent::_(3) .
"if(\$strict_permission_per_field)";
$methods .= PHP_EOL . Indent::_(3) . "{";
$methods .= PHP_EOL . Indent::_(4) . "//" .
Line::_(__Line__, __Class__) . " remove all fields that is not
permitted to be changed";
foreach ($this->permissionFields[$viewName_single] as $fieldName
=> $permission_options)
{
if (isset($_permission_bucket[$fieldName]))
{
$methods .= PHP_EOL . Indent::_(4) . "if (";
$_permission_if = array();
foreach ($permission_options as $perm_key => $field_typrew)
{
$_permission_if[] = "!\$user->authorise('" .
$viewName_single . "." . $perm_key . "." . $fieldName .
"', 'com_" . Placefix::_("component") .
"')";
}
$methods .= implode(' || ', $_permission_if);
$methods .= ")";
$methods .= PHP_EOL . Indent::_(4) . "{";
$methods .= PHP_EOL . Indent::_(5) .
"unset(\$pseudoanonymisedData['". $fieldName .
"']);";
$methods .= PHP_EOL . Indent::_(4) . "}";
}
}
$methods .= PHP_EOL . Indent::_(3) . "}";
}
}
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__,
__Class__) . " get the " . $view->name_list . "
table";
$methods .= PHP_EOL . Indent::_(3) . "\$table =
\$model->getTable();";
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__,
__Class__) . " check that we still have pseudoanonymised data for
" . $view->name_list . " set";
$methods .= PHP_EOL . Indent::_(3) . "if
(!Super__"."_0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a___Power::check(\$pseudoanonymisedData))";
$methods .= PHP_EOL . Indent::_(3) . "{";
$methods .= PHP_EOL . Indent::_(4) . "//" . Line::_(__Line__,
__Class__) . " still archive all items";
$methods .= PHP_EOL . Indent::_(4) . "\$table->publish(\$pks,
2);";
$methods .= PHP_EOL . Indent::_(4) . "return false;";
$methods .= PHP_EOL . Indent::_(3) . "}";
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__,
__Class__) . " Iterate the items to anonimize each one.";
$methods .= PHP_EOL . Indent::_(3) . "foreach (\$pks as \$i =>
\$pk)";
$methods .= PHP_EOL . Indent::_(3) . "{";
$methods .= PHP_EOL . Indent::_(4) . "\$table->reset();";
$methods .= PHP_EOL . Indent::_(4) .
"\$pseudoanonymisedData['id'] = \$pk;";
if (ArrayHelper::check($_random_bucket))
{
foreach ($_random_bucket as $fieldName => $size)
{
$methods .= PHP_EOL . Indent::_(4) . "if
(isset(\$pseudoanonymisedData['" . $fieldName .
"']))";
$methods .= PHP_EOL . Indent::_(4) . "{";
$methods .= PHP_EOL . Indent::_(5) .
"\$pseudoanonymisedData['" . $fieldName . "'] =
self::randomkey(" . (int) $size . ");";
$methods .= PHP_EOL . Indent::_(4) . "}";
}
}
$methods .= PHP_EOL . PHP_EOL . Indent::_(4) . "if
(\$table->bind(\$pseudoanonymisedData))";
$methods .= PHP_EOL . Indent::_(4) . "{";
$methods .= PHP_EOL . Indent::_(5) . "\$table->store();";
$methods .= PHP_EOL . Indent::_(4) . "}";
$methods .= PHP_EOL . Indent::_(3) . "}";
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__,
__Class__) . " archive all items";
$methods .= PHP_EOL . Indent::_(3) . "\$table->publish(\$pks,
2);";
}
else
{
// Delete the rows
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__,
__Class__) . " get the " . $view->name_list . "
table";
$methods .= PHP_EOL . Indent::_(3) . "\$table =
\$model->getTable();";
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__,
__Class__) . " Iterate the items to delete each one.";
$methods .= PHP_EOL . Indent::_(3) . "foreach (\$pks as \$i =>
\$pk)";
$methods .= PHP_EOL . Indent::_(3) . "{";
$methods .= PHP_EOL . Indent::_(4) . "if
(\$table->load(\$pk))";
$methods .= PHP_EOL . Indent::_(4) . "{";
$methods .= PHP_EOL . Indent::_(5) .
"\$table->delete(\$pk);";
$methods .= PHP_EOL . Indent::_(4) . "}";
$methods .= PHP_EOL . Indent::_(3) . "}";
$methods .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__,
__Class__) . " Clear the component's cache";
$methods .= PHP_EOL . Indent::_(3) .
"\$model->cleanCache();";
}
$methods .= PHP_EOL . Indent::_(2) . "}";
$methods .= PHP_EOL . Indent::_(1) . "}" . PHP_EOL;
}
}
}
componentbuilderprivacycompiler/index.html000064400000000054151160402250015236
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>language/af-ZA/af-ZA.plg_extension_componentbuilderprivacycompiler.ini000064400000000143151160402250030700
0ustar00componentbuilderprivacycompilerPLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_NO="Nee"language/af-ZA/af-ZA.plg_extension_componentbuilderprivacycompiler.sys.ini000064400000000143151160402250031515
0ustar00componentbuilderprivacycompilerPLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_NO="Nee"language/en-GB/en-GB.plg_extension_componentbuilderprivacycompiler.ini000064400000002765151160402250030700
0ustar00componentbuilderprivacycompilerPLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER="Extension
- Componentbuilder Privacy Compiler"
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_DESCRIPTION="This plugin
is used to build the privacy plugin for your component during compilation.
To activate it you must first enable it here. Then open your JCB component
global options, and under the Global tab, select this plugin in the
Activate Compiler Plugins field.Also be sure to link your admin views to
the privacy suite of Joomla via our other Content - Componentbuilder
Privacy Tabs plugin."
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_XML_DESCRIPTION="<h1>Extension
- Componentbuilder Privacy Compiler (v.1.2.4)</h1> <div
style='clear: both;'></div><p>This plugin is used
to build the privacy plugin for your component during compilation. To
activate it you must first enable it here. Then open your JCB component
global options, and under the Global tab, select this plugin in the
Activate Compiler Plugins field.Also be sure to link your admin views to
the privacy suite of Joomla via our other Content - Componentbuilder
Privacy Tabs plugin.</p><p>Created by <a
href='https://dev.vdm.io' target='_blank'>Llewellyn
van der Merwe</a><br /><small>Development started 17th
August, 2019</small></p>"
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_PRIVACY_PLUGIN_SETUP_SO_THE_INTEGRATION_WITH_JOOMLA_PRIVACY_SUITE_COULD_NOT_BE_BUILD="You
do not have a global privacy plugin setup, so the integration with Joomla
privacy suite could not be
build."language/en-GB/en-GB.plg_extension_componentbuilderprivacycompiler.sys.ini000064400000002765151160402250031515
0ustar00componentbuilderprivacycompilerPLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER="Extension
- Componentbuilder Privacy Compiler"
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_DESCRIPTION="This plugin
is used to build the privacy plugin for your component during compilation.
To activate it you must first enable it here. Then open your JCB component
global options, and under the Global tab, select this plugin in the
Activate Compiler Plugins field.Also be sure to link your admin views to
the privacy suite of Joomla via our other Content - Componentbuilder
Privacy Tabs plugin."
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_XML_DESCRIPTION="<h1>Extension
- Componentbuilder Privacy Compiler (v.1.2.4)</h1> <div
style='clear: both;'></div><p>This plugin is used
to build the privacy plugin for your component during compilation. To
activate it you must first enable it here. Then open your JCB component
global options, and under the Global tab, select this plugin in the
Activate Compiler Plugins field.Also be sure to link your admin views to
the privacy suite of Joomla via our other Content - Componentbuilder
Privacy Tabs plugin.</p><p>Created by <a
href='https://dev.vdm.io' target='_blank'>Llewellyn
van der Merwe</a><br /><small>Development started 17th
August, 2019</small></p>"
PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_PRIVACY_PLUGIN_SETUP_SO_THE_INTEGRATION_WITH_JOOMLA_PRIVACY_SUITE_COULD_NOT_BE_BUILD="You
do not have a global privacy plugin setup, so the integration with Joomla
privacy suite could not be
build."componentbuilderprivacycompiler/language/en-GB/index.html000064400000000054151160402250017711
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>componentbuilderprivacycompiler/language/index.html000064400000000054151160402250017021
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>componentbuilderprivacycompiler/script.php000064400000003563151160402250015266
0ustar00<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
/**
* Extension - Componentbuilder Privacy Compiler script file.
*
* @package PlgExtensionComponentbuilderPrivacyCompiler
*/
class plgExtensionComponentbuilderPrivacyCompilerInstallerScript
{
/**
* Called before any type of action
*
* @param string $route Which action is happening
(install|uninstall|discover_install|update)
* @param Joomla\CMS\Installer\InstallerAdapter $adapter The object
responsible for running this script
*
* @return boolean True on success
*/
public function preflight($route, $adapter)
{
// get application
$app = Factory::getApplication();
// the default for both install and update
$jversion = new JVersion();
if (!$jversion->isCompatible('3.8.0'))
{
$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0
before continuing!', 'error');
return false;
}
if ('install' === $route)
{
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR .
'/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be
installed from <a href="https://www.joomlacomponentbuilder.com/
" target="_blank">Joomla Component
Builder</a>.', 'error');
return false;
}
}
return true;
}
}
componentbuilderprivacycompiler/componentbuilderprivacycompiler.xml000064400000002574151160402250022476
0ustar00<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" version="3.10"
group="extension" method="upgrade">
<name>PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER</name>
<creationDate>20th September, 2024</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://dev.vdm.io</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights
reserved.</copyright>
<license>GNU General Public License version 2 or later; see
LICENSE.txt</license>
<version>1.2.4</version>
<description>PLG_EXTENSION_COMPONENTBUILDERPRIVACYCOMPILER_XML_DESCRIPTION</description>
<!-- Scripts to run on installation -->
<scriptfile>script.php</scriptfile>
<!-- Language files -->
<languages folder="language">
<language
tag="en-GB">en-GB/en-GB.plg_extension_componentbuilderprivacycompiler.ini</language>
<language
tag="en-GB">en-GB/en-GB.plg_extension_componentbuilderprivacycompiler.sys.ini</language>
<language
tag="af-ZA">af-ZA/af-ZA.plg_extension_componentbuilderprivacycompiler.ini</language>
<language
tag="af-ZA">af-ZA/af-ZA.plg_extension_componentbuilderprivacycompiler.sys.ini</language>
</languages>
<!-- Plugin files -->
<files>
<filename
plugin="componentbuilderprivacycompiler">componentbuilderprivacycompiler.php</filename>
<filename>index.html</filename>
<folder>language</folder>
</files>
</extension>componentbuilderactionlogcompiler/componentbuilderactionlogcompiler.php000064400000057517151160402250023300
0ustar00<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR .
'/components/com_componentbuilder/helpers/componentbuilder.php');
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Registry\Registry;
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
use VDM\Joomla\Utilities\ArrayHelper;
/**
* Extension - Componentbuilder ActionLog Compiler plugin.
*
* @package ComponentbuilderActionLogCompiler
* @since 2.0.1
*/
class PlgExtensionComponentbuilderActionLogCompiler extends CMSPlugin
{
/**
* Affects constructor behavior. If true, language files will be loaded
automatically.
*
* @var boolean
* @since 1.0.0
*/
protected $autoloadLanguage = true;
/**
* The language string builder
*
* @var array
*/
protected $languageArray = [];
/**
* The Scripts
*
* @var array
*/
protected $scriptsArray = ['POSTINSTALLSCRIPT' => [],
'POSTUPDATESCRIPT' => [], 'UNINSTALLSCRIPT' =>
[]];
/**
* Event Triggered in the compiler [on After Get Component Data]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onAfterGetComponentData()
{
if ($this->componentActive() &&
ArrayHelper::check($this->languageArray))
{
foreach($this->languageArray as $key => $string)
{
CFactory::_('Language')->set('admin', $key,
$string);
}
}
}
/**
* Event Triggered in the compiler [on After Build Files Content]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onAfterBuildFilesContent()
{
if ($this->componentActive())
{
$function_name = 'getMainJ3';
if (CFactory::_('Config')->get('joomla_version',
3) != 3)
{
$function_name = 'getMainJ4';
}
// now load the script strings to the component
foreach ($this->scriptsArray as $target => &$bucket)
{
// add the component main target script
CFactory::_('Compiler.Builder.Content.One')->add($target,
$this->{$function_name . $target}());
// add the component views target scripts
if (ArrayHelper::check($bucket))
{
CFactory::_('Compiler.Builder.Content.One')->add($target,
implode('', $bucket));
}
}
}
}
/**
* Event Triggered in the compiler [on After Model View Data]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onAfterModelViewData(&$view)
{
// add the better integration with action log
if ($this->componentActive()
&&ArrayHelper::check($view->fields))
{
foreach ($view->fields as $field)
{
if (isset($field['title']) &&
$field['title'] == 1)
{
$title_holder = $field['base_name'];
break;
}
}
// if not found try again
if (!isset($title_holder))
{
foreach ($view->fields as $field)
{
if (isset($field['list']) &&
$field['list'] == 1 &&
isset($field['order_list']) &&
$field['order_list'] == 1 &&
isset($field['link']) && $field['link']
== 1)
{
$title_holder = $field['base_name'];
break;
}
}
}
// if found update placeholder
if (isset($title_holder))
{
// set main title
CFactory::_('Placeholder')->set('<<<MAIN_TITLE>>>',
$title_holder, false);
}
else
{
// fall back on ID
CFactory::_('Placeholder')->set('<<<MAIN_TITLE>>>',
'id', false);
}
$function_name = 'getViewJ3';
if (CFactory::_('Config')->get('joomla_version',
3) != 3)
{
$function_name = 'getViewJ4';
}
// now load the script strings
foreach ($this->scriptsArray as $target => &$bucket)
{
$bucket[] = $this->{$function_name . $target}();
}
// just remove it again
CFactory::_('Placeholder')->remove('<<<MAIN_TITLE>>>');
// set language string
$this->languageArray[CFactory::_('Placeholder')->get_("LANG_PREFIX")
. '_TYPE_' .
CFactory::_('Placeholder')->get_("VIEW")] =
$view->name_single;
}
}
/**
* get the Main Post Install Script
*
* @return string
*
*/
protected function getMainJ3POSTINSTALLSCRIPT()
{
$script = PHP_EOL . PHP_EOL . Indent::_(3) . "//" .
Line::_(__Line__, __Class__) . " Set db if not set already.";
$script .= PHP_EOL . Indent::_(3) . "if (!isset(\$db))";
$script .= PHP_EOL . Indent::_(3) . "{";
$script .= PHP_EOL . Indent::_(4) . "\$db =
Factory::getDbo();";
$script .= PHP_EOL . Indent::_(3) . "}";
$script .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__,
__Class__) . " Create the " . Placefix::_("component")
. " action logs extensions object.";
$script .= PHP_EOL . Indent::_(3) . "\$" .
Placefix::_("component") . "_action_logs_extensions = new
\stdClass();";
$script .= PHP_EOL . Indent::_(3) . "\$" .
Placefix::_("component") .
"_action_logs_extensions->extension = 'com_" .
Placefix::_("component") . "';";
$script .= PHP_EOL . PHP_EOL . Indent::_(3) . "//" .
Line::_(__Line__, __Class__) . " Set the object into the action logs
extensions table.";
$script .= PHP_EOL . Indent::_(3) . "\$" .
Placefix::_("component") . "_action_logs_extensions_Inserted
= \$db->insertObject('#__action_logs_extensions', \$" .
Placefix::_("component") .
"_action_logs_extensions);";
return CFactory::_('Placeholder')->update_($script);
}
/**
* get the View Post Install Script
*
* @return string
*
*/
protected function getViewJ3POSTINSTALLSCRIPT()
{
$script = PHP_EOL . PHP_EOL . Indent::_(3) . "//" .
Line::_(__Line__, __Class__) . " Set db if not set already.";
$script .= PHP_EOL . Indent::_(3) . "if (!isset(\$db))";
$script .= PHP_EOL . Indent::_(3) . "{";
$script .= PHP_EOL . Indent::_(4) . "\$db =
Factory::getDbo();";
$script .= PHP_EOL . Indent::_(3) . "}";
$script .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__,
__Class__) . " Create the " . Placefix::_("view") .
" action log config object.";
$script .= PHP_EOL . Indent::_(3) . "\$" .
Placefix::_("view") . "_action_log_config = new
\stdClass();";
$script .= PHP_EOL . Indent::_(3) . "\$" .
Placefix::_("view") . "_action_log_config->type_title =
'" . Placefix::_("VIEW") . "';";
$script .= PHP_EOL . Indent::_(3) . "\$" .
Placefix::_("view") . "_action_log_config->type_alias =
'com_" . Placefix::_("component") . "." .
Placefix::_("view") . "';";
$script .= PHP_EOL . Indent::_(3) . "\$" .
Placefix::_("view") . "_action_log_config->id_holder =
'id';";
$script .= PHP_EOL . Indent::_(3) . "\$" .
Placefix::_("view") . "_action_log_config->title_holder =
'<<<MAIN_TITLE>>>';";
$script .= PHP_EOL . Indent::_(3) . "\$" .
Placefix::_("view") . "_action_log_config->table_name =
'#__" . Placefix::_("component") . "_" .
Placefix::_("view") . "';";
$script .= PHP_EOL . Indent::_(3) . "\$" .
Placefix::_("view") . "_action_log_config->text_prefix =
'" . Placefix::_("LANG_PREFIX") . "';";
$script .= PHP_EOL . PHP_EOL . Indent::_(3) . "//" .
Line::_(__Line__, __Class__) . " Set the object into the action log
config table.";
$script .= PHP_EOL . Indent::_(3) . "\$" .
Placefix::_("view") . "_Inserted =
\$db->insertObject('#__action_log_config', \$" .
Placefix::_("view") . "_action_log_config);";
return CFactory::_('Placeholder')->update_($script);
}
/**
* get the Main Post Update Script
*
* @return string
*
*/
protected function getMainJ3POSTUPDATESCRIPT()
{
$script = PHP_EOL . PHP_EOL . Indent::_(3) . "//" .
Line::_(__Line__, __Class__) . " Set db if not set already.";
$script .= PHP_EOL . Indent::_(3) . "if (!isset(\$db))";
$script .= PHP_EOL . Indent::_(3) . "{";
$script .= PHP_EOL . Indent::_(4) . "\$db =
Factory::getDbo();";
$script .= PHP_EOL . Indent::_(3) . "}";
$script .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__,
__Class__) . " Create the " . Placefix::_("component")
. " action logs extensions object.";
$script .= PHP_EOL . Indent::_(3) . "\$" .
Placefix::_("component") . "_action_logs_extensions = new
\stdClass();";
$script .= PHP_EOL . Indent::_(3) . "\$" .
Placefix::_("component") .
"_action_logs_extensions->extension = 'com_" .
Placefix::_("component") . "';";
$script .= PHP_EOL . PHP_EOL . Indent::_(3) . "//" .
Line::_(__Line__, __Class__) . " Check if " .
Placefix::_("component") . " action log extension is already
in action logs extensions DB.";
$script .= PHP_EOL . Indent::_(3) . "\$query =
\$db->getQuery(true);";
$script .= PHP_EOL . Indent::_(3) .
"\$query->select(\$db->quoteName(array('id')));";
$script .= PHP_EOL . Indent::_(3) .
"\$query->from(\$db->quoteName('#__action_logs_extensions'));";
$script .= PHP_EOL . Indent::_(3) .
"\$query->where(\$db->quoteName('extension') . '
LIKE '. \$db->quote(\$" . Placefix::_("component") .
"_action_logs_extensions->extension));";
$script .= PHP_EOL . Indent::_(3) .
"\$db->setQuery(\$query);";
$script .= PHP_EOL . Indent::_(3) . "\$db->execute();";
$script .= PHP_EOL . PHP_EOL . Indent::_(3) . "//" .
Line::_(__Line__, __Class__) . " Set the object into the action logs
extensions table if not found.";
$script .= PHP_EOL . Indent::_(3) . "if
(!\$db->getNumRows())";
$script .= PHP_EOL . Indent::_(3) . "{";
$script .= PHP_EOL . Indent::_(4) . "\$" .
Placefix::_("component") . "_action_logs_extensions_Inserted
= \$db->insertObject('#__action_logs_extensions', \$" .
Placefix::_("component") .
"_action_logs_extensions);";
$script .= PHP_EOL . Indent::_(3) . "}";
return CFactory::_('Placeholder')->update_($script);
}
/**
* get the View Post Update Script
*
* @return string
*
*/
protected function getViewJ3POSTUPDATESCRIPT()
{
$script = PHP_EOL . PHP_EOL . Indent::_(3) . "//" .
Line::_(__Line__, __Class__) . " Set db if not set already.";
$script .= PHP_EOL . Indent::_(3) . "if (!isset(\$db))";
$script .= PHP_EOL . Indent::_(3) . "{";
$script .= PHP_EOL . Indent::_(4) . "\$db =
Factory::getDbo();";
$script .= PHP_EOL . Indent::_(3) . "}";
$script .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__,
__Class__) . " Create the " . Placefix::_("view") .
" action log config object.";
$script .= PHP_EOL . Indent::_(3) . "\$" .
Placefix::_("view") . "_action_log_config = new
\stdClass();";
$script .= PHP_EOL . Indent::_(3) . "\$" .
Placefix::_("view") . "_action_log_config->id =
null;";
$script .= PHP_EOL . Indent::_(3) . "\$" .
Placefix::_("view") . "_action_log_config->type_title =
'" . Placefix::_("VIEW") . "';";
$script .= PHP_EOL . Indent::_(3) . "\$" .
Placefix::_("view") . "_action_log_config->type_alias =
'com_" . Placefix::_("component") . "." .
Placefix::_("view") . "';";
$script .= PHP_EOL . Indent::_(3) . "\$" .
Placefix::_("view") . "_action_log_config->id_holder =
'id';";
$script .= PHP_EOL . Indent::_(3) . "\$" .
Placefix::_("view") . "_action_log_config->title_holder =
'<<<MAIN_TITLE>>>';";
$script .= PHP_EOL . Indent::_(3) . "\$" .
Placefix::_("view") . "_action_log_config->table_name =
'#__" . Placefix::_("component") . "_" .
Placefix::_("view") . "';";
$script .= PHP_EOL . Indent::_(3) . "\$" .
Placefix::_("view") . "_action_log_config->text_prefix =
'" . Placefix::_("LANG_PREFIX") . "';";
$script .= PHP_EOL . PHP_EOL . Indent::_(3) . "//" .
Line::_(__Line__, __Class__) . " Check if " .
Placefix::_("view") . " action log config is already in
action_log_config DB.";
$script .= PHP_EOL . Indent::_(3) . "\$query =
\$db->getQuery(true);";
$script .= PHP_EOL . Indent::_(3) .
"\$query->select(\$db->quoteName(array('id')));";
$script .= PHP_EOL . Indent::_(3) .
"\$query->from(\$db->quoteName('#__action_log_config'));";
$script .= PHP_EOL . Indent::_(3) .
"\$query->where(\$db->quoteName('type_alias') . '
LIKE '. \$db->quote(\$" . Placefix::_("view") .
"_action_log_config->type_alias));";
$script .= PHP_EOL . Indent::_(3) .
"\$db->setQuery(\$query);";
$script .= PHP_EOL . Indent::_(3) . "\$db->execute();";
$script .= PHP_EOL . PHP_EOL . Indent::_(3) . "//" .
Line::_(__Line__, __Class__) . " Set the object into the content types
table.";
$script .= PHP_EOL . Indent::_(3) . "if
(\$db->getNumRows())";
$script .= PHP_EOL . Indent::_(3) . "{";
$script .= PHP_EOL . Indent::_(4) . "\$" .
Placefix::_("view") . "_action_log_config->id =
\$db->loadResult();";
$script .= PHP_EOL . Indent::_(4) . "\$" .
Placefix::_("view") . "_action_log_config_Updated =
\$db->updateObject('#__action_log_config', \$" .
Placefix::_("view") . "_action_log_config,
'id');";
$script .= PHP_EOL . Indent::_(3) . "}";
$script .= PHP_EOL . Indent::_(3) . "else";
$script .= PHP_EOL . Indent::_(3) . "{";
$script .= PHP_EOL . Indent::_(4) . "\$" .
Placefix::_("view") . "_action_log_config_Inserted =
\$db->insertObject('#__action_log_config', \$" .
Placefix::_("view") . "_action_log_config);";
$script .= PHP_EOL . Indent::_(3) . "}";
return CFactory::_('Placeholder')->update_($script);
}
/**
* get the Main Uninstall Script
*
* @return string
*
*/
protected function getMainJ3UNINSTALLSCRIPT()
{
$script = PHP_EOL . PHP_EOL . Indent::_(2) . "//" .
Line::_(__Line__, __Class__) . " Set db if not set already.";
$script .= PHP_EOL . Indent::_(2) . "if (!isset(\$db))";
$script .= PHP_EOL . Indent::_(2) . "{";
$script .= PHP_EOL . Indent::_(3) . "\$db =
Factory::getDbo();";
$script .= PHP_EOL . Indent::_(2) . "}";
$script .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__,
__Class__) . " Set app if not set already.";
$script .= PHP_EOL . Indent::_(2) . "if (!isset(\$app))";
$script .= PHP_EOL . Indent::_(2) . "{";
$script .= PHP_EOL . Indent::_(3) . "\$app =
Factory::getApplication();";
$script .= PHP_EOL . Indent::_(2) . "}";
$script .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__,
__Class__) . " Remove " . Placefix::_("Component") .
" from the action_logs_extensions table";
$script .= PHP_EOL . Indent::_(2) . "\$" .
Placefix::_("component") . "_action_logs_extensions = array(
\$db->quoteName('extension') . ' = ' .
\$db->quote('com_" . Placefix::_("component") .
"') );";
$script .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__,
__Class__) . " Create a new query object.";
$script .= PHP_EOL . Indent::_(2) . "\$query =
\$db->getQuery(true);";
$script .= PHP_EOL . Indent::_(2) .
"\$query->delete(\$db->quoteName('#__action_logs_extensions'));";
$script .= PHP_EOL . Indent::_(2) . "\$query->where(\$" .
Placefix::_("component") .
"_action_logs_extensions);";
$script .= PHP_EOL . Indent::_(2) .
"\$db->setQuery(\$query);";
$script .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__,
__Class__) . " Execute the query to remove " .
Placefix::_("Component") . "";
$script .= PHP_EOL . Indent::_(2) . "\$" .
Placefix::_("component") . "_removed_done =
\$db->execute();";
$script .= PHP_EOL . Indent::_(2) . "if (\$" .
Placefix::_("component") . "_removed_done)";
$script .= PHP_EOL . Indent::_(2) . "{";
$script .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__,
__Class__) . " If successfully remove " .
Placefix::_("Component") . " add queued success
message.";
$script .= PHP_EOL . Indent::_(3) .
"\$app->enqueueMessage(Te" . "xt::_('The com_"
. Placefix::_("component") . " extension was removed from
the <b>#__action_logs_extensions</b> table'));";
$script .= PHP_EOL . Indent::_(2) . "}";
return CFactory::_('Placeholder')->update_($script);
}
/**
* get the View Uninstall Script
*
* @return string
*
*/
protected function getViewJ3UNINSTALLSCRIPT()
{
$script = PHP_EOL . PHP_EOL . Indent::_(2) . "//" .
Line::_(__Line__, __Class__) . " Set db if not set already.";
$script .= PHP_EOL . Indent::_(2) . "if (!isset(\$db))";
$script .= PHP_EOL . Indent::_(2) . "{";
$script .= PHP_EOL . Indent::_(3) . "\$db =
Factory::getDbo();";
$script .= PHP_EOL . Indent::_(2) . "}";
$script .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__,
__Class__) . " Set app if not set already.";
$script .= PHP_EOL . Indent::_(2) . "if (!isset(\$app))";
$script .= PHP_EOL . Indent::_(2) . "{";
$script .= PHP_EOL . Indent::_(3) . "\$app =
Factory::getApplication();";
$script .= PHP_EOL . Indent::_(2) . "}";
$script .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__,
__Class__) . " Remove " . Placefix::_("Component") .
" " . Placefix::_("View") . " from the
action_log_config table";
$script .= PHP_EOL . Indent::_(2) . "\$" .
Placefix::_("view") . "_action_log_config = array(
\$db->quoteName('type_alias') . ' = '.
\$db->quote('com_" . Placefix::_("component") .
"." . Placefix::_("view") . "') );";
$script .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__,
__Class__) . " Create a new query object.";
$script .= PHP_EOL . Indent::_(2) . "\$query =
\$db->getQuery(true);";
$script .= PHP_EOL . Indent::_(2) .
"\$query->delete(\$db->quoteName('#__action_log_config'));";
$script .= PHP_EOL . Indent::_(2) . "\$query->where(\$" .
Placefix::_("view") . "_action_log_config);";
$script .= PHP_EOL . Indent::_(2) .
"\$db->setQuery(\$query);";
$script .= PHP_EOL . Indent::_(2) . "//" . Line::_(__Line__,
__Class__) . " Execute the query to remove com_" .
Placefix::_("component") . "." .
Placefix::_("view") . "";
$script .= PHP_EOL . Indent::_(2) . "\$" .
Placefix::_("view") . "_action_log_config_done =
\$db->execute();";
$script .= PHP_EOL . Indent::_(2) . "if (\$" .
Placefix::_("view") . "_action_log_config_done)";
$script .= PHP_EOL . Indent::_(2) . "{";
$script .= PHP_EOL . Indent::_(3) . "//" . Line::_(__Line__,
__Class__) . " If successfully removed " .
Placefix::_("Component") . " " .
Placefix::_("View") . " add queued success message.";
$script .= PHP_EOL . Indent::_(3) .
"\$app->enqueueMessage(Te" . "xt::_('The com_"
. Placefix::_("component") . "." .
Placefix::_("view") . " type alias was removed from the
<b>#__action_log_config</b> table'));";
$script .= PHP_EOL . Indent::_(2) . "}";
return CFactory::_('Placeholder')->update_($script);
}
/**
* get the Main Post Install Script
*
* @return string
*
*/
protected function getMainJ4POSTINSTALLSCRIPT()
{
$script = PHP_EOL . PHP_EOL . Indent::_(3) . "//" .
Line::_(__Line__, __Class__)
. " Add component to the action logs extensions table.";
$script .= PHP_EOL . Indent::_(3) .
"\$this->setActionLogsExtensions();";
return $script;
}
/**
* get the View Post Install Script
*
* @return string
*
*/
protected function getViewJ4POSTINSTALLSCRIPT()
{
$script = PHP_EOL . PHP_EOL . Indent::_(3) . "//" .
Line::_(__Line__, __Class__)
. " Add " . Placefix::_("View") . " to the
action logs config table.";
$script .= PHP_EOL . Indent::_(3) .
"\$this->setActionLogConfig(";
$script .= PHP_EOL . Indent::_(4) . "//" . Line::_(__Line__,
__Class__) . " typeTitle";
$script .= PHP_EOL . Indent::_(4) . "'" .
Placefix::_("VIEW") . "',";
$script .= PHP_EOL . Indent::_(4) . "//" . Line::_(__Line__,
__Class__) . " typeAlias";
$script .= PHP_EOL . Indent::_(4) . "'com_" .
Placefix::_("component") . "." .
Placefix::_("view") . "',";
$script .= PHP_EOL . Indent::_(4) . "//" . Line::_(__Line__,
__Class__) . " idHolder";
$script .= PHP_EOL . Indent::_(4) . "'id',";
$script .= PHP_EOL . Indent::_(4) . "//" . Line::_(__Line__,
__Class__) . " titleHolder";
$script .= PHP_EOL . Indent::_(4) .
"'<<<MAIN_TITLE>>>',";
$script .= PHP_EOL . Indent::_(4) . "//" . Line::_(__Line__,
__Class__) . " tableName";
$script .= PHP_EOL . Indent::_(4) . "'#__" .
Placefix::_("component") . "_" .
Placefix::_("view") . "',";
$script .= PHP_EOL . Indent::_(4) . "//" . Line::_(__Line__,
__Class__) . " textPrefix";
$script .= PHP_EOL . Indent::_(4) . "'" .
Placefix::_("LANG_PREFIX") . "'";
$script .= PHP_EOL . Indent::_(3) . ");";
return CFactory::_('Placeholder')->update_($script);
}
/**
* get the Main Post Update Script
*
* @return string
*
*/
protected function getMainJ4POSTUPDATESCRIPT()
{
$script = PHP_EOL . PHP_EOL . Indent::_(3) . "//" .
Line::_(__Line__, __Class__)
. " Add/Update component in the action logs extensions
table.";
$script .= PHP_EOL . Indent::_(3) .
"\$this->setActionLogsExtensions();";
return $script;
}
/**
* get the View Post Update Script
*
* @return string
*
*/
protected function getViewJ4POSTUPDATESCRIPT()
{
$script = PHP_EOL . PHP_EOL . Indent::_(3) . "//" .
Line::_(__Line__, __Class__)
. " Add/Update " . Placefix::_("View") . " in
the action logs config table.";
$script .= PHP_EOL . Indent::_(3) .
"\$this->setActionLogConfig(";
$script .= PHP_EOL . Indent::_(4) . "//" . Line::_(__Line__,
__Class__) . " typeTitle";
$script .= PHP_EOL . Indent::_(4) . "'" .
Placefix::_("VIEW") . "',";
$script .= PHP_EOL . Indent::_(4) . "//" . Line::_(__Line__,
__Class__) . " typeAlias";
$script .= PHP_EOL . Indent::_(4) . "'com_" .
Placefix::_("component") . "." .
Placefix::_("view") . "',";
$script .= PHP_EOL . Indent::_(4) . "//" . Line::_(__Line__,
__Class__) . " idHolder";
$script .= PHP_EOL . Indent::_(4) . "'id',";
$script .= PHP_EOL . Indent::_(4) . "//" . Line::_(__Line__,
__Class__) . " titleHolder";
$script .= PHP_EOL . Indent::_(4) .
"'<<<MAIN_TITLE>>>',";
$script .= PHP_EOL . Indent::_(4) . "//" . Line::_(__Line__,
__Class__) . " tableName";
$script .= PHP_EOL . Indent::_(4) . "'#__" .
Placefix::_("component") . "_" .
Placefix::_("view") . "',";
$script .= PHP_EOL . Indent::_(4) . "//" . Line::_(__Line__,
__Class__) . " textPrefix";
$script .= PHP_EOL . Indent::_(4) . "'" .
Placefix::_("LANG_PREFIX") . "'";
$script .= PHP_EOL . Indent::_(3) . ");";
return CFactory::_('Placeholder')->update_($script);
}
/**
* get the Main Uninstall Script
*
* @return string
*
*/
protected function getMainJ4UNINSTALLSCRIPT()
{
$script = PHP_EOL . PHP_EOL . Indent::_(2) . "//" .
Line::_(__Line__, __Class__)
. " Remove component from action logs extensions table.";
$script .= PHP_EOL . Indent::_(2) .
"\$this->removeActionLogsExtensions();";
return $script;
}
/**
* get the View Uninstall Script
*
* @return string
*
*/
protected function getViewJ4UNINSTALLSCRIPT()
{
$script = PHP_EOL . PHP_EOL . Indent::_(2) . "//" .
Line::_(__Line__, __Class__)
. " Remove " . Placefix::_("View") . " from
action logs config table.";
$script .= PHP_EOL . Indent::_(2) .
"\$this->removeActionLogConfig('com_"
. Placefix::_("component") . "." .
Placefix::_("view") . "');";
return CFactory::_('Placeholder')->update_($script);
}
/**
* The array of active components
*
* @var array
*/
protected $componentsActive;
/**
* The activate option
*
* @var int
*/
protected $activateOption = 0;
/**
* Set the line number in comments
*
* @return bool
*
*/
protected function componentActive()
{
// check the active option
if (!$this->activateOption)
{
$this->activateOption =
$this->params->get('activate_option', 1);
}
// active for all components
if ($this->activateOption == 1)
{
return true;
}
// first check is we have the active components set
if ($this->activateOption == 2 &&
!ArrayHelper::check($this->componentsActive))
{
$this->componentsActive =
$this->params->get('components');
}
// only check if there are active
if (ArrayHelper::check($this->componentsActive))
{
return in_array((int) CFactory::_('Config')->component_id,
$this->componentsActive);
}
return false;
}
}
componentbuilderactionlogcompiler/index.html000064400000000054151160402250015540
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>language/en-GB/en-GB.plg_extension_componentbuilderactionlogcompiler.ini000064400000003436151160402250031500
0ustar00componentbuilderactionlogcompilerPLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER="Extension
- Componentbuilder ActionLog Compiler"
PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_DESCRIPTION="This
plugin is used to improve your action log integration with Joomla for your
component during compilation. To activate it you must first enable it here.
Then open your JCB component global options, and under the Global tab,
select this plugin in the Activate Compiler Plugins field."
PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_XML_DESCRIPTION="<h1>Extension
- Componentbuilder ActionLog Compiler (v.2.0.1)</h1> <div
style='clear: both;'></div><p>This plugin is used
to improve your action log integration with Joomla for your component
during compilation. To activate it you must first enable it here. Then open
your JCB component global options, and under the Global tab, select this
plugin in the Activate Compiler Plugins field.</p><p>Created by
<a href='https://dev.vdm.io'
target='_blank'>Llewellyn van der Merwe</a><br
/><small>Development started 27th August,
2019</small></p>"
PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_COMPONENT_ACTIVATION="Component
Activation"
PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_ACTIVATE_OPTION_LABEL="Activate
Options"
PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_ACTIVATE_OPTION_DESCRIPTION="You
can select the kind of activation control you would like to use.
<b>All</b> will target all components, and
<b>Selected</b> will let you select only those you want to be
active."
PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_ALL="All"
PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_SELECTED="Selected"
PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_COMPONENTS_LABEL="Components"
PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_COMPONENTS_DESCRIPTION="Select
the components you would like to be
targeted."language/en-GB/en-GB.plg_extension_componentbuilderactionlogcompiler.sys.ini000064400000003436151160402250032315
0ustar00componentbuilderactionlogcompilerPLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER="Extension
- Componentbuilder ActionLog Compiler"
PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_DESCRIPTION="This
plugin is used to improve your action log integration with Joomla for your
component during compilation. To activate it you must first enable it here.
Then open your JCB component global options, and under the Global tab,
select this plugin in the Activate Compiler Plugins field."
PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_XML_DESCRIPTION="<h1>Extension
- Componentbuilder ActionLog Compiler (v.2.0.1)</h1> <div
style='clear: both;'></div><p>This plugin is used
to improve your action log integration with Joomla for your component
during compilation. To activate it you must first enable it here. Then open
your JCB component global options, and under the Global tab, select this
plugin in the Activate Compiler Plugins field.</p><p>Created by
<a href='https://dev.vdm.io'
target='_blank'>Llewellyn van der Merwe</a><br
/><small>Development started 27th August,
2019</small></p>"
PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_COMPONENT_ACTIVATION="Component
Activation"
PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_ACTIVATE_OPTION_LABEL="Activate
Options"
PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_ACTIVATE_OPTION_DESCRIPTION="You
can select the kind of activation control you would like to use.
<b>All</b> will target all components, and
<b>Selected</b> will let you select only those you want to be
active."
PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_ALL="All"
PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_SELECTED="Selected"
PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_COMPONENTS_LABEL="Components"
PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_COMPONENTS_DESCRIPTION="Select
the components you would like to be
targeted."componentbuilderactionlogcompiler/language/en-GB/index.html000064400000000054151160402250020213
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>componentbuilderactionlogcompiler/language/index.html000064400000000054151160402250017323
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>componentbuilderactionlogcompiler/script.php000064400000003571151160402250015567
0ustar00<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
/**
* Extension - Componentbuilder ActionLog Compiler script file.
*
* @package PlgExtensionComponentbuilderActionLogCompiler
*/
class plgExtensionComponentbuilderActionLogCompilerInstallerScript
{
/**
* Called before any type of action
*
* @param string $route Which action is happening
(install|uninstall|discover_install|update)
* @param Joomla\CMS\Installer\InstallerAdapter $adapter The object
responsible for running this script
*
* @return boolean True on success
*/
public function preflight($route, $adapter)
{
// get application
$app = Factory::getApplication();
// the default for both install and update
$jversion = new JVersion();
if (!$jversion->isCompatible('3.8.0'))
{
$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0
before continuing!', 'error');
return false;
}
if ('install' === $route)
{
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR .
'/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be
installed from <a href="https://www.joomlacomponentbuilder.com/
" target="_blank">Joomla Component
Builder</a>.', 'error');
return false;
}
}
return true;
}
}
componentbuilderactionlogcompiler/componentbuilderactionlogcompiler.xml000064400000004750151160402250023300
0ustar00<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" version="3.10"
group="extension" method="upgrade">
<name>PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER</name>
<creationDate>20th September, 2024</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://dev.vdm.io</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights
reserved.</copyright>
<license>GNU General Public License version 2 or later; see
LICENSE.txt</license>
<version>2.0.1</version>
<description>PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_XML_DESCRIPTION</description>
<!-- Scripts to run on installation -->
<scriptfile>script.php</scriptfile>
<!-- Language files -->
<languages folder="language">
<language
tag="en-GB">en-GB/en-GB.plg_extension_componentbuilderactionlogcompiler.ini</language>
<language
tag="en-GB">en-GB/en-GB.plg_extension_componentbuilderactionlogcompiler.sys.ini</language>
</languages>
<!-- Plugin files -->
<files>
<filename
plugin="componentbuilderactionlogcompiler">componentbuilderactionlogcompiler.php</filename>
<filename>index.html</filename>
<folder>language</folder>
</files>
<!-- Config parameters -->
<config
addrulepath="/administrator/components/com_componentbuilder/models/rules"
addfieldpath="/administrator/components/com_componentbuilder/models/fields"
>
<fields name="params">
<fieldset name="activate"
label="PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_COMPONENT_ACTIVATION">
<!-- Activate_option Field. Type: Radio. (joomla) -->
<field
type="radio"
name="activate_option"
label="PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_ACTIVATE_OPTION_LABEL"
description="PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_ACTIVATE_OPTION_DESCRIPTION"
class="btn-group btn-group-yesno"
default="1"
required="true">
<!-- Option Set. -->
<option value="1">
PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_ALL</option>
<option value="2">
PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_SELECTED</option>
</field>
<!-- Components Field. Type: Joomlacomponents. (custom) -->
<field
type="joomlacomponents"
name="components"
label="PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_COMPONENTS_LABEL"
description="PLG_EXTENSION_COMPONENTBUILDERACTIONLOGCOMPILER_COMPONENTS_DESCRIPTION"
class="list_class"
multiple="true"
default="0"
showon="activate_option:2"
button="false"
/>
</fieldset>
</fields>
</config>
</extension>componentbuilderexportcompiler/componentbuilderexportcompiler.php000064400000021423151160402250022167
0ustar00<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR .
'/components/com_componentbuilder/helpers/componentbuilder.php');
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Plugin\CMSPlugin;
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Line;
use VDM\Joomla\Utilities\ArrayHelper;
/**
* Extension - Componentbuilder Export Compiler plugin.
*
* @package ComponentbuilderExportCompiler
* @since 1.2.1
*/
class PlgExtensionComponentbuilderExportCompiler extends CMSPlugin
{
/**
* Application object
*
* @var CMSApplication
* @since 1.0.0
*/
protected $app;
/**
* Affects constructor behavior. If true, language files will be loaded
automatically.
*
* @var boolean
* @since 1.0.0
*/
protected $autoloadLanguage = true;
/**
* The language string builder
*
* @var array
*/
protected $languageArray = [];
/*
* The Export Text Only switch
*
* @var int
*/
protected $exportTextOnly = 0;
/*
* The Strict Field Export Permissions switch
*
* @var bool
*/
protected $strictFieldExportPermissions = false;
/**
* Event Triggered in the compiler [on Before Get Component Data]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onAfterGetComponentData()
{
if ($this->exportTextOnly && $this->componentActive())
{
// activate export text only
CFactory::_('Config')->set('export_text_only',
(int) $this->exportTextOnly);
// activate strict_permission_per_field if set in plugin (default true)
CFactory::_('Config')->set('permission_strict_per_field',
(bool) $this->strictFieldExportPermissions);
}
}
/**
* Event Triggered in the compiler [on After Model Component Data]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onAfterModelComponentData(&$component)
{
// check if we have export for any view
if ($this->componentActive())
{
// set the export/import option
if (isset($component->admin_views) &&
ArrayHelper::check($component->admin_views))
{
foreach ($component->admin_views as $view)
{
if (!$this->exportTextOnly &&
(isset($view['port']) && $view['port'] || 1 ==
$view['settings']->add_custom_import))
{
$this->exportTextOnly = 1;
$this->strictFieldExportPermissions = (bool)
$this->params->get('strict_permission_per_field', 1);
}
}
}
}
}
/**
* Event Triggered in the compiler [on Before Set Lang File Data]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onBeforeSetLangFileData()
{
if ($this->exportTextOnly && $this->componentActive()
&& ArrayHelper::check($this->languageArray))
{
foreach($this->languageArray as $key => $string)
{
CFactory::_('Language')->set('adminsys', $key,
$string);
}
}
}
/**
* Event Triggered in the compiler [on Before Set Config Field sets]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onBeforeSetConfigFieldsets(&$timer)
{
// only add fields after second time
if ($this->exportTextOnly && $this->componentActive()
&& $timer == 2)
{
// main lang prefix
$lang = CFactory::_('Config')->lang_prefix .
'_CONFIG';
// start building field set for config
$configFieldSets[] = Indent::_(1) . "<fieldset";
$configFieldSets[] = Indent::_(2) .
'name="export_text_only_config"';
$configFieldSets[] = Indent::_(2) . 'label="' . $lang .
'_EXPORT_TEXT_ONLY_TAB_LABEL"';
$configFieldSets[] = Indent::_(2) . 'description="' .
$lang . '_EXPORT_TEXT_ONLY_TAB_DESCRIPTION">';
// setup lang
$this->languageArray[$lang . '_EXPORT_TEXT_ONLY_TAB_LABEL']
= "Export Options";
$this->languageArray[$lang .
'_EXPORT_TEXT_ONLY_TAB_DESCRIPTION'] = "Here are some extra
option to adjust the export behavior of admin views.";
// add custom Export Options
if (isset($configFieldSetsCustomField['Export Options'])
&& ArrayHelper::check($configFieldSetsCustomField['Export
Options']))
{
$configFieldSets[] = implode("",
$configFieldSetsCustomField['Export Options']);
unset($configFieldSetsCustomField['Export Options']);
}
else
{
$this->languageArray[$lang . '_EXPORT_TEXT_ONLY_LABEL'] =
"Export Text Only";
$this->languageArray[$lang .
'_EXPORT_TEXT_ONLY_DESCRIPTION'] = "This option enables the
export of string/text instead of linked IDs in all admin views that have an
export option.";
$this->languageArray[$lang . '_ACTIVATE'] =
"Activate";
$this->languageArray[$lang . '_DEACTIVATE'] =
"Deactivate";
$configFieldSets[] = PHP_EOL . Indent::_(2) . "<!--" .
Line::_(__Line__, __Class__) . " Export Text Only Field. Type: Radio.
(joomla) -->";
$configFieldSets[] = Indent::_(2) . "<field";
$configFieldSets[] = Indent::_(3) .
"type=\"radio\"";
$configFieldSets[] = Indent::_(3) .
"name=\"export_text_only\"";
$configFieldSets[] = Indent::_(3) . "label=\"" . $lang .
"_EXPORT_TEXT_ONLY_LABEL\"";
$configFieldSets[] = Indent::_(3) . "description=\"" .
$lang . "_EXPORT_TEXT_ONLY_DESCRIPTION\"";
$configFieldSets[] = Indent::_(3) . "class=\"btn-group
btn-group-yesno\"";
$configFieldSets[] = Indent::_(3) .
"default=\"0\">";
$configFieldSets[] = Indent::_(3) . "<!--" .
Line::_(__Line__, __Class__) . " Option Set. -->";
$configFieldSets[] = Indent::_(3) . "<option
value=\"1\">";
$configFieldSets[] = Indent::_(4) . $lang .
"_ACTIVATE</option>";
$configFieldSets[] = Indent::_(3) . "<option
value=\"0\">";
$configFieldSets[] = Indent::_(4) . $lang .
"_DEACTIVATE</option>";
$configFieldSets[] = Indent::_(2) . "</field>";
// add strict Field Export Permissions field
if ($this->strictFieldExportPermissions)
{
$this->languageArray[$lang .
'_STRICT_PERMISSION_PER_FIELD_LABEL'] = "Use Strict
Permission per/field";
$this->languageArray[$lang .
'_STRICT_PERMISSION_PER_FIELD_DESCRIPTION'] = "Use strict
permissions per/field in the export methods where there are fields
permissions in a view.";
$configFieldSets[] = PHP_EOL . Indent::_(2) . "<!--" .
Line::_(__Line__, __Class__) . " Strict_permission_per_field Field.
Type: Radio. (joomla) -->";
$configFieldSets[] = Indent::_(2) . "<field";
$configFieldSets[] = Indent::_(3) .
"type=\"radio\"";
$configFieldSets[] = Indent::_(3) .
"name=\"strict_permission_per_field\"";
$configFieldSets[] = Indent::_(3) . "label=\"" . $lang
. "_STRICT_PERMISSION_PER_FIELD_LABEL\"";
$configFieldSets[] = Indent::_(3) . "description=\"" .
$lang . "_STRICT_PERMISSION_PER_FIELD_DESCRIPTION\"";
$configFieldSets[] = Indent::_(3) . "class=\"btn-group
btn-group-yesno\"";
$configFieldSets[] = Indent::_(3) .
"default=\"1\">";
$configFieldSets[] = Indent::_(3) . "<!--" .
Line::_(__Line__, __Class__) . " Option Set. -->";
$configFieldSets[] = Indent::_(3) . "<option
value=\"1\">";
$configFieldSets[] = Indent::_(4) . $lang .
"_ACTIVATE</option>";
$configFieldSets[] = Indent::_(3) . "<option
value=\"0\">";
$configFieldSets[] = Indent::_(4) . $lang .
"_DEACTIVATE</option>";
$configFieldSets[] = Indent::_(2) . "</field>";
}
}
// close that fieldset
$configFieldSets[] = Indent::_(1) . "</fieldset>";
}
}
/**
* The array of active components
*
* @var array
*/
protected $componentsActive;
/**
* The activate option
*
* @var int
*/
protected $activateOption = 0;
/**
* Set the line number in comments
*
* @return bool
*
*/
protected function componentActive()
{
// check the active option
if (!$this->activateOption)
{
$this->activateOption =
$this->params->get('activate_option', 1);
}
// active for all components
if ($this->activateOption == 1)
{
return true;
}
// first check is we have the active components set
if ($this->activateOption == 2 &&
!ArrayHelper::check($this->componentsActive))
{
$this->componentsActive =
$this->params->get('components');
}
// only check if there are active
if (ArrayHelper::check($this->componentsActive))
{
return in_array((int) CFactory::_('Config')->component_id,
$this->componentsActive);
}
return false;
}
}
componentbuilderexportcompiler/index.html000064400000000054151160402250015102
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>componentbuilderexportcompiler/language/en-GB/en-GB.plg_extension_componentbuilderexportcompiler.ini000064400000004532151160402250030461
0ustar00PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER="Extension -
Componentbuilder Export Compiler"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_DESCRIPTION="This plugin
is used to tweak the export options for your components during compilation.
To activate it you must first enable it here. Then open your JCB component
global options, and under the Global tab, select this plugin in the
Activate Compiler Plugins field.Also be sure to activate the component/s
that should be targeted with this added export feature under the Component
Activation tab."
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_XML_DESCRIPTION="<h1>Extension
- Componentbuilder Export Compiler (v.1.2.1)</h1> <div
style='clear: both;'></div><p>This plugin is used
to tweak the export options for your components during compilation. To
activate it you must first enable it here. Then open your JCB component
global options, and under the Global tab, select this plugin in the
Activate Compiler Plugins field.Also be sure to activate the component/s
that should be targeted with this added export feature under the Component
Activation tab.</p><p>Created by <a
href='https://dev.vdm.io' target='_blank'>Llewellyn
van der Merwe</a><br /><small>Development started 21st
August, 2019</small></p>"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_SETTINGS="Settings"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_ACTIVATE_OPTION_LABEL="Activate
Options"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_ACTIVATE_OPTION_DESCRIPTION="You
can select the kind of activation control you would like to use.
<b>All</b> will target all components, and
<b>Selected</b> will let you select only those you want to be
active."
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_ALL="All"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_SELECTED="Selected"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_COMPONENTS_LABEL="Components"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_COMPONENTS_DESCRIPTION="Select
the components you would like to be targeted."
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_STRICT_PERMISSION_PER_FIELD_LABEL="Add
Strict Permission per/field"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_STRICT_PERMISSION_PER_FIELD_DESCRIPTION="You
can add strict permissions per/field in the export method where there is
field permissions in a view."
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_NO="No"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_YES="Yes"language/en-GB/en-GB.plg_extension_componentbuilderexportcompiler.sys.ini000064400000004532151160402250031217
0ustar00componentbuilderexportcompilerPLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER="Extension
- Componentbuilder Export Compiler"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_DESCRIPTION="This plugin
is used to tweak the export options for your components during compilation.
To activate it you must first enable it here. Then open your JCB component
global options, and under the Global tab, select this plugin in the
Activate Compiler Plugins field.Also be sure to activate the component/s
that should be targeted with this added export feature under the Component
Activation tab."
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_XML_DESCRIPTION="<h1>Extension
- Componentbuilder Export Compiler (v.1.2.1)</h1> <div
style='clear: both;'></div><p>This plugin is used
to tweak the export options for your components during compilation. To
activate it you must first enable it here. Then open your JCB component
global options, and under the Global tab, select this plugin in the
Activate Compiler Plugins field.Also be sure to activate the component/s
that should be targeted with this added export feature under the Component
Activation tab.</p><p>Created by <a
href='https://dev.vdm.io' target='_blank'>Llewellyn
van der Merwe</a><br /><small>Development started 21st
August, 2019</small></p>"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_SETTINGS="Settings"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_ACTIVATE_OPTION_LABEL="Activate
Options"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_ACTIVATE_OPTION_DESCRIPTION="You
can select the kind of activation control you would like to use.
<b>All</b> will target all components, and
<b>Selected</b> will let you select only those you want to be
active."
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_ALL="All"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_SELECTED="Selected"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_COMPONENTS_LABEL="Components"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_COMPONENTS_DESCRIPTION="Select
the components you would like to be targeted."
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_STRICT_PERMISSION_PER_FIELD_LABEL="Add
Strict Permission per/field"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_STRICT_PERMISSION_PER_FIELD_DESCRIPTION="You
can add strict permissions per/field in the export method where there is
field permissions in a view."
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_NO="No"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_YES="Yes"componentbuilderexportcompiler/language/en-GB/index.html000064400000000054151160402250017555
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>componentbuilderexportcompiler/language/index.html000064400000000054151160402250016665
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>componentbuilderexportcompiler/script.php000064400000003560151160402250015127
0ustar00<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
/**
* Extension - Componentbuilder Export Compiler script file.
*
* @package PlgExtensionComponentbuilderExportCompiler
*/
class plgExtensionComponentbuilderExportCompilerInstallerScript
{
/**
* Called before any type of action
*
* @param string $route Which action is happening
(install|uninstall|discover_install|update)
* @param Joomla\CMS\Installer\InstallerAdapter $adapter The object
responsible for running this script
*
* @return boolean True on success
*/
public function preflight($route, $adapter)
{
// get application
$app = Factory::getApplication();
// the default for both install and update
$jversion = new JVersion();
if (!$jversion->isCompatible('3.8.0'))
{
$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0
before continuing!', 'error');
return false;
}
if ('install' === $route)
{
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR .
'/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be
installed from <a href="https://www.joomlacomponentbuilder.com/
" target="_blank">Joomla Component
Builder</a>.', 'error');
return false;
}
}
return true;
}
}
componentbuilderexportcompiler/componentbuilderexportcompiler.xml000064400000005764151160402250022212
0ustar00<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" version="3.10"
group="extension" method="upgrade">
<name>PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER</name>
<creationDate>20th September, 2024</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://dev.vdm.io</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights
reserved.</copyright>
<license>GNU General Public License version 2 or later; see
LICENSE.txt</license>
<version>1.2.1</version>
<description>PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_XML_DESCRIPTION</description>
<!-- Scripts to run on installation -->
<scriptfile>script.php</scriptfile>
<!-- Language files -->
<languages folder="language">
<language
tag="en-GB">en-GB/en-GB.plg_extension_componentbuilderexportcompiler.ini</language>
<language
tag="en-GB">en-GB/en-GB.plg_extension_componentbuilderexportcompiler.sys.ini</language>
</languages>
<!-- Plugin files -->
<files>
<filename
plugin="componentbuilderexportcompiler">componentbuilderexportcompiler.php</filename>
<filename>index.html</filename>
<folder>language</folder>
</files>
<!-- Config parameters -->
<config
addrulepath="/administrator/components/com_componentbuilder/models/rules"
addfieldpath="/administrator/components/com_componentbuilder/models/fields"
>
<fields name="params">
<fieldset name="basic"
label="PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_SETTINGS">
<!-- Activate_option Field. Type: Radio. (joomla) -->
<field
type="radio"
name="activate_option"
label="PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_ACTIVATE_OPTION_LABEL"
description="PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_ACTIVATE_OPTION_DESCRIPTION"
class="btn-group btn-group-yesno"
default="1"
required="true">
<!-- Option Set. -->
<option value="1">
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_ALL</option>
<option value="2">
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_SELECTED</option>
</field>
<!-- Components Field. Type: Joomlacomponents. (custom) -->
<field
type="joomlacomponents"
name="components"
label="PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_COMPONENTS_LABEL"
description="PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_COMPONENTS_DESCRIPTION"
class="list_class"
multiple="true"
default="0"
showon="activate_option:2"
button="false"
/>
<!-- Strict_permission_per_field Field. Type: Radio. (joomla) -->
<field
type="radio"
name="strict_permission_per_field"
label="PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_STRICT_PERMISSION_PER_FIELD_LABEL"
description="PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_STRICT_PERMISSION_PER_FIELD_DESCRIPTION"
class="btn-group btn-group-yesno"
default="1">
<!-- Option Set. -->
<option value="0">
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_NO</option>
<option value="1">
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_YES</option>
</field>
</fieldset>
</fields>
</config>
</extension>componentbuilderfieldorderingcompiler/componentbuilderfieldorderingcompiler.php000064400000003712151160402250024760
0ustar00<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR .
'/components/com_componentbuilder/helpers/componentbuilder.php');
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Registry\Registry;
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
/**
* Extension - Componentbuilder Field Ordering Compiler plugin.
*
* @package ComponentbuilderFieldOrderingCompiler
* @since 1.1.0
*/
class PlgExtensionComponentbuilderFieldOrderingCompiler extends CMSPlugin
{
/**
* Event Triggered in the compiler [on Before Model View Data]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onBeforeModelViewData(&$view)
{
// add the privacy
$view->params = (isset($view->params) &&
JsonHelper::check($view->params)) ? json_decode($view->params, true)
: $view->params;
if (ArrayHelper::check($view->params) &&
isset($view->params['fieldordering']) &&
ArrayHelper::check($view->params['fieldordering']))
{
if
($view->params['fieldordering']['add_admin_ordering']
== 1
||
$view->params['fieldordering']['add_linked_ordering']
== 1)
{
// setup the view key name
$name_list = StringHelper::safe($view->name_list);
// load the admin view details
CFactory::_('Compiler.Builder.Views.Default.Ordering')->set($name_list,
$view->params['fieldordering']);
}
}
}
}
componentbuilderfieldorderingcompiler/index.html000064400000000054151160402250016376
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>language/af-ZA/af-ZA.plg_extension_componentbuilderfieldorderingcompiler.ini000064400000000461151160402260033204
0ustar00componentbuilderfieldorderingcompilerPLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_NO="Nee"
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_NO="Nee"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_NO="Nee"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_YES="Ja"language/af-ZA/af-ZA.plg_extension_componentbuilderfieldorderingcompiler.sys.ini000064400000000461151160402260034021
0ustar00componentbuilderfieldorderingcompilerPLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_NO="Nee"
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_NO="Nee"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_NO="Nee"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_YES="Ja"language/en-GB/en-GB.plg_extension_componentbuilderfieldorderingcompiler.ini000064400000002232151160402260033166
0ustar00componentbuilderfieldorderingcompilerPLG_EXTENSION_COMPONENTBUILDERFIELDORDERINGCOMPILER="Extension
- Componentbuilder Field Ordering Compiler"
PLG_EXTENSION_COMPONENTBUILDERFIELDORDERINGCOMPILER_DESCRIPTION="This
plugin is used to set the ordring for your component views during
compilation. To activate it you must first enable it here. Then open your
JCB component global options, and under the Global tab, select this plugin
in the Activate Compiler Plugins field.Also be sure to set your admin views
where you would like to use Field Ordering."
PLG_EXTENSION_COMPONENTBUILDERFIELDORDERINGCOMPILER_XML_DESCRIPTION="<h1>Extension
- Componentbuilder Field Ordering Compiler (v.1.1.0)</h1> <div
style='clear: both;'></div><p>This plugin is used
to set the ordring for your component views during compilation. To activate
it you must first enable it here. Then open your JCB component global
options, and under the Global tab, select this plugin in the Activate
Compiler Plugins field.Also be sure to set your admin views where you would
like to use Field Ordering.</p><p>Created by <a
href='https://dev.vdm.io' target='_blank'>Llewellyn
van der Merwe</a><br /><small>Development started 21st
May,
2020</small></p>"language/en-GB/en-GB.plg_extension_componentbuilderfieldorderingcompiler.sys.ini000064400000002232151160402260034003
0ustar00componentbuilderfieldorderingcompilerPLG_EXTENSION_COMPONENTBUILDERFIELDORDERINGCOMPILER="Extension
- Componentbuilder Field Ordering Compiler"
PLG_EXTENSION_COMPONENTBUILDERFIELDORDERINGCOMPILER_DESCRIPTION="This
plugin is used to set the ordring for your component views during
compilation. To activate it you must first enable it here. Then open your
JCB component global options, and under the Global tab, select this plugin
in the Activate Compiler Plugins field.Also be sure to set your admin views
where you would like to use Field Ordering."
PLG_EXTENSION_COMPONENTBUILDERFIELDORDERINGCOMPILER_XML_DESCRIPTION="<h1>Extension
- Componentbuilder Field Ordering Compiler (v.1.1.0)</h1> <div
style='clear: both;'></div><p>This plugin is used
to set the ordring for your component views during compilation. To activate
it you must first enable it here. Then open your JCB component global
options, and under the Global tab, select this plugin in the Activate
Compiler Plugins field.Also be sure to set your admin views where you would
like to use Field Ordering.</p><p>Created by <a
href='https://dev.vdm.io' target='_blank'>Llewellyn
van der Merwe</a><br /><small>Development started 21st
May,
2020</small></p>"componentbuilderfieldorderingcompiler/language/en-GB/index.html000064400000000054151160402260021052
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>componentbuilderfieldorderingcompiler/language/index.html000064400000000054151160402260020162
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>componentbuilderfieldorderingcompiler/script.php000064400000005602151160402260016423
0ustar00<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
/**
* Extension - Componentbuilder Field Ordering Compiler script file.
*
* @package PlgExtensionComponentbuilderFieldOrderingCompiler
*/
class plgExtensionComponentbuilderFieldOrderingCompilerInstallerScript
{
/**
* Called before any type of action
*
* @param string $route Which action is happening
(install|uninstall|discover_install|update)
* @param Joomla\CMS\Installer\InstallerAdapter $adapter The object
responsible for running this script
*
* @return boolean True on success
*/
public function preflight($route, $adapter)
{
// get application
$app = Factory::getApplication();
// the default for both install and update
$jversion = new JVersion();
if (!$jversion->isCompatible('3.8.0'))
{
$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0
before continuing!', 'error');
return false;
}
if ('install' === $route)
{
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR .
'/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be
installed from <a href="https://www.joomlacomponentbuilder.com/
" target="_blank">Joomla Component
Builder</a>.', 'error');
return false;
}
// load the helper class
JLoader::register('ComponentbuilderHelper',
JPATH_ADMINISTRATOR .
'/components/com_componentbuilder/helpers/componentbuilder.php');
// block install
$blockInstall = true;
// check the version of JCB
$manifest = ComponentbuilderHelper::manifest();
if (isset($manifest->version) &&
strpos($manifest->version, '.') !== false)
{
// get the version
$jcbVersion = explode('.', $manifest->version);
// check that we have JCB 3.0.0 or higher installed
if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3
&&
(
($jcbVersion[0] == 3 && $jcbVersion[1] == 0 &&
$jcbVersion[2] >= 0) ||
($jcbVersion[0] == 3 && $jcbVersion[1] > 0) ||
$jcbVersion[0] > 3)
)
{
$blockInstall = false;
}
}
// allow install if all conditions are met
if ($blockInstall)
{
$app->enqueueMessage('Please upgrade to JCB v3.0.0 or higher
before installing this plugin.', 'error');
return false;
}
}
return true;
}
}
componentbuilderfieldorderingcompiler/componentbuilderfieldorderingcompiler.xml000064400000002654151160402260024776
0ustar00<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" version="3.10"
group="extension" method="upgrade">
<name>PLG_EXTENSION_COMPONENTBUILDERFIELDORDERINGCOMPILER</name>
<creationDate>20th September, 2024</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://dev.vdm.io</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights
reserved.</copyright>
<license>GNU General Public License version 2 or later; see
LICENSE.txt</license>
<version>1.1.0</version>
<description>PLG_EXTENSION_COMPONENTBUILDERFIELDORDERINGCOMPILER_XML_DESCRIPTION</description>
<!-- Scripts to run on installation -->
<scriptfile>script.php</scriptfile>
<!-- Language files -->
<languages folder="language">
<language
tag="en-GB">en-GB/en-GB.plg_extension_componentbuilderfieldorderingcompiler.ini</language>
<language
tag="en-GB">en-GB/en-GB.plg_extension_componentbuilderfieldorderingcompiler.sys.ini</language>
<language
tag="af-ZA">af-ZA/af-ZA.plg_extension_componentbuilderfieldorderingcompiler.ini</language>
<language
tag="af-ZA">af-ZA/af-ZA.plg_extension_componentbuilderfieldorderingcompiler.sys.ini</language>
</languages>
<!-- Plugin files -->
<files>
<filename
plugin="componentbuilderfieldorderingcompiler">componentbuilderfieldorderingcompiler.php</filename>
<filename>index.html</filename>
<folder>language</folder>
</files>
</extension>componentbuilderheaderscompiler/componentbuilderheaderscompiler.php000064400000047431151160402260022363
0ustar00<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR .
'/components/com_componentbuilder/helpers/componentbuilder.php');
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Registry\Registry;
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\String\NamespaceHelper;
/**
* Extension - Componentbuilder Headers Compiler plugin.
*
* @package ComponentbuilderHeadersCompiler
* @since 2.3.1
*/
class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
{
/**
* Global switch to see if a file has custom headers.
*
* @var boolean
* @since 1.0.0
*/
protected $loadHeaders = false;
/**
* The active headers
*
* @var array
* @since 1.0.8
*/
protected $activeHeaders = array();
/**
* The compiler placeholders values
*
* @var array
* @since 1.0.6
*/
protected $placeholders = array();
/**
* The powers to include in project
*
* @var array
* @since 1.0.6
*/
protected $linkedPowers = array();
/**
* The Targets
*
* @var array
* @since 1.0.8
*/
protected $targets = array(
'admin_view_headers' =>
array(
'add_admin_view_model' => array(
'field' => 'admin_view_model',
'context' => 'admin.view.model',
'view' => 'name_single'
),
'add_admin_view' => array(
'field' => 'admin_view',
'context' => 'admin.view',
'view' => 'name_single'
),
'add_admin_view_html' => array(
'field' => 'admin_view_html',
'context' => 'admin.view.html',
'view' => 'name_single'
),
'add_site_admin_view_html' => array(
'field' => 'site_admin_view_html',
'context' => 'site.admin.view.html',
'view' => 'name_single'
),
'add_admin_view_controller' => array(
'field' => 'admin_view_controller',
'context' => 'admin.view.controller',
'view' => 'name_single'
),
'add_ajax_model' => array(
'field' => 'ajax_model',
'context' => 'ajax.admin.model',
'view' => 'ajax'
),
'add_admin_views_model' => array(
'field' => 'admin_views_model',
'context' => 'admin.views.model',
'view' => 'name_list'
),
'add_admin_views' => array(
'field' => 'admin_views',
'context' => 'admin.views',
'view' => 'name_list'
),
'add_admin_views_html' => array(
'field' => 'admin_views_html',
'context' => 'admin.views.html',
'view' => 'name_list'
),
'add_admin_views_controller' => array(
'field' => 'admin_views_controller',
'context' => 'admin.views.controller',
'view' => 'name_list'
),
'add_import_custom_controller' => array(
'field' => 'import_custom_controller',
'context' => 'import.custom.controller',
'view' => 'name_list'
),
'add_import_custom_model' => array(
'field' => 'import_custom_model',
'context' => 'import.custom.model',
'view' => 'name_list'
)
),
'site_view_headers' =>
array(
'add_site_view_model' => array(
'field' => 'site_view_model',
'context' => 'site.view.model',
'view' => 'code'
),
'add_site_view' => array(
'field' => 'site_view',
'context' => 'site.view',
'view' => 'code'
),
'add_site_view_html' => array(
'field' => 'site_view_html',
'context' => 'site.view.html',
'view' => 'code'
),
'add_site_view_controller' => array(
'field' => 'site_view_controller',
'context' => 'site.view.controller',
'view' => 'code'
),
'add_site_views_model' => array(
'field' => 'site_views_model',
'context' => 'site.views.model',
'view' => 'code'
),
'add_site_views' => array(
'field' => 'site_views',
'context' => 'site.views',
'view' => 'code'
),
'add_site_views_html' => array(
'field' => 'site_views_html',
'context' => 'site.views.html',
'view' => 'code'
),
'add_site_views_controller' => array(
'field' => 'site_views_controller',
'context' => 'site.views.controller',
'view' => 'code'
),
'add_ajax_model' => array(
'field' => 'ajax_model',
'context' => 'ajax.site.model',
'view' => 'ajax'
)
),
'custom_admin_view_headers' =>
array(
'add_custom_admin_view_model' => array(
'field' => 'custom_admin_view_model',
'context' => 'custom.admin.view.model',
'view' => 'code'
),
'add_custom_admin_view' => array(
'field' => 'custom_admin_view',
'context' => 'custom.admin.view',
'view' => 'code'
),
'add_custom_admin_view_html' => array(
'field' => 'custom_admin_view_html',
'context' => 'custom.admin.view.html',
'view' => 'code'
),
'add_custom_admin_view_controller' => array(
'field' => 'custom_admin_view_controller',
'context' => 'custom.admin.view.controller',
'view' => 'code'
),
'add_custom_admin_views_model' => array(
'field' => 'custom_admin_views_model',
'context' => 'custom.admin.views.model',
'view' => 'code'
),
'add_custom_admin_views' => array(
'field' => 'custom_admin_views',
'context' => 'custom.admin.views',
'view' => 'code'
),
'add_custom_admin_views_html' => array(
'field' => 'custom_admin_views_html',
'context' => 'custom.admin.views.html',
'view' => 'code'
),
'add_custom_admin_views_controller' => array(
'field' => 'custom_admin_views_controller',
'context' => 'custom.admin.views.controller',
'view' => 'code'
),
'add_ajax_model' => array(
'field' => 'ajax_model',
'context' => 'ajax.admin.model',
'view' => 'ajax'
)
),
'dynamic_get_headers' =>
array(
'add_site_view_model' => array(
'field' => 'site_view_model',
'context' => 'site.view.model',
'view' => 'code'
),
'add_site_view' => array(
'field' => 'site_view',
'context' => 'site.view',
'view' => 'code'
),
'add_site_view_html' => array(
'field' => 'site_view_html',
'context' => 'site.view.html',
'view' => 'code'
),
'add_site_view_controller' => array(
'field' => 'site_view_controller',
'context' => 'site.view.controller',
'view' => 'code'
),
'add_site_views_model' => array(
'field' => 'site_views_model',
'context' => 'site.views.model',
'view' => 'code'
),
'add_site_views' => array(
'field' => 'site_views',
'context' => 'site.views',
'view' => 'code'
),
'add_site_views_html' => array(
'field' => 'site_views_html',
'context' => 'site.views.html',
'view' => 'code'
),
'add_site_views_controller' => array(
'field' => 'site_views_controller',
'context' => 'site.views.controller',
'view' => 'code'
),
'add_custom_admin_view_model' => array(
'field' => 'custom_admin_view_model',
'context' => 'custom.admin.view.model',
'view' => 'code'
),
'add_custom_admin_view' => array(
'field' => 'custom_admin_view',
'context' => 'custom.admin.view',
'view' => 'code'
),
'add_custom_admin_view_html' => array(
'field' => 'custom_admin_view_html',
'context' => 'custom.admin.view.html',
'view' => 'code'
),
'add_custom_admin_view_controller' => array(
'field' => 'custom_admin_view_controller',
'context' => 'custom.admin.view.controller',
'view' => 'code'
),
'add_custom_admin_views_model' => array(
'field' => 'custom_admin_views_model',
'context' => 'custom.admin.views.model',
'view' => 'code'
),
'add_custom_admin_views' => array(
'field' => 'custom_admin_views',
'context' => 'custom.admin.views',
'view' => 'code'
),
'add_custom_admin_views_html' => array(
'field' => 'custom_admin_views_html',
'context' => 'custom.admin.views.html',
'view' => 'code'
),
'add_custom_admin_views_controller' => array(
'field' => 'custom_admin_views_controller',
'context' => 'custom.admin.views.controller',
'view' => 'code'
),
'add_ajax_model' => array(
'field' => 'ajax_model',
'context' => 'ajax.admin.model',
'view' => 'ajax'
)
),
'component_dashboard_headers' =>
array(
'add_dashboard_model' => array(
'field' => 'dashboard_model',
'context' => 'dashboard.model',
'view' => 'dashboard'
),
'add_dashboard_view' => array(
'field' => 'dashboard_view',
'context' => 'dashboard.view',
'view' => 'dashboard'
),
'add_dashboard_view_html' => array(
'field' => 'dashboard_view_html',
'context' => 'dashboard.view.html',
'view' => 'dashboard'
),
'add_dashboard_controller' => array(
'field' => 'dashboard_controller',
'context' => 'dashboard.controller',
'view' => 'dashboard'
),
'add_ajax_model' => array(
'field' => 'ajax_model',
'context' => 'ajax.admin.model',
'view' => 'ajax'
)
),
'joomla_component_headers' =>
array(
'add_admin_component' => array(
'field' => 'admin_component',
'context' => 'admin.component',
'view' => 'admin'
),
'add_site_component' => array(
'field' => 'site_component',
'context' => 'site.component',
'view' => 'site'
),
'add_admin_helper' => array(
'field' => 'admin_helper',
'context' => 'admin.helper',
'view' => 'admin'
),
'add_site_helper' => array(
'field' => 'site_helper',
'context' => 'site.helper',
'view' => 'site'
)
)
);
/**
* Event Triggered in the compiler [on Before Model View Data]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onBeforeModelViewData(&$view)
{
// check that the params are set
if (isset($view->params))
{
// add the headers for the Admin Views
$this->setHeaders($view->params, $view,
'admin_view_headers');
}
}
/**
* Event Triggered in the compiler [on Before Model Custom View Data]
*
* @return void
*
* @since 1.0.2
*/
public function jcb_ce_onBeforeModelCustomViewData(&$view, &$id,
&$table)
{
// check that the params are set
if (isset($view->params))
{
// add the headers for the Site Views
$this->setHeaders($view->params, $view,
'site_view_headers');
// add the headers for the Custom Admin Views
$this->setHeaders($view->params, $view,
'custom_admin_view_headers');
}
}
/**
* Event Triggered in the compiler [on Before Model Dynamic Get Data]
*
* @return void
*
* @since 1.0.10
*/
public function jcb_ce_onBeforeModelDynamicGetData(&$dynamicGet,
&$id, &$code, &$area)
{
// check that the params are set
if (isset($dynamicGet->params))
{
// add the headers for the Site Views
$this->setDynamicHeaders($dynamicGet->params, $code,
'dynamic_get_headers');
}
}
/**
* Event Triggered in the compiler [on Before Model Component Data]
*
* @return void
*
* @since 1.0.4
*/
public function jcb_ce_onBeforeModelComponentData(&$component)
{
// check that the params are set
if (isset($component->params))
{
// add the headers for the Joomla Component
$this->setHeaders($component->params, $component,
'joomla_component_headers');
}
// check that the dashboard params are set
if (isset($component->dashboard_params))
{
// add the headers for the Component Dashboard
$this->setHeaders($component->dashboard_params, $component,
'component_dashboard_headers');
}
}
/**
* Event Triggered in the compiler [on set Class Header]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_setClassHeader(&$event_context,
&$view_name, &$headers)
{
if ($this->loadHeaders &&
isset($this->activeHeaders[$view_name])
&& isset($this->activeHeaders[$view_name][$event_context])
&&
is_array($this->activeHeaders[$view_name][$event_context]))
{
// work with the header values as keys
$_headers = array_flip($headers);
// new headers
$new = $this->activeHeaders[$view_name][$event_context];
// now add the new headers
foreach ($new as $n => $header)
{
// if an empty line is found just skip it
// we check if this header is already set
if (empty($header) || isset($_headers[$header]))
{
continue;
}
$headers[] = $header;
}
}
}
/**
* Event Triggered in the compiler [on Before Get Component Data]
*
* @return void
*
* @since 1.0.6
*/
public function jcb_ce_onBeforeGetComponentData()
{
// get placeholders from the compiler
$this->placeholders =
CFactory::_('Component.Placeholder')->get();
}
/**
* Event Triggered in the compiler [on After Get Component Data]
*
* @return void
*
* @since 1.0.6
*/
public function jcb_ce_onAfterGetComponentData()
{
// add the powers to the component
if (ArrayHelper::check($this->linkedPowers, true))
{
CFactory::_('Power')->load($this->linkedPowers);
}
}
/**
* set the headers
*
* @return void
*
* @since 1.0.8
*/
protected function setHeaders(&$params, &$obj, $key)
{
// add the headers
$params = (JsonHelper::check($params)) ? json_decode($params, true) :
$params;
// make sure we have the keys values in the params area
if (ArrayHelper::check($params) && isset($params[$key])
&& ArrayHelper::check($params[$key]))
{
foreach ($this->targets[$key] as $target => $event)
{
if (isset($params[$key][$target])
&& $params[$key][$target] == 1)
{
// get the header string if set
$this->getHeaders(
$params[$key],
$event,
$this->getViewName(
$obj,
$event['view']
)
);
}
}
}
}
/**
* set the dynamic get headers
*
* @return void
*
* @since 1.0.10
*/
protected function setDynamicHeaders($params, $code, $key)
{
// add the headers
$params = (JsonHelper::check($params)) ? json_decode($params, true) :
$params;
// make sure we have the keys values in the params area
if (ArrayHelper::check($params) && isset($params[$key])
&& ArrayHelper::check($params[$key]))
{
foreach ($this->targets[$key] as $target => $event)
{
if (isset($params[$key][$target])
&& $params[$key][$target] == 1)
{
// get the header string if set
$this->getHeaders(
$params[$key],
$event,
$code
);
}
}
}
}
/**
* get the headers
*
* @return void
*
* @since 1.0
*/
protected function getHeaders(&$params, &$get, $view_name)
{
// we first check if the value is set
if (isset($params[$get['field']]) ||
isset($params['power_' . $get['field']]))
{
// start little headers bucket
$headers = [];
// load the headers if power
if (isset($params['power_' . $get['field']])
&& ArrayHelper::check($params['power_' .
$get['field']], true)
&& ($powers = $this->getPowers($params['power_' .
$get['field']])) !== null)
{
foreach ($powers as $power)
{
$power = trim($power);
$headers[$power] = $power;
}
}
// load the headers if text
if (isset($params[$get['field']]) &&
StringHelper::check($params[$get['field']]))
{
if (($_headers = explode(PHP_EOL, $params[$get['field']])))
{
foreach ($_headers as $header)
{
$header = trim($header);
if (empty($header))
{
continue;
}
$headers[$header] = $header;
}
}
}
// check if we found some header values
if (ArrayHelper::check($headers, true))
{
// activate the load of the headers
$this->loadHeaders = true;
// check if this active header is already set
if
(!isset($this->activeHeaders[$view_name][$get['context']]))
{
// start the active header
$this->activeHeaders[$view_name][$get['context']] = [];
}
// load the found headers and avoid adding the same header twice
foreach ($headers as $header)
{
$header = trim($header);
$this->activeHeaders[$view_name][$get['context']][$header]
= $header;
}
}
}
}
/**
* get the view name
*
* @return string
*
* @since 1.0.8
*/
protected function getViewName(&$view, &$get)
{
if ($get === 'site' || $get === 'admin' || $get ===
'ajax' || $get === 'dashboard')
{
// static key name
return $get;
}
elseif (isset($view->{$get}))
{
return StringHelper::safe(
$view->{$get}
);
}
return '_error';
}
/**
* get the powers header use strings
*
* @return array|null
*
* @since 1.0.6
*/
protected function getPowers($rows): ?array
{
// load the active powers
$powers = array_filter(
// get the power namespace
array_map(function ($row) {
if (($power = ComponentbuilderHelper::getGUID($row['power'],
'power', ['a.guid', 'a.namespace'])) !==
null)
{
$power->build = (int) $row['build'];
$power->as = (string) $row['as'];
return $power;
}
elseif
(CFactory::_('Superpower')->load($row['power'],
['remote']))
{
if (($power = ComponentbuilderHelper::getGUID($row['power'],
'power', ['a.guid', 'a.namespace'])) !==
null)
{
$power->build = (int) $row['build'];
$power->as = (string) $row['as'];
return $power;
}
}
return false;
}, $rows),
// check that we have valid powers
function ($row) {
return is_object($row) && isset($row->guid);
}
);
// add to active powers
if (ArrayHelper::check($powers))
{
// convert the dots to namespace
return array_map(function ($power) {
// add to compiler (to build)
if ($power->build != 6)
{
// secure that always will remain always even if only set that way
once
if (empty($this->linkedPowers[$power->guid]) || $power->build
== 1)
{
$this->linkedPowers[$power->guid] = $power->build;
}
}
// build the namespace
$namespace = NamespaceHelper::safe(
str_replace(
array_keys($this->placeholders),
array_values($this->placeholders),
str_replace('.', '\\', $power->namespace)
)
);
// check if it has an AS option
if (StringHelper::check($power->as) && $power->as !==
'default')
{
return 'use ' . $namespace . ' as ' .
$power->as . ';';
}
return 'use ' . $namespace . ';';
}, $powers);
}
return null;
}
}
componentbuilderheaderscompiler/index.html000064400000000054151160402260015175
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>language/af-ZA/af-ZA.plg_extension_componentbuilderheaderscompiler.ini000064400000000637151160402260030605
0ustar00componentbuilderheaderscompilerPLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_NO="Nee"
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_NO="Nee"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_NO="Nee"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERFIELDORDERINGTABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERFIELDORDERINGTABS_NO="Nee"language/af-ZA/af-ZA.plg_extension_componentbuilderheaderscompiler.sys.ini000064400000000637151160402260031422
0ustar00componentbuilderheaderscompilerPLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_NO="Nee"
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_NO="Nee"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_NO="Nee"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERFIELDORDERINGTABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERFIELDORDERINGTABS_NO="Nee"language/en-GB/en-GB.plg_extension_componentbuilderheaderscompiler.ini000064400000002152151160402260030563
0ustar00componentbuilderheaderscompilerPLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER="Extension
- Componentbuilder Headers Compiler"
PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER_DESCRIPTION="This plugin
is used to set the custom headers for your classes during compilation. To
activate it you must first enable it here. Then open your JCB component
global options, and under the Global tab, select this plugin in the
Activate Compiler Plugins field.Also be sure to set your code where you
would like to set Custom Headers."
PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER_XML_DESCRIPTION="<h1>Extension
- Componentbuilder Headers Compiler (v.2.3.1)</h1> <div
style='clear: both;'></div><p>This plugin is used
to set the custom headers for your classes during compilation. To activate
it you must first enable it here. Then open your JCB component global
options, and under the Global tab, select this plugin in the Activate
Compiler Plugins field.Also be sure to set your code where you would like
to set Custom Headers.</p><p>Created by <a
href='https://dev.vdm.io' target='_blank'>Llewellyn
van der Merwe</a><br /><small>Development started 24th
May,
2020</small></p>"language/en-GB/en-GB.plg_extension_componentbuilderheaderscompiler.sys.ini000064400000002152151160402260031400
0ustar00componentbuilderheaderscompilerPLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER="Extension
- Componentbuilder Headers Compiler"
PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER_DESCRIPTION="This plugin
is used to set the custom headers for your classes during compilation. To
activate it you must first enable it here. Then open your JCB component
global options, and under the Global tab, select this plugin in the
Activate Compiler Plugins field.Also be sure to set your code where you
would like to set Custom Headers."
PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER_XML_DESCRIPTION="<h1>Extension
- Componentbuilder Headers Compiler (v.2.3.1)</h1> <div
style='clear: both;'></div><p>This plugin is used
to set the custom headers for your classes during compilation. To activate
it you must first enable it here. Then open your JCB component global
options, and under the Global tab, select this plugin in the Activate
Compiler Plugins field.Also be sure to set your code where you would like
to set Custom Headers.</p><p>Created by <a
href='https://dev.vdm.io' target='_blank'>Llewellyn
van der Merwe</a><br /><small>Development started 24th
May,
2020</small></p>"componentbuilderheaderscompiler/language/en-GB/index.html000064400000000054151160402260017650
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>componentbuilderheaderscompiler/language/index.html000064400000000054151160402260016760
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>componentbuilderheaderscompiler/script.php000064400000005562151160402260015226
0ustar00<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
/**
* Extension - Componentbuilder Headers Compiler script file.
*
* @package PlgExtensionComponentbuilderHeadersCompiler
*/
class plgExtensionComponentbuilderHeadersCompilerInstallerScript
{
/**
* Called before any type of action
*
* @param string $route Which action is happening
(install|uninstall|discover_install|update)
* @param Joomla\CMS\Installer\InstallerAdapter $adapter The object
responsible for running this script
*
* @return boolean True on success
*/
public function preflight($route, $adapter)
{
// get application
$app = Factory::getApplication();
// the default for both install and update
$jversion = new JVersion();
if (!$jversion->isCompatible('3.8.0'))
{
$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0
before continuing!', 'error');
return false;
}
if ('install' === $route)
{
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR .
'/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be
installed from <a href="https://www.joomlacomponentbuilder.com/
" target="_blank">Joomla Component
Builder</a>.', 'error');
return false;
}
// load the helper class
JLoader::register('ComponentbuilderHelper',
JPATH_ADMINISTRATOR .
'/components/com_componentbuilder/helpers/componentbuilder.php');
// block install
$blockInstall = true;
// check the version of JCB
$manifest = ComponentbuilderHelper::manifest();
if (isset($manifest->version) &&
strpos($manifest->version, '.') !== false)
{
// get the version
$jcbVersion = explode('.', $manifest->version);
// check that we have JCB 3.1.18 or higher installed
if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3
&&
(
($jcbVersion[0] == 3 && $jcbVersion[1] == 1 &&
$jcbVersion[2] >= 18) ||
($jcbVersion[0] == 3 && $jcbVersion[1] > 1) ||
$jcbVersion[0] > 3)
)
{
$blockInstall = false;
}
}
// allow install if all conditions are met
if ($blockInstall)
{
$app->enqueueMessage('Please upgrade to JCB v3.1.18 or higher
before installing this plugin.', 'error');
return false;
}
}
return true;
}
}
componentbuilderheaderscompiler/componentbuilderheaderscompiler.xml000064400000002574151160402260022373
0ustar00<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" version="3.10"
group="extension" method="upgrade">
<name>PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER</name>
<creationDate>20th September, 2024</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://dev.vdm.io</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights
reserved.</copyright>
<license>GNU General Public License version 2 or later; see
LICENSE.txt</license>
<version>2.3.1</version>
<description>PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER_XML_DESCRIPTION</description>
<!-- Scripts to run on installation -->
<scriptfile>script.php</scriptfile>
<!-- Language files -->
<languages folder="language">
<language
tag="en-GB">en-GB/en-GB.plg_extension_componentbuilderheaderscompiler.ini</language>
<language
tag="en-GB">en-GB/en-GB.plg_extension_componentbuilderheaderscompiler.sys.ini</language>
<language
tag="af-ZA">af-ZA/af-ZA.plg_extension_componentbuilderheaderscompiler.ini</language>
<language
tag="af-ZA">af-ZA/af-ZA.plg_extension_componentbuilderheaderscompiler.sys.ini</language>
</languages>
<!-- Plugin files -->
<files>
<filename
plugin="componentbuilderheaderscompiler">componentbuilderheaderscompiler.php</filename>
<filename>index.html</filename>
<folder>language</folder>
</files>
</extension>componentbuilderlanguagepackaging/componentbuilderlanguagepackaging.php000064400000047140151160402260023124
0ustar00<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR .
'/components/com_componentbuilder/helpers/componentbuilder.php');
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Plugin\CMSPlugin;
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Placefix;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\GetHelper;
/**
* Extension - Componentbuilder Language Packaging plugin.
*
* @package ComponentbuilderLanguagePackaging
* @since 1.2.1
*/
class PlgExtensionComponentbuilderLanguagePackaging extends CMSPlugin
{
/**
* Affects constructor behavior. If true, language files will be loaded
automatically.
*
* @var boolean
* @since 1.0.0
*/
protected $autoloadLanguage = true;
/**
* Database object
*
* @var DatabaseDriver
* @since 1.0.0
*/
protected $db;
/**
* Application object
*
* @var CMSApplication
* @since 1.0.0
*/
protected $app;
/**
* The percentage before a language can be added
*
* @var int
* @since 1.0.0
*/
protected $percentageLanguageAdd;
/**
* The percentage before a language can be added
*
* @var int
* @since 1.0.0
*/
protected $percentageLanguageAddOveride = 200;
/**
* The languages names
*
* @var array
* @since 1.0.0
*/
protected $languageNames = [];
/**
* The language building tracker
*
* @var array
* @since 1.0.0
*/
protected $languageTracker = [];
/**
* The should the site folder be removed
*
* @var bool
* @since 1.0.0
*/
protected $removeSiteFolder;
/**
* The should the site folder be removed
*
* @var bool
* @since 1.0.0
*/
protected $removeSiteEditFolder;
/**
* The component path
*
* @var string
* @since 1.0.0
*/
protected $componentPath;
/**
* The compiler path
*
* @var string
* @since 1.0.0
*/
protected $compilerPath;
/**
* The temporal path
*
* @var string
* @since 1.0.0
*/
protected $tempPath;
/**
* The joomla version
*
* @var string
* @since 1.0.0
*/
protected $joomlaVersion;
/**
* The component version
*
* @var string
* @since 1.0.0
*/
protected $component_version;
/**
* The component name
*
* @var string
* @since 1.0.0
*/
protected $componentCodeName;
/**
* The file content static values
*
* @var array
* @since 1.0.0
*/
protected $fileContentStatic;
/*
* The line numbers Switch
*
* @var boolean
* @since 1.0.0
*/
protected $debugLinenr = false;
/**
* The Active Components
*
* @var array
* @since 1.0.0
*/
protected $activeComponents = [];
/**
* The Active Components Names
*
* @var array
* @since 1.0.0
*/
protected $activeComponentsNames = [];
/**
* The Languages
*
* @var array
* @since 1.0.0
*/
protected $languages = [];
/**
* The Language build details
*
* @var array
* @since 1.0.0
*/
protected $buildDetails = [];
/**
* The Excluded Languages
*
* @var array
* @since 1.0.0
*/
protected $excludedLang = [];
/**
* The Active Language
*
* @var string
* @since 1.0.0
*/
protected $langTag;
/**
* Event Triggered in the compiler [on Before Model Component Data]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onBeforeModelComponentData(&$component)
{
// add the privacy
$component->params = (isset($component->params) &&
JsonHelper::check($component->params)) ?
json_decode($component->params, true) : $component->params;
if (ArrayHelper::check($component->params) &&
isset($component->params['language_options']) &&
isset($component->params['language_options']['activate'])
&&
$component->params['language_options']['activate']
== 1)
{
// load the admin component details
$this->activeComponents[$component->id] =
CFactory::_('Config')->component_context;
$this->activeComponentsNames[$component->id] =
StringHelper::safe($component->name_code);
$this->activeComponentsRealNames[$component->id] =
$component->name;
// add excluded list of languages
if
(isset($component->params['language_options']['languages']))
{
$this->excludedLang[$component->id] =
$component->params['language_options']['languages'];
}
else
{
$this->excludedLang[$component->id] = array();
}
// now set the component add languages if we should use local (2)
if
(isset($component->params['language_options']['use_percentagelanguageadd'])
&&
$component->params['language_options']['use_percentagelanguageadd']
== 2)
{
$this->percentageLanguageAddOveride =
$component->params['language_options']['percentagelanguageadd'];
}
}
}
/**
* Event Triggered in the compiler [on After Get]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onAfterGet()
{
// get component id
$id = (int) CFactory::_('Config')->component_id;
// check if there is active
if (ArrayHelper::check($this->activeComponents)
&& isset($this->activeComponents[$id]) &&
$this->percentageLanguageAddOveride != 200)
{
CFactory::_('Config')->set('percentage_language_add',
$this->percentageLanguageAddOveride);
}
}
/**
* Event Triggered in the compiler [on Before Set Lang File Data]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onBeforeSetLangFileData()
{
// lets map some arrays to the plugin for later use
$this->compilerPath =
CFactory::_('Config')->compiler_path;
$this->tempPath = CFactory::_('Config')->tmp_path;
$this->langTag = CFactory::_('Config')->lang_tag;
$this->debugLinenr =
CFactory::_('Config')->get('debug_line_nr', false);
$this->component_version =
CFactory::_('Config')->get('component_version',
'1.0.0');
$this->joomlaVersion =
CFactory::_('Config')->joomla_version;
$this->percentageLanguageAdd =
CFactory::_('Config')->percentage_language_add;
$this->removeSiteFolder =
CFactory::_('Config')->remove_site_folder;
$this->removeSiteEditFolder =
CFactory::_('Config')->remove_site_edit_folder;
$this->componentPath =
CFactory::_('Utilities.Paths')->component_path;
$this->componentCodeName =
CFactory::_('Config')->component_code_name;
}
/**
* Event Triggered in the compiler [on Before Build Plugin Lang Files]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onBeforeBuildPluginLangFiles(&$plugin)
{
// get component id
$id = (int) CFactory::_('Config')->component_id;
// check if there is active
if (ArrayHelper::check($this->activeComponents) &&
isset($this->activeComponents[$id]))
{
// set file name
$file_name = 'plg_' . strtolower($plugin->group) .
'_' . strtolower($plugin->code_name);
// extrude the languages that should not remain in the plugin
$this->extrudeLanguages($id, 'plugins',
CFactory::_('Config')->lang_tag, $file_name,
'admin');
}
}
/**
* Event Triggered in the compiler [on Before Build Module Lang Files]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onBeforeBuildModuleLangFiles(&$module)
{
// get component id
$id = (int) CFactory::_('Config')->component_id;
// check if there is active
if (ArrayHelper::check($this->activeComponents) &&
isset($this->activeComponents[$id]))
{
// extrude the languages that should not remain in the module
$this->extrudeLanguages($id, 'modules',
CFactory::_('Config')->lang_tag, $module->file_name,
$module->target_client);
}
}
/**
* Event Triggered in the compiler [on Before Build All Lang Files]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onBeforeBuildAllLangFiles($targetArea)
{
// get component id
$id = (int) CFactory::_('Config')->component_id;
// check if there is active
if (ArrayHelper::check($this->activeComponents) &&
isset($this->activeComponents[$id]))
{
// set file name
$file_name = 'com_' . $this->activeComponentsNames[$id];
// extrude the languages that should not remain in the module
$this->extrudeLanguages($id, $targetArea,
CFactory::_('Config')->lang_tag, $file_name);
}
// build the language packages
$this->buildLanguages($id,
CFactory::_('Config')->lang_tag);
}
/**
* Extruder of the languages
*
* @return void
*
* @since 1.0
*/
protected function extrudeLanguages(&$id, $targetArea, $langTag,
&$file_name, $target_client = 'both')
{
$mainLangLoader = [];
// check if this id was set before
if (!isset($this->languages[$id]))
{
$this->languages[$id] = [];
$this->buildDetails[$id] = [];
}
// check if this file name was set before
if (!isset($this->languages[$id][$file_name]))
{
$this->languages[$id][$file_name] = [];
}
// set all the extra languages not excluded
foreach
(CFactory::_('Compiler.Builder.Languages')->get($targetArea)
as $key => $language)
{
if ($key !== $langTag && ArrayHelper::check($language)
&& (!isset($this->excludedLang[$id]) || !in_array($key,
$this->excludedLang[$id])))
{
// add to our bucket
$this->languages[$id][$file_name][$key] = $language;
// remove from the JCB build
CFactory::_('Compiler.Builder.Languages')->remove("{$targetArea}.{$key}");
}
// count the area strings
if ($langTag === $key)
{
foreach ($language as $area => $languageStrings)
{
$mainLangLoader[$area] = count($languageStrings);
}
}
}
// store details for build
$this->buildDetails[$id][$file_name] = [$langTag =>
$mainLangLoader, 'target_client' => $target_client];
}
/**
* Start the building of the languages packages
*
* @return void
*
*/
protected function buildLanguages(&$id, $langTag)
{
if (isset($this->languages[$id]) &&
ArrayHelper::check($this->languages[$id]))
{
// rest xml array
$langXML = [];
$langNames = [];
$langPackages = [];
$langZIPNames = [];
$langXMLNames = [];
$versionName = $this->activeComponentsNames[$id] . '_v' .
str_replace('.', '_', $this->component_version .
'__J' . $this->joomlaVersion);
foreach ($this->languages[$id] as $file_name => $languages)
{
if (ArrayHelper::check($languages) &&
isset($this->buildDetails[$id][$file_name][$langTag]))
{
// get the main lang loader
$mainLangLoader = $this->buildDetails[$id][$file_name][$langTag];
// get the target client
$target_client =
$this->buildDetails[$id][$file_name]['target_client'];
foreach ($languages as $tag => $areas)
{
// trim the tag
$tag = trim($tag);
// get language name
$langName = $this->getLanguageName($tag);
$langCodeName = StringHelper::safe($langName, 'F');
// set the file folder name
$langFolderFileName = $langCodeName . '_' . $versionName;
// set the main folder path
$main_path = $this->compilerPath . '/' .
$langFolderFileName . '/';
// set the language name for later
$langNames[$main_path] = $langName;
// set the lang zip name for later
$langZIPNames[$main_path] = $langFolderFileName;
// set the lang xml name for later
$langXMLNames[$main_path] = $langCodeName . '_' .
$this->activeComponentsNames[$id] ;
// we must check if old folder is found and remove it
if (!isset($this->languageTracker[$main_path]) &&
JFolder::exists($main_path))
{
// remove the main folder
ComponentbuilderHelper::removeFolder($main_path);
// do not remove it again
$this->languageTracker[$main_path] = true;
}
// check if exist and create if not
if (!JFolder::exists($main_path))
{
JFolder::create($main_path);
// count the folder created
CFactory::_('Utilities.Counter')->folder++;
}
foreach ($areas as $area => $languageStrings)
{
// get the file name
$fileName = $this->getLanguageFileName($file_name, $tag, $area);
// check if language should be added
if (CFactory::_('Language.Translation')->check($tag,
$languageStrings, $mainLangLoader[$area], $fileName) && ($actions =
$this->getLangActions($file_name, $tag, $area, $target_client)) !==
false)
{
// set the language data
$lang = array_map(
function ($langstring, $placeholder) {
return $placeholder . '="' . $langstring .
'"';
}, array_values($languageStrings),
array_keys($languageStrings)
);
// set the line counter
CFactory::_('Utilities.Counter')->line += count(
(array) $lang
);
// check that the main folder exist
foreach ($actions as $act)
{
$client_path = $main_path . $act['target_client'] .
'/';
// check if exist and create if not
if (!JFolder::exists($client_path))
{
JFolder::create($client_path);
// count the folder created
$this->folderCount++;
}
// write the language data to a file
ComponentbuilderHelper::writeFile(
$client_path . $act['file_name'], implode(PHP_EOL,
$lang)
);
// count the file created
CFactory::_('Utilities.Counter')->line++;
// build xml strings
if (!isset($langXML[$main_path]))
{
$langXML[$main_path] = array();
$langPackages[$main_path] = array();
}
if
(!isset($langXML[$main_path][$act['target_client']]))
{
$langXML[$main_path][$act['target_client']] = array();
}
// set the package targets
$langPackages[$main_path][$act['target_client']] =
$act['target'];
$langXML[$main_path][$act['target_client']][] =
$act['file_name'];
}
// clear memory
unset($lang);
}
}
}
}
}
// load the lang xml
if (ArrayHelper::check($langXML))
{
foreach ($langXML as $main_path => $target_clients)
{
// get the XML
$xml = str_replace(
array_keys(CFactory::_('Compiler.Builder.Content.One')->allActive()),
array_values(CFactory::_('Compiler.Builder.Content.One')->allActive()),
$this->getLanguageXML($target_clients, $langPackages[$main_path],
$langNames[$main_path])
);
// get the XML File Name
$xmlFileName = $langXMLNames[$main_path] . '.xml';
// write the language data to a file
ComponentbuilderHelper::writeFile(
$main_path . $xmlFileName, $xml
);
// set the zip full path
$zipPath = $this->tempPath . '/' .
$langZIPNames[$main_path] . '.zip';
// now zip the package
if (ComponentbuilderHelper::zip(
$main_path, $zipPath
))
{
// now remove the package
ComponentbuilderHelper::removeFolder($main_path);
}
}
}
}
}
/**
* get the language xml
*
* @return string
*
*/
protected function getLanguageXML(&$target_clients, &$targets,
&$language)
{
$xml = '<?xml version="1.0"
encoding="utf-8"?>';
$xml .= PHP_EOL . '<extension type="file"
version="3.2" method="upgrade">';
$xml .= PHP_EOL . Indent::_(1) . '<name>' .
Placefix::_h('Component') . ' - ' . $language . '
Language Pack</name>';
$xml .= PHP_EOL . Indent::_(1) . '<creationDate>' .
Placefix::_h('BUILDDATE') . '</creationDate>';
$xml .= PHP_EOL . Indent::_(1) . '<author>' .
Placefix::_h('AUTHOR') . '</author>';
$xml .= PHP_EOL . Indent::_(1) . '<authorEmail>' .
Placefix::_h('AUTHOREMAIL') . '</authorEmail>';
$xml .= PHP_EOL . Indent::_(1) . '<authorUrl>' .
Placefix::_h('AUTHORWEBSITE') . '</authorUrl>';
$xml .= PHP_EOL . Indent::_(1) . '<copyright>' .
Placefix::_h('COPYRIGHT') . '</copyright>';
$xml .= PHP_EOL . Indent::_(1) . '<license>' .
Placefix::_h('LICENSE') . '</license>';
$xml .= PHP_EOL . Indent::_(1) . '<version>' .
Placefix::_h('ACTUALVERSION') . '</version>';
$xml .= PHP_EOL . Indent::_(1) . '<description>' .
$language . ' Language Pack - ' .
Placefix::_h('SHORT_DESCRIPTION') .
'</description>';
$xml .= PHP_EOL . Indent::_(1) . '<fileset>';
foreach ($target_clients as $target_client => $files)
{
$xml .= PHP_EOL . Indent::_(2) . '<files folder="' .
$target_client . '" target="' .
$targets[$target_client] . '">';
foreach ($files as $file)
{
$xml .= PHP_EOL . Indent::_(3) . '<filename>' . $file .
'</filename>';
}
$xml .= PHP_EOL . Indent::_(2) . '</files>';
}
$xml .= PHP_EOL . Indent::_(1) . '</fileset>';
$xml .= PHP_EOL . '</extension>';
return $xml;
}
/**
* get the language name
*
* @return string
*
*/
protected function getLanguageName(&$tag)
{
if (!isset($this->languageNames[$tag]))
{
if (($name = GetHelper::var('language', $tag,
'langtag', 'name')) !== false)
{
$this->languageNames[$tag] = $name;
}
else
{
$this->languageNames[$tag] = $tag;
}
}
return $this->languageNames[$tag];
}
/**
* get the language actions
*
* @return array
*
*/
protected function getLangActions(&$file_name, &$tag, &$area,
&$target_client)
{
// component extention type
if (strpos($file_name, 'com_') !== false)
{
$target_client = 'admin';
$target = 'administrator/language/';
if (strpos($area, 'site') !== false)
{
$target_client = 'site';
$target = 'language/';
}
return array(
array(
'target_client' => $target_client,
'target' => $target . $tag,
'file_name' => $this->getLanguageFileName($file_name,
$tag, $area)
)
);
}
elseif ('admin' === $target_client)
{
$target = 'administrator/language/';
}
else
{
$target = 'language/';
}
// module/plugin extension type (TODO we return both for now)
return array(
array(
'target_client' => $target_client,
'target' => $target . $tag,
'file_name' => $this->getLanguageFileName($file_name,
$tag, $area)
),
array(
'target_client' => $target_client,
'target' => $target . $tag,
'file_name' => $this->getLanguageFileName($file_name,
$tag, $area, '.sys')
)
);
}
/**
* get the language file name
*
* @return string
*
*/
protected function getLanguageFileName(&$file_name, &$tag,
&$area, $type = '')
{
// component extension type
if (strpos($file_name, 'com_') !== false)
{
if (strpos($area, 'sys') !== false)
{
$type = '.sys';
}
}
// file name
return $tag . '.' . $file_name . $type . '.ini';
}
/**
* check if a translation should be added
*
* @return bool
* @deprecated 3.4 Use
CFactory::_('Language.Translation')->check(...);
*/
protected function shouldLanguageBeAdded(&$tag, &$languageStrings,
&$total, &$file_name) {
// only log messages for none $this->langTag translations
CFactory::_('Language.Translation')->check(
$tag, $languageStrings, $total, $file_name
);
}
}
componentbuilderlanguagepackaging/index.html000064400000000054151160402260015457
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>language/af-ZA/af-ZA.plg_extension_componentbuilderlanguagepackaging.ini000064400000000143151160402260031341
0ustar00componentbuilderlanguagepackagingPLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_NO="Nee"language/af-ZA/af-ZA.plg_extension_componentbuilderlanguagepackaging.sys.ini000064400000000143151160402260032156
0ustar00componentbuilderlanguagepackagingPLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_NO="Nee"language/en-GB/en-GB.plg_extension_componentbuilderlanguagepackaging.ini000064400000001654151160402260031335
0ustar00componentbuilderlanguagepackagingPLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING="Extension
- Componentbuilder Language Packaging"
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_DESCRIPTION="This
plugin is used to add language packaging to JCB. To activate it you must
first enable it here. Then open your JCB component global options, and
under the Global tab, select this plugin in the Activate Compiler Plugins
field."
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_XML_DESCRIPTION="<h1>Extension
- Componentbuilder Language Packaging (v.1.2.1)</h1> <div
style='clear: both;'></div><p>This plugin is used
to add language packaging to JCB. To activate it you must first enable it
here. Then open your JCB component global options, and under the Global
tab, select this plugin in the Activate Compiler Plugins
field.</p><p>Created by <a
href='https://dev.vdm.io' target='_blank'>Llewellyn
van der Merwe</a><br /><small>Development started 12th
October,
2019</small></p>"language/en-GB/en-GB.plg_extension_componentbuilderlanguagepackaging.sys.ini000064400000001654151160402260032152
0ustar00componentbuilderlanguagepackagingPLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING="Extension
- Componentbuilder Language Packaging"
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_DESCRIPTION="This
plugin is used to add language packaging to JCB. To activate it you must
first enable it here. Then open your JCB component global options, and
under the Global tab, select this plugin in the Activate Compiler Plugins
field."
PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_XML_DESCRIPTION="<h1>Extension
- Componentbuilder Language Packaging (v.1.2.1)</h1> <div
style='clear: both;'></div><p>This plugin is used
to add language packaging to JCB. To activate it you must first enable it
here. Then open your JCB component global options, and under the Global
tab, select this plugin in the Activate Compiler Plugins
field.</p><p>Created by <a
href='https://dev.vdm.io' target='_blank'>Llewellyn
van der Merwe</a><br /><small>Development started 12th
October,
2019</small></p>"componentbuilderlanguagepackaging/language/en-GB/index.html000064400000000054151160402260020132
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>componentbuilderlanguagepackaging/language/index.html000064400000000054151160402260017242
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>componentbuilderlanguagepackaging/script.php000064400000005474151160402260015512
0ustar00<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
/**
* Extension - Componentbuilder Language Packaging script file.
*
* @package PlgExtensionComponentbuilderLanguagePackaging
*/
class plgExtensionComponentbuilderLanguagePackagingInstallerScript
{
/**
* Called before any type of action
*
* @param string $route Which action is happening
(install|uninstall|discover_install|update)
* @param Joomla\CMS\Installer\InstallerAdapter $adapter The object
responsible for running this script
*
* @return boolean True on success
*/
public function preflight($route, $adapter)
{
// get application
$app = Factory::getApplication();
// the default for both install and update
$jversion = new JVersion();
if (!$jversion->isCompatible('3.8.0'))
{
$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0
before continuing!', 'error');
return false;
}
if ('install' === $route)
{
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR .
'/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be
installed from <a href="https://www.joomlacomponentbuilder.com/
" target="_blank">Joomla Component
Builder</a>.', 'error');
return false;
}
// load the helper class
JLoader::register('ComponentbuilderHelper',
JPATH_ADMINISTRATOR .
'/components/com_componentbuilder/helpers/componentbuilder.php');
// block install
$blockInstall = true;
// check the version of JCB
$manifest = ComponentbuilderHelper::manifest();
if (isset($manifest->version) &&
strpos($manifest->version, '.') !== false)
{
// get the version
$jcbVersion = explode('.', $manifest->version);
// check that we have JCB 2.10.13 or higher installed
if (count($jcbVersion) == 3 && (($jcbVersion[0] == 2 &&
$jcbVersion[1] >= 10 && (($jcbVersion[1] == 10 &&
$jcbVersion[2] >= 13) || ($jcbVersion[1] > 10))) || $jcbVersion[0]
>= 3))
{
$blockInstall = false;
}
}
// allow install if all conditions are met
if ($blockInstall)
{
$app->enqueueMessage('Please upgrade to JCB 2.10.13 or higher
before installing this plugin.', 'error');
return false;
}
}
return true;
}
}
componentbuilderlanguagepackaging/componentbuilderlanguagepackaging.xml000064400000002614151160402260023132
0ustar00<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" version="3.10"
group="extension" method="upgrade">
<name>PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING</name>
<creationDate>20th September, 2024</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://dev.vdm.io</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights
reserved.</copyright>
<license>GNU General Public License version 2 or later; see
LICENSE.txt</license>
<version>1.2.1</version>
<description>PLG_EXTENSION_COMPONENTBUILDERLANGUAGEPACKAGING_XML_DESCRIPTION</description>
<!-- Scripts to run on installation -->
<scriptfile>script.php</scriptfile>
<!-- Language files -->
<languages folder="language">
<language
tag="en-GB">en-GB/en-GB.plg_extension_componentbuilderlanguagepackaging.ini</language>
<language
tag="en-GB">en-GB/en-GB.plg_extension_componentbuilderlanguagepackaging.sys.ini</language>
<language
tag="af-ZA">af-ZA/af-ZA.plg_extension_componentbuilderlanguagepackaging.ini</language>
<language
tag="af-ZA">af-ZA/af-ZA.plg_extension_componentbuilderlanguagepackaging.sys.ini</language>
</languages>
<!-- Plugin files -->
<files>
<filename
plugin="componentbuilderlanguagepackaging">componentbuilderlanguagepackaging.php</filename>
<filename>index.html</filename>
<folder>language</folder>
</files>
</extension>componentbuilderpowersautoloadercompiler/componentbuilderpowersautoloadercompiler.php000064400000006134151160402260026326
0ustar00<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR .
'/components/com_componentbuilder/helpers/componentbuilder.php');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Registry\Registry;
use VDM\Joomla\Componentbuilder\Compiler\Factory as CFactory;
use VDM\Joomla\Utilities\ArrayHelper;
/**
* Extension - Componentbuilder Powers Autoloader Compiler plugin.
*
* @package ComponentbuilderPowersAutoloaderCompiler
* @since 1.2.1
*/
class PlgExtensionComponentbuilderPowersAutoloaderCompiler extends
CMSPlugin
{
/**
* Affects constructor behavior. If true, language files will be loaded
automatically.
*
* @var boolean
* @since 1.0.0
*/
protected $autoloadLanguage = true;
/**
* Event Triggered in the compiler [on After Get]
*
* @return void
*
* @since 1.0
*/
public function jcb_ce_onAfterGet()
{
// check if this component needs a power autoloader plugin loaded
if (CFactory::_('Config')->add_power &&
$this->componentActive())
{
// now get the plugin ID if set
if (($id = (int) $this->params->get('plugin', 0)) !==
0)
{
// load the power autoloader plugin
CFactory::_('Joomlaplugin.Data')->set($id);
// now set the plugin powers placeholder
CFactory::_('Compiler.Builder.Content.One')->set('PLUGIN_POWER_AUTOLOADER',
'');
}
else
{
Factory::getApplication()->enqueueMessage(Text::_('PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_POWER_PLUGIN_SETUP_SO_THE_POWERS_PLUGIN_AUTOLOADER_COULD_NOT_BE_ADDED'),
'Notice');
}
}
}
/**
* The array of active components
*
* @var array
*/
protected $componentsActive;
/**
* The activate option
*
* @var int
*/
protected $activateOption = 0;
/**
* Set the line number in comments
*
* @return bool
*
*/
protected function componentActive()
{
// check the active option
if (!$this->activateOption)
{
$this->activateOption =
$this->params->get('activate_option', 1);
}
// active for all components
if ($this->activateOption == 1)
{
return true;
}
// first check is we have the active components set
if ($this->activateOption == 2 &&
!ArrayHelper::check($this->componentsActive))
{
$this->componentsActive =
$this->params->get('components');
}
// only check if there are active
if (ArrayHelper::check($this->componentsActive))
{
return in_array((int) CFactory::_('Config')->component_id,
$this->componentsActive);
}
return false;
}
}
componentbuilderpowersautoloadercompiler/index.html000064400000000054151160402260017161
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>language/af-ZA/af-ZA.plg_extension_componentbuilderpowersautoloadercompiler.ini000064400000001747151160402260034560
0ustar00componentbuilderpowersautoloadercompilerPLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_NO="Nee"
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_NO="Nee"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_NO="Nee"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERFIELDORDERINGTABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERFIELDORDERINGTABS_NO="Nee"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_NO="Nee"
PLG_CONTENT_COMPONENTBUILDERADMINHEADERSTABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERADMINHEADERSTABS_NO="Nee"
PLG_CONTENT_COMPONENTBUILDERCUSTOMADMINHEADERSTABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERCUSTOMADMINHEADERSTABS_NO="Nee"
PLG_CONTENT_COMPONENTBUILDERSITEHEADERSTABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERSITEHEADERSTABS_NO="Nee"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS_NO="Nee"language/af-ZA/af-ZA.plg_extension_componentbuilderpowersautoloadercompiler.sys.ini000064400000001747151160402260035375
0ustar00componentbuilderpowersautoloadercompilerPLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERLANGUAGETABS_NO="Nee"
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERPRIVACYTABS_NO="Nee"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_NO="Nee"
PLG_EXTENSION_COMPONENTBUILDEREXPORTCOMPILER_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERFIELDORDERINGTABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERFIELDORDERINGTABS_NO="Nee"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTDASHBOARDHEADERSTABS_NO="Nee"
PLG_CONTENT_COMPONENTBUILDERADMINHEADERSTABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERADMINHEADERSTABS_NO="Nee"
PLG_CONTENT_COMPONENTBUILDERCUSTOMADMINHEADERSTABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERCUSTOMADMINHEADERSTABS_NO="Nee"
PLG_CONTENT_COMPONENTBUILDERSITEHEADERSTABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERSITEHEADERSTABS_NO="Nee"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS_YES="Ja"
PLG_CONTENT_COMPONENTBUILDERCOMPONENTHEADERSTABS_NO="Nee"language/en-GB/en-GB.plg_extension_componentbuilderpowersautoloadercompiler.ini000064400000005026151160402260034536
0ustar00componentbuilderpowersautoloadercompilerPLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER="Extension
- Componentbuilder Powers Autoloader Compiler"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_DESCRIPTION="This
plugin is used to build the power autoloader plugin for your component
during compilation. To activate it you must first enable it here. Then open
your JCB component global options, and under the Global tab, select this
plugin in the Activate Compiler Plugins field."
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_XML_DESCRIPTION="<h1>Extension
- Componentbuilder Powers Autoloader Compiler (v.1.2.1)</h1> <div
style='clear: both;'></div><p>This plugin is used
to build the power autoloader plugin for your component during compilation.
To activate it you must first enable it here. Then open your JCB component
global options, and under the Global tab, select this plugin in the
Activate Compiler Plugins field.</p><p>Created by <a
href='https://dev.vdm.io' target='_blank'>Llewellyn
van der Merwe</a><br /><small>Development started 13th
November, 2021</small></p>"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_POWER_PLUGIN_SETUP_SO_THE_POWERS_PLUGIN_AUTOLOADER_COULD_NOT_BE_ADDED="You
do not have a global power plugin setup, so the powers plugin autoloader
could not be added."
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_GLOBAL_AUTOLOADER="Global
Autoloader"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_NOTE_SELECT_POWER_PLUGIN_LABEL="Select
your power autoloader plugin here."
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_NOTE_SELECT_POWER_PLUGIN_DESCRIPTION="If
you don't yet have a global powers autoloader plugin, <a
href='https://git.vdm.dev/' target='_blank'>watch
this tutorial</a> to see how to setup it up."
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_PLUGIN_LABEL="Plugins"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_ACTIVATE_OPTION_LABEL="Activate
Options"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_ACTIVATE_OPTION_DESCRIPTION="You
can select the kind of activation control you would like to use.
<b>All</b> will target all components, and
<b>Selected</b> will let you select only those you want to be
active."
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_ALL="All"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_SELECTED="Selected"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_COMPONENTS_LABEL="Components"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_COMPONENTS_DESCRIPTION="Select
the components you would like to be
targeted."language/en-GB/en-GB.plg_extension_componentbuilderpowersautoloadercompiler.sys.ini000064400000005026151160402260035353
0ustar00componentbuilderpowersautoloadercompilerPLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER="Extension
- Componentbuilder Powers Autoloader Compiler"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_DESCRIPTION="This
plugin is used to build the power autoloader plugin for your component
during compilation. To activate it you must first enable it here. Then open
your JCB component global options, and under the Global tab, select this
plugin in the Activate Compiler Plugins field."
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_XML_DESCRIPTION="<h1>Extension
- Componentbuilder Powers Autoloader Compiler (v.1.2.1)</h1> <div
style='clear: both;'></div><p>This plugin is used
to build the power autoloader plugin for your component during compilation.
To activate it you must first enable it here. Then open your JCB component
global options, and under the Global tab, select this plugin in the
Activate Compiler Plugins field.</p><p>Created by <a
href='https://dev.vdm.io' target='_blank'>Llewellyn
van der Merwe</a><br /><small>Development started 13th
November, 2021</small></p>"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_YOU_DO_NOT_HAVE_A_GLOBAL_POWER_PLUGIN_SETUP_SO_THE_POWERS_PLUGIN_AUTOLOADER_COULD_NOT_BE_ADDED="You
do not have a global power plugin setup, so the powers plugin autoloader
could not be added."
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_GLOBAL_AUTOLOADER="Global
Autoloader"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_NOTE_SELECT_POWER_PLUGIN_LABEL="Select
your power autoloader plugin here."
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_NOTE_SELECT_POWER_PLUGIN_DESCRIPTION="If
you don't yet have a global powers autoloader plugin, <a
href='https://git.vdm.dev/' target='_blank'>watch
this tutorial</a> to see how to setup it up."
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_PLUGIN_LABEL="Plugins"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_ACTIVATE_OPTION_LABEL="Activate
Options"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_ACTIVATE_OPTION_DESCRIPTION="You
can select the kind of activation control you would like to use.
<b>All</b> will target all components, and
<b>Selected</b> will let you select only those you want to be
active."
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_ALL="All"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_SELECTED="Selected"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_COMPONENTS_LABEL="Components"
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_COMPONENTS_DESCRIPTION="Select
the components you would like to be
targeted."componentbuilderpowersautoloadercompiler/language/en-GB/index.html000064400000000054151160402260021634
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>componentbuilderpowersautoloadercompiler/language/index.html000064400000000054151160402260020744
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>componentbuilderpowersautoloadercompiler/fields/index.html000064400000000054151160402260020427
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>componentbuilderpowersautoloadercompiler/fields/joomlacomponents.php000064400000003227151160402260022537
0ustar00<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Joomlacomponents Form Field class for the Componentbuilder component
*/
class JFormFieldJoomlacomponents extends JFormFieldList
{
/**
* The joomlacomponents field type.
*
* @var string
*/
public $type = 'joomlacomponents';
/**
* Method to get a list of options for a list input.
*
* @return array An array of Html options.
*/
protected function getOptions()
{
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.system_name'),array('id','components_system_name')));
$query->from($db->quoteName('#__componentbuilder_joomla_component',
'a'));
$query->where($db->quoteName('a.published') . '
>= 1');
$query->order('a.system_name ASC');
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
if ($items)
{
foreach($items as $item)
{
$options[] = JHtml::_('select.option', $item->id,
$item->components_system_name);
}
}
return $options;
}
}
componentbuilderpowersautoloadercompiler/fields/joomlaplugins.php000064400000015640151160402260022035
0ustar00<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Joomlaplugins Form Field class for the Componentbuilder component
*/
class JFormFieldJoomlaplugins extends JFormFieldList
{
/**
* The joomlaplugins field type.
*
* @var string
*/
public $type = 'joomlaplugins';
/**
* Override to add new button
*
* @return string The field input markup.
*
* @since 3.2
*/
protected function getInput()
{
// see if we should add buttons
$set_button = $this->getAttribute('button');
// get html
$html = parent::getInput();
// if true set button
if ($set_button === 'true')
{
$button = array();
$script = array();
$button_code_name = $this->getAttribute('name');
// get the input from url
$app = Factory::getApplication();
$jinput = $app->input;
// get the view name & id
$values = $jinput->getArray(array(
'id' => 'int',
'view' => 'word'
));
// check if new item
$ref = '';
$refJ = '';
if (!is_null($values['id']) &&
strlen($values['view']))
{
// only load referral if not new item.
$ref = '&ref=' . $values['view'] .
'&refid=' . $values['id'];
$refJ = '&ref=' . $values['view'] .
'&refid=' . $values['id'];
// get the return value.
$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();
$_return = urlencode(base64_encode($_uri));
// load return value.
$ref .= '&return=' . $_return;
$refJ .= '&return=' . $_return;
}
// get button label
$button_label = trim($button_code_name);
$button_label = preg_replace('/_+/', ' ',
$button_label);
$button_label = preg_replace('/\s+/', ' ',
$button_label);
$button_label = preg_replace("/[^A-Za-z ]/", '',
$button_label);
$button_label = ucfirst(strtolower($button_label));
// get user object
$user = Factory::getUser();
// only add if user allowed to create joomla_plugin
if ($user->authorise('joomla_plugin.create',
'com_componentbuilder') &&
$app->isClient('administrator')) // TODO for now only in admin
area.
{
// build Create button
$button[] = '<a
id="'.$button_code_name.'Create" class="btn
btn-small btn-success hasTooltip"
title="'.Text::sprintf('PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_CREATE_NEW_S',
$button_label).'" style="border-radius: 0px 4px 4px 0px;
padding: 4px 4px 4px 7px;"
href="index.php?option=com_componentbuilder&view=joomla_plugin&layout=edit'.$ref.'"
>
<span class="icon-new
icon-white"></span></a>';
}
// only add if user allowed to edit joomla_plugin
if ($user->authorise('joomla_plugin.edit',
'com_componentbuilder') &&
$app->isClient('administrator')) // TODO for now only in admin
area.
{
// build edit button
$button[] = '<a
id="'.$button_code_name.'Edit" class="btn
btn-small hasTooltip"
title="'.Text::sprintf('PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_EDIT_S',
$button_label).'" style="display: none; padding: 3px 4px 4px
7px;" href="#" >
<span class="icon-edit"></span></a>';
// build script
$script[] = "
jQuery(document).ready(function() {
jQuery('#adminForm').on('change',
'#jform_".$button_code_name."',function (e) {
e.preventDefault();
var ".$button_code_name."Value =
jQuery('#jform_".$button_code_name."').val();
".$button_code_name."Button(".$button_code_name."Value);
});
var ".$button_code_name."Value =
jQuery('#jform_".$button_code_name."').val();
".$button_code_name."Button(".$button_code_name."Value);
});
function ".$button_code_name."Button(value) {
if (value > 0) {
// hide the create button
jQuery('#".$button_code_name."Create').hide();
// show edit button
jQuery('#".$button_code_name."Edit').show();
var url =
'index.php?option=com_componentbuilder&view=joomla_plugins&task=joomla_plugin.edit&id='+value+'".$refJ."';
jQuery('#".$button_code_name."Edit').attr('href',
url);
} else {
// show the create button
jQuery('#".$button_code_name."Create').show();
// hide edit button
jQuery('#".$button_code_name."Edit').hide();
}
}";
}
// check if button was created for joomla_plugin field.
if (is_array($button) && count($button) > 0)
{
// Load the needed script.
$document = Factory::getDocument();
$document->addScriptDeclaration(implode(' ',$script));
// return the button attached to input field.
return '<div class="input-append">' .$html .
implode('',$button).'</div>';
}
}
return $html;
}
/**
* Method to get a list of options for a list input.
*
* @return array An array of Html options.
*/
protected function getOptions()
{
// Get the user object.
$user = Factory::getUser();
// Get the databse object.
$db = Factory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.system_name','a.name','b.name','c.name'),array('id','plugin_system_name','name','class_extends_name','joomla_plugin_group_name')));
$query->from($db->quoteName('#__componentbuilder_joomla_plugin',
'a'));
$query->join('LEFT',
$db->quoteName('#__componentbuilder_class_extends',
'b') . ' ON (' .
$db->quoteName('a.class_extends') . ' = ' .
$db->quoteName('b.id') . ')');
$query->join('LEFT',
$db->quoteName('#__componentbuilder_joomla_plugin_group',
'c') . ' ON (' .
$db->quoteName('a.joomla_plugin_group') . ' = ' .
$db->quoteName('c.id') . ')');
$query->where($db->quoteName('a.published') . '
>= 1');
$query->order('a.system_name ASC');
// Implement View Level Access (if set in table)
if (!$user->authorise('core.options',
'com_componentbuilder'))
{
$columns =
$db->getTableColumns('#__componentbuilder_joomla_plugin');
if(isset($columns['access']))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
}
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
if ($items)
{
$options[] = Html::_('select.option', '',
'Select a plugin');
foreach($items as $item)
{
// set a full class name
$group_name = $item->joomla_plugin_group_name ?? '';
$name = $item->name ?? '';
$options[] = Html::_('select.option', $item->id, '(
' . $item->plugin_system_name . ' ) class Plg' .
$group_name . $name . ' extends ' .
$item->class_extends_name);
}
}
return $options;
}
}
componentbuilderpowersautoloadercompiler/rules/index.html000064400000000054151160402260020313
0ustar00<html><body
bgcolor="#FFFFFF"></body></html>componentbuilderpowersautoloadercompiler/script.php000064400000005616151160402260017212
0ustar00<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder
<https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights
reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\File;
use Joomla\CMS\Filesystem\Folder;
/**
* Extension - Componentbuilder Powers Autoloader Compiler script file.
*
* @package PlgExtensionComponentbuilderPowersAutoloaderCompiler
*/
class plgExtensionComponentbuilderPowersAutoloaderCompilerInstallerScript
{
/**
* Called before any type of action
*
* @param string $route Which action is happening
(install|uninstall|discover_install|update)
* @param Joomla\CMS\Installer\InstallerAdapter $adapter The object
responsible for running this script
*
* @return boolean True on success
*/
public function preflight($route, $adapter)
{
// get application
$app = Factory::getApplication();
// the default for both install and update
$jversion = new JVersion();
if (!$jversion->isCompatible('3.8.0'))
{
$app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0
before continuing!', 'error');
return false;
}
if ('install' === $route)
{
// check that componentbuilder is installed
$pathToCore = JPATH_ADMINISTRATOR .
'/components/com_componentbuilder/helpers/componentbuilder.php';
if (!JFile::exists($pathToCore))
{
$app->enqueueMessage('Joomla Component Builder must first be
installed from <a href="https://www.joomlacomponentbuilder.com/
" target="_blank">Joomla Component
Builder</a>.', 'error');
return false;
}
// load the helper class
JLoader::register('ComponentbuilderHelper',
JPATH_ADMINISTRATOR .
'/components/com_componentbuilder/helpers/componentbuilder.php');
// block install
$blockInstall = true;
// check the version of JCB
$manifest = ComponentbuilderHelper::manifest();
if (isset($manifest->version) &&
strpos($manifest->version, '.') !== false)
{
// get the version
$jcbVersion = explode('.', $manifest->version);
// check that we have JCB 3.0.10 or higher installed
if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3
&&
(
($jcbVersion[0] == 3 && $jcbVersion[1] == 0 &&
$jcbVersion[2] >= 10) ||
($jcbVersion[0] == 3 && $jcbVersion[1] > 0) ||
$jcbVersion[0] > 3)
)
{
$blockInstall = false;
}
}
// allow install if all conditions are met
if ($blockInstall)
{
$app->enqueueMessage('Please upgrade to JCB v3.0.10 or higher
before installing this plugin.', 'error');
return false;
}
}
return true;
}
}
componentbuilderpowersautoloadercompiler/componentbuilderpowersautoloadercompiler.xml000064400000006520151160402260026336
0ustar00<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" version="3.10"
group="extension" method="upgrade">
<name>PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER</name>
<creationDate>20th September, 2024</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://dev.vdm.io</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights
reserved.</copyright>
<license>GNU General Public License version 2 or later; see
LICENSE.txt</license>
<version>1.2.1</version>
<description>PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_XML_DESCRIPTION</description>
<!-- Scripts to run on installation -->
<scriptfile>script.php</scriptfile>
<!-- Language files -->
<languages folder="language">
<language
tag="en-GB">en-GB/en-GB.plg_extension_componentbuilderpowersautoloadercompiler.ini</language>
<language
tag="en-GB">en-GB/en-GB.plg_extension_componentbuilderpowersautoloadercompiler.sys.ini</language>
<language
tag="af-ZA">af-ZA/af-ZA.plg_extension_componentbuilderpowersautoloadercompiler.ini</language>
<language
tag="af-ZA">af-ZA/af-ZA.plg_extension_componentbuilderpowersautoloadercompiler.sys.ini</language>
</languages>
<!-- Plugin files -->
<files>
<filename
plugin="componentbuilderpowersautoloadercompiler">componentbuilderpowersautoloadercompiler.php</filename>
<filename>index.html</filename>
<folder>language</folder>
<folder>fields</folder>
<folder>rules</folder>
</files>
<!-- Config parameters -->
<config>
<fields name="params">
<fieldset name="basic"
label="PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_GLOBAL_AUTOLOADER">
<!-- Note_select_power_plugin Field. Type: Note. A None Database
Field. (joomla) -->
<field type="note" name="note_select_power_plugin"
label="PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_NOTE_SELECT_POWER_PLUGIN_LABEL"
description="PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_NOTE_SELECT_POWER_PLUGIN_DESCRIPTION"
heading="h4" class="alert alert-info
note_select_power_plugin" />
<!-- Plugin Field. Type: Joomlaplugins. (custom) -->
<field
type="joomlaplugins"
name="plugin"
label="PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_PLUGIN_LABEL"
class="list_class span12"
multiple="false"
default="0"
button="true"
/>
<!-- Activate_option Field. Type: Radio. (joomla) -->
<field
type="radio"
name="activate_option"
label="PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_ACTIVATE_OPTION_LABEL"
description="PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_ACTIVATE_OPTION_DESCRIPTION"
class="btn-group btn-group-yesno"
default="1"
required="true">
<!-- Option Set. -->
<option value="1">
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_ALL</option>
<option value="2">
PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_SELECTED</option>
</field>
<!-- Components Field. Type: Joomlacomponents. (custom) -->
<field
type="joomlacomponents"
name="components"
label="PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_COMPONENTS_LABEL"
description="PLG_EXTENSION_COMPONENTBUILDERPOWERSAUTOLOADERCOMPILER_COMPONENTS_DESCRIPTION"
class="list_class"
multiple="true"
default="0"
showon="activate_option:2"
button="false"
/>
</fieldset>
</fields>
</config>
</extension>