| 1 |
<?php |
| 2 |
/** |
| 3 |
* Global chart style settings page template. |
| 4 |
* |
| 5 |
* Variables available: |
| 6 |
* $settings array Current global settings (color_primary, color_secondary) |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; |
| 11 |
} |
| 12 |
|
| 13 |
$updated = isset( $_GET['updated'] ) ? sanitize_text_field( $_GET['updated'] ) : ''; |
| 14 |
?> |
| 15 |
<div class="wrap"> |
| 16 |
<h1><?php esc_html_e( 'Visualizer Settings', 'visualizer' ); ?></h1> |
| 17 |
|
| 18 |
<?php if ( 'true' === $updated ) : ?> |
| 19 |
<div class="notice notice-success is-dismissible"> |
| 20 |
<p><?php esc_html_e( 'Settings saved.', 'visualizer' ); ?></p> |
| 21 |
</div> |
| 22 |
<?php elseif ( 'cleared' === $updated ) : ?> |
| 23 |
<div class="notice notice-success is-dismissible"> |
| 24 |
<p><?php esc_html_e( 'Settings cleared.', 'visualizer' ); ?></p> |
| 25 |
</div> |
| 26 |
<?php endif; ?> |
| 27 |
|
| 28 |
<form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>"> |
| 29 |
<?php wp_nonce_field( 'visualizer_save_global_settings' ); ?> |
| 30 |
<input type="hidden" name="action" value="visualizer_save_global_settings" /> |
| 31 |
|
| 32 |
<table class="form-table" role="presentation"> |
| 33 |
<tbody> |
| 34 |
|
| 35 |
<tr> |
| 36 |
<th scope="row"> |
| 37 |
<label for="visualizer-color-primary"><?php esc_html_e( 'Primary Color', 'visualizer' ); ?></label> |
| 38 |
</th> |
| 39 |
<td> |
| 40 |
<input |
| 41 |
type="text" |
| 42 |
id="visualizer-color-primary" |
| 43 |
name="visualizer_color_primary" |
| 44 |
class="visualizer-color-picker" |
| 45 |
value="<?php echo esc_attr( $settings['color_primary'] ); ?>" |
| 46 |
data-default-color="" |
| 47 |
/> |
| 48 |
<p class="description"><?php esc_html_e( 'Primary color applied to the first data series in new charts.', 'visualizer' ); ?></p> |
| 49 |
</td> |
| 50 |
</tr> |
| 51 |
|
| 52 |
<tr> |
| 53 |
<th scope="row"> |
| 54 |
<label for="visualizer-color-secondary"><?php esc_html_e( 'Secondary Color', 'visualizer' ); ?></label> |
| 55 |
</th> |
| 56 |
<td> |
| 57 |
<input |
| 58 |
type="text" |
| 59 |
id="visualizer-color-secondary" |
| 60 |
name="visualizer_color_secondary" |
| 61 |
class="visualizer-color-picker" |
| 62 |
value="<?php echo esc_attr( $settings['color_secondary'] ); ?>" |
| 63 |
data-default-color="" |
| 64 |
/> |
| 65 |
<p class="description"><?php esc_html_e( 'Secondary color applied to the second data series in new charts.', 'visualizer' ); ?></p> |
| 66 |
</td> |
| 67 |
</tr> |
| 68 |
|
| 69 |
<tr> |
| 70 |
<th scope="row"> |
| 71 |
<label for="visualizer-apply-existing"><?php esc_html_e( 'Apply To Existing Charts', 'visualizer' ); ?></label> |
| 72 |
</th> |
| 73 |
<td> |
| 74 |
<label> |
| 75 |
<input |
| 76 |
type="checkbox" |
| 77 |
id="visualizer-apply-existing" |
| 78 |
name="visualizer_apply_existing" |
| 79 |
value="1" |
| 80 |
<?php checked( $settings['apply_existing'], '1' ); ?> |
| 81 |
/> |
| 82 |
<?php esc_html_e( 'Apply global colors to existing charts at render time (this will override chart colors on display).', 'visualizer' ); ?> |
| 83 |
</label> |
| 84 |
</td> |
| 85 |
</tr> |
| 86 |
|
| 87 |
</tbody> |
| 88 |
</table> |
| 89 |
|
| 90 |
<p class="submit"> |
| 91 |
<button type="submit" class="button button-primary"> |
| 92 |
<?php esc_html_e( 'Save Settings', 'visualizer' ); ?> |
| 93 |
</button> |
| 94 |
<button type="submit" name="visualizer_clear_settings" value="1" class="button" style="margin-left:10px;"> |
| 95 |
<?php esc_html_e( 'Clear Settings', 'visualizer' ); ?> |
| 96 |
</button> |
| 97 |
</p> |
| 98 |
</form> |
| 99 |
</div> |
| 100 |
|
| 101 |
<script type="text/javascript"> |
| 102 |
(function($) { |
| 103 |
$(document).ready(function() { |
| 104 |
$('.visualizer-color-picker').wpColorPicker(); |
| 105 |
}); |
| 106 |
})(jQuery); |
| 107 |
</script> |
| 108 |
|