Developer Reference

This section is for developers extending the DICOM Viewer plugin or integrating it with custom code.


Requirements

  • PHP 8.0+ — the plugin requires modern PHP with type hints and features from PHP 8.0
  • WordPress 6.4+
  • Basic WordPress development knowledge (hooks, filters, REST API)

Topics


Common Tasks

Access plugin settings:

$settings = get_option( 'dv_settings' );
$default_height = $settings['default_height'] ?? '480px';

Check if license is active:

if ( class_exists( 'DV_License' ) && DV_License::is_active() ) {
    // License is active
}

Get attachment details:

$original_name = get_post_meta( $attachment_id, '_dv_original_name', true );
$access_level = get_post_meta( $attachment_id, '_dv_access', true );

Render a DICOM viewer programmatically:

// Shortcode approach
echo do_shortcode( '[dicom_viewer id="123" height="600px"]' );

File Structure

dicom-viewer/
├── dicom-viewer.php              Main plugin file
├── includes/
│   ├── class-dv-plugin.php       Plugin orchestrator
│   ├── class-dv-settings.php     Settings UI
│   ├── class-dv-shortcode.php    Shortcode handler
│   ├── class-dv-block.php        Gutenberg block
│   ├── class-dv-upload.php       File upload handling
│   ├── class-dv-file-server.php  Protected file serving
│   ├── class-dv-license.php      License validation
│   └── class-dv-classic-editor.php  Classic editor support
├── lib/dicom-viewer-core/        JavaScript viewer library
├── webdevelop-license-client/    Shared license client
└── uninstall.php                 Cleanup on uninstall

Next Steps

Hooks & Filters

The DICOM Viewer plugin can be extended by developers using standard WordPress patterns and the plugin’s public classes and methods.

Accessing Plugin Features

Check if License is Active

if ( class_exists( 'DV_License' ) ) {
    if ( DV_License::is_active() ) {
        // License is active — viewer is enabled
    }
}

Render a Viewer Programmatically

if ( class_exists( 'DV_Plugin' ) ) {
    $html = DV_Plugin::render_viewer( [
        'url'           => 'https://example.com/scan.dcm',
        'height'        => '600px',
        'show_download' => true,
    ] );
    echo $html;
}

Future Extensions

The DICOM Viewer is designed for future extensibility. Developers interested in custom integrations should contact the plugin author for guidance on:

  • Custom access control
  • Integration with other WordPress systems
  • Custom viewer configurations