public static function callback_save_post($post_id, \WP_Post $post, $update)
 {
     if (!$update || defined('DOING_AJAX') || defined('DOING_AUTOSAVE')) {
         return;
     }
     $is_export_allowed = filter_var($_POST['dabory-post-export'], FILTER_VALIDATE_BOOLEAN);
     if (!$is_export_allowed) {
         return;
     }
     $auth = new \WSKL_Auth_Info('marketing');
     if ($auth->is_verified()) {
         $key_type = $auth->get_key_type();
         $key_value = $auth->get_key_value();
         $user_id = $auth->get_oir()->get_user_id();
         $site_url = site_url();
         PostAPI::send_post($key_type, $key_value, $site_url, $user_id, $post_id);
         update_post_meta($post_id, LAST_POST_EXPORT, time());
     }
 }
 public static function callback_save_post($post_id, \WP_Post $post, $update)
 {
     if (!$update || defined('DOING_AJAX') || defined('DOING_AUTOSAVE')) {
         return;
     }
     $is_export_allowed = filter_var(wskl_POST('allow-export'), FILTER_VALIDATE_BOOLEAN);
     if (!$is_export_allowed) {
         return;
     }
     $auth = new WSKL_Auth_Info('marketing');
     if ($auth->is_verified()) {
         $key_type = $auth->get_key_type();
         $key_value = $auth->get_key_value();
         $user_id = $auth->get_oir()->get_user_id();
         $site_url = site_url();
         $remote_post_id = PostAPI::send_post($key_type, $key_value, $site_url, $user_id, $post_id);
         if ($remote_post_id) {
             $metadata = array('post_modified' => $post->post_modified, 'post_modified_gmt' => $post->post_modified_gmt, 'exported' => time(), 'remote_post_id' => $remote_post_id);
             update_post_meta($post_id, wskl_get_option_name('post_export_metadata'), $metadata);
         } else {
             error_log('callback_save_post() finished unsuccessfully!');
         }
     }
 }
 public function test_sendPost()
 {
     PostAPI::send_post('marketing', $this->marketingApiKey, site_url(), '1', $this->testPost);
 }