External Code Inclution Option #228

Merged
Llewellyn merged 8 commits from staging into master 2018-02-08 12:42:02 +00:00
9 changed files with 134 additions and 27 deletions
Showing only changes of commit 137bde87a4 - Show all commits

View File

@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.6.13) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.6.14) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -126,13 +126,13 @@ Component Builder is mapped as a component in itself on my local development env
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](http://joomlacomponentbuilder.com)
+ *First Build*: 30th April, 2015
+ *Last Build*: 28th January, 2018
+ *Version*: 2.6.13
+ *Last Build*: 31st January, 2018
+ *Version*: 2.6.14
+ *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*: **180838**
+ *Line count*: **180866**
+ *Field count*: **1577**
+ *File count*: **1161**
+ *File count*: **1162**
+ *Folder count*: **186**
> This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com).
@ -141,6 +141,6 @@ Component Builder is mapped as a component in itself on my local development env
## Donations
Come on buy VDM a coffee :)
* PayPal: [paypal.me/payvdm](https://www.paypal.me/payvdm)
* PayPal: [paypal.me/asseblief](https://www.paypal.me/asseblief)
* Bitcoin: 18vURxYpPFjvNk8BnUy1ovCAyQmY3MzkSf
* Ethereum: 0x9548144662b47327c954f3e214edb96662d51218

View File

@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.6.13) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.6.14) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -126,13 +126,13 @@ Component Builder is mapped as a component in itself on my local development env
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](http://joomlacomponentbuilder.com)
+ *First Build*: 30th April, 2015
+ *Last Build*: 28th January, 2018
+ *Version*: 2.6.13
+ *Last Build*: 31st January, 2018
+ *Version*: 2.6.14
+ *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*: **180838**
+ *Line count*: **180866**
+ *Field count*: **1577**
+ *File count*: **1161**
+ *File count*: **1162**
+ *Folder count*: **186**
> This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com).
@ -141,6 +141,6 @@ Component Builder is mapped as a component in itself on my local development env
## Donations
Come on buy VDM a coffee :)
* PayPal: [paypal.me/payvdm](https://www.paypal.me/payvdm)
* PayPal: [paypal.me/asseblief](https://www.paypal.me/asseblief)
* Bitcoin: 18vURxYpPFjvNk8BnUy1ovCAyQmY3MzkSf
* Ethereum: 0x9548144662b47327c954f3e214edb96662d51218

View File

@ -144,7 +144,7 @@ class Get
public $customCodeMemory = array();
/**
* The custom code in local files that aready exist in system
* The custom code in local files that already exist in system
*
* @var array
*/
@ -164,6 +164,13 @@ class Get
*/
protected $codeAreadyDone = array();
/**
* The online code to be added
*
* @var array
*/
protected $onlineCodeData = array();
/*
* The line numbers Switch
*
@ -3651,7 +3658,80 @@ class Get
{
if (ComponentbuilderHelper::checkString($string))
{
return $this->setLangStrings($this->setCustomCodeData($string));
return $this->setLangStrings($this->setCustomCodeData($this->setOnlineCodeData($string)));
}
return $string;
}
/**
* We start set the online code data & can load it in to string
*
* @param string $string The content to check
*
* @return string
*
*/
public function setOnlineCodeData($string)
{
// check if content has custom code place holder
if (strpos($string, '[ONLIN' . 'ECODE=') !== false)
{
// urls content
$bucket = array();
$found = ComponentbuilderHelper::getAllBetween($string, '[ONLIN' . 'ECODE=', ']');
if (ComponentbuilderHelper::checkArray($found))
{
// build local bucket
foreach ($found as $url)
{
$key = '[ONLIN' . 'ECODE=' . $url . ']';
$urlKey = trim($url);
// check if we already fethced this
if (!isset($this->onlineCodeData[$urlKey]))
{
// get the data string (code)
$this->onlineCodeData[$urlKey] = ComponentbuilderHelper::getFileContents($urlKey);
// did we get any value
if (ComponentbuilderHelper::checkString($this->onlineCodeData[$urlKey]))
{
// check for changes
$liveHash = md5($this->onlineCodeData[$urlKey]);
// check if it exist local
if ($hash = ComponentbuilderHelper::getVar('online_code', $urlKey, 'url', 'hash'))
{
if ($hash !== $liveHash)
{
$object = new stdClass();
$object->url = $urlKey;
$object->hash = $liveHash;
// update local hash
$this->db->updateObject('#__componentbuilder_online_code', $object, 'url');
// give notice of the change
$this->app->enqueueMessage(JText::sprintf('The code from <b>%s</b> has been changed since the last compilation, please investigate!', $urlKey), 'warning');
}
}
else
{
// add the hash to track changes
$object = new stdClass();
$object->url = $urlKey;
$object->hash = $liveHash;
// insert local hash
$this->db->insertObject('#__componentbuilder_online_code', $object);
}
}
}
// add to local bucket
if (ComponentbuilderHelper::checkString($this->onlineCodeData[$urlKey]))
{
$bucket[$key] = $this->onlineCodeData[$urlKey];
}
}
// now update local string if bucket has values
if (ComponentbuilderHelper::checkArray($bucket))
{
$string = $this->setPlaceholders($string, $bucket);
}
}
}
return $string;
}
@ -3660,10 +3740,8 @@ class Get
* We start set the custom code data & can load it in to string
*
* @param string $string The content to check
* @param bool $insert Should we insert the code into the content
* @param bool $bool Should we return bool on success
*
* @return string|bool based on sig
* @return string
*
*/
public function setCustomCodeData($string)
@ -3690,11 +3768,11 @@ class Get
$getFuncName = trim($key);
if (!isset($this->functionNameMemory[$getFuncName]))
{
if (!$found = ComponentbuilderHelper::getVar('custom_code', $getFuncName, 'function_name', 'id'))
if (!$found_local = ComponentbuilderHelper::getVar('custom_code', $getFuncName, 'function_name', 'id'))
{
continue;
}
$this->functionNameMemory[$getFuncName] = $found;
$this->functionNameMemory[$getFuncName] = $found_local;
}
$id = (int) $this->functionNameMemory[$getFuncName];
}
@ -3711,11 +3789,11 @@ class Get
$getFuncName = trim($array[0]);
if (!isset($this->functionNameMemory[$getFuncName]))
{
if (!$found = ComponentbuilderHelper::getVar('custom_code', $getFuncName, 'function_name', 'id'))
if (!$found_local = ComponentbuilderHelper::getVar('custom_code', $getFuncName, 'function_name', 'id'))
{
continue;
}
$this->functionNameMemory[$getFuncName] = $found;
$this->functionNameMemory[$getFuncName] = $found_local;
}
$id = (int) $this->functionNameMemory[$getFuncName];
}
@ -4618,6 +4696,7 @@ class Get
{
// reset found comment type
$commentType = 0;
$this->app->enqueueMessage(JText::sprintf('We found dynamic code <b>all in one line</b>, and ignored it! Please review (%s) for more details!', $path), 'warning');
continue;
}
// do a quick check to insure we have an id

