Version 4.7.6

This commit is contained in:
Neo committed 2025-12-19 16:05:19 -08:00
1 parent 8ba7d43898
commit 7b7404e741
1085 files changed
+30590 -7837

No files matched your search

+44 -1
View File
@@ -1044,7 +1044,7 @@ abstract class _Widget
{
$data = json_decode( $row['widgets'], TRUE );
if ( \count( $data ) )
if ( is_countable( $data ) AND \count( $data ) )
{
foreach( $data as $widget )
{
@@ -1222,4 +1222,47 @@ abstract class _Widget
return $form;
}
/**
* This method can be used to remove a widgets appearances in the CMS and Core App
*
* @param string $widgetkey The widget key
* @param string $app The app the widget belongs to
* @return bool
*/
final public static function deprecateWidget(string $widgetkey, string $app )
{
$areas = array( 'core_widget_areas' );
if ( \IPS\Application::appIsEnabled('cms') )
{
$areas[] = 'cms_page_widget_areas';
}
foreach ( $areas as $table )
{
$widgetsColumn = $table == 'core_widget_areas' ? 'widgets' : 'area_widgets';
foreach ( \IPS\Db::i()->select( '*', $table ) as $area )
{
$whereClause = $table == 'core_widget_areas' ? array( 'id=? AND area=?', $area['id'], $area['area'] ) : array( 'area_page_id=? AND area_area=?', $area['area_page_id'], $area['area_area'] );
$widgets = json_decode( $area[ $widgetsColumn ], TRUE );
$update = FALSE;
foreach ( $widgets as $k => $widget )
{
if ( $widget['key'] == $widgetkey AND $app == $widget['app'] )
{
unset( $widgets[ $k ] );
$update = TRUE;
}
}
if ( $update )
{
\IPS\Db::i()->update( $table, array( $widgetsColumn => json_encode( $widgets ) ), $whereClause );
}
}
}
return TRUE;
}
}