Weighted Sobolev theorem for spatial and spherical potentials in Lebesgue spaces with variable exponent