The three foreach() loops here overwrite each other:
That was done to avoid duplicates. However the props are also overwritten. Perhaps a check to see if it's been set already should be done and merge the is_template/is_image props.
Although we could choose to let one count stronger than the other (in this case imagelink, over templatelink, over pagelink) however the following code is clearly designed with the scenario in mind that multiple props could be set to 1:
$props = []; if ( $row->rd_from ) { $props[] = $msgcache['isredirect']; } if ( $row->is_template ) { $props[] = $msgcache['istemplate']; } if ( $row->is_image ) { $props[] = $msgcache['isimage']; }