private function send_sales_log($order_id) { $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(); SalesAPI::send_data($key_type, $key_value, $site_url, $user_id, $order_id); } }
public static function callback_woocommerce_before_single_product() { $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(); $product_id = get_the_ID(); TodaySeenAPI::send_data($key_type, $key_value, $site_url, $user_id, $product_id, 0, 0); } }
/** * @action wp_ajax_activate_action */ public function callback_activation() { wp_verify_nonce($_POST['activation_nonce'], static::$nonce_action) or die('nonce verification failed.'); $key_type = sanitize_text_field($_POST['key_type']); $key_value = sanitize_text_field($_POST['key_value']); $site_url = sanitize_text_field($_POST['site_url']); $company_name = get_bloginfo('name'); $activation = ClientAPI::activate($key_type, $key_value, $site_url, $company_name, TRUE); $info_model = new WSKL_Auth_Info($key_type); if ($activation instanceof OrderItemRelation) { $info_model->set_oir($activation); $info_model->save(); wp_send_json_success(); } else { $info_model->reset(); wp_send_json_error(); } die; }
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()); } }
private function verify() { if (!wskl_is_option_enabled('enable_sym_pg')) { return TRUE; } if (!is_null($this->verified) && is_bool($this->verified)) { return $this->verified; } $info = new WSKL_Auth_Info('payment'); $key_type = $info->get_key_type(); $key_value = $info->get_key_value(); $site_url = site_url(); // verification null 은 인증 실패. false 는 인증 서버 다운 등의 이유로 인증 시도가 이뤄지지 못함. $verification = ClientAPI::verify($key_type, $key_value, $site_url); if ($verification instanceof OrderItemRelation) { $info->set_oir($verification); $info->save(); $this->verified = TRUE; } else { if ($verification === NULL) { // 인증 실패 $this->verified = FALSE; } else { if ($verification === FALSE) { // 인증 불가 (서버의 이상) $this->verified = $info->is_verified(); } } } return $this->verified; }
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_modelOir() { $auth = new \WSKL_Auth_Info('payment'); $auth->set_oir($this->oir); $this->assertSame($auth->get_oir(), $this->oir); }
function wskl_license_authorized($license_type) { $info = new WSKL_Auth_Info($license_type); return $info->is_available() && $info->is_verified(); }