Hey Adam!
I am not the developer, but I ran into this compatibility issue, as well, so I decided to look at the plugin code to try and see what was actually causing the issue.
What I found is that the error you mentioned above is being thrown because there is a foreach loop (starting on line 675, ending 682) which uses implicit braces, meaning that the developer chose to not include the “{}” characters around the loop. Because the scanning plugin did not find those braces wrapping around the code block for that loop, it thinks that the “break” statement is outside of a loop, but it actually isn’t.
The Fix
I tested this fix out and it no longer throws the compatibility error; if you are comfortable with editing the PHP code, just add explicit braces around the 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 you will need to edit is “/wp-content/plugins/shortcodes-ultimate/inc/core/tools.php”
– Joe