Fixed few bugs in import/export of JCB packages. Resolved gh-204. Made some updates to the Dropbox class, more coming.
This commit is contained in:
parent
edafb6e688
commit
cd5f1f2c87
@ -111,11 +111,11 @@ Component Builder is mapped as a component in itself on my local development env
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
+ *Name*: [Component Builder](http://vdm.bz/component-builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 22nd December, 2017
|
||||
+ *Last Build*: 25th December, 2017
|
||||
+ *Version*: 2.6.7
|
||||
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
|
||||
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
+ *Line count*: **178381**
|
||||
+ *Line count*: **178415**
|
||||
+ *File count*: **1145**
|
||||
+ *Folder count*: **184**
|
||||
|
||||
|
@ -111,11 +111,11 @@ Component Builder is mapped as a component in itself on my local development env
|
||||
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
+ *Name*: [Component Builder](http://vdm.bz/component-builder)
|
||||
+ *First Build*: 30th April, 2015
|
||||
+ *Last Build*: 22nd December, 2017
|
||||
+ *Last Build*: 25th December, 2017
|
||||
+ *Version*: 2.6.7
|
||||
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
|
||||
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
+ *Line count*: **178381**
|
||||
+ *Line count*: **178415**
|
||||
+ *File count*: **1145**
|
||||
+ *Folder count*: **184**
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||
Vast Development Method
|
||||
/-------------------------------------------------------------------------------------------------------/
|
||||
@ -20,6 +21,7 @@ defined('_JEXEC') or die;
|
||||
*/
|
||||
class Dropbox
|
||||
{
|
||||
|
||||
/**
|
||||
* final url
|
||||
*/
|
||||
@ -223,7 +225,6 @@ class Dropbox
|
||||
|
||||
protected function makeGetCall()
|
||||
{
|
||||
|
||||
$options = array(
|
||||
'http' => array(
|
||||
'header' => "Content-Type: application/json\r\n" .
|
||||
@ -241,18 +242,20 @@ class Dropbox
|
||||
$context = stream_context_create($options);
|
||||
$response = file_get_contents($this->url . $this->domainpath[$this->type], false, $context);
|
||||
|
||||
// store the result
|
||||
return $this->getCallResult($response);
|
||||
}
|
||||
|
||||
protected function getCallResult($response)
|
||||
{
|
||||
if ($response === FALSE)
|
||||
{
|
||||
$this->error_summary[] = $this->type . '_error';
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// store the result
|
||||
return $this->setTheResult(json_decode($response));
|
||||
}
|
||||
}
|
||||
|
||||
protected function makeCurlCall()
|
||||
{
|
||||
@ -277,6 +280,12 @@ class Dropbox
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
// store the result
|
||||
return $this->curlCallResult($response);
|
||||
}
|
||||
|
||||
public function curlCallResult($response)
|
||||
{
|
||||
if ($this->checkJson($response))
|
||||
{
|
||||
$response = json_decode($response);
|
||||
|
@ -41,12 +41,16 @@ abstract class ComponentbuilderHelper
|
||||
self::loadSession();
|
||||
}
|
||||
|
||||
/**
|
||||
* The global updater
|
||||
**/
|
||||
protected static $globalUpdater = array();
|
||||
|
||||
/*
|
||||
* Convert repeatable field to subform
|
||||
*
|
||||
* @param array $item The array to convert
|
||||
* @param string $name The main field name
|
||||
* @param array $updater The updater (dynamic) option
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -72,11 +76,6 @@ abstract class ComponentbuilderHelper
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* The global updater
|
||||
**/
|
||||
protected static $globalUpdater = array();
|
||||
|
||||
/*
|
||||
* Convert repeatable field to subform
|
||||
*
|
||||
@ -90,9 +89,11 @@ abstract class ComponentbuilderHelper
|
||||
{
|
||||
// update the repeatable fields
|
||||
foreach ($searcher as $key => $sleutel)
|
||||
{
|
||||
if (isset($object->{$key}))
|
||||
{
|
||||
$isJson = false;
|
||||
if (isset($object->{$key}) && self::checkJson($object->{$key}))
|
||||
if (self::checkJson($object->{$key}))
|
||||
{
|
||||
$object->{$key} = json_decode($object->{$key}, true);
|
||||
$isJson = true;
|
||||
@ -143,16 +144,17 @@ abstract class ComponentbuilderHelper
|
||||
}
|
||||
}
|
||||
// no set back to json if came in as json
|
||||
if (isset($object->{$key}) && $isJson && self::checkArray($object->{$key}))
|
||||
if ($isJson && self::checkArray($object->{$key}))
|
||||
{
|
||||
$object->{$key} = json_encode($object->{$key});
|
||||
}
|
||||
// remove if not json or array
|
||||
elseif (isset($object->{$key}) && !self::checkArray($object->{$key}) && !self::checkJson($object->{$key}))
|
||||
elseif (!self::checkArray($object->{$key}) && !self::checkJson($object->{$key}))
|
||||
{
|
||||
unset($object->{$key});
|
||||
}
|
||||
}
|
||||
}
|
||||
return $object;
|
||||
}
|
||||
|
||||
|
@ -958,7 +958,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
// update the fields
|
||||
$object = new stdClass;
|
||||
$object->id = $adminview;
|
||||
$object->addlinked_views = json_encode($addlinked_views);
|
||||
$object->addlinked_views = json_encode($addlinked_views, JSON_FORCE_OBJECT);
|
||||
// update the admin view
|
||||
$this->_db->updateObject('#__componentbuilder_admin_view', $object, 'id');
|
||||
}
|
||||
@ -1013,7 +1013,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
if (ComponentbuilderHelper::checkArray($updateArray))
|
||||
{
|
||||
// load it back
|
||||
$item->{$field} = json_encode($this->updateSubformIDs($updateArray, $table, $targetArray));
|
||||
$item->{$field} = json_encode($this->updateSubformIDs($updateArray, $table, $targetArray), JSON_FORCE_OBJECT);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1052,7 +1052,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
}
|
||||
if ($isJson)
|
||||
{
|
||||
return json_encode($values);
|
||||
return json_encode($values, JSON_FORCE_OBJECT);
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
@ -1076,7 +1076,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
$item = json_decode($item, true);
|
||||
$isJson = true;
|
||||
}
|
||||
if (ComponentbuilderHelper::checkArray($item))
|
||||
if (ComponentbuilderHelper::checkArray($item) && isset($item[$target]))
|
||||
{
|
||||
// set item ID
|
||||
$itemId = (isset($item['id'])) ? $item['id'] : 'newItem';
|
||||
@ -1135,7 +1135,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
$item[$target] = json_encode($item[$target]);
|
||||
}
|
||||
}
|
||||
elseif (ComponentbuilderHelper::checkObject($item))
|
||||
elseif (ComponentbuilderHelper::checkObject($item) && isset($item->{$target}))
|
||||
{
|
||||
// set item ID
|
||||
$itemId = (isset($item->id)) ? $item->id : 'newItem';
|
||||
@ -1550,7 +1550,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
// subform fields to target
|
||||
$updaterT = array(
|
||||
// subformfield => array( field => type_value )
|
||||
'addcustom_admin_views' => array('customadminview' => 'custom_admin_view')
|
||||
'addcustom_admin_views' => array('customadminview' => 'custom_admin_view', 'adminviews' => 'admin_view', 'before' => 'admin_view')
|
||||
);
|
||||
// update the subform ids
|
||||
$this->updateSubformsIDs($item, 'component_custom_admin_views', $updaterT);
|
||||
@ -1743,7 +1743,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
|
||||
// only update if we have translations
|
||||
if (ComponentbuilderHelper::checkArray($translations))
|
||||
{
|
||||
$item->translation = json_encode($translations);
|
||||
$item->translation = json_encode($translations, JSON_FORCE_OBJECT);
|
||||
}
|
||||
}
|
||||
elseif (isset($item->localTranslation) && ComponentbuilderHelper::checkJson($item->localTranslation))
|
||||
|
@ -258,7 +258,7 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
|
||||
}
|
||||
}
|
||||
$item->{$_value} = $bucket;
|
||||
$objectUpdate->{$_value} = json_encode($bucket);
|
||||
$objectUpdate->{$_value} = json_encode($bucket, JSON_FORCE_OBJECT);
|
||||
}
|
||||
}
|
||||
// be sure to update the table if we found repeatable fields that are still not converted
|
||||
|
@ -500,6 +500,38 @@ class ComponentbuilderModelJoomla_components extends JModelList
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// actions to take before storing the item if table is template, layout, site_view, or custom_admin_view
|
||||
if ('layout' === $table || 'template' === $table || 'site_view' === $table || 'custom_admin_view' === $table)
|
||||
{
|
||||
// unset snippets (we no longer export snippets)
|
||||
if (isset($item->snippet))
|
||||
{
|
||||
unset($item->snippet);
|
||||
}
|
||||
}
|
||||
// actions to take before storing the item if table is joomla_component
|
||||
if ('joomla_component' === $table)
|
||||
{
|
||||
// make sure old fields are not exported any more
|
||||
unset($item->addconfig);
|
||||
unset($item->addadmin_views);
|
||||
unset($item->addcustom_admin_views);
|
||||
unset($item->addsite_views);
|
||||
unset($item->version_update);
|
||||
unset($item->sql_tweak);
|
||||
unset($item->addcustommenus);
|
||||
unset($item->dashboard_tab);
|
||||
unset($item->php_dashboard_methods);
|
||||
unset($item->addfiles);
|
||||
unset($item->addfolders);
|
||||
}
|
||||
// actions to take before storing the item if table is admin_view
|
||||
if ('admin_view' === $table)
|
||||
{
|
||||
// make sure old fields are not exported any more
|
||||
unset($item->addfields);
|
||||
unset($item->addconditions);
|
||||
}
|
||||
// load to global object
|
||||
$this->smartExport[$table][$item->id] = $item;
|
||||
// set the custom code ID's
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="3.2" method="upgrade">
|
||||
<name>COM_COMPONENTBUILDER</name>
|
||||
<creationDate>22nd December, 2017</creationDate>
|
||||
<creationDate>25th December, 2017</creationDate>
|
||||
<author>Llewellyn van der Merwe</author>
|
||||
<authorEmail>joomla@vdm.io</authorEmail>
|
||||
<authorUrl>http://vdm.bz/component-builder</authorUrl>
|
||||
|
Loading…
Reference in New Issue
Block a user