Plugin dependency fail with new Mantis release

If the plugin's minimum dependency for MantisCore is unspecified or
lower than the current release (i.e. the plugin does not specifically
list the current core version as supported) and the plugin does not
define a maximum dependency, we add one with the current version's minor
release (i.e. for 1.3.1 we would add '<1.3').

The purpose of this is to avoid compatibility issues by disabling
plugins which have not been updated for a new Mantis release; authors
have to revise their code (if necessary), and release a new version of
the plugin with updated dependencies.

Fixes #17360
Rename variables to improve code readability
Code optimization

The plugin's base name and cache will not change between iterations, so
we improve performance by moving $t_version_installed's initialization
outside of the foreach loop.