View File

@ -4411,7 +4411,7 @@ Project duration: **###projectWeekTime### weeks** or **###projectMonthTime### mo
## Donations<br />
<br />
If you want to support this project, please consider donating:<br />
* PayPal: [paypal.me/payvdm](https://www.paypal.me/payvdm)<br />
* PayPal: [paypal.me/asseblief](https://www.paypal.me/asseblief)<br />
* Bitcoin: 18vURxYpPFjvNk8BnUy1ovCAyQmY3MzkSf<br />
* Ethereum: 0x9548144662b47327c954f3e214edb96662d51218
</code></div>"

View File

@ -1634,6 +1634,12 @@ INSERT INTO `#__componentbuilder_library_files_folders_urls` (`id`, `addfiles`,
(2, '', '', '{\"addurls0\":{\"url\":\"https:\\/\\/maxcdn.bootstrapcdn.com\\/bootstrap\\/4.0.0-alpha.6\\/js\\/bootstrap.min.js\",\"type\":\"2\"},\"addurls1\":{\"url\":\"https:\\/\\/maxcdn.bootstrapcdn.com\\/bootstrap\\/4.0.0-alpha.6\\/css\\/bootstrap.min.css\",\"type\":\"2\"}}', 2, '', 1, '2017-11-25 16:17:36', '2017-12-25 12:40:16', 10, '', 2),
(3, '', '', '{\"addurls0\":{\"url\":\"https:\\/\\/cdnjs.cloudflare.com\\/ajax\\/libs\\/uikit\\/3.0.0-beta.35\\/js\\/uikit.min.js\",\"type\":\"2\"},\"addurls1\":{\"url\":\"https:\\/\\/cdnjs.cloudflare.com\\/ajax\\/libs\\/uikit\\/3.0.0-beta.35\\/js\\/uikit-icons.min.js\",\"type\":\"2\"},\"addurls2\":{\"url\":\"https:\\/\\/cdnjs.cloudflare.com\\/ajax\\/libs\\/uikit\\/3.0.0-beta.35\\/css\\/uikit.min.css\",\"type\":\"2\"}}', 3, '', 1, '2017-11-25 21:47:40', '2017-12-25 12:38:24', 8, '', 3);
CREATE TABLE IF NOT EXISTS `#__componentbuilder_online_code` (
`url` VARCHAR(255) NOT NULL DEFAULT '',
`hash` VARCHAR(64) NOT NULL DEFAULT '',
PRIMARY KEY (`url`)
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
--

View File

@ -0,0 +1,5 @@
CREATE TABLE IF NOT EXISTS `#__componentbuilder_online_code` (
`url` VARCHAR(255) NOT NULL DEFAULT '',
`hash` VARCHAR(64) NOT NULL DEFAULT '',
PRIMARY KEY (`url`)
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name>
<creationDate>28th January, 2018</creationDate>
<creationDate>31st January, 2018</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://joomlacomponentbuilder.com</authorUrl>
<copyright>Copyright (C) 2015. All Rights Reserved</copyright>
<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
<version>2.6.13</version>
<version>2.6.14</version>
<description><![CDATA[
<h1>Component Builder (v.2.6.13)</h1>
<h1>Component Builder (v.2.6.14)</h1>
<div style="clear: both;"></div>
<p>The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.

View File

@ -390,4 +390,21 @@
<maintainerurl>http://joomlacomponentbuilder.com</maintainerurl>
<targetplatform name="joomla" version="3.*"/>
</update>
<update>
<name>Component Builder</name>
<description>Builds Complex Joomla Components</description>
<element>com_componentbuilder</element>
<type>component</type>
<version>2.6.14</version>
<infourl title="Component Builder!">http://joomlacomponentbuilder.com</infourl>
<downloads>
<downloadurl type="full" format="zip">https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.6.14/JCB_v2.6.14.zip</downloadurl>
</downloads>
<tags>
<tag>stable</tag>
</tags>
<maintainer>Llewellyn van der Merwe</maintainer>
<maintainerurl>http://joomlacomponentbuilder.com</maintainerurl>
<targetplatform name="joomla" version="3.*"/>
</update>
</updates>

View File

@ -4739,7 +4739,7 @@ class com_componentbuilderInstallerScript
echo '<a target="_blank" href="http://joomlacomponentbuilder.com" title="Component Builder">
<img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/>
</a>
<h3>Upgrade to Version 2.6.13 Was Successful! Let us know if anything is not working as expected.</h3>';
<h3>Upgrade to Version 2.6.14 Was Successful! Let us know if anything is not working as expected.</h3>';
}
}
}