| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Settings class for tools |
| 5 |
* |
| 6 |
* @since 1.8 |
| 7 |
*/ |
| 8 |
class PLL_Settings_Tools extends PLL_Settings_Module { |
| 9 |
|
| 10 |
/** |
| 11 |
* Constructor |
| 12 |
* |
| 13 |
* @since 1.8 |
| 14 |
* |
| 15 |
* @param object $polylang polylang object |
| 16 |
*/ |
| 17 |
public function __construct( &$polylang ) { |
| 18 |
parent::__construct( |
| 19 |
$polylang, |
| 20 |
array( |
| 21 |
'module' => 'tools', |
| 22 |
'title' => __( 'Tools', 'polylang' ), |
| 23 |
'description' => __( 'Decide whether to remove all data when deleting Polylang.', 'polylang' ), |
| 24 |
) |
| 25 |
); |
| 26 |
} |
| 27 |
|
| 28 |
/** |
| 29 |
* Displays the settings form |
| 30 |
* |
| 31 |
* @since 1.8 |
| 32 |
*/ |
| 33 |
protected function form() { |
| 34 |
printf( |
| 35 |
'<label for="uninstall"><input id="uninstall" name="uninstall" type="checkbox" value="1" %s /> %s</label>', |
| 36 |
empty( $this->options['uninstall'] ) ? '' : 'checked="checked"', |
| 37 |
esc_html__( 'Remove all Polylang data when using the "Delete" link on the plugins screen.', 'polylang' ) |
| 38 |
); |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* Sanitizes the settings before saving |
| 43 |
* |
| 44 |
* @since 1.8 |
| 45 |
* |
| 46 |
* @param array $options |
| 47 |
*/ |
| 48 |
protected function update( $options ) { |
| 49 |
$newoptions['uninstall'] = isset( $options['uninstall'] ) ? 1 : 0; |
| 50 |
return $newoptions; // Take care to return only validated options |
| 51 |
} |
| 52 |
} |
| 53 |
|