public static function process_withdrawal()
 {
     $action = wskl_POST('action');
     if ($action != 'dabory_members_withdrawal') {
         return;
     }
     self::evaluate_and_redirect_if_failed(is_user_logged_in(), __('먼저 로그인 하세요', 'wskl'));
     self::evaluate_and_redirect_if_failed(wp_verify_nonce($_POST['dabory_members_withdrawal'], 'dabory_members_withdrawal'), __('Nonce 인증에 실패했습니다.', 'wskl'));
     $user = wp_get_current_user();
     $password = wskl_POST('password');
     $reason = wskl_POST('reason', 'sanitize_text_field');
     self::evaluate_and_redirect_if_failed(wp_check_password($password, $user->user_pass, $user->ID), __('비밀번호가 일치하지 않습니다.', 'wskl'));
     if (wskl_is_option_enabled('members_delete_after_withdrawal')) {
         if (!function_exists('wp_delete_user')) {
             include_once ABSPATH . 'wp-admin/includes/user.php';
         }
         // 멤버 정말로 삭제
         wp_logout();
         wp_delete_user($user->ID);
     } else {
         // 역할을 바꿔 탈퇴 회원으로 간주
         update_user_meta($user->ID, 'withdrawal_reason', $reason);
         $user->set_role('wskl_withdrawn');
         wp_logout();
     }
     // 탈퇴 완료 메시지
     wp_redirect(add_query_arg(array('status' => 'complete'), $_SERVER['REQUEST_URI']));
     exit;
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 private static function get_login_options()
 {
     $login_options = array();
     $targets = array();
     if (wskl_is_option_enabled('fb_login')) {
         $targets[] = 'fb';
     }
     if (wskl_is_option_enabled('naver_login')) {
         $targets[] = 'naver';
     }
     foreach ($targets as $prefix) {
         $login_link_text = get_option(wskl_get_option_name($prefix . '_login_link_text'), '[icon]');
         if ($login_link_text && !empty($login_link_text)) {
             switch ($prefix) {
                 case 'fb':
                     $img_url = plugin_dir_url(WSKL_MAIN_FILE) . "assets/image/social-login/facebook.png";
                     $alt = __('페이스북으로 로그인', 'wskl');
                     break;
                 case 'naver':
                     $img_url = plugin_dir_url(WSKL_MAIN_FILE) . "assets/image/social-login/naver.png";
                     $alt = __('네이버 아이디로 로그인', 'wskl');
                     break;
                 default:
                     $img_url = '';
                     $alt = '';
             }
             $login_link_text = str_replace('[icon]', sprintf('<img src="%s" class="%s" alt="%s" title="%3$s">', esc_attr($img_url), esc_attr('auth-provider-icon '), esc_attr($alt)), $login_link_text);
             $login_link_text = wp_kses_post($login_link_text);
             $login_options[$prefix] = array('href' => esc_url("/index.php?sym-api=service-social-login-{$prefix}"), 'link_title' => $login_link_text, 'alt' => $alt);
         }
     }
     return $login_options;
 }
 public static function init()
 {
     // 휴면계정 설정
     wskl_load_module('/includes/inactive-accounts/class-wskl-inactive-accounts.php', 'enable_inactive_accounts');
     // 한국 원화 표시 설정
     if (wskl_is_option_enabled('korean_won')) {
         add_filter('woocommerce_currencies', array(__CLASS__, 'callback_currencies'));
         add_filter('woocommerce_currency_symbol', array(__CLASS__, 'callback_currency_symbol'), 10, 2);
     }
     // SKU 사용 해제
     if (wskl_is_option_enabled('disable_sku')) {
         add_filter('wc_product_sku_enabled', '__return_false');
     }
     // 상점으로 돌아가기 버튼 해제
     if (wskl_is_option_enabled('disable_returntoshop')) {
         add_filter('woocommerce_return_to_shop_redirect', array(__CLASS__, 'callback_return_to_ship_redirect'));
     }
     if (WSKL()->is_request('frontend')) {
         // 관련상품표시
         if (absint(wskl_get_option('related_products_count'))) {
             $priority = absint(wskl_get_option('related_products_priority'));
             add_filter('woocommerce_output_related_products_args', array(__CLASS__, 'callback_related_products_args'), $priority);
         }
         /** 한국형 주소 및 체크아웃 필드 구성 */
         wskl_load_module('/includes/class-wskl-sym-checkout.php', 'enable_sym_checkout');
     }
     /** 입금인 지정 기능 (BACS 입금자 다른 이름) */
     wskl_load_module('/includes/class-wskl-bacs-payer-name.php', 'enable_bacs_payer_name');
     /** 복합과세 */
     wskl_load_module('/includes/class-wskl-combined-tax.php');
 }
コード例 #5
0
 public function init_settings()
 {
     parent::init_settings();
     $options_to_import = array('iamport_user_code', 'iamport_rest_key', 'iamport_rest_secret', 'checkout_methods');
     foreach ($options_to_import as $key) {
         $this->settings[$key] = wskl_get_option($key);
     }
     $this->settings['enabled'] = wskl_yes_or_no(wskl_is_option_enabled('enable_sym_pg') && wskl_get_option('pg_agency') == 'iamport' && in_array($this->checkout_method, $this->settings['checkout_methods']));
 }
コード例 #6
0
 public function init_settings()
 {
     parent::init_settings();
     $options_to_import = array('payapp_user_id', 'payapp_link_key', 'payapp_link_val', 'checkout_methods');
     foreach ($options_to_import as $key) {
         $this->settings[$key] = get_option(wskl_get_option_name($key));
     }
     $this->settings['enabled'] = wskl_yes_or_no(wskl_is_option_enabled('enable_sym_pg') && wskl_get_option('pg_agency') == 'payapp' && in_array($this->checkout_method, $this->get_option('checkout_methods')));
 }
コード例 #7
0
/**
 * 또다른 helper function
 *
 * @param string $relative_path WSKL_PATH 로부터 상대적인 경로. 앞에 '/' 가 안 붙었으면 자동으로 붙임.
 * @param string $option_name   prefix 문자열을 붙이지 않은 옵션 이름. 빈문자열인 경우는 옵션을 체크하지 않음.
 */
function wskl_load_module($relative_path, $option_name = '')
{
    if (empty($option_name) || wskl_is_option_enabled($option_name)) {
        if ($relative_path[0] != '/') {
            $relative_path = '/' . $relative_path;
        }
        /** @noinspection PhpIncludeInspection */
        require_once WSKL_PATH . $relative_path;
    }
}
 public static function init()
 {
     self::$bacs_payer_name_in_own_column = wskl_is_option_enabled('bacs_payer_name_in_own_column');
     // 스크립트 처리가 필요하다면 주석 해제
     // add_action(
     // 	'wp_enqueue_scripts',
     // 	array( __CLASS__, 'enqueue_scripts' )
     // );
     /** 결제 완료 되면 입금자 이름을 포스트 메타 정보로 기록 */
     add_action('woocommerce_checkout_order_processed', array(__CLASS__, 'add_name_to_postmeta'), 10, 2);
     /** 결제 화면에서 입금자 이름을 받을 수 있도록 설정 */
     add_action('woocommerce_checkout_after_customer_details', array(__CLASS__, 'output_payer_field'), 10, 0);
     /** 관리자 초기화 */
     add_action('admin_init', array(__CLASS__, 'prepare_admin'));
 }
 public static function shortcode_dabory_members($attrs, $content)
 {
     $param = wskl_get_from_assoc($attrs, 0);
     $output = '';
     switch ($param) {
         case 'withdrawal':
             if (wskl_is_option_enabled('members_enable_withdrawal_shortcode')) {
                 $output = WSKL_Dabory_Members_Withdrawal::output_form($content);
             }
             break;
         default:
             _doing_it_wrong(__FUNCTION__, "parameter '{$param}' is not recognized.", WSKL_VERSION);
     }
     return $output;
 }
 public static function init()
 {
     /**
      * Loading SMS setting page.
      */
     add_filter('woocommerce_get_settings_pages', array(__CLASS__, 'add_settings_pages'));
     /**
      * Handling dabory-sms-tester ajax request.
      */
     add_action('wp_ajax_dabory-sms-tester', array(__CLASS__, 'do_message_testing'));
     /**
      * Handling dabory-sms-point ajax request.
      */
     add_action('wp_ajax_dabory-sms-point', array(__CLASS__, 'do_message_point'));
     if (wskl_is_option_enabled('develop_emulate_sms')) {
         add_action('admin_notices', array(__CLASS__, 'output_develop_emulate_sms'));
     }
 }
 public static function init()
 {
     /** 배송추적 */
     wskl_load_module('/includes/class-wskl-shipping-tracking.php', 'enable_ship_track');
     /** 바로 구매 */
     wskl_load_module('/includes/class-wskl-direct-purchase.php', 'enable_direct_purchase');
     /** 다보리 배송 */
     wskl_load_module('/includes/class-wskl-shipping-method.php', 'enable_korean_shipping');
     /** 다보리 멤버스 */
     wskl_load_module('/includes/dabory-members/class-wskl-dabory-members.php', 'enable_dabory_members');
     /** 다보리 SMS */
     wskl_load_module('/includes/dabory-sms/class-wskl-dabory-sms.php', 'enable_dabory_sms');
     /** 소셜 로그인 */
     wskl_load_module('/includes/lib/class-social-login.php', 'enable_social_login');
     /** IP blocking */
     wskl_load_module('/includes/class-wskl-ip-block.php', 'enable_countryip_block');
     if (WSKL()->is_request('frontend')) {
         // 상품 리뷰 탭 숨김
         if (wskl_is_option_enabled('hide_product_review_tab')) {
             add_filter('woocommerce_product_tabs', array(__CLASS__, 'callback_hide_product_review_tab'));
         }
     }
 }
コード例 #12
0
 function test_wskl_is_option_enabled()
 {
     $option_name = 'test_option';
     $prefixed_option_name = wskl_get_option_name($option_name);
     update_option($prefixed_option_name, 'yes');
     $this->assertTrue(get_option($prefixed_option_name) === 'yes');
     $this->assertTrue(TRUE === wskl_is_option_enabled($option_name));
     update_option($prefixed_option_name, '1');
     $this->assertTrue(get_option($prefixed_option_name) === '1');
     $this->assertTrue(TRUE === wskl_is_option_enabled($option_name));
     update_option($prefixed_option_name, 'true');
     $this->assertTrue(get_option($prefixed_option_name) === 'true');
     $this->assertTrue(TRUE === wskl_is_option_enabled($option_name));
     update_option($prefixed_option_name, 'no');
     $this->assertTrue(get_option($prefixed_option_name) === 'no');
     $this->assertTrue(FALSE === wskl_is_option_enabled($option_name));
     update_option($prefixed_option_name, '0');
     $this->assertTrue(get_option($prefixed_option_name) === '0');
     $this->assertTrue(FALSE === wskl_is_option_enabled($option_name));
     update_option($prefixed_option_name, 'false');
     $this->assertTrue(get_option($prefixed_option_name) === 'false');
     $this->assertTrue(FALSE === wskl_is_option_enabled($option_name));
 }
コード例 #13
0
 public static function initialize()
 {
     $fqn = __CLASS__;
     // add-to-cart
     if (\wskl_is_option_enabled('enable_add_to_cart_log')) {
         /**
          * validation 과는 관계가 별로 없다. 괜찮은 훅 선언이 있다면 변경해도 좋음.
          * 카트에 물품을 넣고 그 정보를 cassandra API 를 통해 전송한다.
          * @see woocommerce/includes/class-wc-form-handler.php \WC_Form_Handler::add_to_cart_action()
          */
         add_filter('woocommerce_add_to_cart_validation', array($fqn, 'callback_add_to_cart_validation'), 20, 4);
     }
     if (\wskl_is_option_enabled('enable_wish_list_log')) {
     }
     // count only and only if the page is loaded by the user's direct click
     if (\wskl_is_option_enabled('enable_today_seen_log')) {
         /**
          * send today-seen log
          *
          * @see woocommerce/templates/content-single-product.php
          */
         add_action('woocommerce_before_single_product', array($fqn, 'callback_woocommerce_before_single_product'), 99, 0);
     }
 }
コード例 #14
0
/**
 * 플러그인이 가진 의존성 및 설정 페이지를 출력하는 템플릿
 *
 * @param string $option_name               옵션 이름. Prefixing 하지 않음.
 * @param string $plugin_name               의존 외부 플러그인의 이름
 * @param string $plugin_link               의존 외부 플러그인의 URL
 * @param string $setting_page_name         우리 플러그인 안에서 설정 텍스트
 * @param string $setting_page_when_enabled 우리 플러그인 안에서 설정 URL
 *
 * @return string
 */
function wskl_inform_plugin_dependency($option_name, $plugin_name = '', $plugin_link = '', $setting_page_name = '', $setting_page_when_enabled = '')
{
    $description = '';
    if (!empty($plugin_name)) {
        $description = sprintf(apply_filters('wskl_inform_plugin_dependency', __('※ 이 기능은 %s이 설치, 활성화 되어 있어야 합니다.', 'wskl'), $option_name, $plugin_name, $plugin_link, $setting_page_name, $setting_page_when_enabled), wskl_html_anchor($plugin_name, array('href' => $plugin_link, 'target' => '_blank'), TRUE)) . ' ';
    }
    if (wskl_is_option_enabled($option_name) && !empty($setting_page_name)) {
        $description .= apply_filters('wskl_inform_plugin_dependency_setting_page', wskl_html_anchor($setting_page_name, array('href' => $setting_page_when_enabled), TRUE)) . ' ';
    }
    return $description;
}
コード例 #15
0
    return;
}
if (wskl_is_option_enabled('develop_xdebug_always_on')) {
    add_action('init', 'wskl_add_xdebug_session_start');
}
function wskl_add_xdebug_session_start()
{
    $session_value = absint(wskl_get_option('develop_xdebug_session_id'));
    if ($session_value) {
        setcookie('XDEBUG_SESSION', $session_value, time() + HOUR_IN_SECONDS);
    } else {
        setcookie('XDEBUG_SESSION', '', time() - DAY_IN_SECONDS);
    }
}
add_action('admin_notices', 'wskl_output_this_is_debug_mode');
function wskl_output_this_is_debug_mode()
{
    printf('<div class="notice error"><p>%s</p></div>', __('알림: 다보리 플러그인이 디버그 모드에서 동작하고 있습니다!', 'wskl'));
}
if (wskl_is_option_enabled('develop_enable_update_session_id')) {
    add_action('init', 'wskl_update_xdebug_session_id', 5);
}
function wskl_update_xdebug_session_id()
{
    if (isset($_GET['XDEBUG_SESSION_START'])) {
        $session_id = absint($_GET['XDEBUG_SESSION_START']);
        if ($session_id) {
            update_option(wskl_get_option_name('develop_xdebug_session_id'), $session_id);
        }
    }
}
コード例 #16
0
 public static function callback_pay_form_args(array $pay_form_args)
 {
     $pg_agency = wskl_get_option('pg_agency');
     if (wskl_is_option_enabled("enable_combined_tax_{$pg_agency}") && method_exists(__CLASS__, "combined_tax_{$pg_agency}")) {
         return call_user_func_array(array(__CLASS__, "combined_tax_{$pg_agency}"), array($pay_form_args));
     }
     return $pay_form_args;
 }
 public function customize_login_form($rows, $action)
 {
     if ($action != 'pwdchange') {
         return $rows;
     }
     // 주소 찾기 기능
     if (wskl_is_option_enabled('members_enable_postcode_button')) {
         $rows = self::include_postcode_button($rows);
     }
     // 비밀번호 강도 표시 알림
     if (wskl_is_option_enabled('members_password_strength_meter')) {
         self::add_psm_scripts('pass1', 'pass2');
     }
     $rows[0]['field_after'] = self::get_password_guide_output() . $rows[0]['field_after'];
     return $rows;
 }
