iterate_array( $attrs ); return $attrs; } /** * Iterate through the array and replace the url. * * @param array $attrs Array of attributes. * @return array */ public function iterate_array( $attrs ) { foreach ( $attrs as $key => $value ) { if ( is_array( $value ) ) { $attrs[ $key ] = $this->iterate_array( $value ); } if ( is_string( $value ) && preg_match( '/(http|https):\/\/.*\.(?:png|jpg|jpeg|gif|webp)/i', $value ) ) { $attrs[ $key ] = Optml_Main::instance()->manager->url_replacer->build_url( $value ); } } return $attrs; } }