Release of v5.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:54:01 +02:00
parent 4ccc3523d7
commit 36647fca80
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
63 changed files with 1553 additions and 1034 deletions

View File

@ -1,16 +1,20 @@
# v5.0.4-alpha2
# v5.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.
# v5.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.
# v5.0.4-alpha
- Add [AllowDynamicProperties] in the base view class for J5
- Move the _prepareDocument above the display call in the base view class
# v5.0.3
- Add [push] option to powers area.

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 5.0.4-alpha2 Was Successful! Let us know if anything is not working as expected.</h3></div>';
<h3>Upgrade to Version 5.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 (5.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 (5.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*: 5.0.4-alpha2
+ *Last Build*: 13th October, 2024
+ *Version*: 5.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*: **868100**
+ *Line count*: **871753**
+ *Field count*: **2104**
+ *File count*: **5997**
+ *File count*: **6028**
+ *Folder count*: **633**
> 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 (5.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 (5.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*: 5.0.4-alpha2
+ *Last Build*: 13th October, 2024
+ *Version*: 5.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*: **868100**
+ *Line count*: **871753**
+ *Field count*: **2104**
+ *File count*: **5997**
+ *File count*: **6028**
+ *Folder count*: **633**
> 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');
ComponentbuilderHelpe