Plugin Directory

Changeset 2478934


Ignore:
Timestamp:
02/22/2021 12:14:55 PM (5 years ago)
Author:
bbaton
Message:

Version 2.0

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

Legend:

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

    r2463569 r2478934  
    1 #detail_popup {
    2   display: none; /* Hidden by default */
    3   position: fixed; /* Stay in place */
    4   z-index: 99999; /* Sit on top */
    5   padding-top: 100px; /* Location of the box */
    6   left: 0;
    7   top: 0;
    8   min-width: 100% !important; /* Full width */
    9   min-height: 100% !important; /* Full height */
    10   overflow: auto; /* Enable scroll if needed */
    11   background-color: rgb(0,0,0); /* Fallback color */
    12   background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    13   background: url(http://ijvann11.cafe24.com/wp-content/plugins/bbaton-anonymous-age-verification/assets/blue-white.jpg) !important;
    14         background-size: auto;
    15     background-size: cover !important;
    16 }
    17 .imp-dialog.pc.certification-danal {
    18     background: url(http://ijvann11.cafe24.com/wp-content/plugins/bbaton-anonymous-age-verification/assets/blue-white.jpg) !important;
    19         background-size: auto;
    20     background-size: cover !important;
    21 }
    22 .btn_yes,.redirect_me{
    23     background-color: #0071bc !important;
    24 }
    25 .btn_no{
    26     text-decoration: underline !important;
    27 }
    28 .email_container {
    29     text-align: center;
    30 }
    31 .email_container{
    32     display: none;
    33 }
    34 #submit_btn{
    35     margin-top: 7px;
    36 }
    37 #user_email{
    38 max-width: 298px;
    39 margin: auto;
    40 }
    41 
    42 /* Modal Content */
    43 .modal-content {
    44   background-color: #fefefe;
    45   margin: auto;
    46   padding: 20px;
    47   border: 1px solid #888;
    48   width: 50% !important;
    49   text-align: center;
    50 }
    51 
    52 /* The Close Button */
    53 .close {
    54   color: #aaaaaa;
    55   float: right;
    56   font-size: 28px;
    57   font-weight: bold;
    58 }
    59 
    60 .close:hover,
    61 .close:focus {
    62   color: #000;
    63   text-decoration: none;
    64   cursor: pointer;
    65 }
    66 
    671.bbaa {
    682    text-align: center;
  • bbaton-anonymous-age-verification/trunk/assets/js/bbaa.js

    r2463569 r2478934  
    11jQuery(document).ready(function(){
    2     jQuery(document).on('click','.imp-close',function(){
    3         location.reload();
    4     });
    5     var IMP = window.IMP;
    6     IMP.init(bbaton_anonymous_age_verification.iamport_merchant_id);
    7     var mer_uid= '';
    8     var imp_uid= '';
    9     var url_initial= '';
    102    jQuery(".bbaa #iamport_auth").on("click", function (e){
    11         e.preventDefault();
    12         var url = window.location.href;
    13         if (typeof(Storage) !== "undefined") {
    14             localStorage.setItem("bbaton_anonymous_age_verification_last_url", url);
    15         }
    16         url_initial = url;
    17         jQuery('.bbaa').hide();
    18         IMP.certification({}, function (rsp) { // callback
    19              if (rsp.success) {
    20                 mer_uid = rsp.merchant_uid;
    21                      imp_uid = rsp.imp_uid;
    22                     var postData = {
    23                         imp_uid: imp_uid,
    24                         action : 'request_token'
    25                     };
    26               jQuery.ajax({
    27                 type: "POST",
    28                 url: bbaton_anonymous_age_verification.ajax_url,
    29                 dataType: "json",
    30                 data: postData,
    31                 success: function (response) {
    32                     if( response.success ) {
    33                         var user_info = response.data;
    34                         console.log(response);
    35                     console.log(checkIsAdult(user_info.birthday));
    36                         if(checkIsAdult(user_info.birthday) > 18 && user_info.name){
    37                         jQuery('#detail_popup').show();
    38                         var pop_up_content = '';
    39                         pop_up_content += '<p class="inf_det">'+user_info.name+'</p>';
    40                         pop_up_content += '<p class="inf_det">'+user_info.gender+'</p>';
    41                         pop_up_content += '<p class="inf_det">'+user_info.birthday+'</p>';
    42                         pop_up_content += '<p class="inf_det">'+user_info.phone+'</p>';
    43                         pop_up_content += '<p class="inf_det">'+user_info.carrier+'</p>';
    44                         console.log(pop_up_content);
    45                         jQuery('.info_section').css('text-align','center');
    46                         jQuery('.info_section').prepend(pop_up_content);
    47                         jQuery('.btn_no').on('click', function(){
    48                             jQuery('#detail_popup').hide();
    49                        if (url.indexOf("?") < 0)
    50                        url_initial += "?iamport_response_code=" + rsp.merchant_uid;
    51                        else
    52                        url_initial += "&iamport_response_code=" + rsp.merchant_uid;
    53                        window.location.href = url_initial;
    54                          });
    55                         jQuery('.btn_yes').on('click', function(){
    56                             jQuery('.info_section').hide();
    57                             jQuery('.email_container').show();
    58                          });
    59                         } else {
    60                             alert('no data available');
    61                             location.reload();
    62                         }
    63                         //  // When the user clicks on <span> (x), close the modal
    64                         //  span.onclick = function() {
    65                         //  modal.style.display = "none";
    66                         //  }
    67 
    68                             // When the user clicks anywhere outside of the modal, close it
    69                             // window.onclick = function(event) {
    70                             // if (event.target == modal) {
    71                             // modal.style.display = "none";
    72                             // }
    73                             // }
    74                           // if(response.codecode ){
    75                           //     $('#code').val(response.codecode);
    76                           // } else {
    77                           //     $('#code').val('');
    78                           // }
    79                       } else {
    80                       alert(response.msg);
    81                       setTimeout(function(){ location.reload(); }, 2000);
    82                       }
    83                   },
    84                   error: function () {}
    85               });
    86              //    if (url.indexOf("?") < 0)
    87              //        url += "?iamport_response_code=" + rsp.merchant_uid;
    88              //    else
    89              //        url += "&iamport_response_code=" + rsp.merchant_uid;
    90                 // window.location.href = url;
    91              } else {
    92                     alert(rsp.error_msg);
    93              }
    94         });
    95          
    96     });
    97   jQuery('#ignore_mail').on('click', function(){
    98     jQuery('#detail_popup').hide();
    99     if (url_initial.indexOf("?") < 0)
    100      url_initial += "?iamport_response_code=" + mer_uid;
    101    else
    102      url_initial += "&iamport_response_code=" + mer_uid;
    103    window.location.href = url_initial;
    104  });
    105 
    106   var mail_form = jQuery('#mail_form');
    107   if (mail_form.length > 0 ) {
    108     jQuery(document).on('submit',mail_form, function(e){
    109       e.preventDefault();
    110       var customer_email= jQuery('#user_email').val();
    111       console.log(customer_email);
    112       if( customer_email != ''&& mer_uid != '' ){
    113         jQuery('#submit_btn').prop("disabled",true);
    114        var postData = {
    115          imp_uid: imp_uid,
    116          action : 'make_anonymous',
    117          user_email : customer_email.trim(),
    118        };
    119        jQuery.ajax({
    120         type: "POST",
    121         url: bbaton_anonymous_age_verification.ajax_url,
    122         dataType: "json",
    123         data: postData,
    124         success: function (response) {
    125             if (response.data.status == 'success') {
    126                 //jQuery('.after_mail_msg').text('Email Verified Successfully');
    127                 jQuery('#mail_form').hide();
    128                 jQuery('.last_step').show();
    129                 jQuery(document).on('click','.redirect_me', function(){
    130                     if (url_initial.indexOf("?") < 0)
    131                         url_initial += "?iamport_response_code=" + mer_uid;
    132                     else
    133                         url_initial += "&iamport_response_code=" + mer_uid;
    134                     window.location.href = url_initial;
    135                 });
    136             } else {
    137                 setTimeout(function(){ 
    138                     jQuery('#detail_popup').hide();
    139                         if (url_initial.indexOf("?") < 0)
    140                         url_initial += "?iamport_response_code=" + mer_uid;
    141                     else
    142                         url_initial += "&iamport_response_code=" + mer_uid;
    143                     window.location.href = url_initial;
    144                 }, 2000);
    145                     }
    146         },
    147         error: function () {}
    148        });
    149             } else {
    150               location.reload();
    151             }
    152     });
    153   }
     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  });
    1546    jQuery(".bbaa #bbaton_auth").click(function(e){
    1557        e.preventDefault();
     
    15810            localStorage.setItem("bbaton_anonymous_age_verification_last_url", current_url);
    15911        }
    160         var data = {
    161             'action': 'bbaa_login_process',
    162             'backUrl':  current_url
    163         };
    164         // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
    165         jQuery.post(bbaton_anonymous_age_verification.ajax_url, data, function(response) {
    166             window.location.href = response;
    167         });
     12        var bbaa_client_id = bbaton_anonymous_age_verification.bbaa_client_id;
     13        var redirect_uri = bbaton_anonymous_age_verification.redirect_uri;
     14        window.open( "http://bauth.bbaton.com/oauth/authorize?client_id="+bbaa_client_id+"&redirect_uri="+redirect_uri+"&response_type=code&scope=read_profile","bbaton","width=400, height=500");
     15        // var data = {
     16        //  'action': 'bbaa_login_process',
     17        //  'backUrl':  current_url
     18        // };
     19        // // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
     20        // jQuery.post(bbaton_anonymous_age_verification.ajax_url, data, function(response) {
     21        //  window.location.href = response;
     22        // });
    16823    });
    16924    if(jQuery("div").hasClass("bbaa")){
     
    17126    }
    17227});
    173 
    174 function checkIsAdult(enteredDate){
    175   var years = new Date(new Date() - new Date(enteredDate)).getFullYear() - 1970;
    176   years = parseInt(years)+parseInt(1);
    177   return years;
    178 }
  • bbaton-anonymous-age-verification/trunk/bbaton-ananoymous-age-verification.php

    r2465711 r2478934  
    33Plugin Name: 비바톤 익명 성인인증 | BBaton Anonymous Age Verification
    44Description: Anonymous Age Verification Service for Korean Users
    5 Version: 1.11
     5Version: 2.0
    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'));
     44        }
     45
     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        }
     68
     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;
    4077        }
    4178        function bbaa_start_from_here()
     
    4784        function bbaa_enqueue_script_front()
    4885        {
     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           }
    4990            //Style & Script
    5091            wp_enqueue_script('bbaa-script', plugins_url('assets/js/bbaa.js', __FILE__) , array(
     
    5495                'jquery'
    5596            ) , '1.2', true);
     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 );
    5699            wp_localize_script('bbaa-script', 'bbaton_anonymous_age_verification', array(
    57100                'ajax_url' => admin_url('admin-ajax.php'),
    58                 'iamport_merchant_id' => 'imp34765018'
     101                'iamport_merchant_id' => 'imp34765018',
     102                'new_window' =>  $page_url,
     103                'domain' => parse_url(get_option('siteurl') , PHP_URL_HOST),
     104                'bbaa_client_id' =>( sanitize_text_field(get_option('bbaa_client_id')) ),
     105                'redirect_uri' => sanitize_text_field(get_option('bbaa_redirect_url'))
    59106            ));
    60107        }
     
    170217                               redirectURL = localStorage.getItem("bbaton_anonymous_age_verification_last_url");
    171218                            }
    172                             window.location.replace(redirectURL);
     219                           opener.location.href = redirectURL;
     220                           self.close();
    173221                         </script>';
    174222                    die();
  • bbaton-anonymous-age-verification/trunk/login-page.php

    r2465711 r2478934  
    1111        min-height: 100%;
    1212    }
    13     .btn_yes, .redirect_me {
     13  /*  .btn_yes, .redirect_me {
    1414        background-color: #0071bc !important;
    1515        padding: 11px 48px;
     
    1717        color: #fff;
    1818        font-weight: bold;
    19     }
     19    }*/
    2020
    21     .anonymous_ques {
     21   /* .anonymous_ques {
    2222        margin-top: 27px;
    23     }
     23    }*/
    2424
    25     #submit_btn{
     25  /*  #submit_btn{
    2626        background-color: #0071bc !important;
    2727        padding: 11px 48px;
     
    2929        color: #fff;
    3030        font-weight: bold;
    31     }
     31    }*/
    3232
    33     .tag_line {
     33   /* .tag_line {
    3434        font-size: 20px;
    3535        font-weight: bold;
    36     }
     36    }*/
    3737    .inf_det{
    3838    font-family: "Nanum Gothic", sans-serif !important;
    3939    margin-bottom: 4px !important;
    4040}
    41 .tag_line{
     41/*.tag_line{
    4242    color: #0071bc !important;
    4343    margin-top: 5px !important;
     
    4545.last_step{
    4646    display: none;
    47 }
     47}*/
    4848    body {
    4949        padding: 0;
     
    5454        overflow: hidden;
    5555    }
    56     #detail_popup {
     56 /*   #detail_popup {
    5757    background: url(<?php echo plugins_url('assets/bg-login.jpg', __FILE__); ?>) !important;
    5858    background-size: auto;
    5959    background-size: cover !important;
    60 }
     60}*/
    6161
    62     .imp-dialog.pc.certification-danal {
     62   /* .imp-dialog.pc.certification-danal {
    6363     background: url(<?php echo plugins_url('assets/bg-login.jpg', __FILE__); ?>) !important;
    6464    background-size: auto;
    6565    background-size: cover !important;
    66 }
     66}*/
    6767    .bbaa {
     68        min-width: 100% !important;
     69        min-height: 100% !important;
    6870        background: url(<?php echo plugins_url('assets/bg-login.jpg', __FILE__); ?>) !important;
    6971        background-size: cover !important;
     
    8385    word-break: keep-all !important;
    8486    }
    85     .img_last_step{
     87  /*  .img_last_step{
    8688        margin: auto !important;
    87     }
     89    }*/
    8890    #bbaton_auth {
    8991        padding-top: 100px;
     
    128130    </div>
    129131</div>
     132<?php /* ?>
    130133<div id="detail_popup" class="modal">
    131134  <!-- Modal content -->
     
    165168    </div>
    166169</div>
    167 
     170<?php */ ?>
    168171<script>
    169172    jQuery("header").remove();
Note: See TracChangeset for help on using the changeset viewer.