Renamed the uikit lib folders. Resolved the gh-188 by updateing the note. Resolved gh-92 by implementation of the library manager in the compiler.

This commit is contained in:
2017-12-10 21:17:26 +02:00
parent b60d208d9e
commit f900f65baa
700 changed files with 12837 additions and 14154 deletions

View File

@ -1051,13 +1051,14 @@ class Get
{
$component->readme = '';
}
// set lang now
$nowLang = $this->lang;
$this->lang = 'admin';
// dashboard methods
$component->dashboard_tab = (isset($component->dashboard_tab) && ComponentbuilderHelper::checkJson($component->dashboard_tab)) ? json_decode($component->dashboard_tab,true):null;
if (ComponentbuilderHelper::checkArray($component->dashboard_tab))
{
$nowLang = $this->lang;
$this->lang = 'admin';
{
$component->dashboard_tab = array_map( function($array) {
$array['html'] = $this->setDynamicValues($array['html']);
return $array;
@ -1072,13 +1073,13 @@ class Get
{
// load the php for the dashboard model
$component->php_dashboard_methods = $this->setDynamicValues(base64_decode($component->php_dashboard_methods));
// reset back to nowlang
$this->lang = $nowLang;
}
else
{
$component->php_dashboard_methods = '';
}
// reset back to nowlang
$this->lang = $nowLang;
// add the update FTP server sig
if ($component->add_update_server == 1 && is_numeric($component->update_server_ftp) && $component->update_server_ftp > 0)
@ -1626,7 +1627,46 @@ class Get
// fix alias to use in code
$view->code = $this->uniqueCode(ComponentbuilderHelper::safeString($view->codename));
$view->Code = ComponentbuilderHelper::safeString($view->code, 'F');
$view->CODE = ComponentbuilderHelper::safeString($view->code, 'U');
$view->CODE = ComponentbuilderHelper::safeString($view->code, 'U');
// load the library
if (!isset($this->libManager[$this->target]))
{
$this->libManager[$this->target] = array();
}
if (!isset($this->libManager[$this->target][$view->code]))
{
$this->libManager[$this->target][$view->code] = array();
}
// make sure json become array
if (ComponentbuilderHelper::checkJson($view->libraries))
{
$view->libraries = json_decode($view->libraries, true);
}
// if we have an array add it
if (ComponentbuilderHelper::checkArray($view->libraries))
{
foreach ($view->libraries as $library)
{
if (!isset($this->libManager[$this->target][$view->code][$library]))
{
if ($this->getLibrary((int) $library))
{
$this->libManager[$this->target][$view->code][(int) $library] = true;
}
}
}
}
elseif (is_numeric($view->libraries) && !isset($this->libManager[$this->target][$view->code][(int) $view->libraries]))
{
if ($this->getLibrary((int) $view->libraries))
{
$this->libManager[$this->target][$view->code][(int) $view->libraries] = true;
}
}
// setup template array
$this->templateData[$this->target][$view->code] = array();
// setup template and layout data
$this->setTemplateAndLayoutData($view->default,$view->code);
// insure the uikit components are loaded
if (2 == $this->uikit || 1 == $this->uikit)
{
@ -1658,10 +1698,6 @@ class Get
$this->getModule[$this->target][$view->code] = true;
}
}
// setup template array
$this->templateData[$this->target][$view->code] = array();
// setup template and layout data
$this->setTemplateAndLayoutData($view->default,$view->code);
// set the main get data
$main_get = $this->setGetData(array($view->main_get),$view->code);
$view->main_get = $main_get[0];
@ -1731,45 +1767,6 @@ class Get
// }
}
}
// load the library
if (!isset($this->libManager[$this->target]) || !isset($this->libManager[$this->target][$view->code]))
{
// prep array
if (!isset($this->libManager[$this->target]))
{
$this->libManager[$this->target] = array();
}
if (!isset($this->libManager[$this->target][$view->code]))
{
$this->libManager[$this->target][$view->code] = array();
}
// make sure json become array
if (ComponentbuilderHelper::checkJson($view->libraries))
{
$view->libraries = json_decode($view->libraries, true);
}
// if we have an array add it
if (ComponentbuilderHelper::checkArray($view->libraries))
{
foreach ($view->libraries as $library)
{
if (!isset($this->libManager[$this->target][$view->code][$library]))
{
if ($this->getLibrary($library))
{
$this->libManager[$this->target][$view->code][$library] = true;
}
}
}
}
elseif (is_numeric($view->libraries) && !isset($this->libManager[$this->target][$view->code][(int) $view->libraries]))
{
if ($this->getLibrary((int) $view->libraries))
{
$this->libManager[$this->target][$view->code][(int) $view->libraries] = true;
}
}
}
// add_Ajax for this view
if (isset($view->add_php_ajax) && $view->add_php_ajax == 1)
{
@ -2800,6 +2797,42 @@ class Get
$php_view = $this->setDynamicValues(base64_decode($row->php_view));
}
$contnent = $this->setDynamicValues(base64_decode($row->{$table}));
// load the library
if (!isset($this->libManager[$this->target]))
{
$this->libManager[$this->target] = array();
}
if (!isset($this->libManager[$this->target][$view]))
{
$this->libManager[$this->target][$view] = array();
}
// make sure json become array
if (ComponentbuilderHelper::checkJson($row->libraries))
{
$row->libraries = json_decode($row->libraries, true);
}
// if we have an array add it
if (ComponentbuilderHelper::checkArray($row->libraries))
{
foreach ($row->libraries as $library)
{
if (!isset($this->libManager[$this->target][$view][$library]))
{
if ($this->getLibrary((int) $library))
{
$this->libManager[$this->target][$view][(int) $library] = true;
}
}
}
}
elseif (is_numeric($row->libraries) && !isset($this->libManager[$this->target][$view][(int) $row->libraries]))
{
if ($this->getLibrary((int) $row->libraries))
{
$this->libManager[$this->target][$view][(int) $row->libraries] = true;
}
}
// load UIKIT if needed
if (2 == $this->uikit || 1 == $this->uikit)
{
// set uikit to views
@ -2842,45 +2875,6 @@ class Get
$this->getModule[$this->target][$view] = true;
}
}
// load the library
if (!isset($this->libManager[$this->target]) || !isset($this->libManager[$this->target][$view]))
{
// prep array
if (!isset($this->libManager[$this->target]))
{
$this->libManager[$this->target] = array();
}
if (!isset($this->libManager[$this->target][$view]))
{
$this->libManager[$this->target][$view] = array();
}
// make sure json become array
if (ComponentbuilderHelper::checkJson($row->libraries))
{
$row->libraries = json_decode($row->libraries, true);
}
// if we have an array add it
if (ComponentbuilderHelper::checkArray($row->libraries))
{
foreach ($row->libraries as $library)
{
if (!isset($this->libManager[$this->target][$view][$library]))
{
if ($this->getLibrary($library))
{
$this->libManager[$this->target][$view][$library] = true;
}
}
}
}
elseif (is_numeric($row->libraries) && !isset($this->libManager[$this->target][$view][(int) $row->libraries]))
{
if ($this->getLibrary((int) $row->libraries))
{
$this->libManager[$this->target][$view][(int) $row->libraries] = true;
}
}
}
return array('id' => $row->id, 'html' => $contnent, 'php_view' => $php_view);
}
}
@ -2897,6 +2891,46 @@ class Get
*/
protected function getLibrary($id)
{
// check if the lib has already been set
if (!isset($this->libraries[$id]))
{
// make sure we should continue and that the lib is not already bein loaded
switch ($id)
{
case 1: // No Library
return false;
break;
case 3: // Uikit v3
if (2 == $this->uikit || 3 == $this->uikit)
{
// already being loaded
$this->libraries[$id] = false;
}
break;
case 4: // Uikit v2
if (2 == $this->uikit || 1 == $this->uikit)
{
// already being loaded
$this->libraries[$id] = false;
}
break;
case 5: // FooTable v2
if (!isset($this->footableVersion) || 2 == $this->footableVersion)
{
// already being loaded
$this->libraries[$id] = false;
}
break;
case 6: // FooTable v3
if (3 == $this->footableVersion)
{
// already being loaded
$this->libraries[$id] = false;
}
break;
}
}
// check if the lib has already been set
if (!isset($this->libraries[$id]))
{
@ -2915,7 +2949,6 @@ class Get
'c.addfiles',
'c.addfolders',
'c.addurls',
'a.php_preparedocument',
'a.php_setdocument'
),
array(
@ -2928,7 +2961,6 @@ class Get
'addfiles',
'addfolders',
'addurls',
'php_preparedocument',
'php_setdocument'
)
)
@ -2945,36 +2977,48 @@ class Get
// Load the results as a list of stdClass objects
$library = $this->db->loadObject();
// check if this lib uses build-in behaviour
if ($library->how == 4)
{
// fall back on build-in features
$buildin = array(3 => array('uikit' => 3), 4 => array('uikit' => 1), 5 => array('footableVersion' => 2, 'footable' => true), 6 => array('footableVersion' => 3, 'footable' => true));
if (isset($buildin[$library->id]) && ComponentbuilderHelper::checkArray($buildin[$library->id]))
{
// set the lib switch
foreach ($buildin[$library->id] as $lib => $val)
{
$this->{$lib} = $val;
}
// since we are falling back on build-in feature
$library->how = 0;
}
else
{
// since we did not find build in behaviour we must load always.
$library->how = 1;
}
}
// check if this lib has dynamic behaviour
if ($library->how > 0)
{
// unset original value
unset($library->addconfig);
// set the addfolders data
$library->addfolders = (isset($library->addfolders) && ComponentbuilderHelper::checkJson($library->addfolders)) ? json_decode($library->addfolders,true):null;
if (ComponentbuilderHelper::checkArray($library->addfolders))
{
$library->folders = array_values($library->addfolders);
}
unset($library->addfolders);
// set the addfiles data
$library->addfiles = (isset($library->addfiles) && ComponentbuilderHelper::checkJson($library->addfiles)) ? json_decode($library->addfiles,true):null;
if (ComponentbuilderHelper::checkArray($library->addfiles))
{
$library->files = array_values($library->addfiles);
}
unset($library->addfiles);
// set the addurls data
$library->addurls = (isset($library->addurls) && ComponentbuilderHelper::checkJson($library->addurls)) ? json_decode($library->addurls,true):null;
if (ComponentbuilderHelper::checkArray($library->addurls))
{
$library->urls = array_values($library->addurls);
}
unset($library->addurls);
}
// add config fields only if needed
if ($library->how > 1)
{
@ -2990,18 +3034,13 @@ class Get
}, array_values($library->addconfig));
}
}
// if this lib is controlled by custom script
if (3 == $library->how)
{
// set Needed PHP
$phpMethods = array('preparedocument', 'setdocument');
foreach ($phpMethods as $method)
if (isset($library->php_setdocument) && ComponentbuilderHelper::checkString($library->php_setdocument))
{
if (isset($library->{'php_'.$method}) && ComponentbuilderHelper::checkString($library->{'php_'.$method}))
{
$library->{$method} = $this->setDynamicValues(base64_decode($library->{'php_'.$method}));
}
$library->document = $this->setDynamicValues(base64_decode($library->php_setdocument));
}
}
// if this lib is controlled by conditions
@ -3014,14 +3053,14 @@ class Get
$library->conditions = array_values($library->addconditions);
}
}
// if this lib is always being added
else
{
}
unset($library->php_preparedocument);
unset($library->php_setdocument);
unset($library->addconditions);
unset($library->addconfig);
unset($library->addfolders);
unset($library->addfiles);
unset($library->addurls);
// load to global lib
$this->libraries[$id] = $library;
}
else
{

View File

@ -336,6 +336,8 @@ class Structure extends Get
{
return false;
}
// load the libraries files/folders and url's
$this->setLibaries();
// set all static folders and files
if (!$this->setStatic())
{
@ -369,6 +371,122 @@ class Structure extends Get
return '';
}
/**
* Build the Libraries files, folders, url's and config
*
* @return void
*
*/
private function setLibaries()
{
if (ComponentbuilderHelper::checkArray($this->libraries))
{
foreach($this->libraries as $id => &$library)
{
if (ComponentbuilderHelper::checkObject($library))
{
// check if this lib has files
if (isset($library->files) && ComponentbuilderHelper::checkArray($library->files))
{
// add to component files
foreach ($library->files as $file)
{
$this->componentData->files[] = $file;
}
}
// check if this lib has folders
if (isset($library->folders) && ComponentbuilderHelper::checkArray($library->folders))
{
// add to component folders
foreach ($library->folders as $folder)
{
$this->componentData->folders[] = $folder;
}
}
// check if this lib has urls
if (isset($library->urls) && ComponentbuilderHelper::checkArray($library->urls))
{
// build media folder path
$mediaPath = '/media/' . strtolower( preg_replace('/\s+/', '-', ComponentbuilderHelper::safeString($library->name, 'filename', ' ', false)));
// create media path if not set
if (!JFolder::exists( $this->componentPath . $mediaPath))
{
JFolder::create($this->componentPath . $mediaPath);
// count the folder created
$this->folderCount++;
$this->indexHTML($mediaPath);
}
// add to component urls
foreach ($library->urls as $n => &$url)
{
if (isset($url['type']) && $url['type'] > 1 && isset($url['url']) && ComponentbuilderHelper::checkString($url['url']))
{
$fileName = basename($url['url']);
// get the file contents
$data = ComponentbuilderHelper::getFileContents($url['url']);
// build sub path
if (strpos($fileName, '.js') !== false)
{
$path = '/js';
}
elseif (strpos($fileName, '.css') !== false)
{
$path = '/css';
}
else
{
$path = '';
}
// create sub media path if not set
if (!JFolder::exists($this->componentPath . $mediaPath . $path))
{
JFolder::create($this->componentPath . $mediaPath . $path);
// count the folder created
$this->folderCount++;
$this->indexHTML($mediaPath . $path);
}
// set the path to library file
$url['path'] = $mediaPath . $path . '/' . $fileName; // we need this for later
// set full path
$path = $this->componentPath . $url['path'];
// write data to path
$this->writeFile($path, $data);
// count the file created
$this->fileCount++;
}
}
}
// if config fields are found load into component config (avoiding dublicates)
if (isset($library->how) && $library->how > 1 && isset($library->config) && ComponentbuilderHelper::checkArray($library->config))
{
foreach ($library->config as $cofig)
{
$found = array_filter($this->componentData->config, function($item) use($cofig) {
return $item['field'] == $cofig['field'];
});
// set the config data if not found
if (!ComponentbuilderHelper::checkArray($found))
{
$this->componentData->config[] = $cofig;
}
}
}
}
}
}
}
/**
* Write data to file
*
* @return bool true on success
*
*/
public function writeFile($path, $data)
{
return ComponentbuilderHelper::writeFile($path, $data);
}
/**
* Build the Initial Folders
*
@ -926,25 +1044,25 @@ class Structure extends Get
if (2 == $this->uikit || 1 == $this->uikit)
{
// move the UIKIT Folder into place
$uikit = array( 'folder' => 'uikit', 'path' => 'media', 'rename' => 0);
$uikit = array( 'folder' => 'uikit-v2', 'path' => 'media', 'rename' => 0);
$this->componentData->folders[] = $uikit;
}
if (2 == $this->uikit || 3 == $this->uikit)
{
// move the UIKIT-3 Folder into place
$uikit = array( 'folder' => 'uikit-3', 'path' => 'media', 'rename' => 0);
$uikit = array( 'folder' => 'uikit-v3', 'path' => 'media', 'rename' => 0);
$this->componentData->folders[] = $uikit;
}
if ($this->footable && (!isset($this->footableVersion) || 2 == $this->footableVersion))
{
// move the footable folder into place
$footable = array( 'folder' => 'footable2', 'path' => 'media/footable', 'rename' => 1);
$footable = array( 'folder' => 'footable-v2', 'path' => 'media', 'rename' => 0);
$this->componentData->folders[] = $footable;
}
elseif ($this->footable && 3 == $this->footableVersion)
{
// move the footable folder into place
$footable = array( 'folder' => 'footable3', 'path' => 'media/footable', 'rename' => 1);
$footable = array( 'folder' => 'footable-v3', 'path' => 'media', 'rename' => 0);
$this->componentData->folders[] = $footable;
}

View File

@ -1311,7 +1311,7 @@ class Fields extends Structure
public function buildSiteFieldData($view, $field, $set, $type)
{
$decode = array('json','base64','basic_encryption','advance_encryption');
$uikit = array('textarea','editor');
$textareas = array('textarea','editor');
if (isset($this->siteFields[$view][$field]) && ComponentbuilderHelper::checkArray($this->siteFields[$view][$field]))
{
foreach ($this->siteFields[$view][$field] as $code => $array)
@ -1322,10 +1322,15 @@ class Fields extends Structure
$this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']] = array('decode' => $set, 'type' => $type);
}
// set the uikit checker
if ((2 == $this->uikit || 1 == $this->uikit) && in_array($type, $uikit))
if ((2 == $this->uikit || 1 == $this->uikit) && in_array($type, $textareas))
{
$this->siteFieldData['uikit'][$array['site']][$code][$array['as']][$array['key']] = $array;
}
// set the textareas checker
if (in_array($type, $textareas))
{
$this->siteFieldData['textareas'][$array['site']][$code][$array['as']][$array['key']] = $array;
}
}
}
}
@ -2097,7 +2102,7 @@ class Fields extends Structure
// build the search values
if (isset($field['search']) && $field['search'] == 1)
{
$_list = (!isset($field['list'])) ? $field['list'] : 0;
$_list = (isset($field['list'])) ? $field['list'] : 0;
$this->searchBuilder[$listViewName][] = array('type' => $typeName, 'code' => $name, 'custom' => $custom, 'list' => $_list);
}
// build the filter values

View File

@ -184,6 +184,8 @@ class Interpretation extends Fields
* @var array
*/
protected $hasIdRequest = array();
protected $libwarning = array();
/**
* Constructor
@ -1650,10 +1652,11 @@ class Interpretation extends Fields
return $fieldDecode;
}
public function setCustomViewFieldUikitChecker(&$get, $checker, $string, $code, $tab = '')
public function setCustomViewFieldonContentPrepareChecker(&$get, $checker, $string, $code, $tab = '')
{
$fieldUikit = '';
$fieldPrepare = '';
$runplugins = false;
$context = 'com_'.$this->fileContentStatic['###component###'].'.'.$code;
foreach ($checker as $field => $array)
{
if (strpos($get['selection']['select'], $field) !== false)
@ -1664,8 +1667,26 @@ class Interpretation extends Fields
$runplugins .= PHP_EOL.$tab."\tJPluginHelper::importPlugin('content');";
$runplugins .= PHP_EOL.$tab."\t".'$this->_dispatcher = JEventDispatcher::getInstance();';
}
$fieldUikit .= PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." Make sure the content prepare plugins fire on ".$field;
$fieldUikit .= PHP_EOL."\t".$tab."\t".'$this->_dispatcher->trigger("onContentPrepare",array($this->_context,&'.$string.'->'.$field.',$item->params));';
$fieldPrepare .= PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." Make sure the content prepare plugins fire on ".$field;
$fieldPrepare .= PHP_EOL."\t".$tab."\t\$_".$field." = new stdClass();";
$fieldPrepare .= PHP_EOL."\t".$tab."\t\$_".$field.'->text =& '.$string.'->'.$field.'; //'.$this->setLine(__LINE__).' value must be in text';
$fieldPrepare .= PHP_EOL."\t".$tab."\t//".$this->setLine(__LINE__)." Since all values are now in text (Joomla Limitation), we also add the field name (".$field.") to context";
$fieldPrepare .= PHP_EOL."\t".$tab."\t".'$this->_dispatcher->trigger("onContentPrepare",array(\''.$context.'.'.$field.'\',&$_'.$field.',&$this->params));'; // we can improve the params later (TODO)
}
}
// load dispatcher
$this->JEventDispatcher = array('###DISPATCHER###' => ($runplugins?:''));
// return content prepare fix
return $fieldPrepare;
}
public function setCustomViewFieldUikitChecker(&$get, $checker, $string, $code, $tab = '')
{
$fieldUikit = '';
foreach ($checker as $field => $array)
{
if (strpos($get['selection']['select'], $field) !== false)
{
// only load for uikit version 2 (TODO) we may need to add another check here
if (2 == $this->uikit || 1 == $this->uikit)
{
@ -1674,8 +1695,6 @@ class Interpretation extends Fields
}
}
}
// load dispatcher
$this->JEventDispatcher = array('###DISPATCHER###' => ($runplugins?:''));
// return UIKIT fix
return $fieldUikit;
}
@ -2158,6 +2177,16 @@ class Interpretation extends Fields
$getItem .= $this->setCustomViewFieldDecodeFilter($main_get,$decodeFilter,'$data','$data',$code,$tab);
}
}
if (isset($this->siteFieldData['textareas'][$code][$main_get['key']][$main_get['as']]))
{
$contentprepareChecker = $this->siteFieldData['textareas'][$code][$main_get['key']][$main_get['as']];
if (ComponentbuilderHelper::checkArray($contentprepareChecker))
{
// set contentprepare checkers on needed fields
$getItem .= $this->setCustomViewFieldonContentPrepareChecker($main_get, $contentprepareChecker, '$data', $code, $tab);
}
}
if (isset($this->siteFieldData['uikit'][$code][$main_get['key']][$main_get['as']]))
{
@ -2555,12 +2584,18 @@ class Interpretation extends Fields
{
$uikitChecker = $this->siteFieldData['uikit'][$default['code']][$get['key']][$default['as']];
}
// set contnetprepare on needed fields
if (isset($this->siteFieldData['textareas'][$default['code']][$get['key']][$default['as']]))
{
$contentprepareChecker = $this->siteFieldData['textareas'][$default['code']][$get['key']][$default['as']];
}
// set joined values
$placeholders = array('###TAB###' => "\t\t", '###STRING###' => '$item');
$joinedChecker = (isset($this->otherJoin[$this->target][$default['code']][$default['as']]) && ComponentbuilderHelper::checkArray($this->otherJoin[$this->target][$default['code']][$default['as']])) ? $this->otherJoin[$this->target][$default['code']][$default['as']] : '';
if ( (isset($decodeChecker) && ComponentbuilderHelper::checkArray($decodeChecker)) ||
(isset($uikitChecker) && ComponentbuilderHelper::checkArray($uikitChecker)) ||
(isset($decodeFilter) && ComponentbuilderHelper::checkArray($decodeFilter)) ||
(isset($contentprepareChecker) && ComponentbuilderHelper::checkArray($contentprepareChecker)) ||
ComponentbuilderHelper::checkArray($joinedChecker))
{
$decoder = '';
@ -2574,6 +2609,11 @@ class Interpretation extends Fields
{
$decoder_filter = $this->setCustomViewFieldDecodeFilter($get,$decodeFilter,'$item','$items[$nr]',$default['code'],"\t\t");
}
$contnetprepare = '';
if (isset($contentprepareChecker) && ComponentbuilderHelper::checkArray($contentprepareChecker))
{
$contnetprepare = $this->setCustomViewFieldonContentPrepareChecker($get,$contentprepareChecker,'$item',$default['code'],"\t\t");
}
$uikit = '';
if (isset($uikitChecker) && ComponentbuilderHelper::checkArray($uikitChecker))
{
@ -2587,7 +2627,7 @@ class Interpretation extends Fields
$joine .= $this->setPlaceholders($joinedString, $placeholders);
}
}
if (ComponentbuilderHelper::checkString($decoder) || ComponentbuilderHelper::checkString($uikit) || ComponentbuilderHelper::checkString($decoder_filter) || ComponentbuilderHelper::checkString($joine))
if (ComponentbuilderHelper::checkString($decoder) || ComponentbuilderHelper::checkString($contnetprepare) || ComponentbuilderHelper::checkString($uikit) || ComponentbuilderHelper::checkString($decoder_filter) || ComponentbuilderHelper::checkString($joine))
{
$methods .= PHP_EOL."\t\t\t\$items = \$db->loadObjectList();";
$methods .= PHP_EOL.PHP_EOL."\t\t\t//".$this->setLine(__LINE__)." Convert the parameter fields into objects.";
@ -2601,6 +2641,10 @@ class Interpretation extends Fields
{
$methods .= $decoder_filter;
}
if (ComponentbuilderHelper::checkString($contnetprepare))
{
$methods .= $contnetprepare;
}
if (ComponentbuilderHelper::checkString($uikit))
{
$methods .= $uikit;
@ -2738,7 +2782,7 @@ class Interpretation extends Fields
* @param $get
* @param $code
* @return string
*/
*/
public function setCustomViewGetItems(&$get, $code)
{
$getItem = '';
@ -2747,7 +2791,7 @@ class Interpretation extends Fields
$Component = $this->fileContentStatic['###Component###'];
if (ComponentbuilderHelper::checkObject($get))
{
$getItem .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Convert the parameter fields into objects.";
$getItem .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Insure all item fields are adapted where needed.";
$getItem .= PHP_EOL."\t\tif (".$Component."Helper::checkArray(\$items))";
$getItem .= PHP_EOL."\t\t{";
$getItem .= "###DISPATCHER###";
@ -2778,6 +2822,15 @@ class Interpretation extends Fields
$getItem .= $this->setCustomViewFieldDecodeFilter($main_get,$decodeFilter,"\$item",'$items[$nr]',$code,"\t\t");
}
}
if (isset($this->siteFieldData['textareas'][$code][$main_get['key']][$main_get['as']]))
{
$contentprepareChecker = $this->siteFieldData['textareas'][$code][$main_get['key']][$main_get['as']];
if (ComponentbuilderHelper::checkArray($contentprepareChecker))
{
// set contentprepare checkers on needed fields
$getItem .= $this->setCustomViewFieldonContentPrepareChecker($main_get,$contentprepareChecker,"\$item",$code,"\t\t");
}
}
if (isset($this->siteFieldData['uikit'][$code][$main_get['key']][$main_get['as']]))
{
$uikitChecker = $this->siteFieldData['uikit'][$code][$main_get['key']][$main_get['as']];
@ -2923,6 +2976,10 @@ class Interpretation extends Fields
{
// ensure correct target is set
$TARGET = ComponentbuilderHelper::safeString($this->target,'U');
// set libraries ###'.$TARGET.'_LIBRARIES_LOADER###
$this->fileContentDynamic[$view['settings']->code]['###'.$TARGET.'_LIBRARIES_LOADER###'] = $this->setLibrariesLoader($view);
// set uikit ###'.$TARGET.'_UIKIT_LOADER###
$this->fileContentDynamic[$view['settings']->code]['###'.$TARGET.'_UIKIT_LOADER###'] = $this->setUikitLoader($view);
@ -3285,7 +3342,7 @@ class Interpretation extends Fields
{
if (isset($this->footableScripts[$this->target][$view['settings']->code]) && $this->footableScripts[$this->target][$view['settings']->code])
{
return $this->setFootableScripts(false,'$this->document');
return $this->setFootableScripts(false);
}
return '';
}
@ -3419,13 +3476,11 @@ class Interpretation extends Fields
}
return '';
}
public function setUikitLoader(&$view)
public function setLibrariesLoader($view)
{
// reset buktes
// reset bucket
$setter = '';
$loader['css'] = array();
$loader['js'] = array();
// allways load these in
$setter .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." always make sure jquery is loaded.";
$setter .= PHP_EOL."\t\tJHtml::_('jquery.framework');";
@ -3440,6 +3495,229 @@ class Interpretation extends Fields
}
$setter .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Initialize the header checker.";
$setter .= PHP_EOL."\t\t\$HeaderCheck = new ".$this->fileContentStatic['###component###']."HeaderCheck;";
// check if this view should get libraries
if (isset($this->libManager[$this->target][$view['settings']->code])
&& ComponentbuilderHelper::checkArray($this->libManager[$this->target][$view['settings']->code]))
{
foreach ($this->libManager[$this->target][$view['settings']->code] as $id => $true)
{
if (isset($this->libraries[$id]) && ComponentbuilderHelper::checkObject($this->libraries[$id])
&& isset($this->libraries[$id]->document) && ComponentbuilderHelper::checkString($this->libraries[$id]->document))
{
$setter .= PHP_EOL.PHP_EOL.$this->setPlaceholders(
str_replace('$document->', '$this->document->', $this->libraries[$id]->document),
$this->placeholders);
}
elseif (isset($this->libraries[$id]) && ComponentbuilderHelper::checkObject($this->libraries[$id])
&& isset($this->libraries[$id]->how))
{
$setter .= $this->setLibraryDocument($id);
}
}
}
return $setter;
}
protected function setLibraryDocument($id)
{
if (2 == $this->libraries[$id]->how && isset($this->libraries[$id]->conditions)
&& ComponentbuilderHelper::checkArray($this->libraries[$id]->conditions))
{
// build document with the conditions values
$this->setLibraryDocConditions($id, $this->setLibraryScripts($id, false));
}
elseif (1 == $this->libraries[$id]->how)
{
// build document to allways add all files and urls
$this->setLibraryScripts($id);
}
// check if the document was build
if (isset($this->libraries[$id]->document) && ComponentbuilderHelper::checkString($this->libraries[$id]->document))
{
return PHP_EOL.PHP_EOL.$this->libraries[$id]->document;
}
return '';
}
protected function setLibraryDocConditions($id, $scripts)
{
$document = '';
// Start script builder for library files
if (!isset($this->libwarning[$id]))
{
$this->app->enqueueMessage(JText::sprintf('The conditional script builder for <b>%s</b> is not ready, will only be ready in the next update to v2.6.7', $this->libraries[$id]->name), 'warning');
// set the warning only once
$this->libwarning[$id] = true;
}
// if there was any code added to document then set globaly
if (ComponentbuilderHelper::checkString($document))
{
$this->libraries[$id]->document = $document;
}
}
protected function setLibraryScripts($id, $buildDoc = true)
{
$scripts = array();
// load the urls if found
if (isset($this->libraries[$id]->urls) && ComponentbuilderHelper::checkArray($this->libraries[$id]->urls))
{
// set all the files
foreach ($this->libraries[$id]->urls as $url)
{
// if local path is set, then use it first
if (isset($url['path']))
{
// update the root path
$path = $this->getScriptRootPath($url['path']);
// load document script
$scripts[md5($url['path'])] = $this->setIncludeLibScript($path);
// load url also if not building document
if (!$buildDoc)
{
// load document script
$scripts[md5($url['url'])] = $this->setIncludeLibScript($url['url'], false);
}
}
else
{
// load document script
$scripts[md5($url['url'])] = $this->setIncludeLibScript($url['url'], false);
}
}
}
// load the local files if found
if (isset($this->libraries[$id]->files) && ComponentbuilderHelper::checkArray($this->libraries[$id]->files))
{
// set all the files
foreach ($this->libraries[$id]->files as $file)
{
$path = '/'.trim($file['path'], '/');
// check if path has new file name (has extetion)
$pathInfo = pathinfo($path);
// update the root path
$_path = $this->getScriptRootPath($path);
if (isset($pathInfo['extension']) && $pathInfo['extension'])
{
// load document script
$scripts[md5($path)] = $this->setIncludeLibScript($_path, false, $pathInfo);
}
else
{
// load document script
$scripts[md5($path.'/'.trim($file['file'],'/'))] = $this->setIncludeLibScript($_path.'/'.trim($file['file'],'/'));
}
}
}
// load the local folders if found
if (isset($this->libraries[$id]->folders) && ComponentbuilderHelper::checkArray($this->libraries[$id]->folders))
{
// get all the file paths
foreach ($this->libraries[$id]->folders as $folder)
{
if (isset($folder['path']) && isset($folder['folder']))
{
$path = '/'.trim($folder['path'], '/');
if (isset($folder['rename']) && 1 == $folder['rename'])
{
if ($_paths = ComponentbuilderHelper::getAllFilePaths($this->componentPath.$path))
{
$files[$path] = $_paths;
}
}
else
{
$path = $path.'/'.trim($folder['folder'], '/');
if ($_paths = ComponentbuilderHelper::getAllFilePaths($this->componentPath.$path))
{
$files[$path] = $_paths;
}
}
}
}
// now load the script
foreach ($files as $root => $paths)
{
// update the root path
$_root = $this->getScriptRootPath($root);
// load per path
foreach($paths as $path)
{
$scripts[md5($root.'/'.trim($path, '/'))] = $this->setIncludeLibScript($_root.'/'.trim($path, '/'));
}
}
}
// if there was any code added to document then set globaly
if ($buildDoc && ComponentbuilderHelper::checkArray($scripts))
{
$this->libraries[$id]->document = "\t\t//".$this->setLine(__LINE__)." always load these files.".PHP_EOL."\t\t".implode(PHP_EOL."\t\t", $scripts);
// success
return true;
}
elseif (ComponentbuilderHelper::checkArray($scripts))
{
return $scripts;
}
return false;
}
protected function setIncludeLibScript($path, $local = true, $pathInfo = false)
{
// insure we have the path info
if (!$pathInfo)
{
$pathInfo = pathinfo($path);
}
// set the local string
$JURI = '';
if ($local)
{
$JURI = 'JURI::root(true) . ';
}
// use the path info to build the script
if (isset($pathInfo['extension']) && $pathInfo['extension'])
{
switch($pathInfo['extension'])
{
case 'js':
return '$this->document->addScript('.$JURI.'"'.$path.'");';
break;
case 'css':
case 'less':
return '$this->document->addStyleSheet('.$JURI.'"'.$path.'");';
break;
case 'php':
if (strpos($path, 'http') === false)
{
return 'require_once("'.$path.'");';
}
break;
}
}
return '';
}
protected function getScriptRootPath($root)
{
if (strpos($root, '/media/') !== false && strpos($root, '/admin/') === false && strpos($root, '/site/') === false)
{
return str_replace('/media/', '/media/com_'.$this->fileContentStatic['###component###'] .'/', $root);
}
elseif (strpos($root, '/media/') === false && strpos($root, '/admin/') !== false && strpos($root, '/site/') === false)
{
return str_replace('/admin/', '/administrator/components/com_'.$this->fileContentStatic['###component###'] .'/', $root);
}
elseif (strpos($root, '/media/') === false && strpos($root, '/admin/') === false && strpos($root, '/site/') !== false)
{
return str_replace('/site/', '/components/com_'.$this->fileContentStatic['###component###'] .'/', $root);
}
return $root;
}
public function setUikitLoader(&$view)
{
// reset setter
$setter = '';
// load the defaults needed
if ($this->uikit > 0)
{
@ -3468,12 +3746,12 @@ class Interpretation extends Fields
$setter .= PHP_EOL.PHP_EOL.$tabV."\t\t//".$this->setLine(__LINE__)." The uikit css.";
$setter .= PHP_EOL.$tabV."\t\tif ((!\$HeaderCheck->css_loaded('uikit.min') || \$uikit == 1) && \$uikit != 2 && \$uikit != 3)";
$setter .= PHP_EOL.$tabV."\t\t{";
$setter .= PHP_EOL.$tabV."\t\t\t\$this->document->addStyleSheet(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit/css/uikit'.\$style.\$size.'.css');";
$setter .= PHP_EOL.$tabV."\t\t\t\$this->document->addStyleSheet(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit-v2/css/uikit'.\$style.\$size.'.css');";
$setter .= PHP_EOL.$tabV."\t\t}";
$setter .= PHP_EOL.$tabV."\t\t//".$this->setLine(__LINE__)." The uikit js.";
$setter .= PHP_EOL.$tabV."\t\tif ((!\$HeaderCheck->js_loaded('uikit.min') || \$uikit == 1) && \$uikit != 2 && \$uikit != 3)";
$setter .= PHP_EOL.$tabV."\t\t{";
$setter .= PHP_EOL.$tabV."\t\t\t\$this->document->addScript(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit/js/uikit'.\$size.'.js');";
$setter .= PHP_EOL.$tabV."\t\t\t\$this->document->addScript(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit-v2/js/uikit'.\$size.'.js');";
$setter .= PHP_EOL.$tabV."\t\t}";
}
// load the components need
@ -3518,16 +3796,16 @@ class Interpretation extends Fields
$setter .= PHP_EOL.$tabV."\t\t\t\tforeach (".$this->fileContentStatic['###Component###']."Helper::\$uk_components[\$class] as \$name)";
$setter .= PHP_EOL.$tabV."\t\t\t\t{";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t//".$this->setLine(__LINE__)." check if the CSS file exists.";
$setter .= PHP_EOL.$tabV."\t\t\t\t\tif (JFile::exists(JPATH_ROOT.'/media/com_".$this->fileContentStatic['###component###']."/uikit/css/components/'.\$name.\$style.\$size.'.css'))";
$setter .= PHP_EOL.$tabV."\t\t\t\t\tif (JFile::exists(JPATH_ROOT.'/media/com_".$this->fileContentStatic['###component###']."/uikit-v2/css/components/'.\$name.\$style.\$size.'.css'))";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t{";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t\t//".$this->setLine(__LINE__)." load the css.";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t\t\$this->document->addStyleSheet(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit/css/components/'.\$name.\$style.\$size.'.css');";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t\t\$this->document->addStyleSheet(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit-v2/css/components/'.\$name.\$style.\$size.'.css');";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t}";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t//".$this->setLine(__LINE__)." check if the JavaScript file exists.";
$setter .= PHP_EOL.$tabV."\t\t\t\t\tif (JFile::exists(JPATH_ROOT.'/media/com_".$this->fileContentStatic['###component###']."/uikit/js/components/'.\$name.\$size.'.js'))";
$setter .= PHP_EOL.$tabV."\t\t\t\t\tif (JFile::exists(JPATH_ROOT.'/media/com_".$this->fileContentStatic['###component###']."/uikit-v2/js/components/'.\$name.\$size.'.js'))";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t{";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t\t//".$this->setLine(__LINE__)." load the js.";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t\t\$this->document->addScript(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit/js/components/'.\$name.\$size.'.js', 'text/javascript', true);";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t\t\$this->document->addScript(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit-v2/js/components/'.\$name.\$size.'.js', 'text/javascript', true);";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t}";
$setter .= PHP_EOL.$tabV."\t\t\t\t}";
$setter .= PHP_EOL.$tabV."\t\t\t}";
@ -3547,16 +3825,16 @@ class Interpretation extends Fields
$setter .= PHP_EOL.$tabV."\t\t\t\tforeach (".$this->fileContentStatic['###Component###']."Helper::\$uk_components[\$class] as \$name)";
$setter .= PHP_EOL.$tabV."\t\t\t\t{";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t//".$this->setLine(__LINE__)." check if the CSS file exists.";
$setter .= PHP_EOL.$tabV."\t\t\t\t\tif (JFile::exists(JPATH_ROOT.'/media/com_".$this->fileContentStatic['###component###']."/uikit/css/components/'.\$name.\$style.\$size.'.css'))";
$setter .= PHP_EOL.$tabV."\t\t\t\t\tif (JFile::exists(JPATH_ROOT.'/media/com_".$this->fileContentStatic['###component###']."/uikit-v2/css/components/'.\$name.\$style.\$size.'.css'))";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t{";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t\t//".$this->setLine(__LINE__)." load the css.";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t\t\$this->document->addStyleSheet(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit/css/components/'.\$name.\$style.\$size.'.css');";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t\t\$this->document->addStyleSheet(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit-v2/css/components/'.\$name.\$style.\$size.'.css');";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t}";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t//".$this->setLine(__LINE__)." check if the JavaScript file exists.";
$setter .= PHP_EOL.$tabV."\t\t\t\t\tif (JFile::exists(JPATH_ROOT.'/media/com_".$this->fileContentStatic['###component###']."/uikit/js/components/'.\$name.\$size.'.js'))";
$setter .= PHP_EOL.$tabV."\t\t\t\t\tif (JFile::exists(JPATH_ROOT.'/media/com_".$this->fileContentStatic['###component###']."/uikit-v2/js/components/'.\$name.\$size.'.js'))";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t{";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t\t//".$this->setLine(__LINE__)." load the js.";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t\t\$this->document->addScript(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit/js/components/'.\$name.\$size.'.js', 'text/javascript', true);";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t\t\$this->document->addScript(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit-v2/js/components/'.\$name.\$size.'.js', 'text/javascript', true);";
$setter .= PHP_EOL.$tabV."\t\t\t\t\t}";
$setter .= PHP_EOL.$tabV."\t\t\t\t}";
$setter .= PHP_EOL.$tabV."\t\t\t}";
@ -3576,12 +3854,12 @@ class Interpretation extends Fields
$setter .= PHP_EOL.$tabV."\t\t//".$this->setLine(__LINE__)." The uikit css.";
$setter .= PHP_EOL.$tabV."\t\tif ((!\$HeaderCheck->css_loaded('uikit.min') || \$uikit == 1) && \$uikit != 2 && \$uikit != 3)";
$setter .= PHP_EOL.$tabV."\t\t{";
$setter .= PHP_EOL.$tabV."\t\t\t\$this->document->addStyleSheet(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit-3/css/uikit'.\$size.'.css');";
$setter .= PHP_EOL.$tabV."\t\t\t\$this->document->addStyleSheet(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit-v3/css/uikit'.\$size.'.css');";
$setter .= PHP_EOL.$tabV."\t\t}";
$setter .= PHP_EOL.$tabV."\t\t//".$this->setLine(__LINE__)." The uikit js.";
$setter .= PHP_EOL.$tabV."\t\tif ((!\$HeaderCheck->js_loaded('uikit.min') || \$uikit == 1) && \$uikit != 2 && \$uikit != 3)";
$setter .= PHP_EOL.$tabV."\t\t{";
$setter .= PHP_EOL.$tabV."\t\t\t\$this->document->addScript(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit-3/js/uikit'.\$size.'.js');";
$setter .= PHP_EOL.$tabV."\t\t\t\$this->document->addScript(JURI::root(true) .'/media/com_".$this->fileContentStatic['###component###']."/uikit-v3/js/uikit'.\$size.'.js');";
$setter .= PHP_EOL.$tabV."\t\t}";
if (2 == $this->uikit)
{
@ -3808,11 +4086,6 @@ class Interpretation extends Fields
}
}
public function writeFile($path, $data)
{
return ComponentbuilderHelper::writeFile($path, $data);
}
public function setMethodGetItem(&$view)
{
$script = '';
@ -5683,11 +5956,11 @@ class Interpretation extends Fields
{
foreach ($this->componentData->custom_admin_views as $custom_admin_view)
{
if (ComponentbuilderHelper::checkArray($custom_admin_view['adminviews']))
if (isset($custom_admin_view['adminviews']) && ComponentbuilderHelper::checkArray($custom_admin_view['adminviews']))
{
foreach ($custom_admin_view['adminviews'] as $adminview)
{
if ($view['adminview'] == $adminview)
if (isset($view['adminview']) && $view['adminview'] == $adminview)
{
// set the needed keys
$setId = false;
@ -6884,48 +7157,47 @@ class Interpretation extends Fields
/**
* @param bool $init
* @param string $document
* @return string
*/
public function setFootableScripts($init = true, $document = '$document')
*/
public function setFootableScripts($init = true)
{
if (!isset($this->footableVersion) || 2 == $this->footableVersion) // loading version 2
{
$foo = PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Add the CSS for Footable.";
$foo .= PHP_EOL."\t\t".$document."->addStyleSheet(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable/css/footable.core.min.css');";
$foo .= PHP_EOL."\t\t\$this->document->addStyleSheet(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable-v2/css/footable.core.min.css');";
$foo .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Use the Metro Style";
$foo .= PHP_EOL."\t\tif (!isset(\$this->fooTableStyle) || 0 == \$this->fooTableStyle)";
$foo .= PHP_EOL."\t\t{";
$foo .= PHP_EOL."\t\t\t".$document."->addStyleSheet(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable/css/footable.metro.min.css');";
$foo .= PHP_EOL."\t\t\t\$this->document->addStyleSheet(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable-v2/css/footable.metro.min.css');";
$foo .= PHP_EOL."\t\t}";
$foo .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Use the Legacy Style.";
$foo .= PHP_EOL."\t\telseif (isset(\$this->fooTableStyle) && 1 == \$this->fooTableStyle)";
$foo .= PHP_EOL."\t\t{";
$foo .= PHP_EOL."\t\t\t".$document."->addStyleSheet(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable/css/footable.standalone.min.css');";
$foo .= PHP_EOL."\t\t\t\$this->document->addStyleSheet(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable-v2/css/footable.standalone.min.css');";
$foo .= PHP_EOL."\t\t}";
$foo .= PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Add the JavaScript for Footable";
$foo .= PHP_EOL."\t\t".$document."->addScript(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable/js/footable.js');";
$foo .= PHP_EOL."\t\t".$document."->addScript(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable/js/footable.sort.js');";
$foo .= PHP_EOL."\t\t".$document."->addScript(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable/js/footable.filter.js');";
$foo .= PHP_EOL."\t\t".$document."->addScript(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable/js/footable.paginate.js');";
$foo .= PHP_EOL."\t\t\$this->document->addScript(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable-v2/js/footable.js');";
$foo .= PHP_EOL."\t\t\$this->document->addScript(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable-v2/js/footable.sort.js');";
$foo .= PHP_EOL."\t\t\$this->document->addScript(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable-v2/js/footable.filter.js');";
$foo .= PHP_EOL."\t\t\$this->document->addScript(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable-v2/js/footable.paginate.js');";
if ($init)
{
$foo .= PHP_EOL.PHP_EOL."\t\t".'$footable = "jQuery(document).ready(function() { jQuery(function () { jQuery('."'.footable'".').footable(); }); jQuery('."'.nav-tabs'".').on('."'click'".', '."'li'".', function() { setTimeout(tableFix, 10); }); }); function tableFix() { jQuery('."'.footable'".').trigger('."'footable_resize'".'); }";';
$foo .= PHP_EOL."\t\t\$document->addScriptDeclaration(\$footable);".PHP_EOL;
$foo .= PHP_EOL."\t\t\$this->document->addScriptDeclaration(\$footable);".PHP_EOL;
}
}
elseif (3 == $this->footableVersion) // loading version 3
{
$foo = PHP_EOL.PHP_EOL."\t\t//".$this->setLine(__LINE__)." Add the CSS for Footable";
$foo .= PHP_EOL."\t\t".$document."->addStyleSheet('https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css');";
$foo .= PHP_EOL."\t\t".$document."->addStyleSheet(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable/css/footable.standalone.min.css');";
$foo .= PHP_EOL."\t\t\$this->document->addStyleSheet('https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css');";
$foo .= PHP_EOL."\t\t\$this->document->addStyleSheet(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable-v3/css/footable.standalone.min.css');";
$foo .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Add the JavaScript for Footable (adding all funtions)";
$foo .= PHP_EOL."\t\t".$document."->addScript(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable/js/footable.min.js');";
$foo .= PHP_EOL."\t\t\$this->document->addScript(JURI::root() .'media/com_".$this->fileContentStatic['###component###']."/footable-v3/js/footable.min.js');";
if ($init)
{
$foo .= PHP_EOL.PHP_EOL."\t\t".'$footable = "jQuery(document).ready(function() { jQuery(function () { jQuery('."'.footable'".').footable();});});";';
$foo .= PHP_EOL."\t\t\$document->addScriptDeclaration(\$footable);".PHP_EOL;
$foo .= PHP_EOL."\t\t\$this->document->addScriptDeclaration(\$footable);".PHP_EOL;
}
}
return $foo;
@ -9356,7 +9628,7 @@ class Interpretation extends Fields
if (isset($this->customScriptBuilder['token'][$view]) && $this->customScriptBuilder['token'][$view])
{
$fix .= PHP_EOL."\t\t//".$this->setLine(__LINE__)." Add Ajax Token";
$fix .= PHP_EOL."\t\t\$document->addScriptDeclaration(\"var token = '\".JSession::getFormToken().\"';\");";
$fix .= PHP_EOL."\t\t\$this->document->addScriptDeclaration(\"var token = '\".JSession::getFormToken().\"';\");";
}
return $fix;
}
@ -12421,9 +12693,14 @@ class Interpretation extends Fields
$dbkey = 'g';
foreach ($this->componentData->config as $field)
{
$xmlField = $this->setDynamicField($field, $view, $viewType, $lang, $viewName, $listViewName, $spacerCounter, $placeholders, $dbkey, false);
if (ComponentbuilderHelper::checkString($xmlField))
$newxmlField = $this->setDynamicField($field, $view, $viewType, $lang, $viewName, $listViewName, $spacerCounter, $placeholders, $dbkey, false);
// tmp hack untill this whole area is also done in xml (TODO)
if (isset($newxmlField->fieldXML))
{
$xmlField = dom_import_simplexml($newxmlField->fieldXML);
$xmlField = PHP_EOL."\t<!-- ".$newxmlField->comment.' -->'.PHP_EOL."\t".$this->xmlPrettyPrint($xmlField, 'field');
}
if (isset($xmlField) && ComponentbuilderHelper::checkString($xmlField))
{
$this->configFieldSetsCustomField[$field['tabname']][] = $xmlField;
// set global params to db on install

View File

@ -318,6 +318,7 @@ class Infusion extends Interpretation
&& ComponentbuilderHelper::checkString($this->customScriptBuilder['php_document'][$viewName_single]))
{
// ###DOCUMENT_CUSTOM_PHP### <<<DYNAMIC>>>
$this->customScriptBuilder['php_document'][$viewName_single] = str_replace('$document->', '$this->document->', $this->customScriptBuilder['php_document'][$viewName_single]);
$this->fileContentDynamic[$viewName_single]['###DOCUMENT_CUSTOM_PHP###']
= PHP_EOL.$this->setPlaceholders(
$this->customScriptBuilder['php_document'][$viewName_single],