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); } }
/** * @param $key_type * @param $echo * * @return string|void */ public static function get_license_duration_string($key_type, $echo = FALSE) { $info = new WSKL_Auth_Info($key_type); if ($info->is_available()) { if ($info->is_verified()) { $days_left = $info->get_oir()->get_key()->get_days_left(); $text = '<span class="wskl-info">' . sprintf('%s: %s, %s: %s, %s: %s %s', __('발급일', 'wskl'), static::to_date_string($info->get_oir()->get_key()->get_issue_date()), __('만료일', 'wskl'), static::to_date_string($info->get_oir()->get_key()->get_expire_date()), __('남은 기간', 'wskl'), $info->is_expired() ? __('만료됨', 'wskl') : $days_left, _n('일', '일', $days_left, 'wskl')) . '</span>'; } else { $text = '<span class="wskl-notice">' . __('활성화키가 인증되지 않아 기능이 실행되지 않습니다.', 'wskl') . '</span>'; } } else { if (empty($key_type)) { $text = __('키를 입력하지 않았습니다.', 'wskl'); } else { $text = '<span class="wskl-notice">' . __('활성화키가 인증되지 않아 기능이 실행되지 않습니다.', 'wskl') . '</span>'; } } if (!$echo) { return $text; } echo $text; }
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_modelOir() { $auth = new \WSKL_Auth_Info('payment'); $auth->set_oir($this->oir); $this->assertSame($auth->get_oir(), $this->oir); }