| @@ -20,9 +20,9 @@ | ||
| 20 | 20 | * Constructor |
| 21 | 21 | * |
| 22 | 22 | * @since 1.8 |
| 23 | 23 | * |
| 24 | - * @param object $polylang polylang object | |
| 24 | + * @param object $polylang The polylang object. | |
| 25 | 25 | */ |
| 26 | 26 | public function __construct( &$polylang ) { |
| 27 | 27 | parent::__construct( |
| 28 | 28 | $polylang, |
| @@ -40,9 +40,8 @@ | ||
| 40 | 40 | * @since 1.8 |
| 41 | 41 | */ |
| 42 | 42 | public function deactivate() { |
| 43 | 43 | $this->options['sync'] = array(); |
| 44 | - update_option( 'polylang', $this->options ); | |
| 45 | 44 | } |
| 46 | 45 | |
| 47 | 46 | /** |
| 48 | 47 | * Displays the settings form |
| @@ -66,17 +65,18 @@ | ||
| 66 | 65 | <?php |
| 67 | 66 | } |
| 68 | 67 | |
| 69 | 68 | /** |
| 70 | - * Sanitizes the settings before saving | |
| 69 | + * Prepare the received data before saving. | |
| 71 | 70 | * |
| 72 | - * @since 1.8 | |
| 71 | + * @since 3.7 | |
| 73 | 72 | * |
| 74 | - * @param array $options | |
| 73 | + * @param array $options Raw values to save. | |
| 74 | + * @return array | |
| 75 | 75 | */ |
| 76 | - protected function update( $options ) { | |
| 77 | - $newoptions = array( 'sync' => empty( $options['sync'] ) ? array() : array_keys( $options['sync'], 1 ) ); | |
| 78 | - return $newoptions; // take care to return only validated options | |
| 76 | + protected function prepare_raw_data( array $options ): array { | |
| 77 | + // Take care to return only validated options. | |
| 78 | + return array( 'sync' => empty( $options['sync'] ) ? array() : array_keys( $options['sync'], 1 ) ); | |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * Get the row actions. |
| @@ -94,8 +94,10 @@ | ||
| 94 | 94 | * |
| 95 | 95 | * @since 1.0 |
| 96 | 96 | * |
| 97 | 97 | * @return string[] Array synchronization options. |
| 98 | + * | |
| 99 | + * @phpstan-return non-empty-array<non-falsy-string, string> | |
| 98 | 100 | */ |
| 99 | 101 | public static function list_metas_to_sync() { |
| 100 | 102 | return array( |
| 101 | 103 | 'taxonomies' => __( 'Taxonomies', 'polylang' ), |