Plugin Directory

Changeset 2483497


Ignore:
Timestamp:
03/01/2021 11:47:00 AM (5 years ago)
Author:
bbaton
Message:

Version 2.5

Location:
bbaton-anonymous-age-verification/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • bbaton-anonymous-age-verification/trunk/assets/css/bbaa.css

    r2478934 r2483497  
    1818
    1919.bbaa .bbaa19{
    20     width: 150px;
     20    width: 150px;
    2121    margin-bottom: 50px;
    2222}
  • bbaton-anonymous-age-verification/trunk/assets/js/bbaa.js

    r2478934 r2483497  
    11jQuery(document).ready(function(){
     2    var mer_uid= '';
     3    var imp_uid= '';
     4    var IMP = window.IMP;
     5    IMP.init(bbaton_anonymous_age_verification.iamport_merchant_id);
    26    jQuery(".bbaa #iamport_auth").on("click", function (e){
    3     e.preventDefault();
    4     window.open(bbaton_anonymous_age_verification.new_window, 'popupChk', 'width=430, height=680, top=100, left=100, fullscreen=no, menubar=no, status=no, toolbar=no, titlebar=yes, location=no, scrollbar=no');         
    5   });
     7        e.preventDefault();
     8        IMP.certification({popup: true}, function (rsp) { // callback
     9        if (rsp.success) {
     10        mer_uid = rsp.merchant_uid;
     11        imp_uid = rsp.imp_uid;
     12        var postData = {
     13            imp_uid: imp_uid,
     14            action : 'request_token'
     15          };
     16              jQuery.ajax({
     17                type: "POST",
     18                url: bbaton_anonymous_age_verification.ajax_url,
     19                dataType: "json",
     20                data: postData,
     21                success: function (response) {
     22                  if( response.success ) {
     23                    var user_info = response.data;
     24                    console.log(response);
     25                    console.log(checkIsAdult(user_info.birthday));
     26                    if(checkIsAdult(user_info.birthday) > 18 && user_info.name){
     27                    var user_name = user_info.name;
     28                    var gender = user_info.gender;
     29                    var birthday = user_info.birthday.replace(/–/gi, "");
     30                    var phone = user_info.phone;
     31                    var carrier = user_info.carrier;
     32                  setCookie('bbaton_anonymous_age_verification_confirmed',mer_uid,1);
     33                  window.open("http://bapi.bbaton.com/v1/user/auto-register?name="+user_name+"&gender="+gender+"&birthday="+birthday+"&phone="+phone+"&carrier="+carrier+"&impUid="+imp_uid+"&url="+bbaton_anonymous_age_verification.site_url+"", "bbaton", "width=400, height=500");
     34              //    url_redirect = "http://bapi.bbaton.com/v1/user/auto-register?name="+user_name+"&gender="+gender+"&birthday="+birthday+"&phone="+phone+"&carrier="+carrier+"&impUid="+imp_uid+"&url="+window.opener.location.href+"";
     35                //  window.location.href = url_redirect;
     36                    } else {
     37                      alert('Age Verification Failed!.');
     38                      location.reload();
     39                    }
     40                      } else {
     41                      alert(response.msg);
     42                      setTimeout(function(){ location.reload(); }, 2000);
     43                      }
     44                  },
     45                  error: function () {}
     46              });
     47             } else {
     48                    alert(rsp.error_msg);
     49             }
     50        });
     51         
     52    });
     53
    654    jQuery(".bbaa #bbaton_auth").click(function(e){
    755        e.preventDefault();
     
    2674    }
    2775});
     76
     77function setCookie(cname, cvalue, exdays) {
     78  var d = new Date();
     79  d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
     80  var expires = "expires="+d.toUTCString();
     81  document.cookie = cname + "=" + cvalue + ";" + expires + "; domain="+bbaton_anonymous_age_verification.domain+";path=/ ";
     82}
     83function checkIsAdult(enteredDate){
     84  var years = new Date(new Date() - new Date(enteredDate)).getFullYear() - 1970;
     85  years = parseInt(years)+parseInt(1);
     86  return years;
     87}
  • bbaton-anonymous-age-verification/trunk/bbaa_back/bbaa_api_settings.php

    r2465711 r2483497  
    1414    }
    1515}
    16 
     16function media_uploader_enqueue() {
     17    wp_enqueue_media();
     18    wp_register_script('media-uploader', plugins_url('media-uploader.js' , __FILE__ ), array('jquery'));
     19    wp_enqueue_script('media-uploader');
     20}
    1721add_action('admin_enqueue_scripts', 'media_uploader_enqueue');
    18 if (!function_exists('media_uploader_enqueue')){
    19     function media_uploader_enqueue() {
    20         wp_enqueue_media();
    21         wp_register_script('media-uploader', plugins_url('media-uploader.js' , __FILE__ ), array('jquery'));
    22         wp_enqueue_script('media-uploader');
    23     }
    24 }
    2522
    2623if (!function_exists('register_my_bbaa_plugin_settings'))
  • bbaton-anonymous-age-verification/trunk/bbaa_front/bbaa_login_process.php

    r2465711 r2483497  
    1616        echo $url;
    1717        wp_die();
    18     }
    19 }
    20 
    21 add_action('wp_ajax_nopriv_make_anonymous', 'make_anonymous');
    22 add_action('wp_ajax_make_anonymous', 'make_anonymous');
    23 
    24 if (!function_exists("make_anonymous"))
    25 {
    26     function make_anonymous()
    27     {
    28           $apiData = array(
    29           "impUid" => sanitize_text_field($_POST['imp_uid']),
    30           'email' => sanitize_text_field($_POST['user_email'])
    31             );
    32             $headers = array(
    33                 'Content-type'  => 'application/json'
    34             );
    35                 $response = wp_remote_post(
    36                     'http://bapi.bbaton.com/v1/user', array(
    37                     'method' => 'POST',
    38                     'timeout' => 60,
    39                     'redirection' => 5,
    40                     'httpversion' => '1.0',
    41                     'blocking' => true,
    42                     'headers' => $headers,
    43                     'body'          => json_encode($apiData),
    44                     'cookies' => array()
    45                 ));
    46                 if (is_wp_error($response)) {
    47                     $res = array('success'=>false, 'msg'=> 'Authentication Error!');
    48                 } else {
    49                     $body = wp_remote_retrieve_body($response);
    50                     $data = json_decode($body);
    51                     $res = array('success'=>true, 'data'=>  $data);
    52                 }
    53                 wp_send_json($res);
    5418    }
    5519}
     
    11377    }
    11478}
     79
  • bbaton-anonymous-age-verification/trunk/bbaton-ananoymous-age-verification.php

    r2479444 r2483497  
    33Plugin Name: 비바톤 익명 성인인증 | BBaton Anonymous Age Verification
    44Description: Anonymous Age Verification Service for Korean Users
    5 Version: 2.3.3
     5Version: 2.5
    66Author: BBaton
    77Author URI: https://www.bbaton.com
     
    3838                'bbaa_redirect_back'
    3939            ));
    40             add_shortcode('new_window_content', array($this, 'new_window_content_callback'));
    41             add_filter( 'page_template', array(
    42                 $this,'wpa3396_page_template'));
    43             register_activation_hook( __FILE__, array($this,'bbaton_activate'));
     40            // add_shortcode('new_window_content', array($this, 'new_window_content_callback'));
     41            // add_filter( 'page_template', array(
     42            //     $this,'wpa3396_page_template'));
     43            // register_activation_hook( __FILE__, array($this,'bbaton_activate'));
    4444        }
    4545
    46         function bbaton_activate(){
    47         if ( 0 === post_exists( 'New Window' ) ) {
    48             // Create post object
    49             $my_post = array(
    50                 'post_title'    => wp_strip_all_tags( 'New Window' ),
    51                 'post_name'     => 'new-window',
    52                 'post_content'  => '[new_window_content]',
    53                 'post_status'   => 'publish',
    54                 'post_author'   => get_current_user_id(),
    55                 'post_type'     => 'page',
    56             );
    57             // Insert the post into the database
    58             $post_id = wp_insert_post( $my_post );
    59             update_option( 'new_window_page_id', $post_id );
    60         }
    61         }
    62         function wpa3396_page_template( $page_template ){
    63             if ( is_page( 'new-window' ) ) {
    64                 $page_template = plugin_dir_path( __FILE__ ) . 'template_without_header_footer_sidebar.php';
    65             }
    66              return $page_template;
    67         }
     46        // function bbaton_activate(){
     47        // if ( 0 === post_exists( 'New Window' ) ) {
     48        //     // Create post object
     49        //     $my_post = array(
     50        //         'post_title'    => wp_strip_all_tags( 'New Window' ),
     51        //         'post_name'     => 'new-window',
     52        //         'post_content'  => '[new_window_content]',
     53        //         'post_status'   => 'publish',
     54        //         'post_author'   => get_current_user_id(),
     55        //         'post_type'     => 'page',
     56        //     );
     57        //     // Insert the post into the database
     58        //     $post_id = wp_insert_post( $my_post );
     59        //     update_option( 'new_window_page_id', $post_id );
     60        // }
     61        // }
     62        // function wpa3396_page_template( $page_template ){
     63        //     if ( is_page( 'new-window' ) ) {
     64        //         $page_template = plugin_dir_path( __FILE__ ) . 'template_without_header_footer_sidebar.php';
     65        //     }
     66        //      return $page_template;
     67        // }
    6868
    69         function new_window_content_callback(){
    70         wp_enqueue_style('new_window_css');
    71         wp_enqueue_script('new_window_js');
    72         ob_start();
    73         require_once 'bbaton-verification-window.php';
    74         $output = ob_get_contents();
    75         ob_end_clean();
    76         return $output;
    77         }
     69        // function new_window_content_callback(){
     70        // wp_enqueue_style('new_window_css');
     71        // wp_enqueue_script('new_window_js');
     72        // ob_start();
     73        // require_once 'bbaton-verification-window.php';
     74        // $output = ob_get_contents();
     75        // ob_end_clean();
     76        // return $output;
     77        // }
    7878        function bbaa_start_from_here()
    7979        {
     
    8484        function bbaa_enqueue_script_front()
    8585        {
    86             $page_url  = get_permalink( get_page_by_path( 'new-window' ) );
    87            if(!$page_url){
    88            $page_url  = get_permalink( get_page_by_title( 'New Window' ) );
    89            }
     86           // $page_url  = get_permalink( get_page_by_path( 'new-window' ) );
     87           // if(!$page_url){
     88           // $page_url  = get_permalink( get_page_by_title( 'New Window' ) );
     89           // }
    9090            //Style & Script
    9191            wp_enqueue_script('bbaa-script', plugins_url('assets/js/bbaa.js', __FILE__) , array(
    9292                'jquery'
    93             ) , '2.4', true);           
     93            ) , '2.5', true);           
    9494            wp_enqueue_script('iamport-script', "https://cdn.iamport.kr/js/iamport.payment-1.1.8.js" , array(
    9595                'jquery'
    9696            ) , '1.2', true);
    97             wp_register_style('new_window_css', plugins_url('assets/css/new_window.css', __FILE__), array(), '1.2', 'all');
    98             wp_register_script( 'new_window_js', plugins_url('assets/js/new_window.js', __FILE__), array( 'jquery' ), '1.2', false );
     97            // wp_register_style('new_window_css', plugins_url('assets/css/new_window.css', __FILE__), array(), '1.1', 'all');
     98            // wp_register_script( 'new_window_js', plugins_url('assets/js/new_window.js', __FILE__), array( 'jquery' ), '1.1', false );
    9999            wp_localize_script('bbaa-script', 'bbaton_anonymous_age_verification', array(
    100100                'ajax_url' => admin_url('admin-ajax.php'),
    101101                'iamport_merchant_id' => 'imp34765018',
    102                 'new_window' =>  $page_url,
     102                'site_url' =>  get_site_url(),
    103103                'domain' => parse_url(get_option('siteurl') , PHP_URL_HOST),
    104104                'bbaa_client_id' =>( sanitize_text_field(get_option('bbaa_client_id')) ),
     
    153153        function bbaa_redirect_back()
    154154        {
    155             if(isset($_GET['iamport_response_code'])){
    156                 $code = sanitize_text_field($_GET['iamport_response_code']);
    157                 $path = '/';
    158                 $domain = parse_url(get_option('siteurl') , PHP_URL_HOST);
    159                 setcookie('bbaton_anonymous_age_verification_confirmed', $code, time() + 86400, $path, $domain);
    160                 echo '<script>
    161                             var redirectURL = "' . home_url() . '";
    162                             if (typeof(Storage) !== "undefined" && localStorage.getItem("bbaton_anonymous_age_verification_last_url")) {
    163                                redirectURL = localStorage.getItem("bbaton_anonymous_age_verification_last_url");
    164                             }
    165                             window.location.replace(redirectURL);
    166                          </script>';
    167                     die();
    168             }
     155            // if(isset($_GET['iamport_response_code'])){
     156            //     $code = sanitize_text_field($_GET['iamport_response_code']);
     157            //     $path = '/';
     158            //     $domain = parse_url(get_option('siteurl') , PHP_URL_HOST);
     159            //     setcookie('bbaton_anonymous_age_verification_confirmed', $code, time() + 86400, $path, $domain);
     160            //     echo '<script>
     161            //                 var redirectURL = "' . home_url() . '";
     162            //                 if (typeof(Storage) !== "undefined" && localStorage.getItem("bbaton_anonymous_age_verification_last_url")) {
     163            //                    redirectURL = localStorage.getItem("bbaton_anonymous_age_verification_last_url");
     164            //                 }
     165            //                 window.location.replace(redirectURL);
     166            //              </script>';
     167            //         die();
     168            // }
    169169            if (isset($_GET['code']))
    170170            {
  • bbaton-anonymous-age-verification/trunk/login-page.php

    r2478934 r2483497  
    11<link href="https://fonts.googleapis.com/css2?family=Nanum+Gothic&display=swap" rel="stylesheet">
    2 <link href="<?php echo plugins_url('assets/css/bbaa.css?ver=1.7.2', __FILE__); ?>" rel="stylesheet">
     2<link href="<?php echo plugins_url('assets/css/bbaa.css?ver=2.5', __FILE__); ?>" rel="stylesheet">
    33<style>
    44    .col-right{
     
    1111        min-height: 100%;
    1212    }
    13   /*  .btn_yes, .redirect_me {
    14         background-color: #0071bc !important;
    15         padding: 11px 48px;
    16         border: none;
    17         color: #fff;
    18         font-weight: bold;
    19     }*/
    20 
    21    /* .anonymous_ques {
    22         margin-top: 27px;
    23     }*/
    24 
    25   /*  #submit_btn{
    26         background-color: #0071bc !important;
    27         padding: 11px 48px;
    28         border: none;
    29         color: #fff;
    30         font-weight: bold;
    31     }*/
    32 
    33    /* .tag_line {
    34         font-size: 20px;
    35         font-weight: bold;
    36     }*/
    3713    .inf_det{
    3814    font-family: "Nanum Gothic", sans-serif !important;
    3915    margin-bottom: 4px !important;
    4016}
    41 /*.tag_line{
    42     color: #0071bc !important;
    43     margin-top: 5px !important;
    44 }
    45 .last_step{
    46     display: none;
    47 }*/
    4817    body {
    4918        padding: 0;
     
    5423        overflow: hidden;
    5524    }
    56  /*   #detail_popup {
    57     background: url(<?php echo plugins_url('assets/bg-login.jpg', __FILE__); ?>) !important;
    58     background-size: auto;
    59     background-size: cover !important;
    60 }*/
    61 
    62    /* .imp-dialog.pc.certification-danal {
    63      background: url(<?php echo plugins_url('assets/bg-login.jpg', __FILE__); ?>) !important;
    64     background-size: auto;
    65     background-size: cover !important;
    66 }*/
    6725    .bbaa {
    6826        min-width: 100% !important;
     
    13088    </div>
    13189</div>
    132 <?php /* ?>
    133 <div id="detail_popup" class="modal">
    134   <!-- Modal content -->
    135   <div class="modal-content">
    136     <span class="close"></span>
    137     <div class="info_section">
    138         <div class="anonymous_ques">
    139             <p class="tag_line">개인정보를 익명 처리하시겠습니까?</p>
    140             <p style="display: block;"><button class="btn_yes">네</button></p>
    141             <p><a href="#" class="btn_no">아니오, 괜찮습니다</a></p>
    142         </div>
    143     </div>
    144     <div class="email_container">
    145     <form action="" method="post" id="mail_form">
    146         <p>이메일로 처리 결과를 보내 드리겠습니다.</p>
    147         <label for=""></label>
    148         <input type="email" placeholder="이메일" name="user_email" id="user_email" required>
    149         <div>
    150              <input style="background-color: #0071bc !important;" type="submit" name="mail_submit" value="완료" id="submit_btn">
    151             <!--  <input style="background-color: #0071bc !important;" type="button" name="ignore_mail" value="아니오, 괜찮습니다" id="ignore_mail"> -->
    152         </div>
    153         <div style="margin-top: 8px;"><a href="#" id="ignore_mail" style="text-decoration: underline !important;">아니오, 괜찮습니다</a></div>
    154     </form>
    155     <div class="last_step">
    156          <img class="img_last_step" src='<?php echo plugins_url('assets/logo_company.png?ver=2.12', __FILE__); ?>'/>
    157          <p class="tag_line" style="margin-bottom: 10px !important;">
    158              안전하게 익명 처리되었습니다.
    159          </p>
    160          <p class="tag_line">
    161              감사합니다.
    162          </p>
    163          <div>
    164              <button class="redirect_me">완료</button>
    165          </div>
    166     </div>
    167     </div>
    168     </div>
    169 </div>
    170 <?php */ ?>
    17190<script>
    17291    jQuery("header").remove();
Note: See TracChangeset for help on using the changeset viewer.