コード例 #18
0
 /**
  * @callback
  * @used-by   wskl_plugin_monitor
  */
 public static function wp_members()
 {
     if (wskl_is_option_enabled('enable_dabory_members')) {
         add_action('admin_notices', array(__CLASS__, 'output_wp_member_is_inactive'));
     }
     if (wskl_is_option_enabled('enabled_inactive_accounts')) {
         add_action('admin_notices', array(__CLASS__, 'output_inactive_accounts'));
         if (!defined('DISABLE_WP_CRON') || !DISABLE_WP_CRON) {
             add_action('admin_notices', array(__CLASS__, 'output_cron_is_disabled'));
         }
     }
 }
 /**
  * @callback
  *
  * @param \WP_Admin_Bar $wp_admin_bar
  */
 public function callback_admin_bar_menu(WP_Admin_Bar $wp_admin_bar)
 {
     $wp_admin_bar->add_node(array('id' => 'wskl-root', 'title' => '<span class="ab-icon"></span><span>' . __('다보리', 'wskl') . '</span>', 'parent' => FALSE, 'href' => wskl_get_setting_tab_url(''), 'meta' => array()));
     $sub_menus = array(array('parent' => 'wskl-root', 'id' => 'wskl-preview', 'title' => __('일러두기', 'wskl'), 'href' => wskl_get_setting_tab_url('preview')), array('parent' => 'wskl-root', 'id' => 'wskl-authentication', 'title' => __('제품인증', 'wskl'), 'href' => wskl_get_setting_tab_url('authentication')), array('parent' => 'wskl-root', 'id' => 'wskl-checkout-payment-gates', 'title' => __('지불기능', 'wskl'), 'href' => wskl_get_setting_tab_url('checkout-payment-gates')), array('parent' => 'wskl-root', 'id' => 'wskl-essential-features', 'title' => __('핵심기능', 'wskl'), 'href' => wskl_get_setting_tab_url('essential-features')), array('parent' => 'wskl-root', 'id' => 'wskl-convenience-features', 'title' => __('편의기능', 'wskl'), 'href' => wskl_get_setting_tab_url('convenience-features')), array('parent' => 'wskl-root', 'id' => 'wskl-social-login', 'title' => __('소셜기능', 'wskl'), 'href' => wskl_get_setting_tab_url('social-login')), array('parent' => 'wskl-root', 'id' => 'wskl-protection-features', 'title' => __('차단보안기능', 'wskl'), 'href' => wskl_get_setting_tab_url('protection-features')), array('parent' => 'wskl-root', 'id' => 'wskl-marketing', 'title' => __('마케팅자동화기능', 'wskl'), 'href' => wskl_get_setting_tab_url('marketing')));
     if (wskl_lab_enabled()) {
         $sub_menus[] = array('parent' => 'wskl-root', 'id' => 'wskl-beta-features', 'title' => __('다보리 실험실', 'wskl'), 'href' => wskl_get_setting_tab_url('beta-features'));
     }
     if (wskl_debug_enabled()) {
         $sub_menus[] = array('parent' => 'wskl-root', 'id' => 'wskl-developer', 'title' => __('개발자용 ', 'wskl'), 'href' => wskl_get_setting_tab_url('developer'));
     }
     if (wskl_is_option_enabled('enable_dabory_members')) {
         $sub_menus[] = array('parent' => 'wskl-root', 'id' => 'wskl-dabory-members', 'title' => __('다보리 멤버스 설정', 'wskl'), 'href' => wskl_wp_members_url());
     }
     if (wskl_is_option_enabled('enable_inactive_accounts')) {
         $sub_menus[] = array('parent' => 'wskl-root', 'id' => 'wskl-inactive-accounts', 'title' => __('휴면계정 설정', 'wskl'), 'href' => wskl_wp_members_url('inactive-accounts'));
     }
     if (wskl_is_option_enabled('enable_dabory_sms')) {
         $sub_menus[] = array('parent' => 'wskl-root', 'id' => 'wskl-dabory-sms', 'title' => __('다보리 SMS 설정', 'wskl'), 'href' => wskl_dabory_sms_url());
     }
     if (wskl_is_option_enabled('enable_config_editor')) {
         $sub_menus[] = array('parent' => 'wskl-root', 'id' => 'wskl-config-editor', 'title' => __('WP Config 편집', 'wskl'), 'href' => wskl_wp_config_editor_url());
     }
     foreach ($sub_menus as $menu) {
         $wp_admin_bar->add_menu($menu);
     }
 }
 /**
  * 시나리오에 따라 문자열을 보낸다.
  * 어떤 우커머스 이벤트가 있든지, 해당 이벤트에 대한 핸들링은 적절한 메시지를 보내는 것으로 귀결된다.
  * 주의. $order_id 와 $user_id 가 동시에 NULL 이 될 수 없다.
  *
  * @param int|NULL $order_id 주문에 대한 문자열이면 주문 ID. 주문과 관련되 문자가 아니면 NULL.
  * @param int|NULL $user_id  사용자와 관련된 문자열이면 사용자 ID. 사용자와 관련 없으면 NULL.
  * @param string   $scenario 시나리오. 각 섹션의 ID. e.g., new-order, customer-new-account, ...
  *
  * @uses  WSKL_SMS_Text_Substitution
  * @uses  WSKL_Dabory_SMS_Provider_Loading
  *
  * @uses  WSKL_Dabory_SMS_Trigger::get_setting_value()
  * @uses  WSKL_Dabory_SMS_Trigger::get_settings()
  * @uses  WSKL_Dabory_SMS_Trigger::is_already_sent()
  * @uses  WSKL_Dabory_SMS_Trigger::log()
  * @uses  WSKL_Dabory_SMS_Trigger::set_sending_result()
  *
  * @return bool
  */
 private function trigger_common($order_id, $user_id, $scenario)
 {
     if ($order_id) {
         $order = wc_get_order($order_id);
         if (!$order) {
             $this->log('$order is invalid. Triggering halted.', __METHOD__);
             return FALSE;
         }
     } else {
         $order = NULL;
     }
     if ($user_id) {
         $user = get_user_by('id', $user_id);
         if (!$user) {
             $this->log("User ID {$user_id} is invalid.", __METHOD__);
             return FALSE;
         }
     } else {
         $user = NULL;
     }
     if (!$order && !$user_id) {
         $this->log('Either $order_id, or $user_id must be valid.', __METHOD__);
         return FALSE;
     }
     $emulation = wskl_is_option_enabled('develop_emulate_sms');
     // check if a message is already sent (order only)
     if (!$emulation && $order && $this->is_already_sent($order, $scenario)) {
         $this->log("Order #{$order_id} has been notified. Triggering halted.", __METHOD__);
         return FALSE;
     } else {
         if (!$emulation && $user && $this->is_already_sent($user, $scenario)) {
             $this->log("User #{$user_id} ({$user->user_email}) has been notified. Triggering halted.", __METHOD__);
             return FALSE;
         }
     }
     // receiver meta key
     $gs = self::get_settings();
     // retrieve the other fields
     $ns = self::get_settings($scenario);
     $message_template = self::get_setting_value($ns, $scenario, 'message_content');
     $title_template = self::get_setting_value($ns, $scenario, 'message_title');
     $notify_to_managers = self::get_setting_value($ns, $scenario, 'send_to_managers');
     if ($order) {
         $receiver_phone_meta_key = wskl_get_from_assoc($gs, wskl_get_option_name('sms_receiver_meta_field'));
         if (empty($receiver_phone_meta_key)) {
             $this->log('$receiver_phone_meta_key is an empty string. Triggering halted.', __METHOD__);
             return FALSE;
         }
         $customer_phone = $order->{$receiver_phone_meta_key};
     } else {
         $receiver_phone_meta_key = self::get_setting_value($ns, $scenario, 'phone_meta_field');
         if (empty($receiver_phone_meta_key)) {
             $this->log('$receiver_phone_meta_key is an empty string. Triggering halted.', __METHOD__);
             return FALSE;
         }
         $customer_phone = $user->{$receiver_phone_meta_key};
     }
     if (empty($customer_phone)) {
         $this->log('customer phone is empty! Triggering halted.', __METHOD__);
         return FALSE;
     }
     // receivers
     if ($notify_to_managers == 'yes') {
         $r = explode("\n", wskl_get_option('sms_shop_manager_phones'));
         $r[] = $customer_phone;
         $r = array_map(array(__CLASS__, 'trim_phone_number'), $r);
         $r = array_filter($r, array(__CLASS__, 'not_empty'));
         $r = array_unique($r);
         $receivers = implode(',', $r);
         $num_receivers = count($receivers);
     } else {
         $receivers = $customer_phone;
         $num_receivers = 1;
     }
     if (!$num_receivers) {
         $this->log('The number of recipient is 0! Triggering halted.', __METHOD__);
         return FALSE;
     }
     // message substitution
     $sub = new WSKL_SMS_Text_Substitution();
     $sub->init_substitute($order, $user);
     $message_title = $sub->substitute($title_template);
     $message_content = $sub->substitute($message_template);
     $str_bytes = strlen($message_content);
     // message type
     if ($str_bytes > self::SMS_MAX_BYTES) {
         $message_type = 'lms';
     } else {
         $message_type = 'sms';
     }
     $args = array('remote_phone' => $receivers, 'remote_msg' => $message_content, 'remote_subject' => $message_title, 'remote_num' => $num_receivers, 'remote_etc1' => $order_id);
     if (!$emulation) {
         // ... and fire.
         /** @var WSKL_Dabory_SMS_Provider $provider_class */
         $provider_class = Provider_Loading::get_provider_class();
         $sender = $provider_class::factory();
         $response = $sender->send_message($args, $message_type);
         assert($response[3] == $order_id, __FUNCTION__ . ': Order id of etc1 and $order_id are different. This is impossible.');
     } else {
         $message = 'SMS emulation is enabled. Argument: ' . print_r($args, TRUE);
         error_log($message);
     }
     if (!$emulation && $order) {
         self::set_sending_result($order, $scenario, $message_type);
     } else {
         if (!$emulation && $user) {
             self::set_sending_result($user, $scenario, $message_type);
         }
     }
     return TRUE;
 }
