update - v1.0.8
This commit is contained in:
parent
cbbe81168d
commit
deda7d5c82
@ -22,7 +22,7 @@ JLoader::register('ComponentbuilderHelper', JPATH_ADMINISTRATOR . '/components/c
|
|||||||
* Extension - Componentbuilder Headers Compiler plugin.
|
* Extension - Componentbuilder Headers Compiler plugin.
|
||||||
*
|
*
|
||||||
* @package ComponentbuilderHeadersCompiler
|
* @package ComponentbuilderHeadersCompiler
|
||||||
* @since 1.0.7
|
* @since 1.0.8
|
||||||
*/
|
*/
|
||||||
class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
||||||
{
|
{
|
||||||
@ -35,12 +35,12 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
|||||||
protected $loadHeaders = false;
|
protected $loadHeaders = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The files active with headers
|
* The active headers
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
* @since 1.0.0
|
* @since 1.0.8
|
||||||
*/
|
*/
|
||||||
protected $activeFiles = array();
|
protected $activeHeaders = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The compiler placeholders values
|
* The compiler placeholders values
|
||||||
@ -62,7 +62,7 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
|||||||
* The Targets
|
* The Targets
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
* @since 1.0.5
|
* @since 1.0.8
|
||||||
*/
|
*/
|
||||||
protected $targets = array(
|
protected $targets = array(
|
||||||
'admin_view_headers' =>
|
'admin_view_headers' =>
|
||||||
@ -92,6 +92,11 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
|||||||
'context' => 'admin.view.controller',
|
'context' => 'admin.view.controller',
|
||||||
'view' => 'name_single'
|
'view' => 'name_single'
|
||||||
),
|
),
|
||||||
|
'add_ajax_model' => array(
|
||||||
|
'field' => 'ajax_model',
|
||||||
|
'context' => 'ajax.admin.model',
|
||||||
|
'view' => 'ajax'
|
||||||
|
),
|
||||||
'add_admin_views_model' => array(
|
'add_admin_views_model' => array(
|
||||||
'field' => 'admin_views_model',
|
'field' => 'admin_views_model',
|
||||||
'context' => 'admin.views.model',
|
'context' => 'admin.views.model',
|
||||||
@ -154,6 +159,11 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
|||||||
'field' => 'site_views_controller',
|
'field' => 'site_views_controller',
|
||||||
'context' => 'site.views.controller',
|
'context' => 'site.views.controller',
|
||||||
'view' => 'code'
|
'view' => 'code'
|
||||||
|
),
|
||||||
|
'add_ajax_model' => array(
|
||||||
|
'field' => 'ajax_model',
|
||||||
|
'context' => 'ajax.site.model',
|
||||||
|
'view' => 'ajax'
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
'custom_admin_view_headers' =>
|
'custom_admin_view_headers' =>
|
||||||
@ -197,6 +207,39 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
|||||||
'field' => 'custom_admin_views_controller',
|
'field' => 'custom_admin_views_controller',
|
||||||
'context' => 'custom.admin.views.controller',
|
'context' => 'custom.admin.views.controller',
|
||||||
'view' => 'code'
|
'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' =>
|
'joomla_component_headers' =>
|
||||||
@ -231,29 +274,13 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
|||||||
*
|
*
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public function jcb_ce_onBeforeModelViewData(&$context, &$view,
|
public function jcb_ce_onBeforeModelViewData(&$context, &$view, &$placeholders)
|
||||||
&$placeholders
|
|
||||||
) {
|
|
||||||
// add the headers
|
|
||||||
$view->params = (isset($view->params)
|
|
||||||
&& ComponentbuilderHelper::checkJson($view->params)) ? json_decode(
|
|
||||||
$view->params, true
|
|
||||||
) : $view->params;
|
|
||||||
if (ComponentbuilderHelper::checkArray($view->params)
|
|
||||||
&& isset($view->params['admin_view_headers'])
|
|
||||||
&& ComponentbuilderHelper::checkArray(
|
|
||||||
$view->params['admin_view_headers']
|
|
||||||
))
|
|
||||||
{
|
{
|
||||||
foreach ($this->targets['admin_view_headers'] as $target => $event)
|
// check that the params are set
|
||||||
|
if (isset($view->params))
|
||||||
{
|
{
|
||||||
if (isset($view->params['admin_view_headers'][$target])
|
// add the headers for the Admin Views
|
||||||
&& $view->params['admin_view_headers'][$target] == 1)
|
$this->setHeaders($view->params, $view, 'admin_view_headers');
|
||||||
{
|
|
||||||
// get the header string if set
|
|
||||||
$this->getHeaderString($view, $event, 'admin_view_headers');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,49 +289,17 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* @since 1.2
|
* @since 1.0.2
|
||||||
*/
|
*/
|
||||||
public function jcb_ce_onBeforeModelCustomViewData(&$context, &$view,
|
public function jcb_ce_onBeforeModelCustomViewData(&$context, &$view, &$id, &$table)
|
||||||
&$id, &$table
|
|
||||||
) {
|
|
||||||
// add the headers
|
|
||||||
$view->params = (isset($view->params)
|
|
||||||
&& ComponentbuilderHelper::checkJson($view->params)) ? json_decode(
|
|
||||||
$view->params, true
|
|
||||||
) : $view->params;
|
|
||||||
// target site views
|
|
||||||
if (ComponentbuilderHelper::checkArray($view->params)
|
|
||||||
&& isset($view->params['site_view_headers'])
|
|
||||||
&& ComponentbuilderHelper::checkArray(
|
|
||||||
$view->params['site_view_headers']
|
|
||||||
))
|
|
||||||
{
|
{
|
||||||
foreach ($this->targets['site_view_headers'] as $target => $event)
|
// check that the params are set
|
||||||
|
if (isset($view->params))
|
||||||
{
|
{
|
||||||
if (isset($view->params['site_view_headers'][$target])
|
// add the headers for the Site Views
|
||||||
&& $view->params['site_view_headers'][$target] == 1)
|
$this->setHeaders($view->params, $view, 'site_view_headers');
|
||||||
{
|
// add the headers for the Custom Admin Views
|
||||||
// get the header string if set
|
$this->setHeaders($view->params, $view, 'custom_admin_view_headers');
|
||||||
$this->getHeaderString($view, $event, 'site_view_headers');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// target custom admin views
|
|
||||||
if (ComponentbuilderHelper::checkArray($view->params)
|
|
||||||
&& isset($view->params['custom_admin_view_headers'])
|
|
||||||
&& ComponentbuilderHelper::checkArray(
|
|
||||||
$view->params['custom_admin_view_headers']
|
|
||||||
))
|
|
||||||
{
|
|
||||||
foreach ($this->targets['custom_admin_view_headers'] as $target => $event)
|
|
||||||
{
|
|
||||||
if (isset($view->params['custom_admin_view_headers'][$target])
|
|
||||||
&& $view->params['custom_admin_view_headers'][$target] == 1)
|
|
||||||
{
|
|
||||||
// get the header string if set
|
|
||||||
$this->getHeaderString($view, $event, 'custom_admin_view_headers');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,114 +308,23 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
* @since 1.4
|
* @since 1.0.4
|
||||||
*/
|
*/
|
||||||
public function jcb_ce_onBeforeModelComponentData(&$context, &$component)
|
public function jcb_ce_onBeforeModelComponentData(&$context, &$component)
|
||||||
{
|
{
|
||||||
// add the privacy
|
// check that the params are set
|
||||||
$component->params = (isset($component->params)
|
if (isset($component->params))
|
||||||
&& ComponentbuilderHelper::checkJson($component->params)) ? json_decode(
|
|
||||||
$component->params, true
|
|
||||||
) : $component->params;
|
|
||||||
if (ComponentbuilderHelper::checkArray($component->params)
|
|
||||||
&& isset($component->params['joomla_component_headers'])
|
|
||||||
&& ComponentbuilderHelper::checkArray(
|
|
||||||
$component->params['joomla_component_headers']
|
|
||||||
))
|
|
||||||
{
|
{
|
||||||
foreach ($this->targets['joomla_component_headers'] as $target => $event)
|
// 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))
|
||||||
{
|
{
|
||||||
if (isset($component->params['joomla_component_headers'][$target])
|
// add the headers for the Component Dashboard
|
||||||
&& $component->params['joomla_component_headers'][$target] == 1)
|
$this->setHeaders($component->dashboard_params, $component, 'component_dashboard_headers');
|
||||||
{
|
|
||||||
// activate the load of the headers
|
|
||||||
$this->loadHeaders = true;
|
|
||||||
// load the headers
|
|
||||||
$this->activeFiles[$event['view']][$event['context']]
|
|
||||||
= $component->params['joomla_component_headers'][$event['field']];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get the header string
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
protected function getHeaderString(&$view, &$get, $key, $view_name = null)
|
|
||||||
{
|
|
||||||
// we first check if the value is set
|
|
||||||
if (isset($view->params[$key][$get['field']]) || isset($view->params[$key]['power_' . $get['field']]))
|
|
||||||
{
|
|
||||||
// activate the load of the headers
|
|
||||||
$this->loadHeaders = true;
|
|
||||||
// setup the view key name
|
|
||||||
if (!$view_name)
|
|
||||||
{
|
|
||||||
$view_name = ComponentbuilderHelper::safeString(
|
|
||||||
$view->{$get['view']}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// we start this field if not already
|
|
||||||
if (!isset($this->activeFiles[$view_name][$get['context']]))
|
|
||||||
{
|
|
||||||
$this->activeFiles[$view_name][$get['context']] = '';
|
|
||||||
}
|
|
||||||
// start little bucket
|
|
||||||
$bucket = array();
|
|
||||||
// load the headers if text
|
|
||||||
if (isset($view->params[$key][$get['field']]) && ComponentbuilderHelper::checkString($view->params[$key][$get['field']]))
|
|
||||||
{
|
|
||||||
$bucket[] = $view->params[$key][$get['field']];
|
|
||||||
}
|
|
||||||
// load the headers if power
|
|
||||||
if (isset($view->params[$key]['power_' . $get['field']]) && ComponentbuilderHelper::checkArray($view->params[$key]['power_' . $get['field']], true)
|
|
||||||
&& ($use = $this->getPowers($view->params[$key]['power_' . $get['field']])) !== false)
|
|
||||||
{
|
|
||||||
$bucket[] = 'use ' . implode(';' . PHP_EOL . 'use ', $use) . ';';
|
|
||||||
}
|
|
||||||
// we start this field if not already
|
|
||||||
if (ComponentbuilderHelper::checkArray($bucket, true))
|
|
||||||
{
|
|
||||||
$this->activeFiles[$view_name][$get['context']] .= implode(PHP_EOL, $bucket);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get the powers header use strings
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*
|
|
||||||
* @since 1.0.6
|
|
||||||
*/
|
|
||||||
protected function getPowers($ids)
|
|
||||||
{
|
|
||||||
// if none are found
|
|
||||||
$namspaces = false;
|
|
||||||
// add to active powers
|
|
||||||
if (($namspaces = ComponentbuilderHelper::getVars('power', $ids, 'id', 'namespace')) !== false)
|
|
||||||
{
|
|
||||||
foreach ($ids as $id)
|
|
||||||
{
|
|
||||||
$this->linkedPowers[$id] = $id;
|
|
||||||
}
|
|
||||||
// convert the dots to namespace
|
|
||||||
$namspaces = array_map( function($namespace) {
|
|
||||||
return ComponentbuilderHelper::safeNamespace(
|
|
||||||
str_replace(
|
|
||||||
array_keys($this->placeholders),
|
|
||||||
array_values($this->placeholders),
|
|
||||||
str_replace('.', '\\', $namespace)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}, $namspaces );
|
|
||||||
}
|
|
||||||
return $namspaces;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event Triggered in the compiler [on set Class Header]
|
* Event Triggered in the compiler [on set Class Header]
|
||||||
@ -429,20 +333,23 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
|||||||
*
|
*
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public function jcb_ce_setClassHeader(&$context, &$event_context,
|
public function jcb_ce_setClassHeader(&$context, &$event_context, &$view_name, &$headers)
|
||||||
&$view_name,
|
{
|
||||||
&$headers
|
if ($this->loadHeaders && isset($this->activeHeaders[$view_name])
|
||||||
) {
|
&& isset($this->activeHeaders[$view_name][$event_context]))
|
||||||
if ($this->loadHeaders && isset($this->activeFiles[$view_name])
|
|
||||||
&& isset($this->activeFiles[$view_name][$event_context]))
|
|
||||||
{
|
{
|
||||||
// we have default headers we actually need
|
// we have default headers we actually need
|
||||||
foreach ($headers as $n => $header)
|
foreach ($headers as $n => $header)
|
||||||
{
|
{
|
||||||
|
// if an empty line is found just skip it
|
||||||
|
if (empty($header))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// we check if this header is also set from the user
|
// we check if this header is also set from the user
|
||||||
if (empty($header) || (isset($this->activeFiles[$view_name][$event_context]) && strpos(
|
if (isset($this->activeHeaders[$view_name][$event_context]) && strpos(
|
||||||
$this->activeFiles[$view_name][$event_context], $header
|
$this->activeHeaders[$view_name][$event_context], $header
|
||||||
) !== false))
|
) !== false)
|
||||||
{
|
{
|
||||||
// since it is set, remove it here
|
// since it is set, remove it here
|
||||||
unset($headers[$n]);
|
unset($headers[$n]);
|
||||||
@ -450,7 +357,7 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
|||||||
}
|
}
|
||||||
// now add the custom headers
|
// now add the custom headers
|
||||||
// yes they are below the defaults, unless overridden and removed above
|
// yes they are below the defaults, unless overridden and removed above
|
||||||
$headers[] = $this->activeFiles[$view_name][$event_context];
|
$headers[] = $this->activeHeaders[$view_name][$event_context];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,4 +389,142 @@ class PlgExtensionComponentbuilderHeadersCompiler extends CMSPlugin
|
|||||||
$compiler->linkedPowers = $this->linkedPowers;
|
$compiler->linkedPowers = $this->linkedPowers;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set the headers
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 1.0.8
|
||||||
|
*/
|
||||||
|
protected function setHeaders(&$params, &$obj, $key)
|
||||||
|
{
|
||||||
|
// add the headers
|
||||||
|
$params = (ComponentbuilderHelper::checkJson($params)) ? json_decode($params, true) : $params;
|
||||||
|
// make sure we have the keys values in the params area
|
||||||
|
if (ComponentbuilderHelper::checkArray($params) && isset($params[$key])
|
||||||
|
&& ComponentbuilderHelper::checkArray($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']
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 = array();
|
||||||
|
// load the headers if text
|
||||||
|
if (isset($params[$get['field']]) && ComponentbuilderHelper::checkString($params[$get['field']]))
|
||||||
|
{
|
||||||
|
$headers[] = $params[$get['field']];
|
||||||
|
}
|
||||||
|
// load the headers if power
|
||||||
|
if (isset($params['power_' . $get['field']]) && ComponentbuilderHelper::checkArray($params['power_' . $get['field']], true)
|
||||||
|
&& ($use = $this->getPowers($params['power_' . $get['field']])) !== false)
|
||||||
|
{
|
||||||
|
$headers[] = 'use ' . implode(';' . PHP_EOL . 'use ', $use) . ';';
|
||||||
|
}
|
||||||
|
// check if we found some header values
|
||||||
|
if (ComponentbuilderHelper::checkArray($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']] = '';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// each addition we add a new line
|
||||||
|
$this->activeHeaders[$view_name][$get['context']] = PHP_EOL;
|
||||||
|
}
|
||||||
|
// load the found headers
|
||||||
|
$this->activeHeaders[$view_name][$get['context']] .= implode(PHP_EOL, $headers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 ComponentbuilderHelper::safeString(
|
||||||
|
$view->{$get}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return '_error';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get the powers header use strings
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*
|
||||||
|
* @since 1.0.6
|
||||||
|
*/
|
||||||
|
protected function getPowers($ids)
|
||||||
|
{
|
||||||
|
// if none are found
|
||||||
|
$namspaces = false;
|
||||||
|
// add to active powers
|
||||||
|
if (($namspaces = ComponentbuilderHelper::getVars('power', $ids, 'id', 'namespace')) !== false)
|
||||||
|
{
|
||||||
|
foreach ($ids as $id)
|
||||||
|
{
|
||||||
|
$this->linkedPowers[$id] = $id;
|
||||||
|
}
|
||||||
|
// convert the dots to namespace
|
||||||
|
$namspaces = array_map(function ($namespace) {
|
||||||
|
return ComponentbuilderHelper::safeNamespace(
|
||||||
|
str_replace(
|
||||||
|
array_keys($this->placeholders),
|
||||||
|
array_values($this->placeholders),
|
||||||
|
str_replace('.', '\\', $namespace)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}, $namspaces);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $namspaces;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<extension type="plugin" version="4" group="extension" method="upgrade">
|
<extension type="plugin" version="4" group="extension" method="upgrade">
|
||||||
<name>PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER</name>
|
<name>PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER</name>
|
||||||
<creationDate>3rd December, 2021</creationDate>
|
<creationDate>8th December, 2021</creationDate>
|
||||||
<author>Llewellyn van der Merwe</author>
|
<author>Llewellyn van der Merwe</author>
|
||||||
<authorEmail>joomla@vdm.io</authorEmail>
|
<authorEmail>joomla@vdm.io</authorEmail>
|
||||||
<authorUrl>https://dev.vdm.io</authorUrl>
|
<authorUrl>https://dev.vdm.io</authorUrl>
|
||||||
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
|
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
|
||||||
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
|
||||||
<version>1.0.7</version>
|
<version>1.0.8</version>
|
||||||
<description>PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER_XML_DESCRIPTION</description>
|
<description>PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER_XML_DESCRIPTION</description>
|
||||||
|
|
||||||
<!-- Scripts to run on installation -->
|
<!-- Scripts to run on installation -->
|
||||||
|
@ -2,6 +2,6 @@ PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER="Extension - Componentbuilder Head
|
|||||||
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.
|
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."
|
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.1.0.7)</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.
|
PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Headers Compiler (v.1.0.8)</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>"
|
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>"
|
@ -2,6 +2,6 @@ PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER="Extension - Componentbuilder Head
|
|||||||
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.
|
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."
|
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.1.0.7)</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.
|
PLG_EXTENSION_COMPONENTBUILDERHEADERSCOMPILER_XML_DESCRIPTION="<h1>Extension - Componentbuilder Headers Compiler (v.1.0.8)</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>"
|
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>"
|
@ -43,11 +43,12 @@ class plgExtensionComponentbuilderHeadersCompilerInstallerScript
|
|||||||
|
|
||||||
if ('install' === $route)
|
if ('install' === $route)
|
||||||
{
|
{
|
||||||
|
|
||||||
// check that componentbuilder is installed
|
// check that componentbuilder is installed
|
||||||
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
|
$pathToCore = JPATH_ADMINISTRATOR . '/components/com_componentbuilder/helpers/componentbuilder.php';
|
||||||
if (!JFile::exists($pathToCore))
|
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');
|
$app->enqueueMessage('JCB must first be installed from <a href="https://git.vdm.dev/joomla/Component-Builder-Pro/" target="_blank">Joomla Component Builder</a>.', 'error');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// load the helper class
|
// load the helper class
|
||||||
@ -60,8 +61,8 @@ class plgExtensionComponentbuilderHeadersCompilerInstallerScript
|
|||||||
{
|
{
|
||||||
// get the version
|
// get the version
|
||||||
$jcbVersion = explode('.', $manifest->version);
|
$jcbVersion = explode('.', $manifest->version);
|
||||||
// check that we have JCB 2.12.14 or higher installed
|
// check that we have JCB 3 or higher installed
|
||||||
if (count($jcbVersion) == 3 && (($jcbVersion[0] == 2 && (($jcbVersion[1] == 12 && $jcbVersion[2] >= 14) || ($jcbVersion[1] > 12))) || $jcbVersion[0] >= 3))
|
if (count($jcbVersion) == 3 && $jcbVersion[0] >= 3)
|
||||||
{
|
{
|
||||||
$blockInstall = false;
|
$blockInstall = false;
|
||||||
}
|
}
|
||||||
@ -69,7 +70,7 @@ class plgExtensionComponentbuilderHeadersCompilerInstallerScript
|
|||||||
// allow install if all conditions are met
|
// allow install if all conditions are met
|
||||||
if ($blockInstall)
|
if ($blockInstall)
|
||||||
{
|
{
|
||||||
$app->enqueueMessage('Please upgrade to JCB-PRO 2.12.14 or higher before installing this plugin.', 'error');
|
$app->enqueueMessage('Please upgrade to JCB-Pro v3.0.0 or higher before installing this plugin.', 'error');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user