From e905aa895f970a13089f6c4418f6a11de2c6db2c Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Thu, 3 May 2018 01:12:06 +0200 Subject: [PATCH] Fixed gh-272 by updating the table method generateAlias to also make use of the custom alias builder values. --- README.md | 2 +- admin/README.txt | 2 +- admin/compiler/joomla_3/JTable.php | 25 +------- admin/helpers/compiler/e_Interpretation.php | 58 +++++++++++++++++++ admin/helpers/compiler/f_Infusion.php | 3 + admin/tables/admin_fields.php | 46 +++++++-------- admin/tables/admin_fields_conditions.php | 46 +++++++-------- admin/tables/admin_view.php | 33 ++++------- admin/tables/component_admin_views.php | 46 +++++++-------- admin/tables/component_config.php | 46 +++++++-------- admin/tables/component_custom_admin_menus.php | 46 +++++++-------- admin/tables/component_custom_admin_views.php | 46 +++++++-------- admin/tables/component_dashboard.php | 46 +++++++-------- admin/tables/component_files_folders.php | 46 +++++++-------- admin/tables/component_mysql_tweaks.php | 46 +++++++-------- admin/tables/component_site_views.php | 46 +++++++-------- admin/tables/component_updates.php | 46 +++++++-------- admin/tables/custom_admin_view.php | 46 +++++++-------- admin/tables/custom_code.php | 46 +++++++-------- admin/tables/dynamic_get.php | 46 +++++++-------- admin/tables/field.php | 46 +++++++-------- admin/tables/fieldtype.php | 46 +++++++-------- admin/tables/help_document.php | 46 +++++++-------- admin/tables/joomla_component.php | 46 +++++++-------- admin/tables/language.php | 46 +++++++-------- admin/tables/language_translation.php | 46 +++++++-------- admin/tables/layout.php | 46 +++++++-------- admin/tables/library.php | 46 +++++++-------- admin/tables/library_config.php | 46 +++++++-------- admin/tables/library_files_folders_urls.php | 46 +++++++-------- admin/tables/server.php | 46 +++++++-------- admin/tables/site_view.php | 46 +++++++-------- admin/tables/snippet.php | 46 +++++++-------- admin/tables/snippet_type.php | 46 +++++++-------- admin/tables/template.php | 46 +++++++-------- admin/tables/validation_rule.php | 46 +++++++-------- 36 files changed, 764 insertions(+), 739 deletions(-) diff --git a/README.md b/README.md index f112775c4..27a1f929f 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ Component Builder is mapped as a component in itself on my local development env + *Version*: 2.7.7 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **193966** ++ *Line count*: **193953** + *Field count*: **1027** + *File count*: **1201** + *Folder count*: **193** diff --git a/admin/README.txt b/admin/README.txt index f112775c4..27a1f929f 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -130,7 +130,7 @@ Component Builder is mapped as a component in itself on my local development env + *Version*: 2.7.7 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **193966** ++ *Line count*: **193953** + *Field count*: **1027** + *File count*: **1201** + *Folder count*: **193** diff --git a/admin/compiler/joomla_3/JTable.php b/admin/compiler/joomla_3/JTable.php index 63ebbd9ee..67b5d48c4 100644 --- a/admin/compiler/joomla_3/JTable.php +++ b/admin/compiler/joomla_3/JTable.php @@ -323,29 +323,6 @@ class ###Component###Table###View### extends JTable $asset->loadByName('com_###component###'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; - } + }###GENERATENEWALIAS### } diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index e61231c0c..b12efcd1f 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -5754,6 +5754,64 @@ class Interpretation extends Fields return ''; } + public function setGenerateNewAlias($viewName_single) + { + // make sure this view has an alias + if (isset($this->customAliasBuilder[$viewName_single]) || isset($this->titleBuilder[$viewName_single])) + { + // set the title stuff + if (isset($this->customAliasBuilder[$viewName_single])) + { + $titles = array_values($this->customAliasBuilder[$viewName_single]); + } + else + { + $titles = array($this->titleBuilder[$viewName_single]); + } + // reset the bucket + $titleData = array(); + // load the dynamic title builder + foreach ($titles as $title) + { + $titleData[] = "\$this->" . $title; + } + // rest the new function + $newFunction = array(); + $newFunction[] = PHP_EOL . PHP_EOL . "\t/**"; + $newFunction[] = "\t* Generate a valid alias from title / date."; + $newFunction[] = "\t* Remains public to be able to check for duplicated alias before saving"; + $newFunction[] = "\t*"; + $newFunction[] = "\t* @return string"; + $newFunction[] = "\t*/"; + $newFunction[] = "\tpublic function generateAlias()"; + $newFunction[] = "\t{"; + $newFunction[] = "\t\tif (empty(\$this->alias))"; + $newFunction[] = "\t\t{"; + $newFunction[] = "\t\t\t\$this->alias = ".implode(".' '.",$titleData).';'; + $newFunction[] = "\t\t}"; + $newFunction[] = PHP_EOL ."\t\t\$this->alias = JApplication::stringURLSafe(\$this->alias);"; + $newFunction[] = PHP_EOL ."\t\tif (trim(str_replace('-', '', \$this->alias)) == '')"; + $newFunction[] = "\t\t{"; + $newFunction[] = "\t\t\t\$this->alias = JFactory::getDate()->format('Y-m-d-H-i-s');"; + $newFunction[] = "\t\t}"; + $newFunction[] = PHP_EOL ."\t\treturn \$this->alias;"; + $newFunction[] = "\t}"; + return implode(PHP_EOL, $newFunction); + } + // rest the new function + $newFunction = array(); + $newFunction[] = PHP_EOL . PHP_EOL . "\t/**"; + $newFunction[] = "\t* This view does not actually have an alias"; + $newFunction[] = "\t*"; + $newFunction[] = "\t* @return bool"; + $newFunction[] = "\t*/"; + $newFunction[] = "\tpublic function generateAlias()"; + $newFunction[] = "\t{"; + $newFunction[] = "\t\treturn false;"; + $newFunction[] = "\t}"; + return implode(PHP_EOL, $newFunction); + } + public function setInstall() { if (isset($this->queryBuilder) && ComponentbuilderHelper::checkArray($this->queryBuilder)) diff --git a/admin/helpers/compiler/f_Infusion.php b/admin/helpers/compiler/f_Infusion.php index 53a43be1a..5f900f1ed 100644 --- a/admin/helpers/compiler/f_Infusion.php +++ b/admin/helpers/compiler/f_Infusion.php @@ -514,6 +514,9 @@ class Infusion extends Interpretation // ###GENERATENEWTITLE### <<>> $this->fileContentDynamic[$viewName_single]['###GENERATENEWTITLE###'] = $this->setGenerateNewTitle($viewName_single); + // ###GENERATENEWALIAS### <<>> + $this->fileContentDynamic[$viewName_single]['###GENERATENEWALIAS###'] = $this->setGenerateNewAlias($viewName_single); + // ###MODEL_BATCH_COPY### <<>> $this->fileContentDynamic[$viewName_single]['###MODEL_BATCH_COPY###'] = $this->setBatchCopy($viewName_single); diff --git a/admin/tables/admin_fields.php b/admin/tables/admin_fields.php index a47bfb352..0094f10f2 100644 --- a/admin/tables/admin_fields.php +++ b/admin/tables/admin_fields.php @@ -323,29 +323,29 @@ class ComponentbuilderTableAdmin_fields extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->admin_view; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/admin_fields_conditions.php b/admin/tables/admin_fields_conditions.php index 0c51e93a5..fac375eb1 100644 --- a/admin/tables/admin_fields_conditions.php +++ b/admin/tables/admin_fields_conditions.php @@ -323,29 +323,29 @@ class ComponentbuilderTableAdmin_fields_conditions extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->admin_view; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/admin_view.php b/admin/tables/admin_view.php index 3066e00c1..20ef65eb4 100644 --- a/admin/tables/admin_view.php +++ b/admin/tables/admin_view.php @@ -323,29 +323,16 @@ class ComponentbuilderTableAdmin_view extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * This view does not actually have an alias + * + * @return bool + */ + public function generateAlias() + { + return false; } } diff --git a/admin/tables/component_admin_views.php b/admin/tables/component_admin_views.php index 9b4628c8e..eb7df6f76 100644 --- a/admin/tables/component_admin_views.php +++ b/admin/tables/component_admin_views.php @@ -323,29 +323,29 @@ class ComponentbuilderTableComponent_admin_views extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->joomla_component; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/component_config.php b/admin/tables/component_config.php index 36a2c9fd2..a3ebe9bd2 100644 --- a/admin/tables/component_config.php +++ b/admin/tables/component_config.php @@ -323,29 +323,29 @@ class ComponentbuilderTableComponent_config extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->joomla_component; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/component_custom_admin_menus.php b/admin/tables/component_custom_admin_menus.php index a0839cd4f..f9781c7e3 100644 --- a/admin/tables/component_custom_admin_menus.php +++ b/admin/tables/component_custom_admin_menus.php @@ -323,29 +323,29 @@ class ComponentbuilderTableComponent_custom_admin_menus extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->joomla_component; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/component_custom_admin_views.php b/admin/tables/component_custom_admin_views.php index 30a75fcde..7914997d2 100644 --- a/admin/tables/component_custom_admin_views.php +++ b/admin/tables/component_custom_admin_views.php @@ -323,29 +323,29 @@ class ComponentbuilderTableComponent_custom_admin_views extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->joomla_component; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/component_dashboard.php b/admin/tables/component_dashboard.php index 461fc660b..271a12897 100644 --- a/admin/tables/component_dashboard.php +++ b/admin/tables/component_dashboard.php @@ -323,29 +323,29 @@ class ComponentbuilderTableComponent_dashboard extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->joomla_component; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/component_files_folders.php b/admin/tables/component_files_folders.php index 6ab101da6..0949c388e 100644 --- a/admin/tables/component_files_folders.php +++ b/admin/tables/component_files_folders.php @@ -323,29 +323,29 @@ class ComponentbuilderTableComponent_files_folders extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->joomla_component; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/component_mysql_tweaks.php b/admin/tables/component_mysql_tweaks.php index 0db29208b..351386e3e 100644 --- a/admin/tables/component_mysql_tweaks.php +++ b/admin/tables/component_mysql_tweaks.php @@ -323,29 +323,29 @@ class ComponentbuilderTableComponent_mysql_tweaks extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->joomla_component; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/component_site_views.php b/admin/tables/component_site_views.php index 28aa866e3..f5ba92714 100644 --- a/admin/tables/component_site_views.php +++ b/admin/tables/component_site_views.php @@ -323,29 +323,29 @@ class ComponentbuilderTableComponent_site_views extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->joomla_component; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/component_updates.php b/admin/tables/component_updates.php index 1870c7b15..9716e9b5c 100644 --- a/admin/tables/component_updates.php +++ b/admin/tables/component_updates.php @@ -323,29 +323,29 @@ class ComponentbuilderTableComponent_updates extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->joomla_component; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/custom_admin_view.php b/admin/tables/custom_admin_view.php index f60592998..fc8eeb041 100644 --- a/admin/tables/custom_admin_view.php +++ b/admin/tables/custom_admin_view.php @@ -323,29 +323,29 @@ class ComponentbuilderTableCustom_admin_view extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/custom_code.php b/admin/tables/custom_code.php index 2dd802292..3d2e54383 100644 --- a/admin/tables/custom_code.php +++ b/admin/tables/custom_code.php @@ -323,29 +323,29 @@ class ComponentbuilderTableCustom_code extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->component; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/dynamic_get.php b/admin/tables/dynamic_get.php index e09939cc5..35d71c724 100644 --- a/admin/tables/dynamic_get.php +++ b/admin/tables/dynamic_get.php @@ -323,29 +323,29 @@ class ComponentbuilderTableDynamic_get extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/field.php b/admin/tables/field.php index 11fc0be19..7f661ee12 100644 --- a/admin/tables/field.php +++ b/admin/tables/field.php @@ -323,29 +323,29 @@ class ComponentbuilderTableField extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/fieldtype.php b/admin/tables/fieldtype.php index 0d16ef0cb..929c03a22 100644 --- a/admin/tables/fieldtype.php +++ b/admin/tables/fieldtype.php @@ -323,29 +323,29 @@ class ComponentbuilderTableFieldtype extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/help_document.php b/admin/tables/help_document.php index a51c35db3..5d4b1c51c 100644 --- a/admin/tables/help_document.php +++ b/admin/tables/help_document.php @@ -323,29 +323,29 @@ class ComponentbuilderTableHelp_document extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->title; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/joomla_component.php b/admin/tables/joomla_component.php index 9fe5134a5..23621995b 100644 --- a/admin/tables/joomla_component.php +++ b/admin/tables/joomla_component.php @@ -323,29 +323,29 @@ class ComponentbuilderTableJoomla_component extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->system_name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/language.php b/admin/tables/language.php index 2ea6bdf11..ad416b5da 100644 --- a/admin/tables/language.php +++ b/admin/tables/language.php @@ -323,29 +323,29 @@ class ComponentbuilderTableLanguage extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/language_translation.php b/admin/tables/language_translation.php index 65f61f083..675e45c78 100644 --- a/admin/tables/language_translation.php +++ b/admin/tables/language_translation.php @@ -323,29 +323,29 @@ class ComponentbuilderTableLanguage_translation extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->source; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/layout.php b/admin/tables/layout.php index cc928a24e..3ef3dc06b 100644 --- a/admin/tables/layout.php +++ b/admin/tables/layout.php @@ -323,29 +323,29 @@ class ComponentbuilderTableLayout extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/library.php b/admin/tables/library.php index 174d8cc26..8713e0052 100644 --- a/admin/tables/library.php +++ b/admin/tables/library.php @@ -323,29 +323,29 @@ class ComponentbuilderTableLibrary extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/library_config.php b/admin/tables/library_config.php index 975949bc3..fe401acea 100644 --- a/admin/tables/library_config.php +++ b/admin/tables/library_config.php @@ -323,29 +323,29 @@ class ComponentbuilderTableLibrary_config extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->library; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/library_files_folders_urls.php b/admin/tables/library_files_folders_urls.php index d5ca57a49..062348c73 100644 --- a/admin/tables/library_files_folders_urls.php +++ b/admin/tables/library_files_folders_urls.php @@ -323,29 +323,29 @@ class ComponentbuilderTableLibrary_files_folders_urls extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->library; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/server.php b/admin/tables/server.php index f22730970..fc8dbe6b1 100644 --- a/admin/tables/server.php +++ b/admin/tables/server.php @@ -323,29 +323,29 @@ class ComponentbuilderTableServer extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/site_view.php b/admin/tables/site_view.php index 08c8456cd..3dd937b80 100644 --- a/admin/tables/site_view.php +++ b/admin/tables/site_view.php @@ -323,29 +323,29 @@ class ComponentbuilderTableSite_view extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/snippet.php b/admin/tables/snippet.php index bafd87f97..f2e407d91 100644 --- a/admin/tables/snippet.php +++ b/admin/tables/snippet.php @@ -323,29 +323,29 @@ class ComponentbuilderTableSnippet extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/snippet_type.php b/admin/tables/snippet_type.php index cb4e691ba..392c3c56a 100644 --- a/admin/tables/snippet_type.php +++ b/admin/tables/snippet_type.php @@ -323,29 +323,29 @@ class ComponentbuilderTableSnippet_type extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/template.php b/admin/tables/template.php index 1af880724..ae36ced8a 100644 --- a/admin/tables/template.php +++ b/admin/tables/template.php @@ -323,29 +323,29 @@ class ComponentbuilderTableTemplate extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } } diff --git a/admin/tables/validation_rule.php b/admin/tables/validation_rule.php index b270f9471..c62e199bd 100644 --- a/admin/tables/validation_rule.php +++ b/admin/tables/validation_rule.php @@ -323,29 +323,29 @@ class ComponentbuilderTableValidation_rule extends JTable $asset->loadByName('com_componentbuilder'); return $asset->id; - } - - /** - * Generate a valid alias from title / date. - * Remains public to be able to check for duplicated alias before saving - * - * @return string - */ - public function generateAlias() - { - if (empty($this->alias)) - { - $this->alias = $this->name; - } - - $this->alias = JApplication::stringURLSafe($this->alias); - - if (trim(str_replace('-', '', $this->alias)) == '') - { - $this->alias = JFactory::getDate()->format("Y-m-d-H-i-s"); - } - - return $this->alias; + } + + /** + * Generate a valid alias from title / date. + * Remains public to be able to check for duplicated alias before saving + * + * @return string + */ + public function generateAlias() + { + if (empty($this->alias)) + { + $this->alias = $this->name; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JFactory::getDate()->format('Y-m-d-H-i-s'); + } + + return $this->alias; } }