PluginProbe
Polylang / 2.9
Polylang v2.9
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/admin-sync.php +22 -30 3.02.9 View file →
@@ -61,18 +61,16 @@
61 61
62 62 $from_post_id = (int) $_GET['from_post'];
63 63 $from_post = get_post( $from_post_id );
64 64
65 - if ( $from_post instanceof WP_Post ) {
66 - foreach ( array( 'menu_order', 'comment_status', 'ping_status' ) as $property ) {
67 - $data[ $property ] = $from_post->$property;
68 - }
65 + foreach ( array( 'menu_order', 'comment_status', 'ping_status' ) as $property ) {
66 + $data[ $property ] = $from_post->$property;
67 + }
69 68
70 - // Copy the date only if the synchronization is activated
71 - if ( in_array( 'post_date', $this->options['sync'] ) ) {
72 - $data['post_date'] = $from_post->post_date;
73 - $data['post_date_gmt'] = $from_post->post_date_gmt;
74 - }
69 + // Copy the date only if the synchronization is activated
70 + if ( in_array( 'post_date', $this->options['sync'] ) ) {
71 + $data['post_date'] = $from_post->post_date;
72 + $data['post_date_gmt'] = $from_post->post_date_gmt;
75 73 }
76 74 }
77 75
78 76 return $data;
@@ -81,10 +79,8 @@
81 79 /**
82 80 * Copy post metas, and taxonomies when using "Add new" ( translation )
83 81 *
84 82 * @since 2.5
85 - *
86 - * @return void
87 83 */
88 84 public function new_post_translation() {
89 85 global $post;
90 86 static $done = array();
@@ -111,14 +107,14 @@
111 107 }
112 108 }
113 109
114 110 /**
115 - * Get post fields to synchronize.
111 + * Get post fields to synchronize
116 112 *
117 113 * @since 2.4
118 114 *
119 - * @param WP_Post $post Post object.
120 - * @return array Fields to synchronize.
115 + * @param object $post Post object
116 + * @return array
121 117 */
122 118 protected function get_fields_to_sync( $post ) {
123 119 global $wpdb;
124 120
@@ -131,19 +127,16 @@
131 127 unset( $postarr['post_date'] );
132 128 unset( $postarr['post_date_gmt'] );
133 129
134 130 $original = get_post( (int) $_GET['from_post'] );
135 -
136 - if ( $original instanceof WP_Post ) {
137 - $wpdb->update(
138 - $wpdb->posts,
139 - array(
140 - 'post_date' => $original->post_date,
141 - 'post_date_gmt' => $original->post_date_gmt,
142 - ),
143 - array( 'ID' => $post->ID )
144 - );
145 - }
131 + $wpdb->update(
132 + $wpdb->posts,
133 + array(
134 + 'post_date' => $original->post_date,
135 + 'post_date_gmt' => $original->post_date_gmt,
136 + ),
137 + array( 'ID' => $post->ID )
138 + );
146 139 }
147 140
148 141 if ( isset( $GLOBALS['post_type'] ) ) {
149 142 $post_type = $GLOBALS['post_type'];
@@ -159,15 +152,15 @@
159 152 return $postarr;
160 153 }
161 154
162 155 /**
163 - * Synchronizes post fields in translations.
156 + * Synchronizes post fields in translations
164 157 *
165 158 * @since 1.2
166 159 *
167 - * @param int $post_id Post id.
168 - * @param WP_Post $post Post object.
169 - * @param int[] $translations Post translations.
160 + * @param int $post_id post id
161 + * @param object $post post object
162 + * @param array $translations post translations
170 163 */
171 164 public function pll_save_post( $post_id, $post, $translations ) {
172 165 parent::pll_save_post( $post_id, $post, $translations );
173 166
@@ -192,9 +185,8 @@
192 185 * @since 2.3
193 186 *
194 187 * @param string $func Function name
195 188 * @param array $args Function arguments
196 - * @return mixed|void
197 189 */
198 190 public function __call( $func, $args ) {
199 191 $obj = substr( $func, 5 );
200 192