File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 1919
2020// Freemius SDK: Auto deactivate the free version when activating the paid one.
2121if ( function_exists ( 'sugb_fs ' ) ) {
22- sugb_fs ()->set_basename ( true , __FILE__ );
23- return ;
22+ // Prevent PHP errors by checking sugb_fs return value.
23+ // In the free version, sugb_fs() is a no-op function that returns null.
24+ // Only proceed if sugb_fs() returns an object (i.e., the Freemius SDK is loaded).
25+ if ( is_object ( sugb_fs () ) ) {
26+ sugb_fs ()->set_basename ( false , __FILE__ );
27+ return ;
28+ }
2429}
2530
2631defined ( 'STACKABLE_SHOW_PRO_NOTICES ' ) || define ( 'STACKABLE_SHOW_PRO_NOTICES ' , true );
@@ -213,6 +218,11 @@ function is_frontend() {
213218 */
214219if ( STACKABLE_BUILD !== 'free ' ) {
215220 require_once ( plugin_dir_path ( __FILE__ ) . 'freemius.php ' );
221+ } else if ( ! function_exists ( 'sugb_fs ' ) ) {
222+ // Provide a no-op sugb_fs() stub for compatibility when Freemius SDK is not loaded.
223+ // This allows themes and plugins to safely check for Stackable's presence.
224+ // The function returns null and performs no actions.
225+ function sugb_fs () {};
216226}
217227
218228/**
You can’t perform that action at this time.
0 commit comments