Initial public release of BreznFlow, an n8n workflow renderer for WordPress. Fully PHPCS-compliant (WordPress Coding Standards), security-hardened, and ready for WordPress.org plugin review. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
198 lines
7.6 KiB
PHP
198 lines
7.6 KiB
PHP
<?php
|
|
/**
|
|
* Template: Plugin settings page.
|
|
*
|
|
* @package BreznFlow
|
|
* @since 1.0.0
|
|
*/
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- template file, not global scope
|
|
|
|
$settings = \BreznFlow\Admin\SettingsPage::get_defaults();
|
|
$saved = get_option( 'breznflow_settings', array() );
|
|
$settings = array_merge( $settings, $saved );
|
|
?>
|
|
<div class="wrap breznflow-settings-page">
|
|
<h1><?php esc_html_e( 'BreznFlow Settings', 'breznflow' ); ?></h1>
|
|
<?php settings_errors( 'breznflow_settings' ); ?>
|
|
|
|
<form method="post" action="options.php">
|
|
<?php settings_fields( 'breznflow_settings_group' ); ?>
|
|
|
|
<div class="breznflow-card">
|
|
<h2><?php esc_html_e( 'Display Defaults', 'breznflow' ); ?></h2>
|
|
<table class="form-table">
|
|
<tr>
|
|
<th><label for="bf-default-mode"><?php esc_html_e( 'Default Mode', 'breznflow' ); ?></label></th>
|
|
<td>
|
|
<select name="breznflow_settings[default_mode]" id="bf-default-mode">
|
|
<option value="visual" <?php selected( 'visual', $settings['default_mode'] ); ?>>
|
|
<?php esc_html_e( 'Visual', 'breznflow' ); ?>
|
|
</option>
|
|
<option value="info" <?php selected( 'info', $settings['default_mode'] ); ?>>
|
|
<?php esc_html_e( 'Info', 'breznflow' ); ?>
|
|
</option>
|
|
<option value="compact" <?php selected( 'compact', $settings['default_mode'] ); ?>>
|
|
<?php esc_html_e( 'Compact', 'breznflow' ); ?>
|
|
</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th><label for="bf-default-zoom"><?php esc_html_e( 'Default Zoom (%)', 'breznflow' ); ?></label></th>
|
|
<td>
|
|
<input type="number" name="breznflow_settings[default_zoom]" id="bf-default-zoom"
|
|
min="10" max="200" value="<?php echo esc_attr( (string) $settings['default_zoom'] ); ?>" class="small-text" />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th><label for="bf-autofit-threshold"><?php esc_html_e( 'Large Workflow Threshold', 'breznflow' ); ?></label></th>
|
|
<td>
|
|
<input type="number" name="breznflow_settings[autofit_threshold]" id="bf-autofit-threshold"
|
|
min="0" max="500" value="<?php echo esc_attr( (string) $settings['autofit_threshold'] ); ?>" class="small-text" />
|
|
<p class="description"><?php esc_html_e( 'Workflows with this many nodes or more start zoomed in at the trigger node (0 = disabled).', 'breznflow' ); ?></p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th><label for="bf-max-code-lines"><?php esc_html_e( 'Max Code Lines', 'breznflow' ); ?></label></th>
|
|
<td>
|
|
<input type="number" name="breznflow_settings[max_code_lines]" id="bf-max-code-lines"
|
|
min="5" max="500" value="<?php echo esc_attr( (string) $settings['max_code_lines'] ); ?>" class="small-text" />
|
|
<p class="description"><?php esc_html_e( 'Maximum lines of code shown in node detail panel.', 'breznflow' ); ?></p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th><?php esc_html_e( 'Show by Default', 'breznflow' ); ?></th>
|
|
<td>
|
|
<label>
|
|
<input type="checkbox"
|
|
name="breznflow_settings[show_title_default]" value="1"
|
|
<?php checked( 1, (int) $settings['show_title_default'] ); ?> />
|
|
<?php esc_html_e( 'Show workflow title', 'breznflow' ); ?></label><br />
|
|
<label>
|
|
<input type="checkbox"
|
|
name="breznflow_settings[show_infobox_default]" value="1"
|
|
<?php checked( 1, (int) $settings['show_infobox_default'] ); ?> />
|
|
<?php esc_html_e( 'Show node info box', 'breznflow' ); ?></label>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="breznflow-card">
|
|
<h2><?php esc_html_e( 'Workflow Theme', 'breznflow' ); ?></h2>
|
|
<table class="form-table">
|
|
<tr>
|
|
<th><label for="bf-default-theme"><?php esc_html_e( 'Default Theme', 'breznflow' ); ?></label></th>
|
|
<td>
|
|
<select name="breznflow_settings[default_theme]" id="bf-default-theme">
|
|
<?php foreach ( \BreznFlow\Features\ThemeRegistry::discover() as $bf_theme_id => $bf_theme_meta ) : ?>
|
|
<option value="<?php echo esc_attr( $bf_theme_id ); ?>"
|
|
<?php selected( $bf_theme_id, $settings['default_theme'] ?? 'dark' ); ?>>
|
|
<?php echo esc_html( $bf_theme_meta['name'] ); ?>
|
|
</option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
<p class="description">
|
|
<?php esc_html_e( 'Can be overridden per workflow or via shortcode attr theme="light". Custom themes: import via BreznFlow → Themes.', 'breznflow' ); ?>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="breznflow-card">
|
|
<h2><?php esc_html_e( 'Action Bar', 'breznflow' ); ?></h2>
|
|
<table class="form-table">
|
|
<tr>
|
|
<th><?php esc_html_e( 'Share', 'breznflow' ); ?></th>
|
|
<td>
|
|
<label>
|
|
<input type="checkbox"
|
|
name="breznflow_settings[allow_share]" value="1"
|
|
<?php checked( 1, (int) $settings['allow_share'] ); ?> />
|
|
<?php esc_html_e( 'Visitors can share workflow links', 'breznflow' ); ?></label>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th><?php esc_html_e( 'Embed', 'breznflow' ); ?></th>
|
|
<td>
|
|
<label>
|
|
<input type="checkbox"
|
|
name="breznflow_settings[allow_embed]" value="1"
|
|
<?php checked( 1, (int) $settings['allow_embed'] ); ?> />
|
|
<?php esc_html_e( 'Allow iframe embedding (creates public embed URL)', 'breznflow' ); ?></label>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th><?php esc_html_e( 'Get JSON', 'breznflow' ); ?></th>
|
|
<td>
|
|
<label>
|
|
<input type="checkbox"
|
|
name="breznflow_settings[allow_get_json]" value="1"
|
|
<?php checked( 1, (int) $settings['allow_get_json'] ); ?> />
|
|
<?php esc_html_e( 'Visitors can view/copy workflow JSON', 'breznflow' ); ?></label>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th><?php esc_html_e( 'Allow Download', 'breznflow' ); ?></th>
|
|
<td>
|
|
<label>
|
|
<input type="checkbox"
|
|
name="breznflow_settings[allow_download]" value="1"
|
|
<?php checked( 1, (int) $settings['allow_download'] ); ?> />
|
|
<?php esc_html_e( 'Allow visitors to download sanitized workflow JSON', 'breznflow' ); ?></label>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th><label for="bf-download-label"><?php esc_html_e( 'Download Button Label', 'breznflow' ); ?></label></th>
|
|
<td>
|
|
<input type="text" name="breznflow_settings[download_label]" id="bf-download-label"
|
|
value="<?php echo esc_attr( $settings['download_label'] ); ?>" class="regular-text" />
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="breznflow-card">
|
|
<h2><?php esc_html_e( 'Features', 'breznflow' ); ?></h2>
|
|
<table class="form-table">
|
|
<tr>
|
|
<th><?php esc_html_e( 'View Counting', 'breznflow' ); ?></th>
|
|
<td>
|
|
<label>
|
|
<input type="checkbox"
|
|
name="breznflow_settings[view_counting]" value="1"
|
|
<?php checked( 1, (int) $settings['view_counting'] ); ?> />
|
|
<?php esc_html_e( 'Track shortcode render count per workflow', 'breznflow' ); ?></label>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th><?php esc_html_e( 'Related Workflows', 'breznflow' ); ?></th>
|
|
<td>
|
|
<label>
|
|
<input type="checkbox"
|
|
name="breznflow_settings[related_workflows]" value="1"
|
|
<?php checked( 1, (int) $settings['related_workflows'] ); ?> />
|
|
<?php esc_html_e( 'Enable related workflows by shared node types', 'breznflow' ); ?></label>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th><?php esc_html_e( 'Schema.org HowTo', 'breznflow' ); ?></th>
|
|
<td>
|
|
<label>
|
|
<input type="checkbox"
|
|
name="breznflow_settings[schema_howto]" value="1"
|
|
<?php checked( 1, (int) $settings['schema_howto'] ); ?> />
|
|
<?php esc_html_e( 'Output Schema.org HowTo structured data in page head', 'breznflow' ); ?></label>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<?php submit_button(); ?>
|
|
</form>
|
|
</div>
|