コード例 #21
0
 /**
  * 배송/청구 주소 두 가지는 공통점이 많으므로 하나의 함수로 처리.
  *
  * @used-by WSKL_Sym_Checkout::billing_address()
  * @used-by WSKL_Sym_Checkout::shipping_address()
  *
  * @param string $prefix
  * @param array  $address_fields
  *
  * @return array
  */
 private static function address_common_korean($prefix, $address_fields)
 {
     // address_fields 로 전해지는 array 의 키 기본 값은 다음과 같다. (순서대로)
     // {$prefix}_first_name: form-row-first
     // {$prefix}_last_name : form-row-last
     // {$prefix}_company: form-row-wide
     // {$prefix}_email: form-row-first
     // {$prefix}_phone: form-row-last
     // {$prefix}_country: form-row-wide address-field update_totals_on_change
     // {$prefix}_address_1: form-row-wide address-field
     // {$prefix}_address_2: form-row-wide address-field
     // {$prefix}_city: form-row-wide address-field
     // {$prefix}_state: form-row-first address-field
     // {$prefix}_postcode: form-row-last address-field
     $company_enabled = wskl_is_option_enabled('company');
     $field_template = array('first_name' => array('label' => __('이름', 'wskl'), 'required' => TRUE, 'class' => $company_enabled ? array('form-row-first') : array('form-row-wide')), 'company' => array('label' => __('회사명', 'wskl'), 'required' => TRUE, 'class' => array('form-row-last'), 'clear' => TRUE), 'filler_1' => array('type' => 'clear', 'label' => 'blank', 'clear' => TRUE), 'postcode' => array('label' => __('우편번호', 'wskl'), 'placeholder' => __('우편번호', 'wskl'), 'required' => TRUE, 'class' => array('form-row-first', 'address-field'), 'validate' => array('postcode')), 'zipcode_button' => array('label' => __('우편번호 검색', 'wskl'), 'value' => __('우편번호 검색', 'wskl'), 'class' => array('form-row-last'), 'type' => 'button'), 'address_1' => array('label' => __('주소', 'wskl'), 'placeholder' => _x('주소 - 시/도(번지 이전까지)', 'placeholder', 'wskl'), 'required' => TRUE, 'class' => array('form-row-wide', 'address-field'), 'custom_attributes' => array('autocomplete' => 'no')), 'address_2' => array('placeholder' => _x('주소 - 번지 이후', 'placeholder', 'wskl'), 'class' => array('form-row-wide', 'address-field'), 'required' => FALSE, 'custom_attributes' => array('autocomplete' => 'no')), 'email' => array('type' => 'email', 'label' => __('이메일 주소', 'wskl'), 'placeholder' => _x('이메일 주소', 'placeholder', 'wskl'), 'class' => array('form-row-first'), 'required' => TRUE, 'validate' => array('email')), 'phone' => array('label' => __('휴대전화 번호', 'wskl'), 'type' => 'text', 'placeholder' => _x('000-0000-0000', 'placeholder', 'wskl'), 'clear' => TRUE, 'class' => array('input-text', 'form-row-last'), 'required' => TRUE, 'validate' => array('phone')), 'last_name' => array('type' => 'hidden', 'label' => __('성 (따로 기재하는 경우)', 'wskl'), 'required' => FALSE), 'country' => array('type' => 'hidden', 'label' => __('국가', 'wskl'), 'required' => FALSE), 'city' => array('type' => 'hidden', 'label' => __('주소 - 시/도(번지 이전까지)', 'wskl'), 'required' => FALSE), 'state' => array('type' => 'hidden', 'label' => __('주/군', 'wskl'), 'required' => FALSE));
     $output = array();
     foreach ($field_template as $key => $value) {
         // 회사명 표시 옵션이 켜져 있을 때만 회사 필드를 집어 넣음.
         if ($key == 'company' && !$company_enabled) {
             continue;
         }
         $output[$prefix . $key] = $value;
     }
     return $output;
 }
 public function is_option_enabled($key)
 {
     return wskl_is_option_enabled($this->id . '_' . $key);
 }