Version 4.6.0

This commit is contained in:
Neo committed 2025-12-19 05:55:31 -08:00
1 parent f79dcf067a
commit 517a5e1f70
2036 files changed
+110041 -26162

No files matched your search

+40 -27
View File
@@ -378,9 +378,9 @@ abstract class _Widget
}
else
{
if ( file_exists( \IPS\ROOT_PATH . '/plugins/' . $parent->location . '/widgets/' . $widgetKey . '.php' ) )
if ( file_exists( \IPS\SITE_FILES_PATH . '/plugins/' . $parent->location . '/widgets/' . $widgetKey . '.php' ) )
{
require_once \IPS\ROOT_PATH . '/plugins/' . $parent->location . '/widgets/' . $widgetKey . '.php';
require_once \IPS\SITE_FILES_PATH . '/plugins/' . $parent->location . '/widgets/' . $widgetKey . '.php';
$class = '\IPS\\plugins\\' . $parent->location . '\\widgets\\' . $widgetKey;
}
}
@@ -586,7 +586,7 @@ abstract class _Widget
if ( array_key_exists( \IPS\Request::i()->key, $widgets ) )
{
unset( $widgets[ \IPS\Request::i()->key ] );
\file_put_contents( $json, json_encode( $widgets ) );
\file_put_contents( $json, json_encode( $widgets, JSON_PRETTY_PRINT ) );
if ( file_exists( $widgetDirectory . "/" . \IPS\Request::i()->key . ".php" ) )
{
@@ -864,10 +864,9 @@ abstract class _Widget
/* Does this go in the store? Things like active users don't get stored, and if in developer or designer mode, nothing does */
if ( isset( $this->cacheKey ) AND ( !isset( \IPS\Request::i()->cookie['vle_editor'] ) or !\IPS\Request::i()->cookie['vle_editor'] ) AND !\IPS\IN_DEV AND !\IPS\Theme::designersModeEnabled() )
{
/* How long does the store last (in seconds)? Individual widgets can set a higher expiration where sensible (e.g. upcoming calendar events
can be cached for a day regardless of this setting) but not lower */
/* How long does the store last (in seconds)? */
$expiration = \IPS\Settings::i()->widget_cache_ttl;
if ( isset( $this->cacheExpiration ) and $this->cacheExpiration > $expiration )
if ( isset( $this->cacheExpiration ) )
{
$expiration = $this->cacheExpiration;
}
@@ -951,34 +950,48 @@ abstract class _Widget
{
if ( mb_stristr( $output, '<time' ) )
{
$output = preg_replace_callback( '#<time([^>]+?)?>(\d{10})</time>#i', function( $matches )
$output = preg_replace_callback( '#<time([^>]+?)?>([^<]+?)</time>#i', function( $matches )
{
$options = array();
if ( $matches[1] )
$time = NULL;
if ( \is_numeric( $matches[2] ) and \strlen( $matches[2] ) === 10 )
{
preg_match_all( '#(\S+?)=["\'](.+?)["\']\s?#', $matches[1], $submatches, PREG_SET_ORDER );
foreach( $submatches as $idx => $data )
$time = $matches[2];
}
else if ( preg_match( '#\s?datetime=[\'"]([^\'"]+?)[\'"]#', $matches[1], $dateTimeString ) )
{
if ( $dateTimeString[1] )
{
$options[ str_replace( 'data-', '', $data[1] ) ] = $data[2];
$time = strtotime( $dateTimeString[1] );
}
}
$obj = \IPS\DateTime::ts( $matches[2] );
$val = $obj->html();
if ( isset( $options['dateonly'] ) )
if ( $time )
{
$val = (string) $obj->localDate();
$options = array();
preg_match_all( '#(\S+?)=["\'](.+?)["\']\s?#', $matches[1], $submatches, PREG_SET_ORDER );
foreach( $submatches as $idx => $data )
{
$options[ str_replace( 'data-', '', $data[1] ) ] = $data[2];
}
$obj = \IPS\DateTime::ts( $time );
$val = $obj->html();
if ( isset( $options['dateonly'] ) )
{
$val = (string)$obj->localDate();
}
else
{
if ( isset( $options['norelative'] ) )
{
$val = (string)$obj;
}
}
return $val;
}
else if ( isset( $options['norelative'] ) )
{
$val = (string) $obj;
}
return $val;
}, $output );
}