AdminPageSetting.Editor.class.php
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Register, display and save a TinyMC Editor field setting in the admin menu |
| 5 | * |
| 6 | * @since 1.0 |
| 7 | * @package Simple Admin Pages |
| 8 | */ |
| 9 | |
| 10 | class sapAdminPageSettingEditor_2_6_19 extends sapAdminPageSetting_2_6_19 { |
| 11 | |
| 12 | public $sanitize_callback = 'wp_kses_post'; |
| 13 | |
| 14 | /** |
| 15 | * List of arguments accepted by wp_editor |
| 16 | * @since 2.0 |
| 17 | */ |
| 18 | public $args = array(); |
| 19 | |
| 20 | /** |
| 21 | * wp_editor() will handle the escaping |
| 22 | * @since 2.0 |
| 23 | */ |
| 24 | public function esc_value( $val ) { |
| 25 | return $val; |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * Display this setting |
| 30 | * @since 2.0 |
| 31 | */ |
| 32 | public function display_setting() { |
| 33 | |
| 34 | $this->args['textarea_name'] = $this->get_input_name(); |
| 35 | |
| 36 | $value = empty( $this->value ) && !empty( $this->default ) ? $this->default : $this->value; |
| 37 | |
| 38 | ?> |
| 39 | |
| 40 | <fieldset <?php $this->print_conditional_data(); ?>> |
| 41 | <?php wp_editor( $value, preg_replace( '/[^\da-z]/i', '', $this->id), $this->args ); ?> |
| 42 | </fieldset> |
| 43 | |
| 44 | <?php |
| 45 | |
| 46 | $this->display_description(); |
| 47 | |
| 48 | } |
| 49 | |
| 50 | } |
| 51 |