PluginProbe
The WP Remote WordPress Plugin / 4.79
The WP Remote WordPress Plugin v4.79
6.72 6.69 6.65 6.62 6.48 6.47 4.87 4.97 5.05 5.09 5.16 5.22 5.24 5.25 5.38 5.41 5.42 5.45 5.47 5.53 5.56 5.65 5.68 5.72 5.73 All 53 releases
← All changes | wp_dynsync.php +33 -42 4.874.79 View file →
@@ -47,23 +47,26 @@
47 47 $this->add_db_event('posts', array('ID' => $post_id, 'msg_type' => $msg_type));
48 48 }
49 49
50 50 function get_ignored_postmeta() {
51 + $defaults = array(
52 + '_excluded_links'
53 + );
51 54 $ignored_postmeta = $this->ignored_events['postmeta'];
52 55 if (empty($ignored_postmeta)) {
53 56 $ignored_postmeta = array();
54 57 }
55 - return array_unique($ignored_postmeta);
58 + return array_unique(array_merge($defaults, $ignored_postmeta));
56 59 }
57 60
58 61 function postmeta_insert_handler($meta_id, $post_id, $meta_key, $meta_value='') {
59 - if ($this->is_key_ignored($this->get_ignored_postmeta(), $meta_key))
62 + if (in_array($meta_key, $this->get_ignored_postmeta(), true))
60 63 return;
61 64 $this->add_db_event('postmeta', array('meta_id' => $meta_id));
62 65 }
63 66
64 67 function postmeta_modification_handler($meta_id, $object_id, $meta_key, $meta_value) {
65 - if ($this->is_key_ignored($this->get_ignored_postmeta(), $meta_key))
68 + if (in_array($meta_key, $this->get_ignored_postmeta(), true))
66 69 return;
67 70 if (!is_array($meta_id))
68 71 return $this->add_db_event('postmeta', array('meta_id' => $meta_id));
69 72 foreach ($meta_id as $id) {
@@ -71,9 +74,9 @@
71 74 }
72 75 }
73 76
74 77 function postmeta_action_handler($meta_id, $post_id = null, $meta_key = null) {
75 - if ($this->is_key_ignored($this->get_ignored_postmeta(), $meta_key))
78 + if (in_array($meta_key, $this->get_ignored_postmeta(), true))
76 79 return;
77 80 if ( !is_array($meta_id) )
78 81 return $this->add_db_event('postmeta', array('meta_id' => $meta_id));
79 82 foreach ( $meta_id as $id )
@@ -185,29 +188,39 @@
185 188 $this->term_relationships_handler( $object_id, $tt_ids );
186 189 }
187 190
188 191 function get_ignored_options() {
192 + $defaults = array(
193 + 'cron',
194 + 'wpsupercache_gc_time',
195 + 'rewrite_rules',
196 + 'akismet_spam_count',
197 + 'iwp_client_user_hit_count',
198 + '_disqus_sync_lock',
199 + 'stats_cache'
200 + );
189 201 $ignored_options = $this->ignored_events['options'];
190 202 if (empty($ignored_options)) {
191 203 $ignored_options = array();
192 204 }
193 - return array_unique($ignored_options);
205 + return array_unique(array_merge($defaults, $ignored_options));
194 206 }
195 207
196 - function is_key_ignored($ignored_keys, $value) {
197 - $is_ignored = false;
198 - foreach($ignored_keys as $val) {
208 + function get_ping_permission($option_name) {
209 + $ping_permitted = true;
210 + $ignored_options = $this->get_ignored_options();
211 + foreach($ignored_options as $val) {
199 212 if ($val[0] == '/') {
200 - if (preg_match($val, $value))
201 - $is_ignored = true;
213 + if (preg_match($val, $option_name))
214 + $ping_permitted = false;
202 215 } else {
203 - if ($val == $value)
204 - $is_ignored = true;
216 + if ($val == $option_name)
217 + $ping_permitted = false;
205 218 }
206 - if ($is_ignored)
219 + if (!$ping_permitted)
207 220 break;
208 221 }
209 - return $is_ignored;
222 + return $ping_permitted;
210 223 }
211 224
212 225 function option_handler($option_name) {
213 226 if (current_filter() == 'deleted_option')
@@ -213,10 +226,10 @@
213 226 if (current_filter() == 'deleted_option')
214 227 $msg_type = 'delete';
215 228 else
216 229 $msg_type = 'edit';
217 - $is_ignored = $this->is_key_ignored($this->get_ignored_options(), $option_name);
218 - if (!$is_ignored)
230 + $ping_permitted = $this->get_ping_permission($option_name);
231 + if ($ping_permitted)
219 232 $this->add_db_event('options', array('option_name' => $option_name, 'msg_type' => $msg_type));
220 233 return $option_name;
221 234 }
222 235
@@ -244,13 +257,13 @@
244 257 $this->add_db_event('blogs', array('site_id' => $site_id));
245 258 }
246 259
247 260 function sitemeta_handler($option) {
248 - $is_ignored = $this->is_key_ignored($this->get_ignored_options(), $option);
249 - if (!$is_ignored && is_multisite()) {
261 + $ping_permitted = $this->get_ping_permission($option);
262 + if ($ping_permitted && is_multisite()) {
250 263 $this->add_db_event('sitemeta', array('site_id' => $this->db->getSiteId(), 'meta_key' => $option));
251 264 }
252 - return !$is_ignored;
265 + return $ping_permitted;
253 266 }
254 267
255 268 /* WOOCOMMERCE SUPPORT FUNCTIONS BEGINS FROM HERE*/
256 269
@@ -266,27 +279,8 @@
266 279 }
267 280 }
268 281 }
269 282
270 - function woocommerce_update_order_handler($order_id, $order = null) {
271 - $this->add_db_event('wc_orders', array('id' => $order_id));
272 - $this->add_db_event('wc_orders_meta', array('order_id' => $order_id));
273 - $this->add_db_event('wc_order_addresses', array('order_id' => $order_id));
274 - $this->add_db_event('wc_order_operational_data', array('order_id' => $order_id));
275 - }
276 -
277 - function woocommerce_trash_order_handler($order_id) {
278 - $this->add_db_event('wc_orders', array('id' => $order_id));
279 - $this->add_db_event('wc_orders_meta', array('order_id' => $order_id));
280 - }
281 -
282 - function woocommerce_delete_order_handler($order_id) {
283 - $this->add_db_event('wc_orders', array('id' => $order_id, 'msg_type' => 'delete'));
284 - $this->add_db_event('wc_orders_meta', array('order_id' => $order_id, 'msg_type' => 'delete'));
285 - $this->add_db_event('wc_order_addresses', array('order_id' => $order_id, 'msg_type' => 'delete'));
286 - $this->add_db_event('wc_order_operational_data', array('order_id' => $order_id, 'msg_type' => 'delete'));
287 - }
288 -
289 283 function woocommerce_new_order_item_handler($item_id, $item, $order_id) {
290 284 $this->add_db_event('woocommerce_order_items', array('order_item_id' => $item_id));
291 285 $this->add_db_event('woocommerce_order_itemmeta', array('order_item_id' => $item_id));
292 286 }
@@ -564,9 +558,9 @@
564 558 add_action('wp_insert_post', array($this, 'post_action_handler'));
565 559 add_action('edit_attachment', array($this, 'post_action_handler'));
566 560 add_action('add_attachment', array($this, 'post_action_handler'));
567 561 add_action('delete_attachment', array($this, 'post_action_handler'));
568 - add_action('private_to_publish', array($this, 'post_action_handler'));
562 + add_action('private_to_published', array($this, 'post_action_handler'));
569 563 add_action('wp_restore_post_revision', array($this, 'post_action_handler'));
570 564
571 565 /* CAPTURING EVENTS FOR WP_POSTMETA TABLE */
572 566 // Why events for both delete and deleted
@@ -616,11 +610,8 @@
616 610 add_action('add_site_option', array($this, 'sitemeta_handler'), 10, 1);
617 611 add_action('update_site_option', array($this, 'sitemeta_handler'), 10, 1);
618 612
619 613 /* CAPTURING EVENTS FOR WOOCOMMERCE */
620 - add_action('woocommerce_update_order', array($this, 'woocommerce_update_order_handler'), 10, 2);
621 - add_action('woocommerce_delete_order', array($this, 'woocommerce_delete_order_handler'), 10, 1);
622 - add_action('woocommerce_trash_order', array($this, 'woocommerce_trash_order_handler'), 10, 1);
623 614 add_action('woocommerce_resume_order', array($this, 'woocommerce_resume_order_handler'), 10, 1);
624 615 add_action('woocommerce_new_order_item', array($this, 'woocommerce_new_order_item_handler'), 10, 3);
625 616 add_action('woocommerce_update_order_item', array($this, 'woocommerce_update_order_item_handler'), 10, 2);
626 617 add_action('woocommerce_delete_order_item', array($this, 'woocommerce_delete_order_item_handler'), 10, 1);