Release of v4.0.4-alpha3

Fix Save failed issue in dynamicGet. #1148. Move all [TEXT, EDITOR, TEXTAREA] fields from [NOT NULL] to [NULL]. Add the DateHelper class and improve the date methods. Add simple SessionHelper class.
This commit is contained in:
Robot 2024-10-13 22:51:58 +02:00
parent 47e47ee7bb
commit a91fc952a0
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
63 changed files with 1553 additions and 1034 deletions

View File

@ -1,15 +1,19 @@
# v4.0.4-alpha2
# v4.0.4-alpha3
- Remove all backward compatibility issues, so JCB will not need the [Backward Compatibility] plugin to run.
- Added new import powers for custom import of spreadsheets.
- Move the setDocument and _prepareDocument above the display in the site view and custom admin view.
- Update the trashhelper layout to work in Joomla 5.
- Add AllowDynamicProperties (Joomla 4+5) to view class to allow Custom Dynamic Get methods to work without issues.
- Fix Save failed issue in dynamicGet. #1148
- Move all [TEXT, EDITOR, TEXTAREA] fields from [NOT NULL] to [NULL]
- Add the DateHelper class and improve the date methods.
- Add simple SessionHelper class.
# v4.0.4-alpha
- Add [AllowDynamicProperties] in the base view class for J5
- Move the _prepareDocument above the display call in the base view class
- Remove all backward compatibility issues, so JCB will not need the [Backward Compatibility] plugin to run.
- Added new import powers for custom import of spreadsheets.
- Move the setDocument and _prepareDocument above the display in the site view and custom admin view.
- Update the trashhelper layout to work in Joomla 5.
- Add AllowDynamicProperties (Joomla 4+5) to view class to allow Custom Dynamic Get methods to work without issues.
# v4.0.3

View File

@ -3270,7 +3270,7 @@ class Com_ComponentbuilderInstallerScript implements InstallerScriptInterface
echo '<div style="background-color: #fff;" class="alert alert-info"><a target="_blank" href="https://dev.vdm.io" title="Component Builder">
<img src="components/com_componentbuilder/assets/images/vdm-component.jpg"/>
</a>
<h3>Upgrade to Version 4.0.4-alpha2 Was Successful! Let us know if anything is not working as expected.</h3></div>';
<h3>Upgrade to Version 4.0.4-alpha3 Was Successful! Let us know if anything is not working as expected.</h3></div>';
// Add/Update component in the action logs extensions table.
$this->setActionLogsExtensions();

View File

@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (4.0.4-alpha2) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (4.0.4-alpha3) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -144,13 +144,13 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 7th October, 2024
+ *Version*: 4.0.4-alpha2
+ *Last Build*: 13th October, 2024
+ *Version*: 4.0.4-alpha3
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **865648**
+ *Line count*: **869301**
+ *Field count*: **2098**
+ *File count*: **5976**
+ *File count*: **6007**
+ *Folder count*: **621**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).

View File

