A new multifunctional ferrocenyl-substituted ferrocenophane derivate: optical and electronic properties and selective recognition of Mg2+.