Added the JCB community snippets manager #183
@ -111,13 +111,13 @@ 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*: 12th November, 2017
|
||||
+ *Last Build*: 16th November, 2017
|
||||
+ *Version*: 2.6.4
|
||||
+ *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*: **166252**
|
||||
+ *File count*: **1061**
|
||||
+ *Folder count*: **174**
|
||||
+ *Line count*: **167476**
|
||||
+ *File count*: **1070**
|
||||
+ *Folder count*: **176**
|
||||
|
||||
> This **component** was build with a Joomla [Automated Component Builder](http://vdm.bz/component-builder).
|
||||
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
|
@ -111,13 +111,13 @@ 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*: 12th November, 2017
|
||||
+ *Last Build*: 16th November, 2017
|
||||
+ *Version*: 2.6.4
|
||||
+ *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*: **166252**
|
||||
+ *File count*: **1061**
|
||||
+ *Folder count*: **174**
|
||||
+ *Line count*: **167476**
|
||||
+ *File count*: **1070**
|
||||
+ *Folder count*: **176**
|
||||
|
||||
> This **component** was build with a Joomla [Automated Component Builder](http://vdm.bz/component-builder).
|
||||
> Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io)
|
||||
|
@ -225,6 +225,8 @@
|
||||
<action name="ftp.export" title="COM_COMPONENTBUILDER_FTPS_EXPORT" description="COM_COMPONENTBUILDER_FTPS_EXPORT_DESC" />
|
||||
<action name="ftp.import" title="COM_COMPONENTBUILDER_FTPS_IMPORT" description="COM_COMPONENTBUILDER_FTPS_IMPORT_DESC" />
|
||||
<action name="ftp.submenu" title="COM_COMPONENTBUILDER_FTPS_SUBMENU" description="COM_COMPONENTBUILDER_FTPS_SUBMENU_DESC" />
|
||||
<action name="get_snippets.access" title="COM_COMPONENTBUILDER_GET_SNIPPETS_ACCESS" description="COM_COMPONENTBUILDER_GET_SNIPPETS_ACCESS_DESC" />
|
||||
<action name="get_snippets.snippets" title="COM_COMPONENTBUILDER_GET_SNIPPETS_SNIPPETS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_GET_SNIPPETS_SNIPPETS_BUTTON_ACCESS_DESC" />
|
||||
<action name="help_document.access" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_ACCESS" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_ACCESS_DESC" />
|
||||
<action name="help_document.batch" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_USE" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_USE_DESC" />
|
||||
<action name="help_document.create" title="COM_COMPONENTBUILDER_HELP_DOCUMENTS_CREATE" description="COM_COMPONENTBUILDER_HELP_DOCUMENTS_CREATE_DESC" />
|
||||
@ -303,6 +305,8 @@
|
||||
<action name="site_view.export" title="COM_COMPONENTBUILDER_SITE_VIEWS_EXPORT" description="COM_COMPONENTBUILDER_SITE_VIEWS_EXPORT_DESC" />
|
||||
<action name="site_view.import" title="COM_COMPONENTBUILDER_SITE_VIEWS_IMPORT" description="COM_COMPONENTBUILDER_SITE_VIEWS_IMPORT_DESC" />
|
||||
<action name="site_view.submenu" title="COM_COMPONENTBUILDER_SITE_VIEWS_SUBMENU" description="COM_COMPONENTBUILDER_SITE_VIEWS_SUBMENU_DESC" />
|
||||
<action name="snippet.get_snippets" title="COM_COMPONENTBUILDER_SNIPPET_GET_SNIPPETS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_SNIPPET_GET_SNIPPETS_BUTTON_ACCESS_DESC" />
|
||||
<action name="snippet.share_snippets" title="COM_COMPONENTBUILDER_SNIPPET_SHARE_SNIPPETS_BUTTON_ACCESS" description="COM_COMPONENTBUILDER_SNIPPET_SHARE_SNIPPETS_BUTTON_ACCESS_DESC" />
|
||||
<action name="snippet_type.access" title="COM_COMPONENTBUILDER_SNIPPET_TYPES_ACCESS" description="COM_COMPONENTBUILDER_SNIPPET_TYPES_ACCESS_DESC" />
|
||||
<action name="snippet_type.batch" title="COM_COMPONENTBUILDER_SNIPPET_TYPES_BATCH_USE" description="COM_COMPONENTBUILDER_SNIPPET_TYPES_BATCH_USE_DESC" />
|
||||
<action name="snippet_type.create" title="COM_COMPONENTBUILDER_SNIPPET_TYPES_CREATE" description="COM_COMPONENTBUILDER_SNIPPET_TYPES_CREATE_DESC" />
|
||||
|
27
admin/assets/css/get_snippets.css
Normal file
27
admin/assets/css/get_snippets.css
Normal file
@ -0,0 +1,27 @@
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.6.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage get_snippets.css
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* CSS Document */
|
||||
|
||||
|
@ -83,6 +83,57 @@
|
||||
label="COM_COMPONENTBUILDER_CONFIG_API_LABEL"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_API_DESCRIPTION"
|
||||
/>
|
||||
<!-- Set_browser_storage Field. Type: Radio. (joomla) -->
|
||||
<field
|
||||
type="radio"
|
||||
name="set_browser_storage"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_SET_BROWSER_STORAGE_LABEL"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_SET_BROWSER_STORAGE_DESCRIPTION"
|
||||
class="btn-group btn-group-yesno"
|
||||
default="1"
|
||||
required="true">
|
||||
<!-- Option Set. -->
|
||||
<option value="1">
|
||||
COM_COMPONENTBUILDER_CONFIG_ACTIVE</option>
|
||||
<option value="0">
|
||||
COM_COMPONENTBUILDER_CONFIG_INACTIVE</option>
|
||||
</field>
|
||||
<!-- Storage_time_to_live Field. Type: List. (joomla) -->
|
||||
<field
|
||||
type="list"
|
||||
name="storage_time_to_live"
|
||||
label="COM_COMPONENTBUILDER_CONFIG_STORAGE_TIME_TO_LIVE_LABEL"
|
||||
description="COM_COMPONENTBUILDER_CONFIG_STORAGE_TIME_TO_LIVE_DESCRIPTION"
|
||||
class="list_class"
|
||||
multiple="false"
|
||||
default="global"
|
||||
showon="set_browser_storage:1">
|
||||
<!-- Option Set. -->
|
||||
<option value="global">
|
||||
COM_COMPONENTBUILDER_CONFIG_EVERY_SESSION</option>
|
||||
<option value="30">
|
||||
COM_COMPONENTBUILDER_CONFIG_EVERY_THIRTY_SECONDS</option>
|
||||
<option value="60">
|
||||
COM_COMPONENTBUILDER_CONFIG_EVERY_MINUTE</option>
|
||||
<option value="300">
|
||||
COM_COMPONENTBUILDER_CONFIG_EVERY_FIVE_MINUTES</option>
|
||||
<option value="900">
|
||||
COM_COMPONENTBUILDER_CONFIG_EVERY_FIFTEEN_MINUTES</option>
|
||||
<option value="1800">
|
||||
COM_COMPONENTBUILDER_CONFIG_EVERY_THIRTY_MINUTES</option>
|
||||
<option value="3600">
|
||||
COM_COMPONENTBUILDER_CONFIG_EVERY_HOUR</option>
|
||||
<option value="18000">
|
||||
COM_COMPONENTBUILDER_CONFIG_EVERY_FIVE_HOURS</option>
|
||||
<option value="36000">
|
||||
COM_COMPONENTBUILDER_CONFIG_EVERY_TEN_HOURS</option>
|
||||
<option value="86400">
|
||||
COM_COMPONENTBUILDER_CONFIG_EVERY_DAY</option>
|
||||
<option value="604800">
|
||||
COM_COMPONENTBUILDER_CONFIG_EVERY_WEEK</option>
|
||||
<option value="0">
|
||||
COM_COMPONENTBUILDER_CONFIG_NEVER_UPDATE</option>
|
||||
</field>
|
||||
<!-- Spacer_hr_b Field. Type: Spacer. A None Database Field. (joomla) -->
|
||||
<field type="spacer" name="spacer_hr_b" hr="true" class="spacer_hr_b" />
|
||||
<field name="autorTitle"
|
||||
|
63
admin/controllers/get_snippets.php
Normal file
63
admin/controllers/get_snippets.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.6.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage get_snippets.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla controlleradmin library
|
||||
jimport('joomla.application.component.controlleradmin');
|
||||
|
||||
/**
|
||||
* Get_snippets Controller
|
||||
*/
|
||||
class ComponentbuilderControllerGet_snippets extends JControllerAdmin
|
||||
{
|
||||
protected $text_prefix = 'COM_COMPONENTBUILDER_GET_SNIPPETS';
|
||||
/**
|
||||
* Proxy for getModel.
|
||||
* @since 2.5
|
||||
*/
|
||||
public function getModel($name = 'Get_snippets', $prefix = 'ComponentbuilderModel', $config = array())
|
||||
{
|
||||
$model = parent::getModel($name, $prefix, array('ignore_request' => true));
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
public function dashboard()
|
||||
{
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder', false));
|
||||
return;
|
||||
}
|
||||
|
||||
public function openSnippets()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||
// redirect to the snippets admin view
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=snippets', false));
|
||||
return;
|
||||
}
|
||||
}
|
@ -114,8 +114,8 @@ class ComponentbuilderControllerJoomla_components extends JControllerAdmin
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||
// check if import is allowed for this user.
|
||||
$model->user = JFactory::getUser();
|
||||
if ($model->user->authorise('joomla_component.import', 'com_componentbuilder') && $model->user->authorise('core.import', 'com_componentbuilder'))
|
||||
$user = JFactory::getUser();
|
||||
if ($user->authorise('joomla_component.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder'))
|
||||
{
|
||||
$session = JFactory::getSession();
|
||||
$session->set('backto_VDM_IMPORT', 'joomla_components');
|
||||
|
@ -108,4 +108,53 @@ class ComponentbuilderControllerSnippets extends JControllerAdmin
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=snippets', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
public function getSnippets()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||
// redirect to the import snippets custom admin view
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=get_snippets', false));
|
||||
return;
|
||||
}
|
||||
|
||||
public function shareSnippets()
|
||||
{
|
||||
// Check for request forgeries
|
||||
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
|
||||
// Get the model
|
||||
$model = $this->getModel('snippets');
|
||||
// check if import is allowed for this user.
|
||||
$model->user = JFactory::getUser();
|
||||
if ($model->user->authorise('snippet.import', 'com_componentbuilder') && $model->user->authorise('core.export', 'com_componentbuilder'))
|
||||
{
|
||||
// Get the input
|
||||
$input = JFactory::getApplication()->input;
|
||||
$pks = $input->post->get('cid', array(), 'array');
|
||||
// Sanitize the input
|
||||
JArrayHelper::toInteger($pks);
|
||||
// check if there is any selections
|
||||
if (!ComponentbuilderHelper::checkArray($pks))
|
||||
{
|
||||
// Redirect to the list screen with error.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_NO_SNIPPETS_WERE_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=snippets', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
// set auto loader
|
||||
ComponentbuilderHelper::autoLoader('smart');
|
||||
// get the data to export
|
||||
if ($model->shareSnippets($pks))
|
||||
{
|
||||
// Redirect to the list screen with success
|
||||
$message = JText::_('COM_COMPONENTBUILDER_SNIPPETS_HAVE_BEEN_EXPORTED_AND_ZIPPED_READY_TO_SHARE_PLEASE_WATCH_THE_FOLLOWING_A_HREF_TARGET_BLANKVIDEO_TUTORIALA_THAT_SHOWS_YOU_HOW_TO_SHARE_THESE_SNIPPETS_WITH_THE_REST_OF_THE_JCB_COMMUNITY');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=snippets', false), $message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Redirect to the list screen with error.
|
||||
$message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_SHARE_THE_SNIPPETS_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP');
|
||||
$this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=snippets', false), $message, 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ class Compiler extends Infusion
|
||||
$this->removeFolder($this->componentPath . '/site');
|
||||
// clear form component xml
|
||||
$xmlPath = $this->componentPath . '/'. $this->fileContentStatic['###component###']. '.xml';
|
||||
$componentXML = file_get_contents($xmlPath);
|
||||
$componentXML = ComponentbuilderHelper::getFileContents($xmlPath);
|
||||
$textToSite = ComponentbuilderHelper::getBetween($componentXML,'<files folder="site">','</files>');
|
||||
$textToSiteLang = ComponentbuilderHelper::getBetween($componentXML,'<languages folder="site">','</languages>');
|
||||
$componentXML = str_replace(array('<files folder="site">'.$textToSite."</files>", '<languages folder="site">'.$textToSiteLang."</languages>"), array('',''), $componentXML);
|
||||
@ -183,7 +183,7 @@ class Compiler extends Infusion
|
||||
if (isset($this->newFiles['static']) && ComponentbuilderHelper::checkArray($this->newFiles['static']) && isset($this->newFiles['dynamic']) && ComponentbuilderHelper::checkArray($this->newFiles['dynamic']))
|
||||
{
|
||||
// get the bom file
|
||||
$bom = file_get_contents($this->bomPath);
|
||||
$bom = ComponentbuilderHelper::getFileContents($this->bomPath);
|
||||
// first we do the static files
|
||||
foreach ($this->newFiles['static'] as $static)
|
||||
{
|
||||
@ -195,7 +195,7 @@ class Compiler extends Infusion
|
||||
{
|
||||
$php = "<?php\n";
|
||||
}
|
||||
$string = file_get_contents($static['path']);
|
||||
$string = ComponentbuilderHelper::getFileContents($static['path']);
|
||||
if (strpos($string,'###BOM###') !== false)
|
||||
{
|
||||
list($wast,$code) = explode('###BOM###',$string);
|
||||
@ -232,7 +232,7 @@ class Compiler extends Infusion
|
||||
{
|
||||
$php = "<?php\n";
|
||||
}
|
||||
$string = file_get_contents($file['path']);
|
||||
$string = ComponentbuilderHelper::getFileContents($file['path']);
|
||||
if (strpos($string,'###BOM###') !== false)
|
||||
{
|
||||
list($bin,$code) = explode('###BOM###',$string);
|
||||
@ -385,7 +385,7 @@ class Compiler extends Infusion
|
||||
$this->buildReadMeData();
|
||||
}
|
||||
// get the file
|
||||
$string = file_get_contents($path);
|
||||
$string = ComponentbuilderHelper::getFileContents($path);
|
||||
// update the file
|
||||
$answer = $this->setPlaceholders($string, $this->fileContentStatic);
|
||||
// add to zip array
|
||||
|
@ -2881,6 +2881,7 @@ class Get
|
||||
}
|
||||
$gets = array();
|
||||
$keys = array();
|
||||
// first load all options
|
||||
foreach ($lines as $line)
|
||||
{
|
||||
if (strpos($line,'AS') !== false)
|
||||
@ -2896,13 +2897,16 @@ class Get
|
||||
$get = $line;
|
||||
$key = null;
|
||||
}
|
||||
// set the get and key
|
||||
$get = trim($get);
|
||||
$key = trim($key);
|
||||
// only add the view
|
||||
if ('a' != $as && 1 == $row_type && 'view' === $type && strpos('#'.$key,'#'.$view.'_') === false)
|
||||
// only add the view (we must adapt this)
|
||||
if (isset($this->getAsLookup[$method_key][$get]) && 'a' != $as && 1 == $row_type && 'view' === $type && strpos('#'.$key,'#'.$view.'_') === false)
|
||||
{
|
||||
// this is a problem (TODO) since we may want to not add the view name.
|
||||
$key = $view.'_'.trim($key);
|
||||
}
|
||||
// continue only if we have get
|
||||
if (ComponentbuilderHelper::checkString($get))
|
||||
{
|
||||
$gets[] = $this->db->quote($get);
|
||||
|
@ -910,7 +910,7 @@ class Structure extends Get
|
||||
private function setJoomlaVersionData()
|
||||
{
|
||||
// set the version data
|
||||
$versionData = json_decode(file_get_contents($this->templatePath.'/settings.json'));
|
||||
$versionData = json_decode(ComponentbuilderHelper::getFileContents($this->templatePath.'/settings.json'));
|
||||
// add custom folders
|
||||
if ((isset($this->componentData->folders) && ComponentbuilderHelper::checkArray($this->componentData->folders)) || $this->addEximport || $this->uikit || $this->footable)
|
||||
{
|
||||
|
@ -3742,7 +3742,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
if (JFile::exists($file['path']))
|
||||
{
|
||||
$string = file_get_contents($file['path']);
|
||||
$string = ComponentbuilderHelper::getFileContents($file['path']);
|
||||
$buket['static'][] = $this->getInbetweenStrings($string);
|
||||
}
|
||||
}
|
||||
@ -3754,7 +3754,7 @@ class Interpretation extends Fields
|
||||
{
|
||||
if (JFile::exists($doc['path']))
|
||||
{
|
||||
$string = file_get_contents($doc['path']);
|
||||
$string = ComponentbuilderHelper::getFileContents($doc['path']);
|
||||
$buket[$view][] = $this->getInbetweenStrings($string);
|
||||
}
|
||||
}
|
||||
|
@ -1305,7 +1305,7 @@ class Infusion extends Interpretation
|
||||
// build xml path
|
||||
$xmlPath = $this->componentPath . '/'. $this->fileContentStatic['###component###']. '.xml';
|
||||
// get the content in xml
|
||||
$componentXML = file_get_contents($xmlPath);
|
||||
$componentXML = ComponentbuilderHelper::getFileContents($xmlPath);
|
||||
// update the xml content
|
||||
$componentXML = $this->setPlaceholders($componentXML, $replace);
|
||||
// store the values back to xml
|
||||
|
@ -250,7 +250,7 @@ abstract class ComponentbuilderHelper
|
||||
**/
|
||||
protected static $params = false;
|
||||
|
||||
/*
|
||||
/**
|
||||
* get all component IDs
|
||||
*/
|
||||
public static function getComponentIDs()
|
||||
@ -271,7 +271,7 @@ abstract class ComponentbuilderHelper
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Autoloader
|
||||
*/
|
||||
public static function autoLoader($type = 'compiler')
|
||||
@ -1398,7 +1398,7 @@ abstract class ComponentbuilderHelper
|
||||
// first get the file path
|
||||
$path_filename = self::getFilePath('path', $name.$type, $fileType, $key, JPATH_COMPONENT_ADMINISTRATOR);
|
||||
// set as read if not already set
|
||||
if (($content = @file_get_contents($path_filename)) !== FALSE)
|
||||
if ($content = self::getFileContents($path_filename, false))
|
||||
{
|
||||
if ($hash == $content)
|
||||
{
|
||||
@ -1481,6 +1481,93 @@ abstract class ComponentbuilderHelper
|
||||
return '/' . trim( $filePath, '/' ) . '/' . $fileName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the file path or url
|
||||
*
|
||||
* @param string $type The (url/path) type to return
|
||||
* @param string $target The Params Target name (if set)
|
||||
* @param string $default The default path if not set in Params (fallback path)
|
||||
* @param bool $createIfNotSet The switch to create the folder if not found
|
||||
*
|
||||
* @return string On success the path or url is returned based on the type requested
|
||||
*
|
||||
*/
|
||||
public static function getFolderPath($type = 'path', $target = 'folderpath', $default = JPATH_SITE . '/images/', $createIfNotSet = true)
|
||||
{
|
||||
// get the global settings
|
||||
if (!self::checkObject(self::$params))
|
||||
{
|
||||
self::$params = JComponentHelper::getParams('com_componentbuilder');
|
||||
}
|
||||
$folderPath = self::$params->get($target, $default);
|
||||
jimport('joomla.filesystem.folder');
|
||||
// create the folder if it does not exist
|
||||
if ($createIfNotSet && !JFolder::exists($folderPath))
|
||||
{
|
||||
JFolder::create($folderPath);
|
||||
}
|
||||
// return the url
|
||||
if ('url' === $type)
|
||||
{
|
||||
if (strpos($folderPath, JPATH_SITE) !== false)
|
||||
{
|
||||
$folderPath = trim( str_replace( JPATH_SITE, '', $folderPath), '/');
|
||||
return JURI::root() . $folderPath . '/';
|
||||
}
|
||||
// since the path is behind the root folder of the site, return only the root url (may be used to build the link)
|
||||
return JURI::root();
|
||||
}
|
||||
// sanitize the path
|
||||
return '/' . trim( $folderPath, '/' ) . '/';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get the content of a file
|
||||
*
|
||||
* @param string $path The path to the file
|
||||
* @param string/bool $none The return value if no content was found
|
||||
*
|
||||
* @return string On success
|
||||
*
|
||||
*/
|
||||
public static function getFileContents($path, $none = '')
|
||||
{
|
||||
if (self::checkString($path))
|
||||
{
|
||||
// use basic file get content for now
|
||||
if (($content = @file_get_contents($path)) !== FALSE)
|
||||
{
|
||||
return $content;
|
||||
}
|
||||
// use curl if available
|
||||
elseif (function_exists('curl_version'))
|
||||
{
|
||||
// start curl
|
||||
$ch = curl_init();
|
||||
// set the options
|
||||
$options = array();
|
||||
$options[CURLOPT_URL] = $path;
|
||||
$options[CURLOPT_USERAGENT] = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12';
|
||||
$options[CURLOPT_RETURNTRANSFER] = TRUE;
|
||||
$options[CURLOPT_SSL_VERIFYPEER] = FALSE;
|
||||
// load the options
|
||||
curl_setopt_array($ch, $options);
|
||||
// get the content
|
||||
$content = curl_exec($ch);
|
||||
// close the connection
|
||||
curl_close($ch);
|
||||
// return if found
|
||||
if (self::checkString($content))
|
||||
{
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $none;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the Component xml manifest.
|
||||
**/
|
||||
|
@ -855,13 +855,16 @@ COM_COMPONENTBUILDER_ADMIN_VIEW_YES="Yes"
|
||||
COM_COMPONENTBUILDER_ADMIN_VIEW_YOUTUBE="Youtube"
|
||||
COM_COMPONENTBUILDER_ADMIN_VIEW_ZOOM_IN="Zoom In"
|
||||
COM_COMPONENTBUILDER_ADMIN_VIEW_ZOOM_OUT="Zoom Out"
|
||||
COM_COMPONENTBUILDER_AHEAD="Ahead"
|
||||
COM_COMPONENTBUILDER_ALIAS="Alias"
|
||||
COM_COMPONENTBUILDER_ALIGNMENT="Alignment"
|
||||
COM_COMPONENTBUILDER_ALL="All"
|
||||
COM_COMPONENTBUILDER_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER="All is good, please check again latter."
|
||||
COM_COMPONENTBUILDER_ALL_IS_GOOD_THERE_IN_NO_NOTICE_AT_THIS_TIME="All is good, there in no notice at this time."
|
||||
COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE="All unsaved work on this page will be lost, are you sure you want to continue?"
|
||||
COM_COMPONENTBUILDER_ALWAYS_INSURE_THAT_YOU_HAVE_YOUR_LOCAL_COMPONENTS_BACKED_UP_BY_MAKING_AN_EXPORT_OF_ALL_YOUR_LOCAL_COMPONENTS_BEFORE_IMPORTING_ANY_NEW_COMPONENTS_SMALLMAKE_BSUREB_TO_MOVE_THIS_ZIPPED_BACKUP_PACKAGE_OUT_OF_THE_TMP_FOLDER_BEFORE_DOING_AN_IMPORTSMALLBR_IF_YOU_ARE_IMPORTING_A_PACKAGE_OF_A_THREERD_PARTY_JCB_PACKAGE_DEVELOPER_BMAKE_SURE_IT_IS_A_REPUTABLE_JCB_PACKAGE_DEVELOPERSB="Always insure that you have your local components backed up, by making an export of all your local components before importing any new components. <small>(Make <b>SURE</b> to move this zipped backup package out of the tmp folder before doing an import)</small><br />If you are importing a package of a 3rd party JCB package developer, <b>make sure it is a reputable JCB package developers!</b>"
|
||||
COM_COMPONENTBUILDER_ANY_SELECTION_ONLY_FOUR_LISTRADIOCHECKBOXESDYNAMIC_LIST="Any Selection (only 4 list/radio/checkboxes/dynamic_list)"
|
||||
COM_COMPONENTBUILDER_AN_ERROR_HAS_OCCURRED="An error has occurred"
|
||||
COM_COMPONENTBUILDER_ARCHIVED="Archived"
|
||||
COM_COMPONENTBUILDER_AUTHOR="Author"
|
||||
COM_COMPONENTBUILDER_AUTO_CHECKIN="Auto Check-in"
|
||||
@ -2083,6 +2086,7 @@ COM_COMPONENTBUILDER_COMPONENT_UPDATES_VERSION_MESSAGE="Error! Please add some t
|
||||
COM_COMPONENTBUILDER_COMPONENT_UPDATES_VERSION_UPDATE="Version Update"
|
||||
COM_COMPONENTBUILDER_COMPONENT_UPDATES_VERSION_UPDATE_DESCRIPTION="Add Version Updates Here!"
|
||||
COM_COMPONENTBUILDER_COMPONENT_UPDATES_VERSION_UPDATE_LABEL="Version Updates"
|
||||
COM_COMPONENTBUILDER_CONFIG_ACTIVE="Active"
|
||||
COM_COMPONENTBUILDER_CONFIG_ALMOST_FLAT_LOAD="Almost Flat"
|
||||
COM_COMPONENTBUILDER_CONFIG_API_DESCRIPTION="This User will be used to log the API call."
|
||||
COM_COMPONENTBUILDER_CONFIG_API_LABEL="API User"
|
||||
@ -2216,6 +2220,17 @@ COM_COMPONENTBUILDER_CONFIG_EMAILREPLY_HINT="Email Address Here"
|
||||
COM_COMPONENTBUILDER_CONFIG_EMAILREPLY_LABEL=" Reply to Email"
|
||||
COM_COMPONENTBUILDER_CONFIG_ENCRYPTION_DESC="The encryption key for the field encryption is set here."
|
||||
COM_COMPONENTBUILDER_CONFIG_ENCRYPTION_LABEL="Encryption Settings"
|
||||
COM_COMPONENTBUILDER_CONFIG_EVERY_DAY="Every Day"
|
||||
COM_COMPONENTBUILDER_CONFIG_EVERY_FIFTEEN_MINUTES="Every 15 Minutes"
|
||||
COM_COMPONENTBUILDER_CONFIG_EVERY_FIVE_HOURS="Every 5 Hours"
|
||||
COM_COMPONENTBUILDER_CONFIG_EVERY_FIVE_MINUTES="Every 5 Minutes"
|
||||
COM_COMPONENTBUILDER_CONFIG_EVERY_HOUR="Every Hour"
|
||||
COM_COMPONENTBUILDER_CONFIG_EVERY_MINUTE="Every Minute"
|
||||
COM_COMPONENTBUILDER_CONFIG_EVERY_SESSION="Every Session"
|
||||
COM_COMPONENTBUILDER_CONFIG_EVERY_TEN_HOURS="Every 10 Hours"
|
||||
COM_COMPONENTBUILDER_CONFIG_EVERY_THIRTY_MINUTES="Every 30 Minutes"
|
||||
COM_COMPONENTBUILDER_CONFIG_EVERY_THIRTY_SECONDS="Every 30 Seconds"
|
||||
COM_COMPONENTBUILDER_CONFIG_EVERY_WEEK="Every Week"
|
||||
COM_COMPONENTBUILDER_CONFIG_EXPORT_BUY_LINK_DESCRIPTION="Enter link where your JCB package key can be bought."
|
||||
COM_COMPONENTBUILDER_CONFIG_EXPORT_BUY_LINK_HINT="http://www.example.com/buy-keys"
|
||||
COM_COMPONENTBUILDER_CONFIG_EXPORT_BUY_LINK_LABEL="Buy Link<br /><small>(to get key)</small>"
|
||||
@ -2256,6 +2271,7 @@ COM_COMPONENTBUILDER_CONFIG_GLOBAL="Global"
|
||||
COM_COMPONENTBUILDER_CONFIG_GLOBAL_DESC="The Global Parameters"
|
||||
COM_COMPONENTBUILDER_CONFIG_GLOBAL_LABEL="Global"
|
||||
COM_COMPONENTBUILDER_CONFIG_GRADIANT_LOAD="Gradient"
|
||||
COM_COMPONENTBUILDER_CONFIG_INACTIVE="Inactive"
|
||||
COM_COMPONENTBUILDER_CONFIG_MAILER_DESCRIPTION="Select what mailer you would like to use to send emails."
|
||||
COM_COMPONENTBUILDER_CONFIG_MAILER_LABEL="Mailer"
|
||||
COM_COMPONENTBUILDER_CONFIG_MAILONLINE_DESCRIPTION="Warning this will stop all emails from going out."
|
||||
@ -2263,6 +2279,7 @@ COM_COMPONENTBUILDER_CONFIG_MAILONLINE_LABEL="Mailer Status"
|
||||
COM_COMPONENTBUILDER_CONFIG_MAIL_CONFIGURATION="Mail Configuration"
|
||||
COM_COMPONENTBUILDER_CONFIG_MINIFY_DESCRIPTION="Should the JavaScript be minified when compiled."
|
||||
COM_COMPONENTBUILDER_CONFIG_MINIFY_LABEL="Minify JS"
|
||||
COM_COMPONENTBUILDER_CONFIG_NEVER_UPDATE="Never update"
|
||||
COM_COMPONENTBUILDER_CONFIG_NO="No"
|
||||
COM_COMPONENTBUILDER_CONFIG_NONE="None"
|
||||
COM_COMPONENTBUILDER_CONFIG_NOTE_BACKUP_FOLDER_PATH_DESCRIPTION="You components will be placed as zip files inside this folder."
|
||||
@ -2316,6 +2333,8 @@ COM_COMPONENTBUILDER_CONFIG_SENDMAIL="Sendmail"
|
||||
COM_COMPONENTBUILDER_CONFIG_SENDMAIL_DESCRIPTION="Enter the path to the sendmail program directory on your host server."
|
||||
COM_COMPONENTBUILDER_CONFIG_SENDMAIL_HINT="/usr/sbin/sendmail"
|
||||
COM_COMPONENTBUILDER_CONFIG_SENDMAIL_LABEL="Sendmail Path"
|
||||
COM_COMPONENTBUILDER_CONFIG_SET_BROWSER_STORAGE_DESCRIPTION="Select if browser storage should be used to save on Ajax calls and speed up this components site pages."
|
||||
COM_COMPONENTBUILDER_CONFIG_SET_BROWSER_STORAGE_LABEL="Browser Storage"
|
||||
COM_COMPONENTBUILDER_CONFIG_SMTP="SMTP"
|
||||
COM_COMPONENTBUILDER_CONFIG_SMTPAUTH_DESCRIPTION="Select yes if your SMTP host requires SMTP Authentication."
|
||||
COM_COMPONENTBUILDER_CONFIG_SMTPAUTH_LABEL="SMTP Authentication"
|
||||
@ -2333,6 +2352,8 @@ COM_COMPONENTBUILDER_CONFIG_SMTPUSER_DESCRIPTION="Enter the username for access
|
||||
COM_COMPONENTBUILDER_CONFIG_SMTPUSER_HINT="email@demo.com"
|
||||
COM_COMPONENTBUILDER_CONFIG_SMTPUSER_LABEL="SMTP Username"
|
||||
COM_COMPONENTBUILDER_CONFIG_SSL="SSL"
|
||||
COM_COMPONENTBUILDER_CONFIG_STORAGE_TIME_TO_LIVE_DESCRIPTION="How long should the data that is stored in the browser memory remain unchanged before it is removed and updated."
|
||||
COM_COMPONENTBUILDER_CONFIG_STORAGE_TIME_TO_LIVE_LABEL="Update Cycle"
|
||||
COM_COMPONENTBUILDER_CONFIG_TLS="TLS"
|
||||
COM_COMPONENTBUILDER_CONFIG_UIKIT_DESC="<b>The Parameters for the uikit are set here.</b><br />Uikit is a lightweight and modular front-end framework
|
||||
for developing fast and powerful web interfaces. For more info visit <a href="https://getuikit.com/v2/" target="_blank">https://getuikit.com/v2/</a>"
|
||||
@ -3013,6 +3034,7 @@ COM_COMPONENTBUILDER_DATE="Date"
|
||||
COM_COMPONENTBUILDER_DEBUG_LINE_NUMBERS="Debug (line numbers)"
|
||||
COM_COMPONENTBUILDER_DEFAULT_VIEW="Default View"
|
||||
COM_COMPONENTBUILDER_DETAILS="Details"
|
||||
COM_COMPONENTBUILDER_DIVERGED="Diverged"
|
||||
COM_COMPONENTBUILDER_DOES_THIS_PACKAGE_REQUIRE_A_KEY_TO_INSTALL="Does this package require a key to install"
|
||||
COM_COMPONENTBUILDER_DOWNLOAD="download"
|
||||
COM_COMPONENTBUILDER_DYNAMIC_GET="Dynamic Get"
|
||||
@ -3739,6 +3761,12 @@ COM_COMPONENTBUILDER_FTP_STATUS="Status"
|
||||
COM_COMPONENTBUILDER_FTP_VERSION_DESC="A count of the number of times this FTP has been revised."
|
||||
COM_COMPONENTBUILDER_FTP_VERSION_LABEL="Revision"
|
||||
COM_COMPONENTBUILDER_FULL_WIDTH_IN_TAB="Full Width in Tab"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS="Get Snippets"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_ACCESS="Get Snippets Access"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_ACCESS_DESC=" Allows the users in this group to access get snippets."
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_DESC="The compiler"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_SNIPPETS_BUTTON_ACCESS="Get Snippets Snippets Button Access"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_SNIPPETS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the snippets button."
|
||||
COM_COMPONENTBUILDER_GET_THE_KEY_FROM_BSB_FOR_A_CLASSBTN_BTNPRIMARY_HREFS_TARGET_BLANK_TITLEGET_A_KEY_FROM_SSA="Get the key from <b>%s</b> for <a class="btn btn-primary" href="%s" target="_blank" title="get a key from %s">%s</a>"
|
||||
COM_COMPONENTBUILDER_GLOBAL="Global"
|
||||
COM_COMPONENTBUILDER_GREAT_THIS_FUNCTION_NAME_WILL_WORK="Great, this function name will work!"
|
||||
@ -3912,6 +3940,7 @@ COM_COMPONENTBUILDER_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE="Package to import not
|
||||
COM_COMPONENTBUILDER_IMPORT_UPDATE_DATA="Import Data"
|
||||
COM_COMPONENTBUILDER_IMPORT_UPLOAD_BOTTON="Upload File"
|
||||
COM_COMPONENTBUILDER_INACTIVE="Inactive"
|
||||
COM_COMPONENTBUILDER_IN_SYNC="In Sync"
|
||||
COM_COMPONENTBUILDER_ISOLATE="Isolate"
|
||||
COM_COMPONENTBUILDER_ISSUE="issue"
|
||||
COM_COMPONENTBUILDER_IS_NOT_ONLY_FOUR_LISTRADIOCHECKBOXES="Is Not (only 4 list/radio/checkboxes)"
|
||||
@ -3979,6 +4008,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADDUIKIT_DESCRIPTION="Select the version o
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADDUIKIT_LABEL="Add Uikit"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_ADMIN_EVENT="Add Admin Event"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_ADMIN_EVENT_LABEL="Add Global Admin Event"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_BOTH_VTWO_AMP_VTHREE="Add Both v2 & v3"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_CSS="Add Css"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_CSS_LABEL="Add CSS"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_EMAIL_HELPER="Add Email Helper"
|
||||
@ -4014,6 +4044,8 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_SITE_EVENT="Add Site Event"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_SITE_EVENT_LABEL="Add Global Site Event"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_SQL="Add Sql"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_SQL_LABEL="Add MySQL (to view table)"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_UIKIT_VTHREE="Add Uikit v3"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_UIKIT_VTWO="Add Uikit v2"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_UPDATE_SERVER="Add Update Server"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_UPDATE_SERVER_LABEL="Add Update Server"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADMIN_VIEWS="Admin Views"
|
||||
@ -4072,6 +4104,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DESCRIPTION_DESCRIPTION="Add Description H
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DESCRIPTION_HINT="Add Description Here"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DESCRIPTION_LABEL="Description"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DETAILS="Details"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DO_NOT_ADD="Do not add"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DYNAMIC_BUILD_BETA="Dynamic Build (beta)"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DYNAMIC_INTEGRATION="Dynamic Integration"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EDIT="Editing the Joomla Component"
|
||||
@ -4341,8 +4374,8 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_USE_ONLY_FIRST_TWO_NUMBER_OF_GLOBAL_VERSIO
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_USE_VIEW_VERSION_DATE="Use View Version & Date"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_VERSION_DESC="A count of the number of times this Joomla Component has been revised."
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_VERSION_LABEL="Revision"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_VTHREE="v3"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_VTWO="v2"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_VTHREE="V3"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_VTWO="V2"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WEBSITE="Website"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WEBSITE_DESCRIPTION="Enter website address"
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WEBSITE_HINT="http://www.example.com"
|
||||
@ -4668,10 +4701,12 @@ COM_COMPONENTBUILDER_LIBRARIES_N_ITEMS_UNFEATURED_1="%s Library unfeatured."
|
||||
COM_COMPONENTBUILDER_LIBRARIES_N_ITEMS_UNPUBLISHED="%s Libraries unpublished."
|
||||
COM_COMPONENTBUILDER_LIBRARIES_N_ITEMS_UNPUBLISHED_1="%s Library unpublished."
|
||||
COM_COMPONENTBUILDER_LIBRARY="Library"
|
||||
COM_COMPONENTBUILDER_LIBRARY_ASC="Library (Asc)"
|
||||
COM_COMPONENTBUILDER_LIBRARY_CREATED_BY_DESC="The user that created this Library."
|
||||
COM_COMPONENTBUILDER_LIBRARY_CREATED_BY_LABEL="Created By"
|
||||
COM_COMPONENTBUILDER_LIBRARY_CREATED_DATE_DESC="The date this Library was created."
|
||||
COM_COMPONENTBUILDER_LIBRARY_CREATED_DATE_LABEL="Created Date"
|
||||
COM_COMPONENTBUILDER_LIBRARY_DESC="Library (Desc)"
|
||||
COM_COMPONENTBUILDER_LIBRARY_DESCRIPTION="Description"
|
||||
COM_COMPONENTBUILDER_LIBRARY_DESCRIPTION_DESCRIPTION="Enter some description"
|
||||
COM_COMPONENTBUILDER_LIBRARY_DESCRIPTION_HINT="Description Here"
|
||||
@ -4707,6 +4742,8 @@ COM_COMPONENTBUILDER_MATCH_FIELD="Match Field"
|
||||
COM_COMPONENTBUILDER_MATCH_OPTIONS="Match Options"
|
||||
COM_COMPONENTBUILDER_MAX_LENGTH_ONLY_FOUR_TEXT_FIELD="Max Length (only 4 text_field)"
|
||||
COM_COMPONENTBUILDER_MIN_LENGTH_ONLY_FOUR_TEXT_FIELD="Min Length (only 4 text_field)"
|
||||
COM_COMPONENTBUILDER_NAME_ASC="Name (Asc)"
|
||||
COM_COMPONENTBUILDER_NAME_DESC="Name (Desc)"
|
||||
COM_COMPONENTBUILDER_NEW="New"
|
||||
COM_COMPONENTBUILDER_NEW_ISSUE="New Issue"
|
||||
COM_COMPONENTBUILDER_NEW_NOTICE="New Notice"
|
||||
@ -4720,6 +4757,7 @@ COM_COMPONENTBUILDER_NO_CRONJOB_PATH_FOUND_FOR_S="No cronjob path found for (%s)
|
||||
COM_COMPONENTBUILDER_NO_CRONJOB_PATH_FOUND_SINCE_INCORRECT_TYPE_REQUESTED="No cronjob path found since incorrect type requested."
|
||||
COM_COMPONENTBUILDER_NO_ITEM_FOUND="No Item Found"
|
||||
COM_COMPONENTBUILDER_NO_KEYS_WERE_FOUND_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY="No keys were found. To add an export key simply open the component, go to the tab called settings, bottom right there is a field called Export Key."
|
||||
COM_COMPONENTBUILDER_NO_SNIPPETS_WERE_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN="No snippets were selected, please make a selection and try again!"
|
||||
COM_COMPONENTBUILDER_NO_S_FOUND="No %s Found"
|
||||
COM_COMPONENTBUILDER_NO_S_HAVE_BEEN_LINKED_TO_THIS_VIEW_SOON_AS_THIS_IS_DONE_IT_WILL_BE_DISPLAYED_HERE="No %s have been linked to this view. Soon as this is done it will be displayed here."
|
||||
COM_COMPONENTBUILDER_ON_GITHUB="on Github"
|
||||
@ -4730,7 +4768,7 @@ COM_COMPONENTBUILDER_OPEN_ON_GITHUB="Open on Github"
|
||||
COM_COMPONENTBUILDER_ORDER_BEFORE="Order Before"
|
||||
COM_COMPONENTBUILDER_ORDER_IN_EDIT="Order in Edit"
|
||||
COM_COMPONENTBUILDER_ORDER_IN_LIST_VIEWS="Order in list views"
|
||||
COM_COMPONENTBUILDER_OUT_OF_DATE="Out of date"
|
||||
COM_COMPONENTBUILDER_OUT_OF_DATE="Out of Date"
|
||||
COM_COMPONENTBUILDER_OWNER_DETAILS_WAS_SET="Owner details was set"
|
||||
COM_COMPONENTBUILDER_OWNER_S="Owner: %s"
|
||||
COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS="Package Owner Details"
|
||||
@ -4742,6 +4780,7 @@ COM_COMPONENTBUILDER_PLEASE_ADD_FILES_TO_S="Please add files to (%s)"
|
||||
COM_COMPONENTBUILDER_PLEASE_ADD_FOLDERS_TO_S="Please add folders to (%s)"
|
||||
COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_LATTER="Please check again latter."
|
||||
COM_COMPONENTBUILDER_PLEASE_SELECT_A_COMPONENT_THAT_YOU_WOULD_LIKE_TO_COMPILE="Please select a component that you would like to compile."
|
||||
COM_COMPONENTBUILDER_PLEASE_TRY_AGAIN_LATER="Please try again later"
|
||||
COM_COMPONENTBUILDER_PLEASE_WAIT_CLEARING_THE_TMP_FOLDER="Please wait! Clearing the tmp folder"
|
||||
COM_COMPONENTBUILDER_PUBLIC_ACCESS="Public Access"
|
||||
COM_COMPONENTBUILDER_PUBLISHED="Published"
|
||||
@ -4756,6 +4795,7 @@ COM_COMPONENTBUILDER_SAVE_SUCCESS="Great! Item successfully saved."
|
||||
COM_COMPONENTBUILDER_SAVE_WARNING="The value already existed so please select another."
|
||||
COM_COMPONENTBUILDER_SEARCHABLE="Searchable"
|
||||
COM_COMPONENTBUILDER_SELECT_THE_COMPONENT_TO_COMPILE="Select the component to compile"
|
||||
COM_COMPONENTBUILDER_SHARE_SNIPPETS="Share Snippets"
|
||||
COM_COMPONENTBUILDER_SHOULD_JCB_INSERT_THE_CUSTOM_CODE_PLACEHOLDERS_THIS_IS_ONLY_APPLICABLE_IF_THIS_COMPONENT_HAS_CUSTOM_CODE="Should JCB insert the custom code placeholders? This is only applicable if this component has custom code."
|
||||
COM_COMPONENTBUILDER_SHOULD_THE_COMPONENT_BE_MOVED_TO_YOUR_LOCAL_REPOSITORY_FOLDER="Should the component be moved to your local repository folder?"
|
||||
COM_COMPONENTBUILDER_SHOULD_THE_ZIPPED_PACKAGE_OF_THE_COMPONENT_BE_MOVED_TO_THE_LOCAL_BACKUP_AND_REMOTE_SALES_SERVER_THIS_IS_ONLY_APPLICABLE_IF_THIS_COMPONENT_HAS_THOSE_VALUES_SET="Should the zipped package of the component be moved to the local backup and remote sales server? This is only applicable if this component has those values set."
|
||||
@ -5235,6 +5275,7 @@ COM_COMPONENTBUILDER_SNIPPETS_EDIT_VERSION="Snippets Edit Version"
|
||||
COM_COMPONENTBUILDER_SNIPPETS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version snippets"
|
||||
COM_COMPONENTBUILDER_SNIPPETS_EXPORT="Snippets Export"
|
||||
COM_COMPONENTBUILDER_SNIPPETS_EXPORT_DESC="Allows the users in this group to export export snippets"
|
||||
COM_COMPONENTBUILDER_SNIPPETS_HAVE_BEEN_EXPORTED_AND_ZIPPED_READY_TO_SHARE_PLEASE_WATCH_THE_FOLLOWING_A_HREF_TARGET_BLANKVIDEO_TUTORIALA_THAT_SHOWS_YOU_HOW_TO_SHARE_THESE_SNIPPETS_WITH_THE_REST_OF_THE_JCB_COMMUNITY="Snippets have been exported and zipped ready to share! Please watch the following <a href="#" target="_blank">video tutorial</a> that shows you how to share these snippets with the rest of the JCB community."
|
||||
COM_COMPONENTBUILDER_SNIPPETS_IMPORT="Snippets Import"
|
||||
COM_COMPONENTBUILDER_SNIPPETS_IMPORT_DESC="Allows the users in this group to import import snippets"
|
||||
COM_COMPONENTBUILDER_SNIPPETS_N_ITEMS_ARCHIVED="%s Snippets archived."
|
||||
@ -5267,6 +5308,8 @@ COM_COMPONENTBUILDER_SNIPPET_DESCRIPTION_LABEL="Description"
|
||||
COM_COMPONENTBUILDER_SNIPPET_DETAILS="Details"
|
||||
COM_COMPONENTBUILDER_SNIPPET_EDIT="Editing the Snippet"
|
||||
COM_COMPONENTBUILDER_SNIPPET_ERROR_UNIQUE_ALIAS="Another Snippet has the same alias."
|
||||
COM_COMPONENTBUILDER_SNIPPET_GET_SNIPPETS_BUTTON_ACCESS="Snippet Get Snippets Button Access"
|
||||
COM_COMPONENTBUILDER_SNIPPET_GET_SNIPPETS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the get snippets button."
|
||||
COM_COMPONENTBUILDER_SNIPPET_HEADING="Heading"
|
||||
COM_COMPONENTBUILDER_SNIPPET_HEADING_DESCRIPTION="Enter short heading"
|
||||
COM_COMPONENTBUILDER_SNIPPET_HEADING_HINT="Your Heading Here"
|
||||
@ -5290,6 +5333,8 @@ COM_COMPONENTBUILDER_SNIPPET_ORDERING_LABEL="Ordering"
|
||||
COM_COMPONENTBUILDER_SNIPPET_PERMISSION="Permissions"
|
||||
COM_COMPONENTBUILDER_SNIPPET_PUBLISHING="Publishing"
|
||||
COM_COMPONENTBUILDER_SNIPPET_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Snippet to customise the alias."
|
||||
COM_COMPONENTBUILDER_SNIPPET_SHARE_SNIPPETS_BUTTON_ACCESS="Snippet Share Snippets Button Access"
|
||||
COM_COMPONENTBUILDER_SNIPPET_SHARE_SNIPPETS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the share snippets button."
|
||||
COM_COMPONENTBUILDER_SNIPPET_SNIPPET="Snippet"
|
||||
COM_COMPONENTBUILDER_SNIPPET_SNIPPET_HINT="// Add the snippets code here"
|
||||
COM_COMPONENTBUILDER_SNIPPET_SNIPPET_LABEL="Snippet"
|
||||
@ -5522,6 +5567,7 @@ COM_COMPONENTBUILDER_THE_NOTICE_BOARD_IS_LOADING="The notice board is loading"
|
||||
COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_CODESCODE="The package key is: <code>%s</code>"
|
||||
COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_S="The package key is: %s"
|
||||
COM_COMPONENTBUILDER_THE_README_IS_LOADING="The readme is loading"
|
||||
COM_COMPONENTBUILDER_THE_SNIPPETS_IS_LOADING="The snippets is loading"
|
||||
COM_COMPONENTBUILDER_THE_WIKI_IS_LOADING="The wiki is loading"
|
||||
COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY="This package has no key."
|
||||
COM_COMPONENTBUILDER_TITLE="Title"
|
||||
@ -5529,6 +5575,8 @@ COM_COMPONENTBUILDER_TOTAL_DOWNLOADS="total downloads"
|
||||
COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_BJCB_GLOBAL_OPTIONSB_GO_TO_THE_BCOMPANYB_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE="To change the package owner defaults. Open the <b>JCB Global Options</b>, go to the <b>Company</b> tab and add the correct company details there."
|
||||
COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE="To change the package owner defaults. Open the JCB Global Options, go to the Company tab and add the correct company details there."
|
||||
COM_COMPONENTBUILDER_TRASHED="Trashed"
|
||||
COM_COMPONENTBUILDER_TYPE_ASC="Type (Asc)"
|
||||
COM_COMPONENTBUILDER_TYPE_DESC="Type (Desc)"
|
||||
COM_COMPONENTBUILDER_TYPE_ERROR="Type Error"
|
||||
COM_COMPONENTBUILDER_UNACTIVE_ONLY_FOUR_TEXT_FIELD="Unactive (only 4 text_field)"
|
||||
COM_COMPONENTBUILDER_UNDERNEATH_TABS="Underneath Tabs"
|
||||
@ -5551,6 +5599,7 @@ COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_ONE_HUNDRED_AND_TWENTY_EI
|
||||
COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY_WITHOUT_THIS_KEY_IT_WILL_TAKE_THE_CURRENT_TECHNOLOGY_WITH_A_BRUTE_FORCE_ATTACK_METHOD_MORE_THEN_A_HREFHTTPRANDOMIZECOMHOWLONGTOHACKPASS_TARGET_BLANK_TITLEHOW_LONG_TO_HACK_PASSSEVEN_HUNDRED_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZEROA_YEARS_TO_CRACK_THEORETICALLY_UNLESS_THEY_HAVE_THIS_KEY_ABOVE_SO_DO_KEEP_IT_SAFE="Your data is encrypted with a AES 128 bit encryption using the above 32 character key. Without this key it will take the current technology with a brute force attack method more then <a href="http://random-ize.com/how-long-to-hack-pass/" target="_blank" title="How long to hack pass">700 000 000 000 000 000 000 000 000 000 000</a> years to crack theoretically. Unless they have this key above, so do keep it safe."
|
||||
COM_COMPONENTBUILDER_YOU_CAN_NOW_SELECT_THE_COMPONENT_BZIPB_PACKAGE_YOU_WOULD_LIKE_TO_IMPORTBR_SMALLPLEASE_NOTE_THAT_SMART_COMPONENT_IMPORT_ONLY_WORKS_WITH_THE_FOLLOWING_FORMAT_BZIPBSMALL="You can now select the component <b>zip</b> package you would like to import.<br /><small>Please note that smart component import only works with the following format: <b>(.zip)</b></small>"
|
||||
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_IMPORT_A_COMPONENT_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP="You do not have permission to import a component, please contact your system administrator for more help."
|
||||
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_SHARE_THE_SNIPPETS_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP="You do not have permission to share the snippets, please contact your system administrator for more help."
|
||||
COM_COMPONENTBUILDER_YOU_HAVE_S_S_ADDING_MORE_THEN_FIFTY_S_IS_CONSIDERED_BAD_PRACTICE="You have %s %s. Adding more then 50 %s is considered bad practice."
|
||||
COM_COMPONENTBUILDER_YOU_HAVE_S_S_ADDING_MORE_THEN_FIFTY_S_IS_CONSIDERED_BAD_PRACTICE_YOUR_S_PAGE_LOAD_IN_JCB_WILL_SLOWDOWN_YOU_SHOULD_CONSIDER_DECOUPLING_SOME_OF_THESE_S="You have %s %s. Adding more then 50 %s is considered bad practice. Your %s page load in JCB will slowdown. You should consider decoupling some of these %s."
|
||||
COM_COMPONENTBUILDER_YOU_MUST_SELECT_A_COMPONENT="You must select a component!"
|
||||
|
@ -438,6 +438,10 @@ COM_COMPONENTBUILDER_FTPS_IMPORT="Ftps Import"
|
||||
COM_COMPONENTBUILDER_FTPS_IMPORT_DESC="Allows the users in this group to import import ftps"
|
||||
COM_COMPONENTBUILDER_FTPS_SUBMENU="Ftps Submenu"
|
||||
COM_COMPONENTBUILDER_FTPS_SUBMENU_DESC="Allows the users in this group to update the submenu of the ftp"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_ACCESS="Get Snippets Access"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_ACCESS_DESC=" Allows the users in this group to access get snippets."
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_SNIPPETS_BUTTON_ACCESS="Get Snippets Snippets Button Access"
|
||||
COM_COMPONENTBUILDER_GET_SNIPPETS_SNIPPETS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the snippets button."
|
||||
COM_COMPONENTBUILDER_HELP_DOCUMENTS_ACCESS="Help Documents Access"
|
||||
COM_COMPONENTBUILDER_HELP_DOCUMENTS_ACCESS_DESC="Allows the users in this group to access access help documents"
|
||||
COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_USE="Help Documents Batch Use"
|
||||
@ -657,6 +661,10 @@ COM_COMPONENTBUILDER_SNIPPETS_IMPORT="Snippets Import"
|
||||
COM_COMPONENTBUILDER_SNIPPETS_IMPORT_DESC="Allows the users in this group to import import snippets"
|
||||
COM_COMPONENTBUILDER_SNIPPETS_SUBMENU="Snippets Submenu"
|
||||
COM_COMPONENTBUILDER_SNIPPETS_SUBMENU_DESC="Allows the users in this group to update the submenu of the snippet"
|
||||
COM_COMPONENTBUILDER_SNIPPET_GET_SNIPPETS_BUTTON_ACCESS="Snippet Get Snippets Button Access"
|
||||
COM_COMPONENTBUILDER_SNIPPET_GET_SNIPPETS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the get snippets button."
|
||||
COM_COMPONENTBUILDER_SNIPPET_SHARE_SNIPPETS_BUTTON_ACCESS="Snippet Share Snippets Button Access"
|
||||
COM_COMPONENTBUILDER_SNIPPET_SHARE_SNIPPETS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the share snippets button."
|
||||
COM_COMPONENTBUILDER_SNIPPET_TYPES_ACCESS="Snippet Types Access"
|
||||
COM_COMPONENTBUILDER_SNIPPET_TYPES_ACCESS_DESC="Allows the users in this group to access access snippet types"
|
||||
COM_COMPONENTBUILDER_SNIPPET_TYPES_BATCH_USE="Snippet Types Batch Use"
|
||||
|
@ -1711,19 +1711,21 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('name', 'heading', 'usage', 'description', 'type', 'snippet', 'url')));
|
||||
$query->from($db->quoteName('#__componentbuilder_snippet'));
|
||||
$query->where($db->quoteName('published') . ' = 1');
|
||||
$query->where($db->quoteName('id') . ' = '. (int) $id);
|
||||
$query->select($db->quoteName(array('a.name', 'a.heading', 'a.usage', 'a.description', 'b.name', 'a.snippet', 'a.url', 'c.name'), array('name', 'heading', 'usage', 'description', 'type', 'snippet', 'url', 'library')));
|
||||
$query->from($db->quoteName('#__componentbuilder_snippet', 'a'));
|
||||
// From the componentbuilder_snippet_type table.
|
||||
$query->join('LEFT', $db->quoteName('#__componentbuilder_snippet_type', 'b') . ' ON (' . $db->quoteName('a.type') . ' = ' . $db->quoteName('b.id') . ')');
|
||||
// From the componentbuilder_library table.
|
||||
$query->join('LEFT', $db->quoteName('#__componentbuilder_library', 'c') . ' ON (' . $db->quoteName('a.library') . ' = ' . $db->quoteName('c.id') . ')');
|
||||
$query->where($db->quoteName('a.published') . ' >= 1');
|
||||
$query->where($db->quoteName('a.id') . ' = '. (int) $id);
|
||||
|
||||
// Reset the query using our newly populated query object.
|
||||
$db->setQuery($query);
|
||||
$db->execute();
|
||||
if ($db->getNumRows())
|
||||
{
|
||||
$model = ComponentbuilderHelper::getModel('snippets');
|
||||
$snippet = $db->loadObject();
|
||||
$snippet->type = JText::_($model->selectionTranslation($snippet->type,'type'));
|
||||
$snippet->snippet = base64_decode($snippet->snippet);
|
||||
// return found snippet settings
|
||||
return $snippet;
|
||||
|
@ -151,21 +151,25 @@ class JFormFieldSnippets extends JFormFieldList
|
||||
{
|
||||
$db = JFactory::getDBO();
|
||||
$query = $db->getQuery(true);
|
||||
$query->select($db->quoteName(array('a.id','a.name','a.type'),array('id','snippet_name','type')));
|
||||
$query->select($db->quoteName(array('a.id','a.name','b.name','c.name'),array('id','snippet_name','type','library')));
|
||||
$query->from($db->quoteName('#__componentbuilder_snippet', 'a'));
|
||||
$query->where($db->quoteName('a.published') . ' = 1');
|
||||
$query->order('a.name ASC');
|
||||
// From the componentbuilder_snippet_type table.
|
||||
$query->join('LEFT', $db->quoteName('#__componentbuilder_snippet_type', 'b') . ' ON (' . $db->quoteName('a.type') . ' = ' . $db->quoteName('b.id') . ')');
|
||||
// From the componentbuilder_library table.
|
||||
$query->join('LEFT', $db->quoteName('#__componentbuilder_library', 'c') . ' ON (' . $db->quoteName('a.library') . ' = ' . $db->quoteName('c.id') . ')');
|
||||
$query->where($db->quoteName('a.published') . ' >= 1');
|
||||
$query->order('c.ordering ASC');
|
||||
$query->order('b.name ASC');
|
||||
$db->setQuery((string)$query);
|
||||
$items = $db->loadObjectList();
|
||||
$options = array();
|
||||
if ($items)
|
||||
{
|
||||
$options[] = JHtml::_('select.option', '', 'Select an option');
|
||||
$model = ComponentbuilderHelper::getModel('snippets');
|
||||
foreach($items as $item)
|
||||
{
|
||||
$type = $model->selectionTranslation($item->type,'type');
|
||||
$options[] = JHtml::_('select.option', $item->id, $item->snippet_name . ' (' . JText::_($type) . ')' );
|
||||
$lib = (ComponentbuilderHelper::checkString($item->library)) ? ' (' . $item->library . ')' :'';
|
||||
$options[] = JHtml::_('select.option', $item->id, $item->type . ' - ' . $item->snippet_name . $lib );
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
|
@ -385,11 +385,14 @@ function getSnippetDetails(id){
|
||||
getSnippetDetails_server(id).done(function(result) {
|
||||
if(result.snippet){
|
||||
var description = '';
|
||||
if (result.description.length > 0)
|
||||
{
|
||||
if (result.description.length > 0) {
|
||||
description = '<p>'+result.description+'</p>';
|
||||
}
|
||||
var code = '<div id="snippet-code"><b>'+result.name+' ('+result.type+')</b> <a href="'+result.url+'" target="_blank" >see more details</a><br /><em>'+result.heading+'</em><br /><textarea id="snippet" class="span12" rows="11">'+result.snippet+'</textarea></div>';
|
||||
var library = '';
|
||||
if (result.library.length > 0) {
|
||||
library = ' <b>('+result.library+')</b>';
|
||||
}
|
||||
var code = '<div id="snippet-code"><b>'+result.name+' ('+result.type+')</b> <a href="'+result.url+'" target="_blank" >see more details'+library+'</a><br /><em>'+result.heading+'</em><br /><textarea id="snippet" class="span12" rows="11">'+result.snippet+'</textarea></div>';
|
||||
jQuery('#snippet-code').remove();
|
||||
jQuery('.snippet-code').append(code);
|
||||
// make sure the code block is active
|
||||
|
@ -739,13 +739,13 @@
|
||||
default="0">
|
||||
<!-- Option Set. -->
|
||||
<option value="0">
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NO</option>
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DO_NOT_ADD</option>
|
||||
<option value="2">
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BOTH</option>
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_BOTH_VTWO_AMP_VTHREE</option>
|
||||
<option value="1">
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_VTWO</option>
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_UIKIT_VTWO</option>
|
||||
<option value="3">
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_VTHREE</option>
|
||||
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_UIKIT_VTHREE</option>
|
||||
</field>
|
||||
<!-- Note_mysql_tweak_options Field. Type: Note. A None Database Field. (joomla) -->
|
||||
<field type="note" name="note_mysql_tweak_options" label="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_MYSQL_TWEAK_OPTIONS_LABEL" description="COM_COMPONENTBUILDER_JOOMLA_COMPONENT_NOTE_MYSQL_TWEAK_OPTIONS_DESCRIPTION" heading="h4" class="alert alert-info note_mysql_tweak_options" />
|
||||
|
@ -118,11 +118,14 @@ function getSnippetDetails(id){
|
||||
getSnippetDetails_server(id).done(function(result) {
|
||||
if(result.snippet){
|
||||
var description = '';
|
||||
if (result.description.length > 0)
|
||||
{
|
||||
if (result.description.length > 0) {
|
||||
description = '<p>'+result.description+'</p>';
|
||||
}
|
||||
var code = '<div id="snippet-code"><b>'+result.name+' ('+result.type+')</b> <a href="'+result.url+'" target="_blank" >see more details</a><br /><em>'+result.heading+'</em><br /><textarea id="snippet" class="span12" rows="11">'+result.snippet+'</textarea></div>';
|
||||
var library = '';
|
||||
if (result.library.length > 0) {
|
||||
library = ' <b>('+result.library+')</b>';
|
||||
}
|
||||
var code = '<div id="snippet-code"><b>'+result.name+' ('+result.type+')</b> <a href="'+result.url+'" target="_blank" >see more details'+library+'</a><br /><em>'+result.heading+'</em><br /><textarea id="snippet" class="span12" rows="11">'+result.snippet+'</textarea></div>';
|
||||
jQuery('#snippet-code').remove();
|
||||
jQuery('.snippet-code').append(code);
|
||||
// make sure the code block is active
|
||||
|
@ -463,11 +463,14 @@ function getSnippetDetails(id){
|
||||
getSnippetDetails_server(id).done(function(result) {
|
||||
if(result.snippet){
|
||||
var description = '';
|
||||
if (result.description.length > 0)
|
||||
{
|
||||
if (result.description.length > 0) {
|
||||
description = '<p>'+result.description+'</p>';
|
||||
}
|
||||
var code = '<div id="snippet-code"><b>'+result.name+' ('+result.type+')</b> <a href="'+result.url+'" target="_blank" >see more details</a><br /><em>'+result.heading+'</em><br /><textarea id="snippet" class="span12" rows="11">'+result.snippet+'</textarea></div>';
|
||||
var library = '';
|
||||
if (result.library.length > 0) {
|
||||
library = ' <b>('+result.library+')</b>';
|
||||
}
|
||||
var code = '<div id="snippet-code"><b>'+result.name+' ('+result.type+')</b> <a href="'+result.url+'" target="_blank" >see more details'+library+'</a><br /><em>'+result.heading+'</em><br /><textarea id="snippet" class="span12" rows="11">'+result.snippet+'</textarea></div>';
|
||||
jQuery('#snippet-code').remove();
|
||||
jQuery('.snippet-code').append(code);
|
||||
// make sure the code block is active
|
||||
|
@ -118,11 +118,14 @@ function getSnippetDetails(id){
|
||||
getSnippetDetails_server(id).done(function(result) {
|
||||
if(result.snippet){
|
||||
var description = '';
|
||||
if (result.description.length > 0)
|
||||
{
|
||||
if (result.description.length > 0) {
|
||||
description = '<p>'+result.description+'</p>';
|
||||
}
|
||||
var code = '<div id="snippet-code"><b>'+result.name+' ('+result.type+')</b> <a href="'+result.url+'" target="_blank" >see more details</a><br /><em>'+result.heading+'</em><br /><textarea id="snippet" class="span12" rows="11">'+result.snippet+'</textarea></div>';
|
||||
var library = '';
|
||||
if (result.library.length > 0) {
|
||||
library = ' <b>('+result.library+')</b>';
|
||||
}
|
||||
var code = '<div id="snippet-code"><b>'+result.name+' ('+result.type+')</b> <a href="'+result.url+'" target="_blank" >see more details'+library+'</a><br /><em>'+result.heading+'</em><br /><textarea id="snippet" class="span12" rows="11">'+result.snippet+'</textarea></div>';
|
||||
jQuery('#snippet-code').remove();
|
||||
jQuery('.snippet-code').append(code);
|
||||
// make sure the code block is active
|
||||
|
150
admin/models/get_snippets.php
Normal file
150
admin/models/get_snippets.php
Normal file
@ -0,0 +1,150 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.6.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage get_snippets.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import the Joomla modellist library
|
||||
jimport('joomla.application.component.modellist');
|
||||
|
||||
/**
|
||||
* Componentbuilder Model for Get_snippets
|
||||
*/
|
||||
class ComponentbuilderModelGet_snippets extends JModelList
|
||||
{
|
||||
/**
|
||||
* Model user data.
|
||||
*
|
||||
* @var strings
|
||||
*/
|
||||
protected $user;
|
||||
protected $userId;
|
||||
protected $guest;
|
||||
protected $groups;
|
||||
protected $levels;
|
||||
protected $app;
|
||||
protected $input;
|
||||
protected $uikitComp;
|
||||
|
||||
/**
|
||||
* Method to build an SQL query to load the list data.
|
||||
*
|
||||
* @return string An SQL query
|
||||
*/
|
||||
protected function getListQuery()
|
||||
{
|
||||
// Get the current user for authorisation checks
|
||||
$this->user = JFactory::getUser();
|
||||
$this->userId = $this->user->get('id');
|
||||
$this->guest = $this->user->get('guest');
|
||||
$this->groups = $this->user->get('groups');
|
||||
$this->authorisedGroups = $this->user->getAuthorisedGroups();
|
||||
$this->levels = $this->user->getAuthorisedViewLevels();
|
||||
$this->app = JFactory::getApplication();
|
||||
$this->input = $this->app->input;
|
||||
$this->initSet = true;
|
||||
// Make sure all records load, since no pagination allowed.
|
||||
$this->setState('list.limit', 0);
|
||||
// Get a db connection.
|
||||
$db = JFactory::getDbo();
|
||||
|
||||
// Create a new query object.
|
||||
$query = $db->getQuery(true);
|
||||
|
||||
// Get from #__componentbuilder_snippet as a
|
||||
$query->select($db->quoteName(
|
||||
array('a.id','a.heading','a.name','a.url','a.created','a.modified'),
|
||||
array('id','heading','name','url','created','modified')));
|
||||
$query->from($db->quoteName('#__componentbuilder_snippet', 'a'));
|
||||
|
||||
// Get from #__componentbuilder_snippet_type as b
|
||||
$query->select($db->quoteName(
|
||||
array('b.name'),
|
||||
array('type')));
|
||||
$query->join('LEFT', ($db->quoteName('#__componentbuilder_snippet_type', 'b')) . ' ON (' . $db->quoteName('a.type') . ' = ' . $db->quoteName('b.id') . ')');
|
||||
|
||||
// Get from #__componentbuilder_library as c
|
||||
$query->select($db->quoteName(
|
||||
array('c.name'),
|
||||
array('library')));
|
||||
$query->join('LEFT', ($db->quoteName('#__componentbuilder_library', 'c')) . ' ON (' . $db->quoteName('a.library') . ' = ' . $db->quoteName('c.id') . ')');
|
||||
|
||||
// return the query object
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get an array of data items.
|
||||
*
|
||||
* @return mixed An array of data items on success, false on failure.
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
$user = JFactory::getUser();
|
||||
// check if this user has permission to access items
|
||||
if (!$user->authorise('get_snippets.access', 'com_componentbuilder'))
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
$app->enqueueMessage(JText::_('Not authorised!'), 'error');
|
||||
// redirect away if not a correct (TODO for now we go to default view)
|
||||
$app->redirect('index.php?option=com_componentbuilder');
|
||||
return false;
|
||||
}
|
||||
// load parent items
|
||||
$items = parent::getItems();
|
||||
|
||||
// Get the global params
|
||||
$globalParams = JComponentHelper::getParams('com_componentbuilder', true);
|
||||
|
||||
// Convert the parameter fields into objects.
|
||||
if (ComponentbuilderHelper::checkArray($items))
|
||||
{
|
||||
foreach ($items as $nr => &$item)
|
||||
{
|
||||
// Always create a slug for sef URL's
|
||||
$item->slug = (isset($item->alias) && isset($item->id)) ? $item->id.':'.$item->alias : $item->id;
|
||||
}
|
||||
}
|
||||
|
||||
// return items
|
||||
return $items;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the uikit needed components
|
||||
*
|
||||
* @return mixed An array of objects on success.
|
||||
*
|
||||
*/
|
||||
public function getUikitComp()
|
||||
{
|
||||
if (isset($this->uikitComp) && ComponentbuilderHelper::checkArray($this->uikitComp))
|
||||
{
|
||||
return $this->uikitComp;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -55,6 +55,120 @@ class ComponentbuilderModelSnippets extends JModelList
|
||||
parent::__construct($config);
|
||||
}
|
||||
|
||||
public $user;
|
||||
|
||||
/**
|
||||
* Method to build the export package
|
||||
*
|
||||
* @return bool on success.
|
||||
*/
|
||||
public function shareSnippets($pks)
|
||||
{
|
||||
// setup the query
|
||||
if (ComponentbuilderHelper::checkArray($pks))
|
||||
{
|
||||
// Get the user object.
|
||||
if (!ComponentbuilderHelper::checkObject($this->user))
|
||||
{
|
||||
$this->user = JFactory::getUser();
|
||||
}
|
||||
// Create a new query object.
|
||||
if (!ComponentbuilderHelper::checkObject($this->_db))
|
||||
{
|
||||
$this->_db = JFactory::getDBO();
|
||||
}
|
||||
$query = $this->_db->getQuery(true);
|
||||
|
||||
// Select some fields
|
||||
$query->select($this->_db->quoteName(
|
||||
array('a.name','a.heading','a.description','a.usage','a.snippet','a.url','b.name','c.name','a.created','a.modified'),
|
||||
array('name','heading','description','usage','snippet','url','type','library','created','modified')
|
||||
));
|
||||
|
||||
// From the componentbuilder_snippet table
|
||||
$query->from($this->_db->quoteName('#__componentbuilder_snippet', 'a'));
|
||||
// From the componentbuilder_snippet_type table.
|
||||
$query->join('LEFT', $this->_db->quoteName('#__componentbuilder_snippet_type', 'b') . ' ON (' . $this->_db->quoteName('a.type') . ' = ' . $this->_db->quoteName('b.id') . ')');
|
||||
// From the componentbuilder_library table.
|
||||
$query->join('LEFT', $this->_db->quoteName('#__componentbuilder_library', 'c') . ' ON (' . $this->_db->quoteName('a.library') . ' = ' . $this->_db->quoteName('c.id') . ')');
|
||||
$query->where('a.id IN (' . implode(',',$pks) . ')');
|
||||
|
||||
// Implement View Level Access
|
||||
if (!$this->user->authorise('core.options', 'com_componentbuilder'))
|
||||
{
|
||||
$groups = implode(',', $this->user->getAuthorisedViewLevels());
|
||||
$query->where('a.access IN (' . $groups . ')');
|
||||
}
|
||||
|
||||
// Order the results by ordering
|
||||
$query->order('a.ordering ASC');
|
||||
|
||||
// Load the items
|
||||
$this->_db->setQuery($query);
|
||||
$this->_db->execute();
|
||||
if ($this->_db->getNumRows())
|
||||
{
|
||||
// load the items from db
|
||||
$items = $this->_db->loadObjectList();
|
||||
// check if we have items
|
||||
if (ComponentbuilderHelper::checkArray($items))
|
||||
{
|
||||
// get the shared paths
|
||||
$this->fullPath = rtrim(ComponentbuilderHelper::getFolderPath('path', 'sharepath', JFactory::getConfig()->get('tmp_path')), '/') . '/snippets';
|
||||
// remove old folder with the same name
|
||||
if (JFolder::exists($this->fullPath))
|
||||
{
|
||||
// remove if old folder is found
|
||||
ComponentbuilderHelper::removeFolder($this->fullPath);
|
||||
}
|
||||
// create the full path
|
||||
JFolder::create($this->fullPath);
|
||||
// set zip path
|
||||
$this->zipPath = $this->fullPath .'.zip';
|
||||
// remove old zip files with the same name
|
||||
if (JFile::exists($this->zipPath))
|
||||
{
|
||||
// remove file if found
|
||||
JFile::delete($this->zipPath);
|
||||
}
|
||||
// set params
|
||||
$this->params = JComponentHelper::getParams('com_componentbuilder');
|
||||
// Set the person sharing information (default VDM ;)
|
||||
$info = array();
|
||||
$info['company'] = $this->params->get('export_company', 'Vast Development Method');
|
||||
$info['owner'] = $this->params->get('export_owner', 'Llewellyn van der Merwe');
|
||||
$info['email'] = $this->params->get('export_email', 'joomla@vdm.io');
|
||||
$info['website'] = $this->params->get('export_website', 'https://www.vdm.io/');
|
||||
// prep the item
|
||||
foreach($items as $item)
|
||||
{
|
||||
// just unlock the snippet
|
||||
$item->snippet = base64_decode($item->snippet);
|
||||
// load the company detail to each snippet
|
||||
$item->contributor_company = $info['company'];
|
||||
$item->contributor_name = $info['owner'];
|
||||
$item->contributor_email = $info['email'];
|
||||
$item->contributor_website = $info['website'];
|
||||
// now store the snippet info
|
||||
ComponentbuilderHelper::writeFile($this->fullPath . '/' .ComponentbuilderHelper::safeString($item->library . ' - (' . $item->type . ') ' . $item->name, 'filename', '', false). '.json', json_encode($item, JSON_PRETTY_PRINT));
|
||||
}
|
||||
// zip the folder
|
||||
if (!ComponentbuilderHelper::zip($this->fullPath, $this->zipPath))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// remove the folder
|
||||
if (!ComponentbuilderHelper::removeFolder($this->fullPath))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to auto-populate the model state.
|
||||
*
|
||||
|
File diff suppressed because one or more lines are too long
@ -587,7 +587,7 @@ jQuery(document).ready(function(){
|
||||
var groupName = jQuery(row).data('group');
|
||||
var fieldName = groupName.replace('join_', '').replace('_table', '').replace(/([0-9])/g, '');
|
||||
var fieldNr = groupName.replace(/([A-z_])/g, '');
|
||||
updateSubItems(fieldName, fieldNr, '', '');
|
||||
updateSubItems(fieldName, fieldNr, '_', '_');
|
||||
});
|
||||
|
||||
});
|
||||
|
1
admin/views/get_snippets/index.html
Normal file
1
admin/views/get_snippets/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
107
admin/views/get_snippets/tmpl/default.php
Normal file
107
admin/views/get_snippets/tmpl/default.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.6.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage default.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
|
||||
JHtml::_('behavior.tooltip');
|
||||
JHtml::_('behavior.formvalidation');
|
||||
JHtml::_('formbehavior.chosen', 'select');
|
||||
JHtml::_('behavior.keepalive');
|
||||
?>
|
||||
<?php if ($this->canDo->get('get_snippets.access')): ?>
|
||||
<script type="text/javascript">
|
||||
Joomla.submitbutton = function(task) {
|
||||
if (task === 'get_snippets.back') {
|
||||
parent.history.back();
|
||||
return false;
|
||||
} else {
|
||||
var form = document.getElementById('adminForm');
|
||||
form.task.value = task;
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<form action="<?php echo JRoute::_('index.php?option=com_componentbuilder&view=get_snippets'); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
|
||||
<input type="hidden" name="task" value="" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
</form>
|
||||
<div id="snippets-github">
|
||||
<br /><br /><br />
|
||||
<center><h1><?php echo JText::_('COM_COMPONENTBUILDER_THE_SNIPPETS_IS_LOADING'); ?>.<span class="loading-dots">.</span></h1></center>
|
||||
</div>
|
||||
<div id="snippets-display" style="display: none;">
|
||||
<nav class="uk-navbar">
|
||||
<a href="https://github.com/vdm-io/Joomla-Component-Builder-Snippets" class="uk-navbar-brand uk-hidden-small" target="_blank"><i class="uk-icon-github"></i> gitHub</a>
|
||||
<ul class="uk-navbar-nav uk-hidden-small snippets-menu">
|
||||
<li data-uk-filter=""><a href=""><?php echo JText::_('COM_COMPONENTBUILDER_ALL'); ?></a></li>
|
||||
<li data-uk-filter="equal"><a href=""><?php echo JText::_('COM_COMPONENTBUILDER_IN_SYNC'); ?></a></li>
|
||||
<li data-uk-filter="behind"><a href=""><?php echo JText::_('COM_COMPONENTBUILDER_OUT_OF_DATE'); ?></a></li>
|
||||
<li data-uk-filter="new"><a href=""><?php echo JText::_('COM_COMPONENTBUILDER_NEW'); ?></a></li>
|
||||
<li data-uk-filter="diverged"><a href=""><?php echo JText::_('COM_COMPONENTBUILDER_DIVERGED'); ?></a></li>
|
||||
<li data-uk-filter="ahead"><a href=""><?php echo JText::_('COM_COMPONENTBUILDER_AHEAD'); ?></a></li>
|
||||
<li data-uk-sort="snippet-name"><a href=""><?php echo JText::_('COM_COMPONENTBUILDER_NAME_ASC'); ?></a></li>
|
||||
<li data-uk-sort="snippet-name:desc"><a href=""><?php echo JText::_('COM_COMPONENTBUILDER_NAME_DESC'); ?></a></li>
|
||||
<li data-uk-sort="snippet-libraries"><a href=""><?php echo JText::_('COM_COMPONENTBUILDER_LIBRARY_ASC'); ?></a></li>
|
||||
<li data-uk-sort="snippet-libraries:desc"><a href=""><?php echo JText::_('COM_COMPONENTBUILDER_LIBRARY_DESC'); ?></a></li>
|
||||
<li data-uk-sort="snippet-types"><a href=""><?php echo JText::_('COM_COMPONENTBUILDER_TYPE_ASC'); ?></a></li>
|
||||
<li data-uk-sort="snippet-types:desc"><a href=""><?php echo JText::_('COM_COMPONENTBUILDER_TYPE_DESC'); ?></a></li>
|
||||
</ul>
|
||||
<a href="#small-snippets-menu" class="uk-navbar-toggle uk-visible-small" data-uk-offcanvas></a>
|
||||
</nav>
|
||||
<br />
|
||||
<div id="snippets-grid" class="uk-grid uk-grid-preserve uk-grid-width-small-1-1 uk-grid-width-medium-1-3 uk-grid-width-large-1-4" data-uk-grid="{gutter:10, controls: '.snippets-menu'}" data-uk-check-display></div>
|
||||
</div>
|
||||
<div id="small-snippets-menu" class="uk-offcanvas">
|
||||
<div class="uk-offcanvas-bar">
|
||||
<ul class="uk-nav uk-nav-offcanvas" data-uk-nav>
|
||||
<li data-uk-filter=""><a href="" class="uk-offcanvas-close"><?php echo JText::_('COM_COMPONENTBUILDER_ALL'); ?></a></li>
|
||||
<li data-uk-filter="equal"><a href="" class="uk-offcanvas-close"><?php echo JText::_('COM_COMPONENTBUILDER_IN_SYNC'); ?></a></li>
|
||||
<li data-uk-filter="behind"><a href="" class="uk-offcanvas-close"><?php echo JText::_('COM_COMPONENTBUILDER_OUT_OF_DATE'); ?></a></li>
|
||||
<li data-uk-filter="new"><a href="" class="uk-offcanvas-close"><?php echo JText::_('COM_COMPONENTBUILDER_NEW'); ?></a></li>
|
||||
<li data-uk-filter="diverged"><a href="" class="uk-offcanvas-close"><?php echo JText::_('COM_COMPONENTBUILDER_DIVERGED'); ?></a></li>
|
||||
<li data-uk-filter="ahead"><a href="" class="uk-offcanvas-close"><?php echo JText::_('COM_COMPONENTBUILDER_AHEAD'); ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
// nice little dot trick :)
|
||||
jQuery(document).ready( function($) {
|
||||
var x=0;
|
||||
setInterval(function() {
|
||||
var dots = "";
|
||||
x++;
|
||||
for (var y=0; y < x%8; y++) {
|
||||
dots+=".";
|
||||
}
|
||||
$(".loading-dots").text(dots);
|
||||
} , 500);
|
||||
});
|
||||
</script>
|
||||
<?php else: ?>
|
||||
<h1><?php echo JText::_('COM_COMPONENTBUILDER_NO_ACCESS_GRANTED'); ?></h1>
|
||||
<?php endif; ?>
|
1
admin/views/get_snippets/tmpl/index.html
Normal file
1
admin/views/get_snippets/tmpl/index.html
Normal file
@ -0,0 +1 @@
|
||||
<html><body bgcolor="#FFFFFF"></body></html>
|
400
admin/views/get_snippets/view.html.php
Normal file
400
admin/views/get_snippets/view.html.php
Normal file
@ -0,0 +1,400 @@
|
||||
<?php
|
||||
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
|
||||
__ __ _ _____ _ _ __ __ _ _ _
|
||||
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
|
||||
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
|
||||
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
|
||||
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
|
||||
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
|
||||
| |
|
||||
|_|
|
||||
/-------------------------------------------------------------------------------------------------------------------------------/
|
||||
|
||||
@version 2.6.x
|
||||
@created 30th April, 2015
|
||||
@package Component Builder
|
||||
@subpackage view.html.php
|
||||
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
|
||||
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
@copyright Copyright (C) 2015. All Rights Reserved
|
||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||
|
||||
Builds Complex Joomla Components
|
||||
|
||||
/-----------------------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
// No direct access to this file
|
||||
defined('_JEXEC') or die('Restricted access');
|
||||
|
||||
// import Joomla view library
|
||||
jimport('joomla.application.component.view');
|
||||
|
||||
/**
|
||||
* Componentbuilder View class for the Get_snippets
|
||||
*/
|
||||
class ComponentbuilderViewGet_snippets extends JViewLegacy
|
||||
{
|
||||
// Overwriting JView display method
|
||||
function display($tpl = null)
|
||||
{
|
||||
// get component params
|
||||
$this->params = JComponentHelper::getParams('com_componentbuilder');
|
||||
// get the application
|
||||
$this->app = JFactory::getApplication();
|
||||
// get the user object
|
||||
$this->user = JFactory::getUser();
|
||||
// get global action permissions
|
||||
$this->canDo = ComponentbuilderHelper::getActions('get_snippets');
|
||||
// Initialise variables.
|
||||
$this->items = $this->get('Items');
|
||||
|
||||
// We don't need toolbar in the modal window.
|
||||
if ($this->getLayout() !== 'modal')
|
||||
{
|
||||
// add the tool bar
|
||||
$this->addToolBar();
|
||||
}
|
||||
|
||||
// set the document
|
||||
$this->setDocument();
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
throw new Exception(implode("\n", $errors), 500);
|
||||
}
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the document
|
||||
*/
|
||||
protected function setDocument()
|
||||
{
|
||||
|
||||
// always make sure jquery is loaded.
|
||||
JHtml::_('jquery.framework');
|
||||
// Load the header checker class.
|
||||
require_once( JPATH_COMPONENT_ADMINISTRATOR.'/helpers/headercheck.php' );
|
||||
// Initialize the header checker.
|
||||
$HeaderCheck = new componentbuilderHeaderCheck;
|
||||
|
||||
// Load uikit options.
|
||||
$uikit = $this->params->get('uikit_load');
|
||||
// Set script size.
|
||||
$size = $this->params->get('uikit_min');
|
||||
// Set css style.
|
||||
$style = $this->params->get('uikit_style');
|
||||
|
||||
// The uikit css.
|
||||
if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
|
||||
{
|
||||
$this->document->addStyleSheet(JURI::root(true) .'/media/com_componentbuilder/uikit/css/uikit'.$style.$size.'.css');
|
||||
}
|
||||
// The uikit js.
|
||||
if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3)
|
||||
{
|
||||
$this->document->addScript(JURI::root(true) .'/media/com_componentbuilder/uikit/js/uikit'.$size.'.js');
|
||||
}
|
||||
|
||||
// Load the script to find all uikit components needed.
|
||||
if ($uikit != 2)
|
||||
{
|
||||
// Set the default uikit components in this view.
|
||||
$uikitComp = array();
|
||||
$uikitComp[] = 'data-uk-grid';
|
||||
}
|
||||
|
||||
// Load the needed uikit components in this view.
|
||||
if ($uikit != 2 && isset($uikitComp) && ComponentbuilderHelper::checkArray($uikitComp))
|
||||
{
|
||||
// load just in case.
|
||||
jimport('joomla.filesystem.file');
|
||||
// loading...
|
||||
foreach ($uikitComp as $class)
|
||||
{
|
||||
foreach (ComponentbuilderHelper::$uk_components[$class] as $name)
|
||||
{
|
||||
// check if the CSS file exists.
|
||||
if (JFile::exists(JPATH_ROOT.'/media/com_componentbuilder/uikit/css/components/'.$name.$style.$size.'.css'))
|
||||
{
|
||||
// load the css.
|
||||
$this->document->addStyleSheet(JURI::root(true) .'/media/com_componentbuilder/uikit/css/components/'.$name.$style.$size.'.css');
|
||||
}
|
||||
// check if the JavaScript file exists.
|
||||
if (JFile::exists(JPATH_ROOT.'/media/com_componentbuilder/uikit/js/components/'.$name.$size.'.js'))
|
||||
{
|
||||
// load the js.
|
||||
$this->document->addScript(JURI::root(true) .'/media/com_componentbuilder/uikit/js/components/'.$name.$size.'.js', 'text/javascript', true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// load the local snippets
|
||||
if (ComponentbuilderHelper::checkArray($this->items))
|
||||
{
|
||||
$local_snippets = array();
|
||||
foreach ($this->items as $item)
|
||||
{
|
||||
$path = ComponentbuilderHelper::safeString($item->library . ' - (' . $item->type . ') ' . $item->name, 'filename', '', false). '.json';
|
||||
$local_snippets[$path] = $item;
|
||||
}
|
||||
}
|
||||
// Add the JavaScript for JStore
|
||||
$this->document->addScript(JURI::root() .'media/com_componentbuilder/js/jquery.json.min.js');
|
||||
$this->document->addScript(JURI::root() .'media/com_componentbuilder/js/jstorage.min.js');
|
||||
// check if we should use browser storage
|
||||
$setBrowserStorage = $this->params->get('set_browser_storage', null);
|
||||
if ($setBrowserStorage)
|
||||
{
|
||||
// check what (Time To Live) show we use
|
||||
$storageTimeToLive = $this->params->get('storage_time_to_live', 'global');
|
||||
if ('global' == $storageTimeToLive)
|
||||
{
|
||||
// use the global session time
|
||||
$session = JFactory::getSession();
|
||||
// must have itin milliseconds
|
||||
$expire = ($session->getExpire()*60)* 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
// use the Componentbuilder Global setting
|
||||
if (0 != $storageTimeToLive)
|
||||
{
|
||||
// this will convert the time into milliseconds
|
||||
$storageTimeToLive = $storageTimeToLive * 1000;
|
||||
}
|
||||
$expire = $storageTimeToLive;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// set to use no storage
|
||||
$expire = 30000;
|
||||
}
|
||||
// token
|
||||
$this->document->addScriptDeclaration("var token = '". JSession::getFormToken() ."';");
|
||||
// set an error message if needed
|
||||
$this->document->addScriptDeclaration("var returnError = '<div class=\"uk-alert uk-alert-warning\"><h1>".JText::_('COM_COMPONENTBUILDER_AN_ERROR_HAS_OCCURRED')."!</h1><p>".JText::_('COM_COMPONENTBUILDER_PLEASE_TRY_AGAIN_LATER').".</p></div>';");
|
||||
// Set the Time To Live To JavaScript
|
||||
$this->document->addScriptDeclaration("var expire = ". (int) $expire.";");
|
||||
// load the local snippets
|
||||
if (ComponentbuilderHelper::checkArray($this->items))
|
||||
{
|
||||
// Set the local snippets array
|
||||
$this->document->addScriptDeclaration("var local_snippets = ". json_encode($local_snippets).";");
|
||||
}
|
||||
// add the document default css file
|
||||
$this->document->addStyleSheet(JURI::root(true) .'/administrator/components/com_componentbuilder/assets/css/get_snippets.css');
|
||||
// Set the Custom JS script to view
|
||||
$this->document->addScriptDeclaration("
|
||||
// start the moment the document is ready
|
||||
jQuery(document).ready(function () {
|
||||
getSnippets('https://api.github.com/repos/vdm-io/Joomla-Component-Builder-Snippets/git/trees/master');
|
||||
});
|
||||
jQuery(document).ready(function(){
|
||||
jQuery('body').on('click','.getmodal',function(){
|
||||
// Ajax request
|
||||
var btn = jQuery(this);
|
||||
btn.prop('disabled', true);
|
||||
setTimeout(function(){
|
||||
btn.prop('disabled', false);
|
||||
}, 3000);
|
||||
var path = btn.data('path');
|
||||
var type = btn.data('type');
|
||||
getSnippetModal(path, type);
|
||||
});
|
||||
});
|
||||
// load every thing once ready
|
||||
jQuery(document).ajaxStop(function () {
|
||||
if (0 === jQuery.active) {
|
||||
setTimeout( function() {
|
||||
//do something special
|
||||
jQuery('#snippets-github').html('<h1>Snippets</h1>');
|
||||
jQuery('#snippets-display').show();
|
||||
jQuery('#snippets-grid').trigger('display.uk.check');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
|
||||
// get unix time stamp
|
||||
function unixTimeStamp(_theDate) {
|
||||
// check if JCB already has this snippet
|
||||
var aDate = new Date(_theDate);
|
||||
return Math.round(aDate.getTime()/1000);
|
||||
}
|
||||
|
||||
// set the snippet status
|
||||
function getSnippetStatus(snippet, key) {
|
||||
// check if JCB already has this snippet
|
||||
if(local_snippets.hasOwnProperty(key)){
|
||||
// first get local time stamp
|
||||
var local_created = unixTimeStamp(local_snippets[key].created);
|
||||
var local_modified = unixTimeStamp(local_snippets[key].modified);
|
||||
// now get github time stamps
|
||||
var created = unixTimeStamp(snippet.created);
|
||||
var modified = unixTimeStamp(snippet.modified);
|
||||
// work out the status
|
||||
if (local_created == created) {
|
||||
if (local_modified == modified) {
|
||||
return 'equal';
|
||||
} else if (local_modified > modified) {
|
||||
return 'behind';
|
||||
} else if (local_modified < modified) {
|
||||
return 'ahead';
|
||||
}
|
||||
}
|
||||
return 'diverged';
|
||||
}
|
||||
return 'new';
|
||||
}
|
||||
|
||||
// get the snippets
|
||||
function getSnippets(path) {
|
||||
var _paths = jQuery.jStorage.get('JCB-Snippets-Paths', null);
|
||||
if (_paths) {
|
||||
setSnippets(_paths);
|
||||
jQuery('#snippets-github').html('<h1>Snippets</h1>');
|
||||
jQuery('#snippets-display').show();
|
||||
} else {
|
||||
jQuery.get(path)
|
||||
.success(function(paths) {
|
||||
jQuery.jStorage.set('JCB-Snippets-Paths', paths, {TTL: expire});
|
||||
setSnippets(paths);
|
||||
})
|
||||
.error(function(jqXHR, textStatus, errorThrown) {
|
||||
jQuery('#snippets-github').html(returnError);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// set the snippets
|
||||
function setSnippets(paths) {
|
||||
jQuery.each(paths.tree, function(key,value){
|
||||
if (value.path.indexOf('.json') >= 0) {
|
||||
var _snippet = jQuery.jStorage.get(value.path, null);
|
||||
if (_snippet) {
|
||||
setSnippet(_snippet, value.path);
|
||||
jQuery('#snippets-grid').trigger('display.uk.check');
|
||||
} else {
|
||||
jQuery.get('https://raw.githubusercontent.com/vdm-io/Joomla-Component-Builder-Snippets/master/'+value.path)
|
||||
.success(function(snippet) {
|
||||
// convert the string to json.object
|
||||
snippet = jQuery.parseJSON(snippet);
|
||||
jQuery.jStorage.set(value.path, snippet, {TTL: expire});
|
||||
setSnippet(snippet, value.path);
|
||||
})
|
||||
.error(function(jqXHR, textStatus, errorThrown) {
|
||||
// we could do more
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// set the snippets
|
||||
function setSnippet(snippet, key) {
|
||||
// get the status
|
||||
var status = getSnippetStatus(snippet, key);
|
||||
// build the snippet display
|
||||
var html = '<div class=\"uk-panel\" data-uk-filter=\"'+status+'\" data-snippet-libraries=\"'+snippet.library+'\" data-snippet-types=\"'+snippet.type+'\" data-snippet-name=\"'+snippet.name+'\">';
|
||||
html += '<div class=\"uk-panel uk-panel-box uk-width-1-1\">';
|
||||
html += '<div class=\"uk-panel-badge uk-badge\">'+status+'</div><br />';
|
||||
html += '<h3 class=\"uk-panel-title\">' + snippet.library+ ' - (' + snippet.type + ') ' + snippet.name + '</h3>';
|
||||
html += snippet.heading + '<hr />';
|
||||
html += '<div class=\"uk-button-group uk-width-1-1 uk-margin-small-bottom\">';
|
||||
html += '<button class=\"uk-button uk-button-success uk-width-1-3 getmodal\" data-status=\"'+status+'\" data-path=\"'+key+'\" data-type=\"usage\">Usage</button>';
|
||||
html += '<button class=\"uk-button uk-button-success uk-width-1-3 getmodal\" data-status=\"'+status+'\" data-path=\"'+key+'\" data-type=\"description\">Description</button>';
|
||||
html += '<button class=\"uk-button uk-button-success uk-width-1-3 getmodal\" data-status=\"'+status+'\" data-path=\"'+key+'\" data-type=\"snippet\">Snippet</button>';
|
||||
html += '</div>';
|
||||
html += '<div><a class=\"uk-button uk-button-mini uk-button-success uk-width-1-1\" href=\"'+snippet.url+'\" target=\"_blank\">' + snippet.name + '</a></div>';
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
// now we have the snippet
|
||||
jQuery('#snippets-grid').append(html);
|
||||
}
|
||||
|
||||
// set the modal
|
||||
function getSnippetModal(key, type) {
|
||||
var _snippet = jQuery.jStorage.get(key, null);
|
||||
if (_snippet) {
|
||||
// show modal
|
||||
showSnippetModal(_snippet, type);
|
||||
} else {
|
||||
jQuery.get('https://raw.githubusercontent.com/vdm-io/Joomla-Component-Builder-Snippets/master/'+key)
|
||||
.success(function(snippet) {
|
||||
// convert the string to json.object
|
||||
snippet = jQuery.parseJSON(snippet);
|
||||
jQuery.jStorage.set(key, snippet, {TTL: expire});
|
||||
// show modal
|
||||
showSnippetModal(snippet, type);
|
||||
})
|
||||
.error(function(jqXHR, textStatus, errorThrown) {
|
||||
// we could do more
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// show the modal
|
||||
function showSnippetModal(snippet, type) {
|
||||
var html = '<div class=\"uk-modal-dialog uk-modal-dialog-lightbox\">';
|
||||
html += '<a href=\"\" class=\"uk-modal-close uk-close uk-close-alt\"></a>';
|
||||
html += '<h3>' + snippet.library + ' - (' + snippet.type + ') ' + snippet.name + '</h3>';
|
||||
html += '<br /><textarea class=\"uk-width-1-1\" rows=\"15\">'+snippet[type]+'</textarea>';
|
||||
html += '<br /><small>C: ' + snippet.created + ' | M: ' + snippet.modified + '</small>';
|
||||
html += '</div>';
|
||||
// add html to modal
|
||||
var modal = UIkit.modal.blockUI(html);
|
||||
// show modal
|
||||
modal.show();
|
||||
}
|
||||
");
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting the toolbar
|
||||
*/
|
||||
protected function addToolBar()
|
||||
{
|
||||
// hide the main menu
|
||||
$this->app->input->set('hidemainmenu', true);
|
||||
// add title to the page
|
||||
JToolbarHelper::title(JText::_('COM_COMPONENTBUILDER_GET_SNIPPETS'),'search');
|
||||
// add the back button
|
||||
// JToolBarHelper::custom('get_snippets.back', 'undo-2', '', 'COM_COMPONENTBUILDER_BACK', false);
|
||||
// add cpanel button
|
||||
JToolBarHelper::custom('get_snippets.dashboard', 'grid-2', '', 'COM_COMPONENTBUILDER_DASH', false);
|
||||
if ($this->canDo->get('get_snippets.snippets'))
|
||||
{
|
||||
// add Snippets button.
|
||||
JToolBarHelper::custom('get_snippets.openSnippets', 'pin', '', 'COM_COMPONENTBUILDER_SNIPPETS', false);
|
||||
}
|
||||
|
||||
// set help url for this view if found
|
||||
$help_url = ComponentbuilderHelper::getHelpUrl('get_snippets');
|
||||
if (ComponentbuilderHelper::checkString($help_url))
|
||||
{
|
||||
JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url);
|
||||
}
|
||||
|
||||
// add the options comp button
|
||||
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
|
||||
{
|
||||
JToolBarHelper::preferences('com_componentbuilder');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a value for output in a view script.
|
||||
*
|
||||
* @param mixed $var The output to escape.
|
||||
*
|
||||
* @return mixed The escaped value.
|
||||
*/
|
||||
public function escape($var)
|
||||
{
|
||||
// use the helper htmlEscape method instead.
|
||||
return ComponentbuilderHelper::htmlEscape($var, $this->_charset);
|
||||
}
|
||||
}
|
@ -134,6 +134,11 @@ class ComponentbuilderViewSnippets extends JViewLegacy
|
||||
$dhtml = $layout->render(array('title' => $title));
|
||||
$bar->appendButton('Custom', $dhtml, 'batch');
|
||||
}
|
||||
if ($this->user->authorise('snippet.share_snippets', 'com_componentbuilder'))
|
||||
{
|
||||
// add Share Snippets button.
|
||||
JToolBarHelper::custom('snippets.shareSnippets', 'share', '', 'COM_COMPONENTBUILDER_SHARE_SNIPPETS', false);
|
||||
}
|
||||
|
||||
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
|
||||
{
|
||||
@ -149,6 +154,11 @@ class ComponentbuilderViewSnippets extends JViewLegacy
|
||||
JToolBarHelper::custom('snippets.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true);
|
||||
}
|
||||
}
|
||||
if ($this->user->authorise('snippet.get_snippets', 'com_componentbuilder'))
|
||||
{
|
||||
// add Get Snippets button.
|
||||
JToolBarHelper::custom('snippets.getSnippets', 'search', '', 'COM_COMPONENTBUILDER_GET_SNIPPETS', false);
|
||||
}
|
||||
|
||||
if ($this->canDo->get('core.import') && $this->canDo->get('snippet.import'))
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="component" version="3.2" method="upgrade">
|
||||
<name>COM_COMPONENTBUILDER</name>
|
||||
<creationDate>12th November, 2017</creationDate>
|
||||
<creationDate>16th November, 2017</creationDate>
|
||||
<author>Llewellyn van der Merwe</author>
|
||||
<authorEmail>joomla@vdm.io</authorEmail>
|
||||
<authorUrl>http://vdm.bz/component-builder</authorUrl>
|
||||
|
2
media/js/jquery.json.min.js
vendored
Normal file
2
media/js/jquery.json.min.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/*! jQuery JSON plugin v2.5.1 */
|
||||
!function($){"use strict";var escape=/["\\\x00-\x1f\x7f-\x9f]/g,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},hasOwn=Object.prototype.hasOwnProperty;$.toJSON="object"==typeof JSON&&JSON.stringify?JSON.stringify:function(a){if(null===a)return"null";var b,c,d,e,f=$.type(a);if("undefined"===f)return void 0;if("number"===f||"boolean"===f)return String(a);if("string"===f)return $.quoteString(a);if("function"==typeof a.toJSON)return $.toJSON(a.toJSON());if("date"===f){var g=a.getUTCMonth()+1,h=a.getUTCDate(),i=a.getUTCFullYear(),j=a.getUTCHours(),k=a.getUTCMinutes(),l=a.getUTCSeconds(),m=a.getUTCMilliseconds();return 10>g&&(g="0"+g),10>h&&(h="0"+h),10>j&&(j="0"+j),10>k&&(k="0"+k),10>l&&(l="0"+l),100>m&&(m="0"+m),10>m&&(m="0"+m),'"'+i+"-"+g+"-"+h+"T"+j+":"+k+":"+l+"."+m+'Z"'}if(b=[],$.isArray(a)){for(c=0;c<a.length;c++)b.push($.toJSON(a[c])||"null");return"["+b.join(",")+"]"}if("object"==typeof a){for(c in a)if(hasOwn.call(a,c)){if(f=typeof c,"number"===f)d='"'+c+'"';else{if("string"!==f)continue;d=$.quoteString(c)}f=typeof a[c],"function"!==f&&"undefined"!==f&&(e=$.toJSON(a[c]),b.push(d+":"+e))}return"{"+b.join(",")+"}"}},$.evalJSON="object"==typeof JSON&&JSON.parse?JSON.parse:function(str){return eval("("+str+")")},$.secureEvalJSON="object"==typeof JSON&&JSON.parse?JSON.parse:function(str){var filtered=str.replace(/\\["\\\/bfnrtu]/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"");if(/^[\],:{}\s]*$/.test(filtered))return eval("("+str+")");throw new SyntaxError("Error parsing JSON, source is not valid.")},$.quoteString=function(a){return a.match(escape)?'"'+a.replace(escape,function(a){var b=meta[a];return"string"==typeof b?b:(b=a.charCodeAt(),"\\u00"+Math.floor(b/16).toString(16)+(b%16).toString(16))})+'"':'"'+a+'"'}}(jQuery);
|
16
media/js/jstorage.min.js
vendored
Normal file
16
media/js/jstorage.min.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
(function(){function C(){var a="{}";if("userDataBehavior"==f){g.load("jStorage");try{a=g.getAttribute("jStorage")}catch(b){}try{r=g.getAttribute("jStorage_update")}catch(c){}h.jStorage=a}D();x();E()}function u(){var a;clearTimeout(F);F=setTimeout(function(){if("localStorage"==f||"globalStorage"==f)a=h.jStorage_update;else if("userDataBehavior"==f){g.load("jStorage");try{a=g.getAttribute("jStorage_update")}catch(b){}}if(a&&a!=r){r=a;var l=p.parse(p.stringify(c.__jstorage_meta.CRC32)),k;C();k=p.parse(p.stringify(c.__jstorage_meta.CRC32));
|
||||
var d,n=[],e=[];for(d in l)l.hasOwnProperty(d)&&(k[d]?l[d]!=k[d]&&"2."==String(l[d]).substr(0,2)&&n.push(d):e.push(d));for(d in k)k.hasOwnProperty(d)&&(l[d]||n.push(d));s(n,"updated");s(e,"deleted")}},25)}function s(a,b){a=[].concat(a||[]);var c,k,d,n;if("flushed"==b){a=[];for(c in m)m.hasOwnProperty(c)&&a.push(c);b="deleted"}c=0;for(d=a.length;c<d;c++){if(m[a[c]])for(k=0,n=m[a[c]].length;k<n;k++)m[a[c]][k](a[c],b);if(m["*"])for(k=0,n=m["*"].length;k<n;k++)m["*"][k](a[c],b)}}function v(){var a=(+new Date).toString();
|
||||
if("localStorage"==f||"globalStorage"==f)try{h.jStorage_update=a}catch(b){f=!1}else"userDataBehavior"==f&&(g.setAttribute("jStorage_update",a),g.save("jStorage"));u()}function D(){if(h.jStorage)try{c=p.parse(String(h.jStorage))}catch(a){h.jStorage="{}"}else h.jStorage="{}";z=h.jStorage?String(h.jStorage).length:0;c.__jstorage_meta||(c.__jstorage_meta={});c.__jstorage_meta.CRC32||(c.__jstorage_meta.CRC32={})}function w(){if(c.__jstorage_meta.PubSub){for(var a=+new Date-2E3,b=0,l=c.__jstorage_meta.PubSub.length;b<
|
||||
l;b++)if(c.__jstorage_meta.PubSub[b][0]<=a){c.__jstorage_meta.PubSub.splice(b,c.__jstorage_meta.PubSub.length-b);break}c.__jstorage_meta.PubSub.length||delete c.__jstorage_meta.PubSub}try{h.jStorage=p.stringify(c),g&&(g.setAttribute("jStorage",h.jStorage),g.save("jStorage")),z=h.jStorage?String(h.jStorage).length:0}catch(k){}}function q(a){if("string"!=typeof a&&"number"!=typeof a)throw new TypeError("Key name must be string or numeric");if("__jstorage_meta"==a)throw new TypeError("Reserved key name");
|
||||
return!0}function x(){var a,b,l,k,d=Infinity,n=!1,e=[];clearTimeout(G);if(c.__jstorage_meta&&"object"==typeof c.__jstorage_meta.TTL){a=+new Date;l=c.__jstorage_meta.TTL;k=c.__jstorage_meta.CRC32;for(b in l)l.hasOwnProperty(b)&&(l[b]<=a?(delete l[b],delete k[b],delete c[b],n=!0,e.push(b)):l[b]<d&&(d=l[b]));Infinity!=d&&(G=setTimeout(x,Math.min(d-a,2147483647)));n&&(w(),v(),s(e,"deleted"))}}function E(){var a;if(c.__jstorage_meta.PubSub){var b,l=A,k=[];for(a=c.__jstorage_meta.PubSub.length-1;0<=a;a--)b=
|
||||
c.__jstorage_meta.PubSub[a],b[0]>A&&(l=b[0],k.unshift(b));for(a=k.length-1;0<=a;a--){b=k[a][1];var d=k[a][2];if(t[b])for(var n=0,e=t[b].length;n<e;n++)try{t[b][n](b,p.parse(p.stringify(d)))}catch(g){}}A=l}}var y=window.jQuery||window.$||(window.$={}),p={parse:window.JSON&&(window.JSON.parse||window.JSON.decode)||String.prototype.evalJSON&&function(a){return String(a).evalJSON()}||y.parseJSON||y.evalJSON,stringify:Object.toJSON||window.JSON&&(window.JSON.stringify||window.JSON.encode)||y.toJSON};if("function"!==
|
||||
typeof p.parse||"function"!==typeof p.stringify)throw Error("No JSON support found, include //cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js to page");var c={__jstorage_meta:{CRC32:{}}},h={jStorage:"{}"},g=null,z=0,f=!1,m={},F=!1,r=0,t={},A=+new Date,G,B={isXML:function(a){return(a=(a?a.ownerDocument||a:0).documentElement)?"HTML"!==a.nodeName:!1},encode:function(a){if(!this.isXML(a))return!1;try{return(new XMLSerializer).serializeToString(a)}catch(b){try{return a.xml}catch(c){}}return!1},
|
||||
decode:function(a){var b="DOMParser"in window&&(new DOMParser).parseFromString||window.ActiveXObject&&function(a){var b=new ActiveXObject("Microsoft.XMLDOM");b.async="false";b.loadXML(a);return b};if(!b)return!1;a=b.call("DOMParser"in window&&new DOMParser||window,a,"text/xml");return this.isXML(a)?a:!1}};y.jStorage={version:"0.4.12",set:function(a,b,l){q(a);l=l||{};if("undefined"==typeof b)return this.deleteKey(a),b;if(B.isXML(b))b={_is_xml:!0,xml:B.encode(b)};else{if("function"==typeof b)return;
|
||||
b&&"object"==typeof b&&(b=p.parse(p.stringify(b)))}c[a]=b;for(var k=c.__jstorage_meta.CRC32,d=p.stringify(b),g=d.length,e=2538058380^g,h=0,f;4<=g;)f=d.charCodeAt(h)&255|(d.charCodeAt(++h)&255)<<8|(d.charCodeAt(++h)&255)<<16|(d.charCodeAt(++h)&255)<<24,f=1540483477*(f&65535)+((1540483477*(f>>>16)&65535)<<16),f^=f>>>24,f=1540483477*(f&65535)+((1540483477*(f>>>16)&65535)<<16),e=1540483477*(e&65535)+((1540483477*(e>>>16)&65535)<<16)^f,g-=4,++h;switch(g){case 3:e^=(d.charCodeAt(h+2)&255)<<16;case 2:e^=
|
||||
(d.charCodeAt(h+1)&255)<<8;case 1:e^=d.charCodeAt(h)&255,e=1540483477*(e&65535)+((1540483477*(e>>>16)&65535)<<16)}e^=e>>>13;e=1540483477*(e&65535)+((1540483477*(e>>>16)&65535)<<16);k[a]="2."+((e^e>>>15)>>>0);this.setTTL(a,l.TTL||0);s(a,"updated");return b},get:function(a,b){q(a);return a in c?c[a]&&"object"==typeof c[a]&&c[a]._is_xml?B.decode(c[a].xml):c[a]:"undefined"==typeof b?null:b},deleteKey:function(a){q(a);return a in c?(delete c[a],"object"==typeof c.__jstorage_meta.TTL&&a in c.__jstorage_meta.TTL&&
|
||||
delete c.__jstorage_meta.TTL[a],delete c.__jstorage_meta.CRC32[a],w(),v(),s(a,"deleted"),!0):!1},setTTL:function(a,b){var l=+new Date;q(a);b=Number(b)||0;return a in c?(c.__jstorage_meta.TTL||(c.__jstorage_meta.TTL={}),0<b?c.__jstorage_meta.TTL[a]=l+b:delete c.__jstorage_meta.TTL[a],w(),x(),v(),!0):!1},getTTL:function(a){var b=+new Date;q(a);return a in c&&c.__jstorage_meta.TTL&&c.__jstorage_meta.TTL[a]?(a=c.__jstorage_meta.TTL[a]-b)||0:0},flush:function(){c={__jstorage_meta:{CRC32:{}}};w();v();s(null,
|
||||
"flushed");return!0},storageObj:function(){function a(){}a.prototype=c;return new a},index:function(){var a=[],b;for(b in c)c.hasOwnProperty(b)&&"__jstorage_meta"!=b&&a.push(b);return a},storageSize:function(){return z},currentBackend:function(){return f},storageAvailable:function(){return!!f},listenKeyChange:function(a,b){q(a);m[a]||(m[a]=[]);m[a].push(b)},stopListening:function(a,b){q(a);if(m[a])if(b)for(var c=m[a].length-1;0<=c;c--)m[a][c]==b&&m[a].splice(c,1);else delete m[a]},subscribe:function(a,
|
||||
b){a=(a||"").toString();if(!a)throw new TypeError("Channel not defined");t[a]||(t[a]=[]);t[a].push(b)},publish:function(a,b){a=(a||"").toString();if(!a)throw new TypeError("Channel not defined");c.__jstorage_meta||(c.__jstorage_meta={});c.__jstorage_meta.PubSub||(c.__jstorage_meta.PubSub=[]);c.__jstorage_meta.PubSub.unshift([+new Date,a,b]);w();v()},reInit:function(){C()},noConflict:function(a){delete window.$.jStorage;a&&(window.jStorage=this);return this}};(function(){var a=!1;if("localStorage"in
|
||||
window)try{window.localStorage.setItem("_tmptest","tmpval"),a=!0,window.localStorage.removeItem("_tmptest")}catch(b){}if(a)try{window.localStorage&&(h=window.localStorage,f="localStorage",r=h.jStorage_update)}catch(c){}else if("globalStorage"in window)try{window.globalStorage&&(h="localhost"==window.location.hostname?window.globalStorage["localhost.localdomain"]:window.globalStorage[window.location.hostname],f="globalStorage",r=h.jStorage_update)}catch(k){}else if(g=document.createElement("link"),
|
||||
g.addBehavior){g.style.behavior="url(#default#userData)";document.getElementsByTagName("head")[0].appendChild(g);try{g.load("jStorage")}catch(d){g.setAttribute("jStorage","{}"),g.save("jStorage"),g.load("jStorage")}a="{}";try{a=g.getAttribute("jStorage")}catch(m){}try{r=g.getAttribute("jStorage_update")}catch(e){}h.jStorage=a;f="userDataBehavior"}else{g=null;return}D();x();"localStorage"==f||"globalStorage"==f?"addEventListener"in window?window.addEventListener("storage",u,!1):document.attachEvent("onstorage",
|
||||
u):"userDataBehavior"==f&&setInterval(u,1E3);E();"addEventListener"in window&&window.addEventListener("pageshow",function(a){a.persisted&&u()},!1)})()})();
|
@ -3394,7 +3394,7 @@ class com_componentbuilderInstallerScript
|
||||
$query = $db->getQuery(true);
|
||||
// Field to update.
|
||||
$fields = array(
|
||||
$db->quoteName('params') . ' = ' . $db->quote('{"autorName":"Llewellyn van der Merwe","autorEmail":"joomla@vdm.io","minify":"0","percentagelanguageadd":"50","backup_package_name":"JCB_Backup_[YEAR]_[MONTH]_[DAY]","export_license":"GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html","export_copyright":"Copyright (C) 2015. All Rights Reserved","check_in":"-1 day","save_history":"1","history_limit":"10","uikit_load":"1","uikit_min":"","uikit_style":""}'),
|
||||
$db->quoteName('params') . ' = ' . $db->quote('{"autorName":"Llewellyn van der Merwe","autorEmail":"joomla@vdm.io","minify":"0","percentagelanguageadd":"50","set_browser_storage":"1","storage_time_to_live":"global","backup_package_name":"JCB_Backup_[YEAR]_[MONTH]_[DAY]","export_license":"GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html","export_copyright":"Copyright (C) 2015. All Rights Reserved","check_in":"-1 day","save_history":"1","history_limit":"10","uikit_load":"1","uikit_min":"","uikit_style":""}'),
|
||||
);
|
||||
// Condition.
|
||||
$conditions = array(
|
||||
|
@ -37,7 +37,7 @@ abstract class ComponentbuilderHelper
|
||||
**/
|
||||
protected static $params = false;
|
||||
|
||||
/*
|
||||
/**
|
||||
* get all component IDs
|
||||
*/
|
||||
public static function getComponentIDs()
|
||||
@ -58,7 +58,7 @@ abstract class ComponentbuilderHelper
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* Autoloader
|
||||
*/
|
||||
public static function autoLoader($type = 'compiler')
|
||||
@ -1185,7 +1185,7 @@ abstract class ComponentbuilderHelper
|
||||
// first get the file path
|
||||
$path_filename = self::getFilePath('path', $name.$type, $fileType, $key, JPATH_COMPONENT_ADMINISTRATOR);
|
||||
// set as read if not already set
|
||||
if (($content = @file_get_contents($path_filename)) !== FALSE)
|
||||
if ($content = self::getFileContents($path_filename, false))
|
||||
{
|
||||
if ($hash == $content)
|
||||
{
|
||||
@ -1269,6 +1269,93 @@ abstract class ComponentbuilderHelper
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the file path or url
|
||||
*
|
||||
* @param string $type The (url/path) type to return
|
||||
* @param string $target The Params Target name (if set)
|
||||
* @param string $default The default path if not set in Params (fallback path)
|
||||
* @param bool $createIfNotSet The switch to create the folder if not found
|
||||
*
|
||||
* @return string On success the path or url is returned based on the type requested
|
||||
*
|
||||
*/
|
||||
public static function getFolderPath($type = 'path', $target = 'folderpath', $default = JPATH_SITE . '/images/', $createIfNotSet = true)
|
||||
{
|
||||
// get the global settings
|
||||
if (!self::checkObject(self::$params))
|
||||
{
|
||||
self::$params = JComponentHelper::getParams('com_componentbuilder');
|
||||
}
|
||||
$folderPath = self::$params->get($target, $default);
|
||||
jimport('joomla.filesystem.folder');
|
||||
// create the folder if it does not exist
|
||||
if ($createIfNotSet && !JFolder::exists($folderPath))
|
||||
{
|
||||
JFolder::create($folderPath);
|
||||
}
|
||||
// return the url
|
||||
if ('url' === $type)
|
||||
{
|
||||
if (strpos($folderPath, JPATH_SITE) !== false)
|
||||
{
|
||||
$folderPath = trim( str_replace( JPATH_SITE, '', $folderPath), '/');
|
||||
return JURI::root() . $folderPath . '/';
|
||||
}
|
||||
// since the path is behind the root folder of the site, return only the root url (may be used to build the link)
|
||||
return JURI::root();
|
||||
}
|
||||
// sanitize the path
|
||||
return '/' . trim( $folderPath, '/' ) . '/';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get the content of a file
|
||||
*
|
||||
* @param string $path The path to the file
|
||||
* @param string/bool $none The return value if no content was found
|
||||
*
|
||||
* @return string On success
|
||||
*
|
||||
*/
|
||||
public static function getFileContents($path, $none = '')
|
||||
{
|
||||
if (self::checkString($path))
|
||||
{
|
||||
// use basic file get content for now
|
||||
if (($content = @file_get_contents($path)) !== FALSE)
|
||||
{
|
||||
return $content;
|
||||
}
|
||||
// use curl if available
|
||||
elseif (function_exists('curl_version'))
|
||||
{
|
||||
// start curl
|
||||
$ch = curl_init();
|
||||
// set the options
|
||||
$options = array();
|
||||
$options[CURLOPT_URL] = $path;
|
||||
$options[CURLOPT_USERAGENT] = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12';
|
||||
$options[CURLOPT_RETURNTRANSFER] = TRUE;
|
||||
$options[CURLOPT_SSL_VERIFYPEER] = FALSE;
|
||||
// load the options
|
||||
curl_setopt_array($ch, $options);
|
||||
// get the content
|
||||
$content = curl_exec($ch);
|
||||
// close the connection
|
||||
curl_close($ch);
|
||||
// return if found
|
||||
if (self::checkString($content))
|
||||
{
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $none;
|
||||
}
|
||||
|
||||
|
||||
public static function jsonToString($value, $sperator = ", ", $table = null)
|
||||
{
|
||||
// check if string is JSON
|
||||
|
Loading…
Reference in New Issue
Block a user