PluginProbe
Polylang / 3.7.1
Polylang v3.7.1
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
← All changes | modules/sync/settings-sync.php +14 -12 2.93.7.1 View file →
@@ -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,25 +65,26 @@
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 - * Get the row actions
82 + * Get the row actions.
83 83 *
84 84 * @since 1.8
85 85 *
86 - * @return array
86 + * @return string[] Row actions.
87 87 */
88 88 protected function get_actions() {
89 89 return empty( $this->options['sync'] ) ? array( 'configure' ) : array( 'configure', 'deactivate' );
90 90 }
@@ -89,13 +89,15 @@
89 89 return empty( $this->options['sync'] ) ? array( 'configure' ) : array( 'configure', 'deactivate' );
90 90 }
91 91
92 92 /**
93 - * List the post metas to synchronize
93 + * Get the list of synchronization settings.
94 94 *
95 95 * @since 1.0
96 96 *
97 - * @return array
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' ),