Global existence and stability of a nonlinear wave equation with variable-exponent nonlinearities