| 1 |
<?php |
| 2 |
add_filter( 'wpas_plugin_settings', 'wpas_core_settings_style', 5, 1 ); |
| 3 |
/** |
| 4 |
* Add plugin style settings. |
| 5 |
* |
| 6 |
* @param (array) $def Array of existing settings |
| 7 |
* @return (array) Updated settings |
| 8 |
*/ |
| 9 |
function wpas_core_settings_style( $def ) { |
| 10 |
|
| 11 |
$settings = array( |
| 12 |
'style' => array( |
| 13 |
'name' => __( 'Style', 'awesome-support' ), |
| 14 |
'options' => array( |
| 15 |
array( |
| 16 |
'name' => __( 'Theme', 'awesome-support' ), |
| 17 |
'id' => 'theme', |
| 18 |
'type' => 'select', |
| 19 |
'desc' => __( 'Which theme to use for the front-end.', 'awesome-support' ), |
| 20 |
'options' => wpas_list_themes(), |
| 21 |
'default' => 'default' |
| 22 |
), |
| 23 |
array( |
| 24 |
'name' => __( 'Overlay', 'awesome-support' ), |
| 25 |
'id' => 'theme_overlay', |
| 26 |
'type' => 'select', |
| 27 |
'desc' => __( 'An overlay is generally a pure css variation on the theme selected above that overides the colors of the selected theme. The default overlay is the most widely compatible overlay - other overlays may or may not work with your theme. There is limited technical support for overlays other than the default.', 'awesome-support' ), |
| 28 |
'options' => wpas_list_overlays(), |
| 29 |
'default' => 'style.css' |
| 30 |
), |
| 31 |
array( |
| 32 |
'name' => __( 'Theme Stylesheet', 'awesome-support' ), |
| 33 |
'id' => 'theme_stylesheet', |
| 34 |
'type' => 'checkbox', |
| 35 |
'desc' => __( 'Load the theme stylesheet. Don\'t uncheck if you don\'t know what this means', 'awesome-support' ), |
| 36 |
'default' => true |
| 37 |
), |
| 38 |
array( |
| 39 |
'name' => __( 'Use editor in front-end', 'awesome-support' ), |
| 40 |
'id' => 'frontend_wysiwyg_editor', |
| 41 |
'type' => 'checkbox', |
| 42 |
'desc' => __( 'Show an editor for the ticket description when user submits a ticket.', 'awesome-support' ), |
| 43 |
'default' => true |
| 44 |
), |
| 45 |
array( |
| 46 |
'name' => __( 'Use automatic linker', 'awesome-support' ), |
| 47 |
'id' => 'use_autolinker', |
| 48 |
'type' => 'checkbox', |
| 49 |
'desc' => __( 'Automatically link URLs, email addresses, phone numbers, twitter handles, and hashtags', 'awesome-support' ), |
| 50 |
'default' => true |
| 51 |
), |
| 52 |
array( |
| 53 |
'name' => __( 'Colors', 'awesome-support' ), |
| 54 |
'type' => 'heading', |
| 55 |
), |
| 56 |
array( |
| 57 |
'name' => __( 'Open Status', 'awesome-support' ), |
| 58 |
'id' => 'color_open', |
| 59 |
'type' => 'color', |
| 60 |
'default' => '#81d742', |
| 61 |
), |
| 62 |
array( |
| 63 |
'name' => __( 'Closed Status', 'awesome-support' ), |
| 64 |
'id' => 'gas_color_closed', |
| 65 |
'type' => 'color', |
| 66 |
'default' => '#dd3333', |
| 67 |
), |
| 68 |
array( |
| 69 |
'name' => __( 'Old Status', 'awesome-support' ), |
| 70 |
'id' => 'color_old', |
| 71 |
'type' => 'color', |
| 72 |
'default' => '#dd9933', |
| 73 |
), |
| 74 |
array( |
| 75 |
'name' => __( 'Awaiting Reply', 'awesome-support' ), |
| 76 |
'id' => 'color_awaiting_reply', |
| 77 |
'type' => 'color', |
| 78 |
'default' => '#0074a2', |
| 79 |
), |
| 80 |
array( |
| 81 |
'name' => __( 'Ticket Template Type', 'awesome-support' ), |
| 82 |
'id' => 'color_ticket_template_type', |
| 83 |
'type' => 'color', |
| 84 |
'default' => '#1383D9', |
| 85 |
), |
| 86 |
) |
| 87 |
), |
| 88 |
); |
| 89 |
|
| 90 |
$status = wpas_get_post_status(); |
| 91 |
|
| 92 |
$defaults = apply_filters( 'wpas_labels_default_colors', array( |
| 93 |
'queued' => '#1e73be', |
| 94 |
'processing' => '#a01497', |
| 95 |
'hold' => '#b56629', |
| 96 |
'unknown' => '#169baa' |
| 97 |
) ); |
| 98 |
|
| 99 |
foreach ( $status as $id => $label ) { |
| 100 |
|
| 101 |
$option = array( |
| 102 |
'name' => $label, |
| 103 |
'id' => 'color_' . $id, |
| 104 |
'type' => 'color', |
| 105 |
'default' => isset( $defaults[$id] ) ? $defaults[$id] : wpas_get_option( "color_$id", $defaults['unknown'] ), |
| 106 |
); |
| 107 |
|
| 108 |
array_push( $settings['style']['options'], $option ); |
| 109 |
} |
| 110 |
|
| 111 |
return array_merge( $def, apply_filters('wpas_settings_style', $settings ) ); |
| 112 |
|
| 113 |
} |