$theTitle=wp_title(" - ", false); if($theTitle != "") { ?>
About Virtualization, VDI, SBC, Application Compatibility and anything else I feel like
After installing a new Plugin in WordPress called Native Apps Builder I got the following error when I tried to go to the Plugin’s settings:
Fatal error: Cannot redeclare class Snoopy in www/blog/wp-content/plugins/native-apps-builder/appsbuilderapi.php on line 34
This error is caused because a class named "Snoopy" is being declared twice. I figured that two plugins were incompatible with each other so I first needed to know which ones.
Easiest way to find that out is to use the Linux Shell and search for the string Snoopy in all files from the WordPress Plugin folder:
I opened the first file that was also using Snoopy, sitemap-core.php:
1 2 3 4 5 6 | if(!file_exists(ABSPATH . 'wp-includes/class-snoopy.php')) { trigger_error('Snoopy Web Request failed: Snoopy not found.',E_USER_NOTICE); return false; //Hoah? } require_once( ABSPATH . 'wp-includes/class-snoopy.php'); |
I concluded from that code that Snoopy is already included in WordPress by default in the wp-includes folder.
I openend wp-includes/class-snoopy.php and the class is only loaded conditionally:
1 2 3 4 5 6 7 | if ( !class_exists( 'Snoopy' ) ) : class Snoopy { ... ... } endif; |
This seemed like the proper way to do it so I decided to modify appsbuilderapi.php to define the class Snoopy conditionally as well.
Go to the plugin in WordPress and click Edit:
Select the proper file from the filelist:
Scroll down to the class definition (class Snoopy) and insert the following line before it:
1 2 | if ( !class_exists( 'Snoopy' ) ) : class Snoopy |
Then scroll down to the end of the class definition and add an endif to close the condition:
1 2 3 4 | } endif; class AppsBuilderApi { |
Click Update File to save the changes and then it works:
Leave a reply