isolated input circuit to check regular switch or photo-transistor
I think you missed that optically coupled elements are potential free therefore you can place them in any arm of the corresponding series within the circuit (from vcc to gnd in your case) consructing the logic behavior you want. For buttons (switches) the same is actual.



As you can see at the picture above, it is possible to use the same schematic to control both switch or photo transistor.