I posted this in another support thread as well:
I am not the developer, but I ran into the same compatibility issue that you mentioned above, so I decided to look into the code and find out what is actually causing the error to be thrown.
What I found was that there is a foreach loop (starting line 675, ending line 682) for which the developer used implicit braces, meaning that they chose not include the “{}” characters around the loop code block. Since the scanning plugin did not find those braces, it thinks that the “break” statement is outside of a loop block, which it actually isn’t. I have tested out a fix for this, that has resolved the compatibility error on my sites.
The Fix
If you are comfortable with editing the PHP code of the plugin, you just need to add explicit braces around the offending loop block.
So this:
foreach ( array( 'media', 'posts', 'category', 'taxonomy' ) as $type )
if ( strpos( trim( $args['source'] ), $type . ':' ) === 0 ) {
$args['source'] = array(
'type' => $type,
'val' => (string) trim( str_replace( array( $type . ':', ' ' ), '', $args['source'] ), ',' )
);
break;
}
becomes this:
foreach ( array( 'media', 'posts', 'category', 'taxonomy' ) as $type )
{
if ( strpos( trim( $args['source'] ), $type . ':' ) === 0 ) {
$args['source'] = array(
'type' => $type,
'val' => (string) trim( str_replace( array( $type . ':', ' ' ), '', $args['source'] ), ',' )
);
break;
}
}
The file that you need to update is “wp-content/plugins/shortcodes-ultimate/inc/core/tools.php”.