@ -9,7 +9,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo
Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will save you lots of time and money. A real must have!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (4.0.4-alpha2) with **ALL** its features and **ALL** concepts totally open-source and free!
You can install it quite easily and with no limitations. On [gitea](https://git.vdm.dev/joomla/Component-Builder/tags) is the latest release (4.0.4-alpha3) with **ALL** its features and **ALL** concepts totally open-source and free!
> Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -144,13 +144,13 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io)
+ *Name*: [Component Builder](https://git.vdm.dev/joomla/Component-Builder)
+ *First Build*: 30th April, 2015
+ *Last Build*: 7th October, 2024
+ *Version*: 4.0.4-alpha2
+ *Last Build*: 13th October, 2024
+ *Version*: 4.0.4-alpha3
+ *Copyright*: Copyright (C) 2015 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **865648**
+ *Line count*: **869301**
+ *Field count*: **2098**
+ *File count*: **5976**
+ *File count*: **6007**
+ *Folder count*: **621**
> This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](https://www.joomlacomponentbuilder.com).

View File

@ -104,7 +104,6 @@
label="COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_JOOMLA_COMPONENT_LABEL"
description="COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_JOOMLA_COMPONENT_DESCRIPTION"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="false"
required="true"
readonly="true"

View File

@ -104,7 +104,6 @@
label="COM_COMPONENTBUILDER_COMPONENT_CONFIG_JOOMLA_COMPONENT_LABEL"
description="COM_COMPONENTBUILDER_COMPONENT_CONFIG_JOOMLA_COMPONENT_DESCRIPTION"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="false"
required="true"
readonly="true"

View File

@ -104,7 +104,6 @@
label="COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_JOOMLA_COMPONENT_LABEL"
description="COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_MENUS_JOOMLA_COMPONENT_DESCRIPTION"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="false"
required="true"
readonly="true"

View File

@ -104,7 +104,6 @@
label="COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_VIEWS_JOOMLA_COMPONENT_LABEL"
description="COM_COMPONENTBUILDER_COMPONENT_CUSTOM_ADMIN_VIEWS_JOOMLA_COMPONENT_DESCRIPTION"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="false"
required="true"
readonly="true"

View File

@ -104,7 +104,6 @@
label="COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_JOOMLA_COMPONENT_LABEL"
description="COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_JOOMLA_COMPONENT_DESCRIPTION"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="false"
required="true"
readonly="true"
@ -174,7 +173,6 @@
label="COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_HTML_LABEL"
rows="20"
cols="30"
default=""
class="text_area tab_html"
filter="raw"
hint="COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_HTML_HINT"

View File

@ -104,7 +104,6 @@
label="COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_JOOMLA_COMPONENT_LABEL"
description="COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_JOOMLA_COMPONENT_DESCRIPTION"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="false"
required="true"
readonly="true"

View File

@ -104,7 +104,6 @@
label="COM_COMPONENTBUILDER_COMPONENT_MODULES_JOOMLA_COMPONENT_LABEL"
description="COM_COMPONENTBUILDER_COMPONENT_MODULES_JOOMLA_COMPONENT_DESCRIPTION"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="false"
required="true"
readonly="true"

View File

@ -104,7 +104,6 @@
label="COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_JOOMLA_COMPONENT_LABEL"
description="COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_JOOMLA_COMPONENT_DESCRIPTION"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="false"
required="true"
readonly="true"
@ -187,7 +186,6 @@
label="COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_IDS_LABEL"
rows="20"
cols="40"
default=""
description="COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_IDS_DESCRIPTION"
class="text_area ids_selection"
filter="raw"

View File

@ -104,7 +104,6 @@
label="COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_JOOMLA_COMPONENT_LABEL"
description="COM_COMPONENTBUILDER_COMPONENT_PLACEHOLDERS_JOOMLA_COMPONENT_DESCRIPTION"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="false"
required="true"
readonly="true"

View File

@ -104,7 +104,6 @@
label="COM_COMPONENTBUILDER_COMPONENT_PLUGINS_JOOMLA_COMPONENT_LABEL"
description="COM_COMPONENTBUILDER_COMPONENT_PLUGINS_JOOMLA_COMPONENT_DESCRIPTION"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="false"
required="true"
readonly="true"

View File

@ -104,7 +104,6 @@
label="COM_COMPONENTBUILDER_COMPONENT_ROUTER_JOOMLA_COMPONENT_LABEL"
description="COM_COMPONENTBUILDER_COMPONENT_ROUTER_JOOMLA_COMPONENT_DESCRIPTION"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="false"
required="true"
readonly="true"

View File

@ -104,7 +104,6 @@
label="COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_JOOMLA_COMPONENT_LABEL"
description="COM_COMPONENTBUILDER_COMPONENT_SITE_VIEWS_JOOMLA_COMPONENT_DESCRIPTION"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="false"
required="true"
readonly="true"

View File

@ -104,7 +104,6 @@
label="COM_COMPONENTBUILDER_COMPONENT_UPDATES_JOOMLA_COMPONENT_LABEL"
description="COM_COMPONENTBUILDER_COMPONENT_UPDATES_JOOMLA_COMPONENT_DESCRIPTION"
class="list_class"
layout="joomla.form.field.list-fancy-select"
multiple="false"
required="true"
readonly="true"
@ -159,7 +158,6 @@
label="COM_COMPONENTBUILDER_COMPONENT_UPDATES_MYSQL_LABEL"
rows="30"
cols="15"
default=""
description="COM_COMPONENTBUILDER_COMPONENT_UPDATES_MYSQL_DESCRIPTION"
class="text_area mysql_update"
filter="raw"

View File

@ -332,7 +332,6 @@
label="COM_COMPONENTBUILDER_FIELDTYPE_EXAMPLE_LABEL"
rows="2"
cols="15"
default=""
description="COM_COMPONENTBUILDER_FIELDTYPE_EXAMPLE_DESCRIPTION"
message="COM_COMPONENTBUILDER_FIELDTYPE_EXAMPLE_MESSAGE"
class="text_area span12"

View File

@ -143,7 +143,6 @@
label="COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATES_MYSQL_LABEL"
rows="30"
cols="15"
default=""
description="COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATES_MYSQL_DESCRIPTION"
class="text_area mysql_update"
filter="raw"

View File

@ -143,7 +143,6 @@
label="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_MYSQL_LABEL"
rows="30"
cols="15"
default=""
description="COM_COMPONENTBUILDER_JOOMLA_PLUGIN_UPDATES_MYSQL_DESCRIPTION"
class="text_area mysql_update"
filter="raw"

View File

@ -166,7 +166,6 @@
label="COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_LABEL"
rows="15"
cols="5"
default=""
description="COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_DESCRIPTION"
class="input-xxlarge span12"
hint="COM_COMPONENTBUILDER_SERVER_PRIVATE_KEY_HINT"

View File

@ -4171,9 +4171,9 @@ COM_COMPONENTBUILDER_CUSTOM_CODE_HASHENDTARGET_DESCRIPTION="The end hash target
COM_COMPONENTBUILDER_CUSTOM_CODE_HASHENDTARGET_HINT="autogenerated md5 hash"
COM_COMPONENTBUILDER_CUSTOM_CODE_HASHENDTARGET_LABEL="End Hash Target"
COM_COMPONENTBUILDER_CUSTOM_CODE_HASHENDTARGET_MESSAGE="Error! Please add some text here."
COM_COMPONENTBUILDER_CUSTOM_CODE_HASHTARGET_DESCRIPTION="The start hash target to help insert the code at the correct place, if the line position change. This hash is the md5 of a few lines above the custom code"
COM_COMPONENTBUILDER_CUSTOM_CODE_HASHTARGET_DESCRIPTION="The end hash target to help insert the code until the correct place, if the line position change. This hash is the md5 of a few lines below the custom code"
COM_COMPONENTBUILDER_CUSTOM_CODE_HASHTARGET_HINT="autogenerated md5 hash"
COM_COMPONENTBUILDER_CUSTOM_CODE_HASHTARGET_LABEL="Start Hash Target"
COM_COMPONENTBUILDER_CUSTOM_CODE_HASHTARGET_LABEL="End Hash Target"
COM_COMPONENTBUILDER_CUSTOM_CODE_HASHTARGET_MESSAGE="Error! Please add some text here."
COM_COMPONENTBUILDER_CUSTOM_CODE_HASH_AUTOMATION="Hash (automation)"
COM_COMPONENTBUILDER_CUSTOM_CODE_HTML="HTML"

File diff suppressed because one or more lines are too long

View File

@ -49,6 +49,7 @@ use VDM\Joomla\Componentbuilder\Compiler\Utilities\FieldHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as CompilerFactory;
use VDM\Joomla\Utilities\Base64Helper;
use VDM\Joomla\FOF\Encrypt\AES;
use VDM\Joomla\Utilities\DateHelper;
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
use VDM\Joomla\Utilities\String\FieldHelper as StringFieldHelper;
use VDM\Joomla\Utilities\String\TypeHelper;
@ -2166,7 +2167,7 @@ abstract class ComponentbuilderHelper
{
if (!isset(self::$session) || !ObjectHelper::check(self::$session))
{
self::$session = Factory::getSession();
self::$session = Factory::getApplication()->getSession();
}
// set the defaults
self::setSessionDefaults();
@ -2179,7 +2180,7 @@ abstract class ComponentbuilderHelper
{
if (!isset(self::$session) || !ObjectHelper::check(self::$session))
{
self::$session = Factory::getSession();
self::$session = Factory::getApplication()->getSession();
}
// set to local memory to speed up program
self::$localSession[$key] = $value;
@ -2194,7 +2195,7 @@ abstract class ComponentbuilderHelper
{
if (!isset(self::$session) || !ObjectHelper::check(self::$session))
{
self::$session = Factory::getSession();
self::$session = Factory::getApplication()->getSession();
}
// check if in local memory
if (!isset(self::$localSession[$key]))
@ -5230,193 +5231,245 @@ abstract class ComponentbuilderHelper
/**
* Change to nice fancy date
* Convert a date to a human-readable fancy format (e.g., "1st of January 2024").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Formatted date.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::fancyDate($date, $checkStamp);
*/
public static function fancyDate($date, $check_stamp = true)
public static function fancyDate($date, bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('jS \o\f F Y',$date);
return DateHelper::fancyDate($date, $checkStamp);
}
/**
* get date based in period past
* Get a formatted date based on the time period (dynamic format based on age of the date).
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Formatted date.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::fancyDynamicDate($date, $checkStamp);
*/
public static function fancyDynamicDate($date, $check_stamp = true)
public static function fancyDynamicDate($date, bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
// older then year
$lastyear = date("Y", strtotime("-1 year"));
$tragetyear = date("Y", $date);
if ($tragetyear <= $lastyear)
{
return date('m/d/y', $date);
}
// same day
$yesterday = strtotime("-1 day");
if ($date > $yesterday)
{
return date('g:i A', $date);
}
// just month day
return date('M j', $date);
return DateHelper::fancyDynamicDate($date, $checkStamp);
}
/**
* Change to nice fancy day time and date
* Convert a date to a human-readable day, time, and date format (e.g., "Mon 12am 1st of January 2024").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Formatted day, time, and date.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::fancyDayTimeDate($date, $checkStamp);
*/
public static function fancyDayTimeDate($time, $check_stamp = true)
public static function fancyDayTimeDate($date, bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($time))
{
$time = strtotime($time);
}
return date('D ga jS \o\f F Y',$time);
return DateHelper::fancyDayTimeDate($date, $checkStamp);
}
/**
* Change to nice fancy time and date
* Convert a date to a human-readable time and date format (e.g., "(12:00) 1st of January 2024").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Formatted time and date.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::fancyDateTime($date, $checkStamp);
*/
public static function fancyDateTime($time, $check_stamp = true)
public static function fancyDateTime($date, bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($time))
{
$time = strtotime($time);
}
return date('(G:i) jS \o\f F Y',$time);
return DateHelper::fancyDateTime($date, $checkStamp);
}
/**
* Change to nice hour:minutes time
* Convert a time to a human-readable format (e.g., "12:00").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Formatted time.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::fancyTime($date, $checkStamp);
*/
public static function fancyTime($time, $check_stamp = true)
public static function fancyTime($date, bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($time))
{
$time = strtotime($time);
}
return date('G:i',$time);
return DateHelper::fancyTime($date, $checkStamp);
}
/**
* set the date day as Sunday through Saturday
* Convert a date to the day name (e.g., "Sunday").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Day name.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::setDayName($date, $checkStamp);
*/
public static function setDayName($date, $check_stamp = true)
public static function setDayName($date, bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('l', $date);
return DateHelper::setDayName($date, $checkStamp);
}
/**
* set the date month as January through December
* Convert a date to the month name (e.g., "January").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Month name.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::setMonthName($date, $checkStamp);
*/
public static function setMonthName($date, $check_stamp = true)
public static function setMonthName($date, bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('F', $date);
return DateHelper::setMonthName($date, $checkStamp);
}
/**
* set the date day as 1st
* Convert a date to the day with suffix (e.g., "1st").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Day with suffix.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::setDay($date, $checkStamp);
*/
public static function setDay($date, $check_stamp = true)
public static function setDay($date, bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('jS', $date);
return DateHelper::setDay($date, $checkStamp);
}
/**
* set the date month as 5
* Convert a date to the numeric month (e.g., "5").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Numeric month.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::setMonth($date, $checkStamp);
*/
public static function setMonth($date, $check_stamp = true)
public static function setMonth($date, bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('n', $date);
return DateHelper::setMonth($date, $checkStamp);
}
/**
* set the date year as 2004 (for charts)
* Convert a date to the full year (e.g., "2024").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Full year.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::setYear($date, $checkStamp);
*/
public static function setYear($date, $check_stamp = true)
public static function setYear($date, bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('Y', $date);
return DateHelper::setYear($date, $checkStamp);
}
/**
* set the date as 2004/05 (for charts)
* Convert a date to a year/month format (e.g., "2024/05").
*
* @param string|int $date The date as a string or timestamp.
* @param string $spacer The spacer between year and month.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Year/Month format.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::setYearMonth($date, $spacer, $checkStamp);
*/
public static function setYearMonth($date, $spacer = '/', $check_stamp = true)
public static function setYearMonth($date, string $spacer = '/', bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('Y' . $spacer . 'm', $date);
return DateHelper::setYearMonth($date, $spacer, $checkStamp);
}
/**
* set the date as 2004/05/03 (for charts)
* Convert a date to a year/month/day format (e.g., "2024/05/03").
*
* @param string|int $date The date as a string or timestamp.
* @param string $spacer The spacer between year and month.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Year/Month/Day format.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::setYearMonthDay($date, $spacer, $checkStamp);
*/
public static function setYearMonthDay($date, $spacer = '/', $check_stamp = true)
public static function setYearMonthDay($date, string $spacer = '/', bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('Y' . $spacer . 'm' . $spacer . 'd', $date);
return DateHelper::setYearMonthDay($date, $spacer, $checkStamp);
}
/**
* set the date as 03/05/2004
* Convert a date to a day/month/year format (e.g., "03/05/2024").
*
* @param string|int $date The date as a string or timestamp.
* @param string $spacer The spacer between year and month.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Day/Month/Year format.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::setDayMonthYear($date, $spacer, $checkStamp);
*/
public static function setDayMonthYear($date, $spacer = '/', $check_stamp = true)
public static function setDayMonthYear($date, string $spacer = '/', bool $checkStamp = true): string
{
if ($check_stamp && !self::isValidTimeStamp($date))
{
$date = strtotime($date);
}
return date('d' . $spacer . 'm' . $spacer . 'Y', $date);
return DateHelper::setDayMonthYear($date, $spacer, $checkStamp);
}
/**
* Check if string is a valid time stamp
* Convert a date string to a valid timestamp.
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return int The valid timestamp.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::getValidTimestamp($date, $checkStamp);
*/
public static function isValidTimeStamp($timestamp)
public static function getValidTimestamp($date, bool $checkStamp): int
{
return ((int) $timestamp === $timestamp)
&& ($timestamp <= PHP_INT_MAX)
&& ($timestamp >= ~PHP_INT_MAX);
return DateHelper::getValidTimestamp($date, $checkStamp);
}
/**
* Check if string is a valid date
* https://www.php.net/manual/en/function.checkdate.php#113205
* Check if the input is a valid Unix timestamp.
*
* @param mixed $timestamp The timestamp to validate.
*
* @return bool True if valid timestamp, false otherwise.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::isValidTimeStamp($timestamp);
*/
public static function isValidateDate($date, $format = 'Y-m-d H:i:s')
public static function isValidTimeStamp($timestamp): bool
{
$d = DateTime::createFromFormat($format, $date);
return $d && $d->format($format) == $date;
return DateHelper::isValidTimeStamp($timestamp);
}
/**
* Check if a string is a valid date according to the specified format.
*
* @param string $date The date string to validate.
* @param string $format The format to check against (default is 'Y-m-d H:i:s').
*
* @return bool True if valid date, false otherwise.
* @since 3.0.0
* @deprecated 4.0.0 Use DateHelper::isValidateDate($date, $format);
*/
public static function isValidateDate($date, string $format = 'Y-m-d H:i:s'): bool
{
return DateHelper::isValidateDate($date, $format);
}
/**

View File

@ -29,6 +29,7 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -147,7 +148,7 @@ class Admin_fields_relationsModel extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('admin_fields_relations__'.$id))
if (($vdm = SessionHelper::get('admin_fields_relations__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -155,17 +156,17 @@ class Admin_fields_relationsModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'admin_fields_relations__'.$id);
ComponentbuilderHelper::set('admin_fields_relations__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'admin_fields_relations__'.$id);
SessionHelper::set('admin_fields_relations__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -219,7 +220,7 @@ class Admin_fields_relationsModel extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('admin_fields_relations__'.$id))
if (($vdm = SessionHelper::get('admin_fields_relations__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -227,17 +228,17 @@ class Admin_fields_relationsModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'admin_fields_relations__'.$id);
ComponentbuilderHelper::set('admin_fields_relations__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'admin_fields_relations__'.$id);
SessionHelper::set('admin_fields_relations__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}

View File

@ -29,6 +29,7 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -296,7 +297,7 @@ class Admin_viewModel extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('admin_view__'.$id))
if (($vdm = SessionHelper::get('admin_view__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -304,17 +305,17 @@ class Admin_viewModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'admin_view__'.$id);
ComponentbuilderHelper::set('admin_view__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'admin_view__'.$id);
SessionHelper::set('admin_view__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -644,7 +645,7 @@ class Admin_viewModel extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('admin_view__'.$id))
if (($vdm = SessionHelper::get('admin_view__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -652,17 +653,17 @@ class Admin_viewModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'admin_view__'.$id);
ComponentbuilderHelper::set('admin_view__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'admin_view__'.$id);
SessionHelper::set('admin_view__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
// update the fields
@ -1073,7 +1074,7 @@ class Admin_viewModel extends AdminModel
// change to false
$form->setFieldAttribute($requiredField, 'required', 'false');
// also clear the data set
$data[$requiredField] = '';
unset($data[$requiredField]);
}
}
}

View File

@ -36,6 +36,7 @@ use VDM\Joomla\Componentbuilder\Search\Factory as SearchFactory;
use VDM\Joomla\Utilities\ArrayHelper as UtilitiesArrayHelper;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\GuidHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\Base64Helper;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\FieldHelper;
use VDM\Joomla\Utilities\FormHelper;
@ -1674,7 +1675,7 @@ class AjaxModel extends ListModel
* @var array
* @since 3.0.13
*/
protected $viewid = [];
protected array $viewid = [];
/**
* Get the view details via the session
@ -1694,7 +1695,7 @@ class AjaxModel extends ListModel
if ($vdm)
{
// set view and id
if ($view = ComponentbuilderHelper::get($vdm))
if (($view = SessionHelper::get($vdm)) !== null)
{
$current = (array) explode('__', $view);
if (StringHelper::check($current[0]) && isset($current[1]) && is_numeric($current[1]))
@ -1707,7 +1708,7 @@ class AjaxModel extends ListModel
}
}
// set GUID if found
if (($guid = ComponentbuilderHelper::get($vdm . '__guid')) !== false)
if (($guid = SessionHelper::get($vdm . '__guid')) !== null)
{
if (GuidHelper::valid($guid))
{
@ -1715,7 +1716,7 @@ class AjaxModel extends ListModel
}
}
// set return if found
if (($return = ComponentbuilderHelper::get($vdm . '__return')) !== false)
if (($return = SessionHelper::get($vdm . '__return')) !== null)
{
if (StringHelper::check($return))
{

View File

@ -29,6 +29,7 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -151,7 +152,7 @@ class Class_extendsModel extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('class_extends__'.$id))
if (($vdm = SessionHelper::get('class_extends__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -159,17 +160,17 @@ class Class_extendsModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'class_extends__'.$id);
ComponentbuilderHelper::set('class_extends__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'class_extends__'.$id);
SessionHelper::set('class_extends__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -227,7 +228,7 @@ class Class_extendsModel extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('class_extends__'.$id))
if (($vdm = SessionHelper::get('class_extends__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -235,17 +236,17 @@ class Class_extendsModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'class_extends__'.$id);
ComponentbuilderHelper::set('class_extends__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'class_extends__'.$id);
SessionHelper::set('class_extends__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}

View File

@ -29,6 +29,7 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -155,7 +156,7 @@ class Class_methodModel extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('class_method__'.$id))
if (($vdm = SessionHelper::get('class_method__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -163,17 +164,17 @@ class Class_methodModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'class_method__'.$id);
ComponentbuilderHelper::set('class_method__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'class_method__'.$id);
SessionHelper::set('class_method__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -237,7 +238,7 @@ class Class_methodModel extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('class_method__'.$id))
if (($vdm = SessionHelper::get('class_method__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -245,17 +246,17 @@ class Class_methodModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'class_method__'.$id);
ComponentbuilderHelper::set('class_method__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'class_method__'.$id);
SessionHelper::set('class_method__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -611,7 +612,7 @@ class Class_methodModel extends AdminModel
// change to false
$form->setFieldAttribute($requiredField, 'required', 'false');
// also clear the data set
$data[$requiredField] = '';
unset($data[$requiredField]);
}
}
}

View File

@ -29,6 +29,7 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -152,7 +153,7 @@ class Class_propertyModel extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('class_property__'.$id))
if (($vdm = SessionHelper::get('class_property__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -160,17 +161,17 @@ class Class_propertyModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'class_property__'.$id);
ComponentbuilderHelper::set('class_property__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'class_property__'.$id);
SessionHelper::set('class_property__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -228,7 +229,7 @@ class Class_propertyModel extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('class_property__'.$id))
if (($vdm = SessionHelper::get('class_property__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -236,17 +237,17 @@ class Class_propertyModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'class_property__'.$id);
ComponentbuilderHelper::set('class_property__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'class_property__'.$id);
SessionHelper::set('class_property__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -602,7 +603,7 @@ class Class_propertyModel extends AdminModel
// change to false
$form->setFieldAttribute($requiredField, 'required', 'false');
// also clear the data set
$data[$requiredField] = '';
unset($data[$requiredField]);
}
}
}

View File

@ -29,6 +29,7 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -155,7 +156,7 @@ class Component_dashboardModel extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('component_dashboard__'.$id))
if (($vdm = SessionHelper::get('component_dashboard__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -163,17 +164,17 @@ class Component_dashboardModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'component_dashboard__'.$id);
ComponentbuilderHelper::set('component_dashboard__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'component_dashboard__'.$id);
SessionHelper::set('component_dashboard__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -233,7 +234,7 @@ class Component_dashboardModel extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('component_dashboard__'.$id))
if (($vdm = SessionHelper::get('component_dashboard__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -241,17 +242,17 @@ class Component_dashboardModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'component_dashboard__'.$id);
ComponentbuilderHelper::set('component_dashboard__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'component_dashboard__'.$id);
SessionHelper::set('component_dashboard__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
// update the fields

View File

@ -29,6 +29,7 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -156,7 +157,7 @@ class Component_routerModel extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('component_router__'.$id))
if (($vdm = SessionHelper::get('component_router__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -164,17 +165,17 @@ class Component_routerModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'component_router__'.$id);
ComponentbuilderHelper::set('component_router__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'component_router__'.$id);
SessionHelper::set('component_router__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -246,7 +247,7 @@ class Component_routerModel extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('component_router__'.$id))
if (($vdm = SessionHelper::get('component_router__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -254,17 +255,17 @@ class Component_routerModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'component_router__'.$id);
ComponentbuilderHelper::set('component_router__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'component_router__'.$id);
SessionHelper::set('component_router__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}

View File

@ -29,6 +29,7 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -213,7 +214,7 @@ class Custom_admin_viewModel extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('custom_admin_view__'.$id))
if (($vdm = SessionHelper::get('custom_admin_view__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -221,17 +222,17 @@ class Custom_admin_viewModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'custom_admin_view__'.$id);
ComponentbuilderHelper::set('custom_admin_view__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'custom_admin_view__'.$id);
SessionHelper::set('custom_admin_view__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -381,7 +382,7 @@ class Custom_admin_viewModel extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('custom_admin_view__'.$id))
if (($vdm = SessionHelper::get('custom_admin_view__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -389,17 +390,17 @@ class Custom_admin_viewModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'custom_admin_view__'.$id);
ComponentbuilderHelper::set('custom_admin_view__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'custom_admin_view__'.$id);
SessionHelper::set('custom_admin_view__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}

View File

@ -29,6 +29,7 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -167,7 +168,7 @@ class Custom_codeModel extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('custom_code__'.$id))
if (($vdm = SessionHelper::get('custom_code__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -175,17 +176,17 @@ class Custom_codeModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'custom_code__'.$id);
ComponentbuilderHelper::set('custom_code__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'custom_code__'.$id);
SessionHelper::set('custom_code__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -237,7 +238,7 @@ class Custom_codeModel extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('custom_code__'.$id))
if (($vdm = SessionHelper::get('custom_code__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -245,17 +246,17 @@ class Custom_codeModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'custom_code__'.$id);
ComponentbuilderHelper::set('custom_code__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'custom_code__'.$id);
SessionHelper::set('custom_code__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -604,7 +605,7 @@ class Custom_codeModel extends AdminModel
// change to false
$form->setFieldAttribute($requiredField, 'required', 'false');
// also clear the data set
$data[$requiredField] = '';
unset($data[$requiredField]);
}
}
}

View File

@ -29,6 +29,7 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -207,7 +208,7 @@ class Dynamic_getModel extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('dynamic_get__'.$id))
if (($vdm = SessionHelper::get('dynamic_get__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -215,17 +216,17 @@ class Dynamic_getModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'dynamic_get__'.$id);
ComponentbuilderHelper::set('dynamic_get__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'dynamic_get__'.$id);
SessionHelper::set('dynamic_get__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -381,7 +382,7 @@ class Dynamic_getModel extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('dynamic_get__'.$id))
if (($vdm = SessionHelper::get('dynamic_get__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -389,17 +390,17 @@ class Dynamic_getModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'dynamic_get__'.$id);
ComponentbuilderHelper::set('dynamic_get__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'dynamic_get__'.$id);
SessionHelper::set('dynamic_get__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
@ -795,7 +796,7 @@ class Dynamic_getModel extends AdminModel
// change to false
$form->setFieldAttribute($requiredField, 'required', 'false');
// also clear the data set
$data[$requiredField] = '';
unset($data[$requiredField]);
}
}
}

View File

@ -29,6 +29,7 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -200,7 +201,7 @@ class FieldModel extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('field__'.$id))
if (($vdm = SessionHelper::get('field__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -208,17 +209,17 @@ class FieldModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'field__'.$id);
ComponentbuilderHelper::set('field__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'field__'.$id);
SessionHelper::set('field__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -318,7 +319,7 @@ class FieldModel extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('field__'.$id))
if (($vdm = SessionHelper::get('field__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -326,17 +327,17 @@ class FieldModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'field__'.$id);
ComponentbuilderHelper::set('field__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'field__'.$id);
SessionHelper::set('field__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -690,7 +691,7 @@ class FieldModel extends AdminModel
// change to false
$form->setFieldAttribute($requiredField, 'required', 'false');
// also clear the data set
$data[$requiredField] = '';
unset($data[$requiredField]);
}
}
}

View File

@ -29,6 +29,7 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -174,7 +175,7 @@ class FieldtypeModel extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('fieldtype__'.$id))
if (($vdm = SessionHelper::get('fieldtype__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -182,17 +183,17 @@ class FieldtypeModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'fieldtype__'.$id);
ComponentbuilderHelper::set('fieldtype__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'fieldtype__'.$id);
SessionHelper::set('fieldtype__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -246,7 +247,7 @@ class FieldtypeModel extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('fieldtype__'.$id))
if (($vdm = SessionHelper::get('fieldtype__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -254,17 +255,17 @@ class FieldtypeModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'fieldtype__'.$id);
ComponentbuilderHelper::set('fieldtype__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'fieldtype__'.$id);
SessionHelper::set('fieldtype__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
// check what type of properties array we have here (should be subform... but just incase)
@ -870,7 +871,7 @@ class FieldtypeModel extends AdminModel
// change to false
$form->setFieldAttribute($requiredField, 'required', 'false');
// also clear the data set
$data[$requiredField] = '';
unset($data[$requiredField]);
}
}
}

View File

@ -490,7 +490,7 @@ class Help_documentModel extends AdminModel
// change to false
$form->setFieldAttribute($requiredField, 'required', 'false');
// also clear the data set
$data[$requiredField] = '';
unset($data[$requiredField]);
}
}
}

View File

@ -29,6 +29,7 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -331,7 +332,7 @@ class Joomla_componentModel extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('joomla_component__'.$id))
if (($vdm = SessionHelper::get('joomla_component__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -339,17 +340,17 @@ class Joomla_componentModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'joomla_component__'.$id);
ComponentbuilderHelper::set('joomla_component__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'joomla_component__'.$id);
SessionHelper::set('joomla_component__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -560,7 +561,7 @@ class Joomla_componentModel extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('joomla_component__'.$id))
if (($vdm = SessionHelper::get('joomla_component__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -568,17 +569,17 @@ class Joomla_componentModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'joomla_component__'.$id);
ComponentbuilderHelper::set('joomla_component__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'joomla_component__'.$id);
SessionHelper::set('joomla_component__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
@ -976,7 +977,7 @@ class Joomla_componentModel extends AdminModel
// change to false
$form->setFieldAttribute($requiredField, 'required', 'false');
// also clear the data set
$data[$requiredField] = '';
unset($data[$requiredField]);
}
}
}

View File

@ -29,6 +29,7 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -237,7 +238,7 @@ class Joomla_moduleModel extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('joomla_module__'.$id))
if (($vdm = SessionHelper::get('joomla_module__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -245,17 +246,17 @@ class Joomla_moduleModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'joomla_module__'.$id);
ComponentbuilderHelper::set('joomla_module__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'joomla_module__'.$id);
SessionHelper::set('joomla_module__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -409,7 +410,7 @@ class Joomla_moduleModel extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('joomla_module__'.$id))
if (($vdm = SessionHelper::get('joomla_module__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -417,17 +418,17 @@ class Joomla_moduleModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'joomla_module__'.$id);
ComponentbuilderHelper::set('joomla_module__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'joomla_module__'.$id);
SessionHelper::set('joomla_module__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}

View File

@ -29,6 +29,7 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -214,7 +215,7 @@ class Joomla_pluginModel extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('joomla_plugin__'.$id))
if (($vdm = SessionHelper::get('joomla_plugin__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -222,17 +223,17 @@ class Joomla_pluginModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'joomla_plugin__'.$id);
ComponentbuilderHelper::set('joomla_plugin__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'joomla_plugin__'.$id);
SessionHelper::set('joomla_plugin__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -374,7 +375,7 @@ class Joomla_pluginModel extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('joomla_plugin__'.$id))
if (($vdm = SessionHelper::get('joomla_plugin__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -382,17 +383,17 @@ class Joomla_pluginModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'joomla_plugin__'.$id);
ComponentbuilderHelper::set('joomla_plugin__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'joomla_plugin__'.$id);
SessionHelper::set('joomla_plugin__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}

View File

@ -29,6 +29,7 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -147,7 +148,7 @@ class Language_translationModel extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('language_translation__'.$id))
if (($vdm = SessionHelper::get('language_translation__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -155,17 +156,17 @@ class Language_translationModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'language_translation__'.$id);
ComponentbuilderHelper::set('language_translation__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'language_translation__'.$id);
SessionHelper::set('language_translation__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -237,7 +238,7 @@ class Language_translationModel extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('language_translation__'.$id))
if (($vdm = SessionHelper::get('language_translation__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -245,17 +246,17 @@ class Language_translationModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'language_translation__'.$id);
ComponentbuilderHelper::set('language_translation__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'language_translation__'.$id);
SessionHelper::set('language_translation__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}

View File

@ -29,6 +29,7 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -169,7 +170,7 @@ class LayoutModel extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('layout__'.$id))
if (($vdm = SessionHelper::get('layout__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -177,17 +178,17 @@ class LayoutModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'layout__'.$id);
ComponentbuilderHelper::set('layout__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'layout__'.$id);
SessionHelper::set('layout__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -253,7 +254,7 @@ class LayoutModel extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('layout__'.$id))
if (($vdm = SessionHelper::get('layout__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -261,17 +262,17 @@ class LayoutModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'layout__'.$id);
ComponentbuilderHelper::set('layout__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'layout__'.$id);
SessionHelper::set('layout__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}

View File

@ -29,6 +29,7 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -185,7 +186,7 @@ class LibraryModel extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('library__'.$id))
if (($vdm = SessionHelper::get('library__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -193,17 +194,17 @@ class LibraryModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'library__'.$id);
ComponentbuilderHelper::set('library__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'library__'.$id);
SessionHelper::set('library__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -271,7 +272,7 @@ class LibraryModel extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('library__'.$id))
if (($vdm = SessionHelper::get('library__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -279,17 +280,17 @@ class LibraryModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'library__'.$id);
ComponentbuilderHelper::set('library__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'library__'.$id);
SessionHelper::set('library__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -626,7 +627,7 @@ class LibraryModel extends AdminModel
// change to false
$form->setFieldAttribute($requiredField, 'required', 'false');
// also clear the data set
$data[$requiredField] = '';
unset($data[$requiredField]);
}
}
}

View File

@ -29,6 +29,7 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -149,7 +150,7 @@ class PlaceholderModel extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('placeholder__'.$id))
if (($vdm = SessionHelper::get('placeholder__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -157,17 +158,17 @@ class PlaceholderModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'placeholder__'.$id);
ComponentbuilderHelper::set('placeholder__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'placeholder__'.$id);
SessionHelper::set('placeholder__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -219,7 +220,7 @@ class PlaceholderModel extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('placeholder__'.$id))
if (($vdm = SessionHelper::get('placeholder__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -227,17 +228,17 @@ class PlaceholderModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'placeholder__'.$id);
ComponentbuilderHelper::set('placeholder__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'placeholder__'.$id);
SessionHelper::set('placeholder__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}

View File

@ -30,6 +30,7 @@ use Joomla\Input\Input;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Componentbuilder\Power\Factory as PowerFactory;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -195,7 +196,7 @@ class PowerModel extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('power__'.$id))
if (($vdm = SessionHelper::get('power__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -203,17 +204,17 @@ class PowerModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'power__'.$id);
ComponentbuilderHelper::set('power__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'power__'.$id);
SessionHelper::set('power__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -339,7 +340,7 @@ class PowerModel extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('power__'.$id))
if (($vdm = SessionHelper::get('power__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -347,17 +348,17 @@ class PowerModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'power__'.$id);
ComponentbuilderHelper::set('power__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'power__'.$id);
SessionHelper::set('power__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}

View File

@ -547,7 +547,7 @@ class ServerModel extends AdminModel
// change to false
$form->setFieldAttribute($requiredField, 'required', 'false');
// also clear the data set
$data[$requiredField] = '';
unset($data[$requiredField]);
}
}
}

View File

@ -29,6 +29,7 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -216,7 +217,7 @@ class Site_viewModel extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('site_view__'.$id))
if (($vdm = SessionHelper::get('site_view__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -224,17 +225,17 @@ class Site_viewModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'site_view__'.$id);
ComponentbuilderHelper::set('site_view__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'site_view__'.$id);
SessionHelper::set('site_view__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -384,7 +385,7 @@ class Site_viewModel extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('site_view__'.$id))
if (($vdm = SessionHelper::get('site_view__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -392,17 +393,17 @@ class Site_viewModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'site_view__'.$id);
ComponentbuilderHelper::set('site_view__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'site_view__'.$id);
SessionHelper::set('site_view__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}

View File

@ -29,6 +29,7 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -169,7 +170,7 @@ class TemplateModel extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('template__'.$id))
if (($vdm = SessionHelper::get('template__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -177,17 +178,17 @@ class TemplateModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'template__'.$id);
ComponentbuilderHelper::set('template__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'template__'.$id);
SessionHelper::set('template__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -253,7 +254,7 @@ class TemplateModel extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('template__'.$id))
if (($vdm = SessionHelper::get('template__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -261,17 +262,17 @@ class TemplateModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'template__'.$id);
ComponentbuilderHelper::set('template__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'template__'.$id);
SessionHelper::set('template__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}

View File

@ -29,6 +29,7 @@ use Joomla\Utilities\ArrayHelper;
use Joomla\Input\Input;
use VDM\Component\Componentbuilder\Administrator\Helper\ComponentbuilderHelper;
use Joomla\CMS\Helper\TagsHelper;
use VDM\Joomla\Utilities\SessionHelper;
use VDM\Joomla\Utilities\StringHelper as UtilitiesStringHelper;
use VDM\Joomla\Utilities\ObjectHelper;
use VDM\Joomla\Utilities\GuidHelper;
@ -152,7 +153,7 @@ class Validation_ruleModel extends AdminModel
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('validation_rule__'.$id))
if (($vdm = SessionHelper::get('validation_rule__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -160,17 +161,17 @@ class Validation_ruleModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'validation_rule__'.$id);
ComponentbuilderHelper::set('validation_rule__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'validation_rule__'.$id);
SessionHelper::set('validation_rule__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
@ -222,7 +223,7 @@ class Validation_ruleModel extends AdminModel
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('validation_rule__'.$id))
if (($vdm = SessionHelper::get('validation_rule__'.$id)) !== null)
{
$this->vastDevMod = $vdm;
}
@ -230,17 +231,17 @@ class Validation_ruleModel extends AdminModel
{
// set the vast development method key
$this->vastDevMod = UtilitiesStringHelper::random(50);
ComponentbuilderHelper::set($this->vastDevMod, 'validation_rule__'.$id);
ComponentbuilderHelper::set('validation_rule__'.$id, $this->vastDevMod);
SessionHelper::set($this->vastDevMod, 'validation_rule__'.$id);
SessionHelper::set('validation_rule__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = Factory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
SessionHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ObjectHelper::check($item) && isset($item->guid)
&& GuidHelper::valid($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
SessionHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}

View File

@ -329,14 +329,12 @@ class HtmlView extends BaseHtmlView
// add return_here
$this->getDocument()->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) Uri::getInstance())) . "';");
// add the libs for subform (since not adding it via xml but ajax)
Factory::getApplication()
->getDocument()
$this->getDocument()
->getWebAssetManager()
->useScript('webcomponent.field-subform')
->usePreset('choicesjs')
->useScript('webcomponent.field-fancy-select');
Factory::getApplication()
->getDocument()
$this->getDocument()
->addStyleDeclaration('.subform-table-sublayout-section .controls { margin-left: 0px }');
// set some lang
Text::script('COM_COMPONENTBUILDER_PROPERTY_ALREADY_SELECTED_TRY_ANOTHER');

View File

@ -167,7 +167,7 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_components&task=jooml
<?php if ($canDo->get($_button['view'].'.edit') && ($id = GetHelper::var($_button['view'], $item->id, 'joomla_component', 'id')) !== false): ?>
<a class="hasTooltip btn btn-mini" href="index.php?option=com_componentbuilder&view=<?php echo $_button['views'] ?>&task=<?php echo $_button['view'] ?>.edit&id=<?php echo $id; ?>&return=<?php echo $this->return_here; ?>" title="<?php echo $_button['title']; ?>" ><span class="icon-<?php echo $_button['icon']; ?>"></span></a>
<?php elseif ($canDo->get($_button['view'].'.create')): ?>
<a class="hasTooltip btn btn-mini" href="index.php?option=com_componentbuilder&view=<?php echo $_button['views'] ?>&task=<?php echo $_button['view'] ?>.edit&ref=joomla_component&refid=<?php echo $item->id; ?>&return=<?php echo $this->return_here; ?>" title="<?php echo $_button['title']; ?>" ><span class="icon-<?php echo $_button['icon']; ?>"></span></a>
<a class="hasTooltip btn btn-mini" href="index.php?option=com_componentbuilder&view=<?php echo $_button['views'] ?>&task=<?php echo $_button['view'] ?>.edit&field=joomla_component&field_id=<?php echo $item->id; ?>&return=<?php echo $this->return_here; ?>" title="<?php echo $_button['title']; ?>" ><span class="icon-<?php echo $_button['icon']; ?>"></span></a>
<?php endif; ?>
<?php endforeach; ?>
@ -182,7 +182,7 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_components&task=jooml
<?php if ($canDo->get($_button['view'].'.edit') && ($id = GetHelper::var($_button['view'], $item->id, 'joomla_component', 'id')) !== false): ?>
<a class="hasTooltip btn btn-mini" href="index.php?option=com_componentbuilder&view=<?php echo $_button['views'] ?>&task=<?php echo $_button['view'] ?>.edit&id=<?php echo $id; ?>&return=<?php echo $this->return_here; ?>" title="<?php echo $_button['title']; ?>" ><span class="icon-<?php echo $_button['icon']; ?>"></span></a>
<?php elseif ($canDo->get($_button['view'].'.create')): ?>
<a class="hasTooltip btn btn-mini" href="index.php?option=com_componentbuilder&view=<?php echo $_button['views'] ?>&task=<?php echo $_button['view'] ?>.edit&ref=joomla_component&refid=<?php echo $item->id; ?>&return=<?php echo $this->return_here; ?>" title="<?php echo $_button['title']; ?>" ><span class="icon-<?php echo $_button['icon']; ?>"></span></a>
<a class="hasTooltip btn btn-mini" href="index.php?option=com_componentbuilder&view=<?php echo $_button['views'] ?>&task=<?php echo $_button['view'] ?>.edit&field=joomla_component&field_id=<?php echo $item->id; ?>&return=<?php echo $this->return_here; ?>" title="<?php echo $_button['title']; ?>" ><span class="icon-<?php echo $_button['icon']; ?>"></span></a>
<?php endif; ?>
<?php endforeach; ?>
</div>
@ -196,7 +196,7 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_components&task=jooml
<?php if ($canDo->get($_button['view'].'.edit') && ($id = GetHelper::var($_button['view'], $item->id, 'joomla_component', 'id')) !== false): ?>
<a class="hasTooltip btn btn-mini" href="index.php?option=com_componentbuilder&view=<?php echo $_button['views'] ?>&task=<?php echo $_button['view'] ?>.edit&id=<?php echo $id; ?>&return=<?php echo $this->return_here; ?>" title="<?php echo $_button['title']; ?>" ><span class="icon-<?php echo $_button['icon']; ?>"></span></a>
<?php elseif ($canDo->get($_button['view'].'.create')): ?>
<a class="hasTooltip btn btn-mini" href="index.php?option=com_componentbuilder&view=<?php echo $_button['views'] ?>&task=<?php echo $_button['view'] ?>.edit&ref=joomla_component&refid=<?php echo $item->id; ?>&return=<?php echo $this->return_here; ?>" title="<?php echo $_button['title']; ?>" ><span class="icon-<?php echo $_button['icon']; ?>"></span></a>
<a class="hasTooltip btn btn-mini" href="index.php?option=com_componentbuilder&view=<?php echo $_button['views'] ?>&task=<?php echo $_button['view'] ?>.edit&field=joomla_component&field_id=<?php echo $item->id; ?>&return=<?php echo $this->return_here; ?>" title="<?php echo $_button['title']; ?>" ><span class="icon-<?php echo $_button['icon']; ?>"></span></a>
<?php endif; ?>
<?php endforeach; ?>
</div>

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="4.0" method="upgrade">
<name>COM_COMPONENTBUILDER</name>
<creationDate>7th October, 2024</creationDate>
<creationDate>13th October, 2024</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>joomla@vdm.io</authorEmail>
<authorUrl>https://dev.vdm.io</authorUrl>
<copyright>Copyright (C) 2015 Vast Development Method. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>4.0.4-alpha2</version>
<version>4.0.4-alpha3</version>
<description><![CDATA[
<h1>Component Builder (v.4.0.4-alpha2)</h1>
<h1>Component Builder (v.4.0.4-alpha3)</h1>
<div style="clear: both;"></div>
<p>The Component Builder for [Joomla](https://extensions.joomla.org/extension/component-builder/) is highly advanced tool that is truly able to build extremely complex components in a fraction of the time.

View File

@ -98,7 +98,7 @@
<version>4.0.4-alpha</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v4.0.4-alpha2.zip</downloadurl>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v4.0.4-alpha3.zip</downloadurl>
</downloads>
<tags>
<tag>alpha</tag>
@ -113,10 +113,10 @@
<element>pkg_component_builder</element>
<type>package</type>
<client>site</client>
<version>4.0.4-alpha2</version>
<version>4.0.4-alpha3</version>
<infourl title="Component Builder!">https://dev.vdm.io</infourl>
<downloads>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v4.0.4-alpha2.zip</downloadurl>
<downloadurl type="full" format="zip">https://git.vdm.dev/api/v1/repos/joomla/pkg-component-builder/archive/v4.0.4-alpha3.zip</downloadurl>
</downloads>
<tags>
<tag>alpha</tag>

View File

@ -17300,7 +17300,7 @@ class Interpretation extends Fields
. "\$form->setFieldAttribute(\$requiredField, 'required', 'false');";
$fix .= PHP_EOL . Indent::_(5) . "//" . Line::_(__Line__, __Class__)
. " also clear the data set";
$fix .= PHP_EOL . Indent::_(5) . "\$data[\$requiredField] = '';";
$fix .= PHP_EOL . Indent::_(5) . "unset(\$data[\$requiredField]);";
$fix .= PHP_EOL . Indent::_(4) . "}";
$fix .= PHP_EOL . Indent::_(3) . "}";
$fix .= PHP_EOL . Indent::_(2) . "}";

View File

@ -250,6 +250,7 @@ final class Manager
'entity' => $entity,
'access' => $fileType['download_access'] ?? 1,
'guid' => $this->getGuid('guid'),
'created_by' => $this->user->id
];
}
}

View File

@ -0,0 +1,72 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Reader\IReadFilter;
/**
* Chunk Read Filter Class
*
* @since 3.2.0
*/
final class ChunkReadFilter implements IReadFilter
{
/**
* The first row to read in the current chunk.
*
* @var int
*/
private int $startRow;
/**
* The last row to read in the current chunk.
* This is calculated as $startRow + $chunkSize - 1.
*
* @var int
*/
private int $endRow;
/**
* Constructor to initialize the chunk filter.
*
* @param int $startRow The starting row to read.
* @param int $chunkSize The number of rows to read in each chunk.
*/
public function __construct(int $startRow, int $chunkSize)
{
$this->startRow = $startRow;
$this->endRow = $startRow + $chunkSize - 1;
}
/**
* Determines whether a cell should be read based on its row and column.
*
* @param string $column The column index (e.g., 'A', 'B', 'C').
* @param int $row The row index.
* @param string|null $worksheetName The worksheet name (not used in this case).
*
* @return bool Whether the cell should be read.
*/
public function readCell(string $columnAddress, int $row, string $worksheetName = ''): bool
{
// Only read rows that fall within the chunk range
if ($row >= $this->startRow && $row <= $this->endRow)
{
return true;
}
return false;
}
}

View File

@ -12,6 +12,8 @@
namespace VDM\Joomla\Componentbuilder\Spreadsheet;
use Joomla\CMS\Factory;
use Joomla\CMS\User\User;
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
@ -105,7 +107,7 @@ final class Exporter
'font' => [
'bold' => true,
'color' => ['rgb' => '1171A3'],
'size' => 12,
'size' => 13,
'name' => 'Verdana'
]
];
@ -289,6 +291,8 @@ final class Exporter
$sheet->getColumnDimension($columnIndex)->setAutoSize(true);
$sheet->getStyle($columnIndex . $rowIndex)->applyFromArray($this->headerStyles);
$sheet->getStyle($columnIndex . $rowIndex)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
$row_height = ($this->headerStyles['font']['size'] ?? 13) + 5;
$sheet->getRowDimension($rowIndex)->setRowHeight($row_height);
}
elseif ($columnIndex === 'A')
{

View File

@ -13,7 +13,7 @@ namespace VDM\Joomla\Componentbuilder\Spreadsheet;
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Reader\IReadFilter;
use VDM\Joomla\Componentbuilder\Spreadsheet\ChunkReadFilter;
/**
@ -40,7 +40,7 @@ final class Header
}
try {
$chunkFilter = new ChunkReadFilter(2, 1);
$chunkFilter = new ChunkReadFilter(1, 20);
$inputFileType = IOFactory::identify($filePath);
$reader = IOFactory::createReader($inputFileType);
$reader->setReadFilter($chunkFilter);

View File

@ -13,9 +13,9 @@ namespace VDM\Joomla\Componentbuilder\Spreadsheet;
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Reader\IReadFilter;
use PhpOffice\PhpSpreadsheet\Reader\Exception as ReaderException;
use PhpOffice\PhpSpreadsheet\Exception as SpreadsheetException;
use VDM\Joomla\Componentbuilder\Spreadsheet\ChunkReadFilter;
/**

View File

@ -0,0 +1,294 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2020
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Utilities;
/**
* Simple Date Helper
*
* @since 5.0.2
*/
abstract class DateHelper
{
/**
* Convert a date to a human-readable fancy format (e.g., "1st of January 2024").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Formatted date.
* @since 3.0.0
*/
public static function fancyDate($date, bool $checkStamp = true): string
{
$date = static::getValidTimestamp($date, $checkStamp);
return date('jS \o\f F Y', $date);
}
/**
* Get a formatted date based on the time period (dynamic format based on age of the date).
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Formatted date.
* @since 3.0.0
*/
public static function fancyDynamicDate($date, bool $checkStamp = true): string
{
$date = static::getValidTimestamp($date, $checkStamp);
// If older than a year, use m/d/y format.
if (date('Y', $date) < date('Y', strtotime('-1 year')))
{
return date('m/d/y', $date);
}
// If it's the same day, return the time.
if ($date > strtotime('-1 day'))
{
return date('g:i A', $date);
}
// Otherwise, return the month and day.
return date('M j', $date);
}
/**
* Convert a date to a human-readable day, time, and date format (e.g., "Mon 12am 1st of January 2024").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Formatted day, time, and date.
* @since 3.0.0
*/
public static function fancyDayTimeDate($date, bool $checkStamp = true): string
{
$date = static::getValidTimestamp($date, $checkStamp);
return date('D gA jS \o\f F Y', $date);
}
/**
* Convert a date to a human-readable time and date format (e.g., "(12:00) 1st of January 2024").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Formatted time and date.
* @since 3.0.0
*/
public static function fancyDateTime($date, bool $checkStamp = true): string
{
$date = static::getValidTimestamp($date, $checkStamp);
return date('(G:i) jS \o\f F Y', $time);
}
/**
* Convert a time to a human-readable format (e.g., "12:00").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Formatted time.
* @since 3.0.0
*/
public static function fancyTime($date, bool $checkStamp = true): string
{
$date = static::getValidTimestamp($date, $checkStamp);
return date('G:i', $date);
}
/**
* Convert a date to the day name (e.g., "Sunday").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Day name.
* @since 3.0.0
*/
public static function setDayName($date, bool $checkStamp = true): string
{
$date = static::getValidTimestamp($date, $checkStamp);
return date('l', $date);
}
/**
* Convert a date to the month name (e.g., "January").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Month name.
* @since 3.0.0
*/
public static function setMonthName($date, bool $checkStamp = true): string
{
$date = static::getValidTimestamp($date, $checkStamp);
return date('F', $date);
}
/**
* Convert a date to the day with suffix (e.g., "1st").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Day with suffix.
* @since 3.0.0
*/
public static function setDay($date, bool $checkStamp = true): string
{
$date = static::getValidTimestamp($date, $checkStamp);
return date('jS', $date);
}
/**
* Convert a date to the numeric month (e.g., "5").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Numeric month.
* @since 3.0.0
*/
public static function setMonth($date, bool $checkStamp = true): string
{
$date = static::getValidTimestamp($date, $checkStamp);
return date('n', $date);
}
/**
* Convert a date to the full year (e.g., "2024").
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Full year.
* @since 3.0.0
*/
public static function setYear($date, bool $checkStamp = true): string
{
$date = static::getValidTimestamp($date, $checkStamp);
return date('Y', $date);
}
/**
* Convert a date to a year/month format (e.g., "2024/05").
*
* @param string|int $date The date as a string or timestamp.
* @param string $spacer The spacer between year and month.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Year/Month format.
* @since 3.0.0
*/
public static function setYearMonth($date, string $spacer = '/', bool $checkStamp = true): string
{
$date = static::getValidTimestamp($date, $checkStamp);
return date('Y' . $spacer . 'm', $date);
}
/**
* Convert a date to a year/month/day format (e.g., "2024/05/03").
*
* @param string|int $date The date as a string or timestamp.
* @param string $spacer The spacer between year and month.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Year/Month/Day format.
* @since 3.0.0
*/
public static function setYearMonthDay($date, string $spacer = '/', bool $checkStamp = true): string
{
$date = static::getValidTimestamp($date, $checkStamp);
return date('Y' . $spacer . 'm' . $spacer . 'd', $date);
}
/**
* Convert a date to a day/month/year format (e.g., "03/05/2024").
*
* @param string|int $date The date as a string or timestamp.
* @param string $spacer The spacer between year and month.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return string Day/Month/Year format.
* @since 3.0.0
*/
public static function setDayMonthYear($date, string $spacer = '/', bool $checkStamp = true): string
{
$date = static::getValidTimestamp($date, $checkStamp);
return date('d' . $spacer . 'm' . $spacer . 'Y', $date);
}
/**
* Convert a date string to a valid timestamp.
*
* @param string|int $date The date as a string or timestamp.
* @param bool $checkStamp Whether to check if the input is a timestamp.
*
* @return int The valid timestamp.
* @since 3.0.0
*/
public static function getValidTimestamp($date, bool $checkStamp): int
{
if ($checkStamp && !static::isValidTimeStamp($date))
{
$date = strtotime($date ?? 'Now');
}
return (int) $date;
}
/**
* Check if the input is a valid Unix timestamp.
*
* @param mixed $timestamp The timestamp to validate.
*
* @return bool True if valid timestamp, false otherwise.
* @since 3.0.0
*/
public static function isValidTimeStamp($timestamp): bool
{
return (is_numeric($timestamp) && (int) $timestamp == $timestamp && $timestamp > 0);
}
/**
* Check if a string is a valid date according to the specified format.
*
* @param string $date The date string to validate.
* @param string $format The format to check against (default is 'Y-m-d H:i:s').
*
* @return bool True if valid date, false otherwise.
* @since 3.0.0
*/
public static function isValidateDate($date, string $format = 'Y-m-d H:i:s'): bool
{
$d = \DateTime::createFromFormat($format, $date);
return $d && $d->format($format) === $date;
}
}

View File

@ -0,0 +1,89 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2020
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Utilities;
use Joomla\CMS\Factory;
use Joomla\CMS\Session\Session;
/**
* Simple Session
*
* @since 5.0.2
*/
abstract class SessionHelper
{
/**
* The active session
*
* @var Session|null
* @since 5.0.2
*/
private static ?Session $session = null;
/**
* Get the active session
*
* @return Session
* @throws \RuntimeException if the session cannot be loaded
* @since 5.0.2
*/
public static function session(): Session
{
if (static::$session === null)
{
try {
static::$session = Factory::getApplication()->getSession();
} catch (\Exception $e) {
// Rethrow the exception as a RuntimeException to propagate it downstream
throw new \RuntimeException('Unable to load the session.', 0, $e);
}
}
return static::$session;
}
/**
* Get data from the session store
*
* @param string $name Name of a variable
* @param mixed $default Default value of a variable if not set
*
* @return mixed Value of the variable from the session
* @since 5.0.2
*/
public static function get(string $name, $default = null)
{
$value = static::session()->get($name, $default);
// Ensure the value is set in the session even if it was default
static::set($name, $value);
return $value;
}
/**
* Set data into the session store
*
* @param string $name Name of a variable
* @param mixed $value Value of a variable
*
* @return mixed Old value of the variable
* @since 5.0.2
*/
public static function set(string $name, $value = null)
{
return static::session()->set($name, $value);
}
}