PluginProbe
Polylang / 2.1
Polylang v2.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 +18 -25 2.7.22.1 View file →
@@ -7,9 +7,9 @@
7 7 */
8 8 class PLL_Settings_Sync extends PLL_Settings_Module {
9 9
10 10 /**
11 - * Constructor
11 + * constructor
12 12 *
13 13 * @since 1.8
14 14 *
15 15 * @param object $polylang polylang object
@@ -14,20 +14,17 @@
14 14 *
15 15 * @param object $polylang polylang object
16 16 */
17 17 public function __construct( &$polylang ) {
18 - parent::__construct(
19 - $polylang,
20 - array(
21 - 'module' => 'sync',
22 - 'title' => __( 'Synchronization', 'polylang' ),
23 - 'description' => __( 'The synchronization options allow to maintain exact same values (or translations in the case of taxonomies and page parent) of meta content between the translations of a post or page.', 'polylang' ),
24 - )
25 - );
18 + parent::__construct( $polylang, array(
19 + 'module' => 'sync',
20 + 'title' => __( 'Synchronization', 'polylang' ),
21 + 'description' => __( 'The synchronization options allow to maintain exact same values (or translations in the case of taxonomies and page parent) of meta content between the translations of a post or page.', 'polylang' ),
22 + ) );
26 23 }
27 24
28 25 /**
29 - * Deactivates the module
26 + * deactivates the module
30 27 *
31 28 * @since 1.8
32 29 */
33 30 public function deactivate() {
@@ -35,31 +32,27 @@
35 32 update_option( 'polylang', $this->options );
36 33 }
37 34
38 35 /**
39 - * Displays the settings form
36 + * displays the settings form
40 37 *
41 38 * @since 1.8
42 39 */
43 - protected function form() {
44 - ?>
45 - <ul class="pll-inline-block-list">
46 - <?php
40 + protected function form() {?>
41 + <ul class="pll-inline-block-list"><?php
47 42 foreach ( self::list_metas_to_sync() as $key => $str ) {
48 43 printf(
49 44 '<li><label><input name="sync[%s]" type="checkbox" value="1" %s /> %s</label></li>',
50 45 esc_attr( $key ),
51 - checked( in_array( $key, $this->options['sync'] ), true, false ),
46 + in_array( $key, $this->options['sync'] ) ? 'checked="checked"' : '',
52 47 esc_html( $str )
53 48 );
54 - }
55 - ?>
56 - </ul>
57 - <?php
49 + } ?>
50 + </ul><?php
58 51 }
59 52
60 53 /**
61 - * Sanitizes the settings before saving
54 + * sanitizes the settings before saving
62 55 *
63 56 * @since 1.8
64 57 *
65 58 * @param array $options
@@ -64,14 +57,14 @@
64 57 *
65 58 * @param array $options
66 59 */
67 60 protected function update( $options ) {
68 - $newoptions = array( 'sync' => empty( $options['sync'] ) ? array() : array_keys( $options['sync'], 1 ) );
61 + $newoptions['sync'] = empty( $options['sync'] ) ? array() : array_keys( $options['sync'], 1 );
69 62 return $newoptions; // take care to return only validated options
70 63 }
71 64
72 65 /**
73 - * Get the row actions
66 + * get the row actions
74 67 *
75 68 * @since 1.8
76 69 *
77 70 * @return array
@@ -80,15 +73,15 @@
80 73 return empty( $this->options['sync'] ) ? array( 'configure' ) : array( 'configure', 'deactivate' );
81 74 }
82 75
83 76 /**
84 - * List the post metas to synchronize
77 + * list the post metas to synchronize
85 78 *
86 79 * @since 1.0
87 80 *
88 81 * @return array
89 82 */
90 - public static function list_metas_to_sync() {
83 + static public function list_metas_to_sync() {
91 84 return array(
92 85 'taxonomies' => __( 'Taxonomies', 'polylang' ),
93 86 'post_meta' => __( 'Custom fields', 'polylang' ),
94 87 'comment_status' => __( 'Comment status', 'polylang' ),