| @@ -8,11 +8,8 @@ | ||
| 8 | 8 | public static $actlog_table = 'activities_store'; |
| 9 | 9 | public $db; |
| 10 | 10 | public $settings; |
| 11 | 11 | public $bvinfo; |
| 12 | - public $request_id; | |
| 13 | - public $ip_header; | |
| 14 | - public $ignored_events; | |
| 15 | 12 | |
| 16 | 13 | public function __construct($db, $settings, $info, $config) { |
| 17 | 14 | $this->db = $db; |
| 18 | 15 | $this->settings = $settings; |
| @@ -119,11 +116,11 @@ | ||
| 119 | 116 | $ip = $_SERVER['REMOTE_ADDR']; |
| 120 | 117 | } |
| 121 | 118 | |
| 122 | 119 | $ip = trim($ip); |
| 123 | - if (WPRHelper::safePregMatch('/^\[([0-9a-fA-F:]+)\](:[0-9]+)$/', $ip, $matches)) { | |
| 120 | + if (preg_match('/^\[([0-9a-fA-F:]+)\](:[0-9]+)$/', $ip, $matches)) { | |
| 124 | 121 | $ip = $matches[1]; |
| 125 | - } elseif (WPRHelper::safePregMatch('/^([0-9.]+)(:[0-9]+)$/', $ip, $matches)) { | |
| 122 | + } elseif (preg_match('/^([0-9.]+)(:[0-9]+)$/', $ip, $matches)) { | |
| 126 | 123 | $ip = $matches[1]; |
| 127 | 124 | } |
| 128 | 125 | |
| 129 | 126 | return $ip; |
| @@ -152,9 +149,9 @@ | ||
| 152 | 149 | function is_key_ignored($ignored_keys, $value) { |
| 153 | 150 | $is_ignored = false; |
| 154 | 151 | if (array_key_exists("post_types_regex", $ignored_keys)) { |
| 155 | 152 | foreach ($ignored_keys['post_types_regex'] as $val) { |
| 156 | - if (WPRHelper::safePregMatch($val, $value)) { | |
| 153 | + if (preg_match($val, $value)) { | |
| 157 | 154 | return true; |
| 158 | 155 | } |
| 159 | 156 | } |
| 160 | 157 | } |
| @@ -403,8 +400,9 @@ | ||
| 403 | 400 | return $data; |
| 404 | 401 | } |
| 405 | 402 | |
| 406 | 403 | function get_update_data($options) { |
| 404 | + global $wp_version; | |
| 407 | 405 | $event_data = array('action' => 'update'); |
| 408 | 406 | if ($options['type'] === 'plugin') { |
| 409 | 407 | $event_data['type'] = 'plugin'; |
| 410 | 408 | if (array_key_exists("plugin", $options)) { |
| @@ -420,8 +418,12 @@ | ||
| 420 | 418 | unset($options['theme']); |
| 421 | 419 | } |
| 422 | 420 | $event_data['themes'] = $this->get_theme_update_data($options['themes']); |
| 423 | 421 | } |
| 422 | + else if ($options['type'] === 'core') { | |
| 423 | + $event_data['type'] = 'core'; | |
| 424 | + $event_data['wp_core'] = array('prev_version' => $wp_version); | |
| 425 | + } | |
| 424 | 426 | return $event_data; |
| 425 | 427 | } |
| 426 | 428 | |
| 427 | 429 | function get_install_data($upgrader, $options) { |
| @@ -439,11 +441,8 @@ | ||
| 439 | 441 | |
| 440 | 442 | function upgrade_handler($upgrader, $data) { |
| 441 | 443 | $event_data = array(); |
| 442 | 444 | if ($data['action'] === 'update') { |
| 443 | - if ('core' === $data['type']) { | |
| 444 | - return; | |
| 445 | - } | |
| 446 | 445 | $event_data = $this->get_update_data($data); |
| 447 | 446 | } else if ($data['action'] === 'install') { |
| 448 | 447 | $event_data = $this->get_install_data($upgrader, $data); |
| 449 | 448 | } |
| @@ -449,16 +448,8 @@ | ||
| 449 | 448 | } |
| 450 | 449 | $this->add_activity($event_data); |
| 451 | 450 | } |
| 452 | 451 | |
| 453 | - function core_upgrade_handler($new_wp_version) { | |
| 454 | - global $wp_version; | |
| 455 | - $event_data = array(); | |
| 456 | - $event_data['type'] = 'core'; | |
| 457 | - $event_data['wp_core'] = array('prev_version' => $wp_version, 'new_version' => $new_wp_version); | |
| 458 | - $this->add_activity($event_data); | |
| 459 | - } | |
| 460 | - | |
| 461 | 452 | /* ADDING ACTION AND LISTENERS FOR SENSING EVENTS. */ |
| 462 | 453 | public function add_actions_and_listeners() { |
| 463 | 454 | /* SENSORS FOR POST AND PAGE CHANGES */ |
| 464 | 455 | add_action('pre_post_update', array($this, 'post_handler')); |
| @@ -504,9 +495,8 @@ | ||
| 504 | 495 | add_action('password_reset', array( $this, 'password_reset_handler'), 10, 2); |
| 505 | 496 | |
| 506 | 497 | /* SENSOR FOR PLUGIN, THEME, WPCORE UPGRADES */ |
| 507 | 498 | add_action('upgrader_process_complete', array($this, 'upgrade_handler'), 10, 2); |
| 508 | - add_action('_core_updated_successfully', array($this, 'core_upgrade_handler'), 10, 1); | |
| 509 | 499 | |
| 510 | 500 | /* SENSORS FOR WOOCOMMERCE EVENTS */ |
| 511 | 501 | add_action('woocommerce_attribute_added', array($this, 'woocommerce_attribute_created_handler'), 10, 2); |
| 512 | 502 | add_action('woocommerce_attribute_updated', array($this, 'woocommerce_attribute_handler'), 10, 1); |