' . esc_html__(
'The public URL of the served doxa-maps built tree (the folder that contains manifest.json and each /.js). Bundles are loaded from here — nothing is stored in WordPress.',
'doxa-maps-embed'
) . '
';
},
'doxa_maps_embed'
);
add_settings_field(
self::OPTION,
__( 'Catalog base URL', 'doxa-maps-embed' ),
array( $this, 'field' ),
'doxa_maps_embed',
'doxa_maps_embed_main'
);
}
/**
* Only allow an absolute http(s) URL; fall back to the current value on bad input.
*
* @param mixed $value Raw submitted value.
* @return string
*/
public function sanitize_base( $value ) {
$value = is_string( $value ) ? trim( $value ) : '';
$url = esc_url_raw( $value, array( 'http', 'https' ) );
if ( '' === $url ) {
add_settings_error(
self::OPTION,
'doxa_maps_embed_base_invalid',
__( 'Catalog base URL must be an absolute http(s) URL.', 'doxa-maps-embed' )
);
return (string) get_option( self::OPTION, DOXA_MAPS_EMBED_DEFAULT_BASE );
}
return rtrim( $url, '/' );
}
public function field() {
$value = get_option( self::OPTION, DOXA_MAPS_EMBED_DEFAULT_BASE );
printf(
'',
esc_attr( self::OPTION ),
esc_attr( $value ),
esc_attr( DOXA_MAPS_EMBED_DEFAULT_BASE )
);
echo '