Version 5.0.13

This commit is contained in:
Neo committed 2025-12-19 19:04:57 -08:00
1 parent b89858b2ff
commit 5efe744c5f
1407 files changed
+69690 -30177

No files matched your search

+22 -1
View File
@@ -245,7 +245,7 @@ class Setting extends Model
}
elseif( $this->type == static::SETTING_NUMBER )
{
return isset( $this->_data['default'] ) ? (int) $this->_data['default'] : 0;
return ( isset( $this->_data['default'] ) and is_numeric( $this->_data['default'] ) ) ? $this->_data['default'] : 0;
}
return $this->_data['default'] ?? '';
@@ -404,6 +404,27 @@ class Setting extends Model
case static::SETTING_CHECKBOX:
$value = (int) $value;
break;
case static::SETTING_IMAGE:
/* Handle Resource URLs */
preg_match( '/\{([a-z]+?=([\'"]).+?\\2 ?+)}/', $value, $matches );
if( count( $matches ) )
{
preg_match_all( '/(.+?)="([^"]*)"\s?/', $matches[1], $submatches );
if( count( $submatches[0] ) and $submatches[1][0] == 'resource' )
{
$resourceName = array_shift( $submatches[2] );
array_shift( $submatches[1] );
$options = array();
foreach ( $submatches[1] as $k => $v )
{
$options[ $v ] = $submatches[2][ $k ];
}
$value = Theme::i()->resource( $resourceName, $options['app'] ?? 'core', $options['location'] ?? 'front' )->url;
}
}
break;
}
return $value;