Plugin Directory

Changeset 3407370


Ignore:
Timestamp:
12/01/2025 11:16:20 PM (4 months ago)
Author:
hipaatizer
Message:

1.3.7

Location:
hipaatizer
Files:
69 added
4 edited

Legend:

Unmodified
Added
Removed
  • hipaatizer/trunk/admin/class-hipaatizer-admin.php

    r3192694 r3407370  
    2121        add_action( 'init', array( $this, 'hipaatizer_id' )  );
    2222        add_action( 'init', array( $this, 'hipaa_whiteLabet' )  );
    23         add_action( 'init', array( $this, 'hipaa_transfer_cf7_uregistered' )  );
    24         add_action( 'init', array( $this, 'hipaa_transfer_wpf_uregistered' )  );
    25         add_action( 'init', array( $this, 'hipaa_transfer_gf_uregistered' )  );
     23        add_action( 'admin_init', array( $this, 'hipaa_transfer_cf7_uregistered' )  );
     24        add_action( 'admin_init', array( $this, 'hipaa_transfer_wpf_uregistered' )  );
     25        add_action( 'admin_init', array( $this, 'hipaa_transfer_gf_uregistered' )  );
    2626        add_filter( 'script_loader_tag', array( $this,'hipaa_script_tags'), 10, 2);
    2727        add_action( 'wp_ajax_refresh_hipaa_forms',  array( $this, 'hipaa_refresh_hipaa_forms' ) );
    28         add_action( 'wp_ajax_nopriv_refresh_hipaa_forms',  array( $this, 'hipaa_refresh_hipaa_forms' ) );
    2928        add_action( 'wp_ajax_tabs_hipaa_forms',  array( $this, 'hipaa_tabs_hipaa_forms' ) );
    30         add_action( 'wp_ajax_nopriv_tabs_hipaa_forms',  array( $this, 'hipaa_tabs_hipaa_forms' ) );
    31 
    32 
    3329    }
    3430
     
    3733
    3834        $site_id  = ( is_multisite() ) ? get_current_blog_id() : '';
    39         $dbprefix = ( is_multisite() ) ? $wpdb->get_blog_prefix(0) : $wpdb->prefix;
     35        $dbprefix = is_multisite() ? $wpdb->get_blog_prefix( get_current_blog_id() ) : $wpdb->prefix;
    4036        $cf7key   = vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex(random_bytes(16)), 4));
    4137
     
    5450            );      endif;
    5551
    56         if( !empty($_GET['code']) ){
    57             $code = sanitize_key($_GET['code']);
    58 
    59             if( !empty($_GET['cf7']) ){
    60 
    61                 $this->hipaa_transfer_cf7();
    62 
    63                 if( $message == "Successful operation."){
    64                     $curl =  HIPAATIZER_APP.'/api/v1/account/activate?code='.$code.'&contactForm7Id='.$cf7key;
     52            if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
     53                return;
     54            }
     55            if( !empty($_GET['code']) ){
     56                $code = sanitize_text_field( wp_unslash( $_GET['code'] ) );
     57                if( !empty($_GET['cf7']) ){
     58
     59                    $this->hipaa_transfer_cf7();
     60
     61                    if( $message == "Successful operation."){
     62                        $curl =  HIPAATIZER_APP.'/api/v1/account/activate?code='.$code.'&contactForm7Id='.$cf7key;
     63                    } else {
     64                        $curl =  HIPAATIZER_APP.'/api/v1/account/activate?code='.$code;
     65                    }
     66
    6567                } else {
    6668                    $curl =  HIPAATIZER_APP.'/api/v1/account/activate?code='.$code;
    6769                }
    68 
    69             } else {
    70                 $curl =  HIPAATIZER_APP.'/api/v1/account/activate?code='.$code;
    71             }
    72 
    73 
    74             $response      = wp_remote_get( $curl);
    75             $body          = wp_remote_retrieve_body( $response );
    76             $res           = json_decode($body, true);
    77             $hipaa_message = ( !empty($res['message']) ) ? $res['message'] : '';
    78 
    79             if( $hipaa_message == '' ){
    80                 $new_hipaaID  = sanitize_key($body);
    81                 if( !empty($new_hipaaID)){
    82 
    83                     if (isset($hipaaID)){
    84                         if( !empty($site_id)) :
    85                         $wpdb->query( $wpdb->prepare( "UPDATE `{$dbprefix}hipaatizer` SET hipaatizer_id = %s WHERE id = %s  AND site_id = %s", $new_hipaaID, $rowID, $site_id )  );
    86                         else:
    87                         $wpdb->query( $wpdb->prepare( "UPDATE `{$dbprefix}hipaatizer` SET hipaatizer_id = %s WHERE id = %s", $new_hipaaID, $rowID )  );
    88                         endif;
    89                     } else {
    90                         if( !empty($site_id)) :
    91                             $wpdb->query( $wpdb->prepare( "INSERT INTO `{$dbprefix}hipaatizer`  (hipaatizer_id, site_id)  VALUES ( %s, %s)", $new_hipaaID, $site_id )  );
    92                         else:
    93                             $wpdb->query( $wpdb->prepare( "INSERT INTO `{$dbprefix}hipaatizer`  (hipaatizer_id)  VALUES ( %s )", $new_hipaaID )  );
    94                         endif;
     70                $response      = wp_remote_get( $curl);
     71                $body          = wp_remote_retrieve_body( $response );
     72                $res           = json_decode($body, true);
     73                $hipaa_message = ( !empty($res['message']) ) ? $res['message'] : '';
     74
     75                if( $hipaa_message == '' ){
     76                    $new_hipaaID  = sanitize_key($body);
     77                    if( !empty($new_hipaaID)){
     78
     79                        if (isset($hipaaID)){
     80                            if( !empty($site_id)) :
     81                            $wpdb->query( $wpdb->prepare( "UPDATE `{$dbprefix}hipaatizer` SET hipaatizer_id = %s WHERE id = %s  AND site_id = %s", $new_hipaaID, $rowID, $site_id )  );
     82                            else:
     83                            $wpdb->query( $wpdb->prepare( "UPDATE `{$dbprefix}hipaatizer` SET hipaatizer_id = %s WHERE id = %s", $new_hipaaID, $rowID )  );
     84                            endif;
     85                        } else {
     86                            if( !empty($site_id)) :
     87                                $wpdb->query( $wpdb->prepare( "INSERT INTO `{$dbprefix}hipaatizer`  (hipaatizer_id, site_id)  VALUES ( %s, %s)", $new_hipaaID, $site_id )  );
     88                            else:
     89                                $wpdb->query( $wpdb->prepare( "INSERT INTO `{$dbprefix}hipaatizer`  (hipaatizer_id)  VALUES ( %s )", $new_hipaaID )  );
     90                            endif;
     91                        }
     92                        delete_transient( 'hipaatizer_public_info_' . $new_hipaaID );
     93                        unset($_COOKIE['hipaaID']);
     94                        setcookie('hipaaID', '', time() - 3600);
     95                        $path = admin_url( 'admin.php' ).'?page=hipaatizer';
     96                        wp_redirect( esc_url($path) );
     97                        exit;
    9598                    }
    96                     unset($_COOKIE['hipaaID']);
    97                     setcookie('hipaaID', '', time() - 3600);
    98                     $path = admin_url( 'admin.php' ).'?page=hipaatizer';
    99                     wp_redirect( esc_url($path) );
    100                     exit;
    101                 }
    102 
    103             }
    104 
     99
     100            }
    105101        }
    106102        if( !empty($_COOKIE['hipaaID'])){
     
    120116                endif;
    121117            }
     118            delete_transient( 'hipaatizer_public_info_' . $new_hipaaID );
    122119            unset($_COOKIE['hipaaID']);
    123120            setcookie('hipaaID', '', time() - 3600);
     
    129126
    130127        if( isset($_GET['hipaa_logout']) && $_GET['hipaa_logout'] == 1){
     128            if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
     129                return;
     130            }
     131
     132            if ( ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( $_GET['_wpnonce'], 'hipaa_logout' ) ) {
     133                return;
     134            }           
    131135            unset($_COOKIE['hipaaID']);
     136            if ( ! empty( $hipaaID ) ) {
     137                delete_transient( 'hipaatizer_public_info_' . $hipaaID );
     138            }
    132139            setcookie('hipaaID', '', time() - 3600);
    133140            if( !empty($site_id)) :
     
    149156        $iframe = '';
    150157        $screen = get_current_screen();
    151         $dbprefix = ( is_multisite() ) ? $wpdb->get_blog_prefix(0) : $wpdb->prefix;
     158        $dbprefix = is_multisite() ? $wpdb->get_blog_prefix( get_current_blog_id() ) : $wpdb->prefix;
    152159        $login = '/login';
    153160
     
    226233    }
    227234
    228     public function hipaa_whiteLabet() {
    229     global $hipaaID, $whiteLabelUrl;
    230 
    231     if ( $hipaaID != ''  ):
    232 
    233         $curl     = HIPAATIZER_APP.'/api/v1/account/'.$hipaaID.'/public_info';
    234         $response = wp_remote_get( $curl);
    235         $body     = wp_remote_retrieve_body( $response );
    236         $res      = json_decode($body, true);
    237 
    238         $whiteLabelUrl = ( isset($res['whiteLabelUrl']) ) ? $res['whiteLabelUrl'] : '';
    239 
    240         if($whiteLabelUrl != '' && strrev($whiteLabelUrl)[0]==='/') {
    241             $whiteLabelUrl = rtrim($whiteLabelUrl, '/');
    242         }
    243 
    244     endif;
    245 
    246     return $whiteLabelUrl;
     235public function hipaa_whiteLabet() {
     236    global $hipaaID, $whiteLabelUrl;
     237
     238    if ( empty( $hipaaID ) ) {
     239        return $whiteLabelUrl;
     240    }
     241
     242    $cache_key = 'hipaatizer_public_info_' . $hipaaID;
     243
     244    $whiteLabelUrl = get_transient( $cache_key );
     245    if ( false !== $whiteLabelUrl ) {
     246        return $whiteLabelUrl;
     247    }
     248    $curl     = HIPAATIZER_APP . '/api/v1/account/' . $hipaaID . '/public_info';
     249    $response = wp_remote_get( $curl );
     250
     251    if ( is_wp_error( $response ) ) {
     252        return $whiteLabelUrl;
     253    }
     254
     255    $body = wp_remote_retrieve_body( $response );
     256    $res  = json_decode( $body, true );
     257
     258    $whiteLabelUrl = ! empty( $res['whiteLabelUrl'] ) ? rtrim( $res['whiteLabelUrl'], '/' ) : '';
     259
     260    set_transient( $cache_key, $whiteLabelUrl, DAY_IN_SECONDS );
     261
     262    return $whiteLabelUrl;
    247263}
     264
    248265    public function hipaa_admin_menu() {
    249266        global $hipaaID;
     
    344361    }
    345362    public function hipaa_refresh_hipaa_forms(){
    346 
     363        if ( ! current_user_can( 'manage_options' ) ) {
     364            wp_send_json_error( array( 'message' => 'Forbidden' ), 403 );
     365        }
    347366        check_ajax_referer( 'hipaa_refresh_hipaa_forms_nonce', 'nonce' );
    348367        echo $this->hipaa_get_forms();
     
    351370
    352371    public function hipaa_tabs_hipaa_forms(){
     372        if ( ! current_user_can( 'manage_options' ) ) {
     373            wp_send_json_error( array( 'message' => 'Forbidden' ), 403 );
     374        }
     375
     376        check_ajax_referer( 'hipaa_refresh_hipaa_forms_nonce', 'nonce' );
    353377
    354378        echo $this->hipaa_get_forms();
    355         wp_die();
     379    wp_die();
    356380    }
    357381
     
    362386
    363387        foreach($_GET['cf7'] as $val) {
    364 
     388        $id = absint( $val );
     389        if ( ! $id ) {
     390            continue;
     391        }       
    365392        $form            = array();
    366         $cf7_post        = get_post($val);
    367         $form['id']      = $val;
     393        $cf7_post        = get_post($id);
     394        $form['id']      = $id;
    368395        $form['title']   = $cf7_post->post_title;
    369396        $form['content'] = $cf7_post->post_content;
     
    386413    public function hipaa_transfer_cf7_uregistered(){
    387414        global $cf7key, $message;
     415        if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
     416            return;
     417        }
     418        if ( empty( $_GET['cf7'] ) || empty( $_GET['hipaaID'] ) ) {
     419            return;
     420        }
     421
     422        if ( ! isset( $_GET['hipaa_import_cf7_nonce'] ) ||
     423            ! wp_verify_nonce( $_GET['hipaa_import_cf7_nonce'], 'hipaa_import_cf7' ) ) {
     424            return;
     425        }       
     426        $hipaaID = sanitize_key( wp_unslash( $_GET['hipaaID'] ) );
     427        $_GET['cf7'] = array_map(
     428            'absint',
     429            (array) wp_unslash( $_GET['cf7'] )
     430        );
    388431        if( !empty($_GET['cf7']) &&  !empty($_GET['hipaaID']) ){
    389432            $this->hipaa_transfer_cf7();
     
    391434            if( $message == "Successful operation."){
    392435                if(!empty($_GET['hipaaID'])) {
    393                     $url  = HIPAATIZER_APP.'/api/v1/account/import/contact_from_7?utm_source=wppl&contactForm7Id='.$cf7key.'&accountId='.sanitize_key($_GET['hipaaID']);
     436                    $url  = HIPAATIZER_APP.'/api/v1/account/import/contact_from_7?utm_source=wppl&contactForm7Id='.$cf7key.'&accountId='.$hipaaID;
    394437                    $response = wp_remote_get( $url );
    395438                    $body     = wp_remote_retrieve_body( $response );
     
    405448                    $url = admin_url( 'admin.php' )."?page=hipaatizer&import_cf7=error";
    406449                }
    407                     wp_redirect( esc_url($url) );
     450                    wp_safe_redirect( esc_url_raw( $url ) );
    408451                    exit;
    409452            }
     
    416459
    417460            foreach($_GET['wpf'] as $val) {
    418 
     461                $id = absint( $val );
     462                if ( ! $id ) {
     463                    continue;
     464                }               
    419465                $form            = array();
    420                 $wpf_post        = get_post($val);
    421                 $form['id']      = $val;
     466                $wpf_post        = get_post($id);
     467                $form['id']      = $id ;
    422468                $form['title']   = $wpf_post->post_title;
    423469                $form['content'] = $wpf_post->post_content;
     
    425471            }
    426472
    427             $data = json_encode($arr); wp_die($data);
     473            $data = wp_json_encode( $arr );
    428474            $url  = HIPAATIZER_APP.'/api/v1/sign_up/prepare_cf7_forms_for_import?wpformsId='.$cf7key;
    429475
     
    441487
    442488    public function hipaa_transfer_wpf_uregistered(){
    443     global $cf7key, $message;
    444         if( !empty($_GET['wpf']) &&  !empty($_GET['hipaaID']) ){
     489        global $cf7key, $message;
     490
     491        if ( ! is_admin() || ! current_user_can( 'manage_options' ) ) {
     492            return;
     493        }
     494
     495        if ( empty( $_GET['wpf'] ) || empty( $_GET['hipaaID'] ) ) {
     496            return;
     497        }
     498
     499        if ( ! isset( $_GET['hipaa_import_wpf_nonce'] ) ||
     500            ! wp_verify_nonce( $_GET['hipaa_import_wpf_nonce'], 'hipaa_import_wpf' ) ) {
     501            return;
     502        }
     503
     504        $hipaaID = sanitize_key( wp_unslash( $_GET['hipaaID'] ) );
     505        $_GET['wpf'] = array_map(
     506            'absint',
     507            (array) wp_unslash( $_GET['wpf'] )
     508        );
     509
     510        if ( ! empty( $_GET['wpf'] ) && ! empty( $hipaaID ) ) {
    445511            $this->hipaa_transfer_wpf();
    446512
    447             if( $message == "Successful operation."){
    448                 if(!empty($_GET['hipaaID'])) {
    449                 $url  = HIPAATIZER_APP.'/api/v1/account/import/contact_from_7?wpformsId='.$cf7key.'&accountId='.sanitize_key($_GET['hipaaID']);
     513            if ( $message === 'Successful operation.' ) {
     514                $url  = HIPAATIZER_APP . '/api/v1/account/import/contact_from_7?wpformsId=' . $cf7key . '&accountId=' . $hipaaID;
    450515                $response = wp_remote_get( $url );
    451                 $body    = wp_remote_retrieve_body( $response );
    452                 $res     = json_decode($body, true);
    453                 $message_import = $res['message'];
    454             if( $message_import == "Successful operation."){
    455                 $url = admin_url( 'admin.php' )."?page=hipaatizer&import_wpf=success";
    456 
     516                $body     = wp_remote_retrieve_body( $response );
     517                $res      = json_decode( $body, true );
     518                $message_import = isset( $res['message'] ) ? $res['message'] : '';
     519
     520                if ( $message_import === 'Successful operation.' ) {
     521                    $url = admin_url( 'admin.php?page=hipaatizer&import_wpf=success' );
    457522                } else {
    458                     $url = admin_url( 'admin.php' )."?page=hipaatizer&import_wpf=error";
     523                    $url = admin_url( 'admin.php?page=hipaatizer&import_wpf=error' );
    459524                }
    460525
    461                 } else {
    462             $url = admin_url( 'admin.php' )."?page=hipaatizer&import_wpf=error";
    463                 }
    464                 wp_redirect( esc_url($url) );
     526                wp_safe_redirect( esc_url_raw( $url ) );
    465527                exit;
    466528            }
    467529        }
    468530    }
    469 
    470531    public function hipaa_transfer_gf(){
    471532        global $cf7key, $message;
     
    536597            $results  = $res['workflows'];
    537598
    538             $type_form   = (isset($_GET['type'])) ? trim($_GET['type']) : 'SimpleForm';
    539             $folder_form = (isset($_GET['folderId'])) ? trim($_GET['folderId']) : '';
    540             $status_form = (isset($_GET['status'])) ? trim($_GET['status']) : '';
     599            $type_form   = isset( $_GET['type'] )      ? sanitize_text_field( wp_unslash( $_GET['type'] ) )      : 'SimpleForm';
     600            $folder_form = isset( $_GET['folderId'] )  ? sanitize_text_field( wp_unslash( $_GET['folderId'] ) ) : '';
     601            $status_form = isset( $_GET['status'] )    ? sanitize_text_field( wp_unslash( $_GET['status'] ) )    : '';
    541602            $forms       = array();
    542603            foreach ($results as $item) :
     
    570631            if( $forms ):
    571632            $nb_elem_per_page = 10;
    572             $page = isset($_GET['paged'])?intval($_GET['paged']-1):0;
     633            $page = isset( $_GET['paged'] ) ? max( 0, intval( $_GET['paged'] ) - 1 ) : 0;
    573634            $number_of_pages = intval(count($forms)/$nb_elem_per_page)+1;
    574635
     
    701762            <input type="hidden" name="page" value="hipaatizer">
    702763            <input type="hidden" name="hipaaID" value="<?php echo sanitize_key($hipaaID); ?>">
     764            <?php wp_nonce_field( 'hipaa_import_cf7', 'hipaa_import_cf7_nonce' ); ?>           
    703765            <?php
    704766            $args = array(
     
    758820    public function hipaa_import_gf() {
    759821        global $wpdb, $hipaaID;
    760         $dbprefix = ( is_multisite() ) ? $wpdb->get_blog_prefix(0) : $wpdb->prefix;
     822        $dbprefix = is_multisite() ? $wpdb->get_blog_prefix( get_current_blog_id() ) : $wpdb->prefix;
    761823    ?>
    762824    <form id="export-gf" action="<?php echo esc_url( admin_url( 'admin.php' ) ); ?>" method="get" class="export-forms">
  • hipaatizer/trunk/admin/js/hipaatizer-admin.js

    r2991169 r3407370  
    1 (function( $ ) {
    2     'use strict';
    3 
    4     var ifrm = document.createElement('iframe'),
    5         $url = hipaa_params.url,
     1(function ($) {
     2    'use strict';
     3
     4    var ifrm = document.createElement('iframe'),
     5        $url = hipaa_params.url,
    66        $pluginUrl = hipaa_params.pluginUrl,
    7         $curl = hipaa_params.curl,
    8         $query_param = window.location.href.slice(window.location.href.indexOf('?')+1),
     7        $curl = hipaa_params.curl,
     8        $query_param = window.location.href.slice(window.location.href.indexOf('?') + 1),
    99        searchParams = new URLSearchParams(window.location.search);
    10        // $irameH = $(window).height() - 32;
    11 
    12         //ifrm.setAttribute('src', $url);
    13        // ifrm.style.height = $irameH+'px';
    14 
    15         if ( $url ) {
    16             location.href = $url+'&pluginUrl='+encodeURIComponent($pluginUrl);
    17         }
    18 
    19         $( document ).ready(function() {
    20         if( $('.hipaa-iframe-container').length ){
     10    // $irameH = $(window).height() - 32;
     11
     12    //ifrm.setAttribute('src', $url);
     13    // ifrm.style.height = $irameH+'px';
     14
     15    if ($url) {
     16        location.href = $url + '&pluginUrl=' + encodeURIComponent($pluginUrl);
     17    }
     18
     19    $(document).ready(function () {
     20        if ($('.hipaa-iframe-container').length) {
    2121            $('.hipaa-iframe-container').append(ifrm);
    2222        }
    23         $('#adminmenu .wp-has-current-submenu ul  li  a').each(function(){
     23        $('#adminmenu .wp-has-current-submenu ul  li  a').each(function () {
    2424            var $this = $(this),
    2525                $href = $this.attr('href');
    26             if( $href == '?'+$query_param ) {
     26            if ($href == '?' + $query_param) {
    2727                $('#adminmenu .wp-has-current-submenu ul  li.current a').removeClass('current');
    2828                $('#adminmenu .wp-has-current-submenu ul  li.current').removeClass('current');
     
    3131            }
    3232        });
    33         if( searchParams.has('auth') ){
     33        if (searchParams.has('auth')) {
    3434            $('.hipaa-loader').show();
    3535            $('.hipaa-fcontent').hide();
    3636        }
    37             $('.copyShortcode').on('click', function(e){
    38                 e.preventDefault();
    39                 var $this = $(this),
     37        $('.copyShortcode').on('click', function (e) {
     38            e.preventDefault();
     39            var $this = $(this),
    4040                $temp = $("<input>"),
    4141                element = $this.next('span');
    42                 $("body").append($temp);
    43                 $temp.val($(element).text()).select();
    44                 document.execCommand("copy");
    45                 $temp.remove();
    46                 $this.find('.tooltip_copied').addClass('show');
    47                 $this.find('.tooltip').hide();
    48                 setTimeout(function(){
    49                     $this.find('.tooltip_copied').removeClass('show');
    50                     $this.find('.tooltip').show();
    51                 }, 2000);
     42            $("body").append($temp);
     43            $temp.val($(element).text()).select();
     44            document.execCommand("copy");
     45            $temp.remove();
     46            $this.find('.tooltip_copied').addClass('show');
     47            $this.find('.tooltip').hide();
     48            setTimeout(function () {
     49                $this.find('.tooltip_copied').removeClass('show');
     50                $this.find('.tooltip').show();
     51            }, 2000);
     52        });
     53
     54        $('.hipaa-refresh').on('click', function () {
     55            var $type_form = $(this).attr('data-type');
     56            $('.hipaa-loader').show();
     57            $.ajax({
     58                type: 'GET',
     59                url: hipaa_params.ajax_url,
     60                data: { action: 'refresh_hipaa_forms', nonce: hipaa_params.nonce, type: $type_form },
     61                success: function (response) {
     62                    $('#hipaa-list').html(response);
     63                    $('.hipaa-loader').hide();
     64                }
     65
     66
    5267            });
    53 
    54             $('.hipaa-refresh').on('click',  function () {
    55                 var $type_form = $(this).attr('data-type');
    56                     $('.hipaa-loader').show();
    57                     $.ajax({
     68        });
     69
     70        $('.hipaa-tabs a').on('click', function (e) {
     71            e.preventDefault();
     72            $('.hipaa-loader').show();
     73            var $this = $(this),
     74                $type = $this.attr('data-type'),
     75                $folderId = $this.attr('data-folderId'),
     76                $status = $this.attr('data-status');
     77
     78            $('.hipaa-tabs li').removeClass('active');
     79            $this.parent().addClass('active');
     80            if (!$status) {
     81                $.ajax({
    5882                    type: 'GET',
    5983                    url: hipaa_params.ajax_url,
    60                     data:  { action: 'refresh_hipaa_forms',  nonce: hipaa_params.nonce, type: $type_form },
    61                     success: function(response) {
     84                    data: { action: 'tabs_hipaa_forms', nonce: hipaa_params.nonce, type: $type, folderId: $folderId },
     85                    success: function (response) {
    6286                        $('#hipaa-list').html(response);
    6387                        $('.hipaa-loader').hide();
    6488                    }
    65 
    66 
    67                     });
    68             });
    69 
    70             $('.hipaa-tabs a').on('click',  function (e) {
    71                 e.preventDefault();
    72                 $('.hipaa-loader').show();
    73                 var $this     = $(this),
    74                     $type = $this.attr('data-type'),
    75                     $folderId = $this.attr('data-folderId'),
    76                     $status   = $this.attr('data-status');
    77 
    78                 $('.hipaa-tabs li').removeClass('active');
    79                 $this.parent().addClass('active');
    80                 if( !$status ) {
    81                     $.ajax({
     89                });
     90            } else {
     91                $.ajax({
    8292                    type: 'GET',
    8393                    url: hipaa_params.ajax_url,
    84                     data:  { action: 'tabs_hipaa_forms', type: $type,  folderId: $folderId },
    85                     success: function(response) {
     94                    data: { action: 'tabs_hipaa_forms', nonce: hipaa_params.nonce, type: $type, status: $status },
     95                    success: function (response) {
    8696                        $('#hipaa-list').html(response);
    8797                        $('.hipaa-loader').hide();
    88                         }
    89                     });
    90                 } else {
    91                     $.ajax({
    92                         type: 'GET',
    93                         url: hipaa_params.ajax_url,
    94                         data:  { action: 'tabs_hipaa_forms', type: $type,  status: $status },
    95                         success: function(response) {
    96                             $('#hipaa-list').html(response);
    97                             $('.hipaa-loader').hide();
    98                         }
    99                     });
    100                 }
    101             });
    102 
    103                 function checked_all($el){
    104                     if( $el.is(':checked') ){
    105                         $('#export-wpcf7').find('input[type="checkbox"]').prop('checked',true);
    106                     } else {
    107                         $('#export-wpcf7').find('input[type="checkbox"]').prop('checked',false);
    10898                    }
    109                 }
    110                 checked_all($('#select_all'));
    111 
    112                 $('#select_all').on('change', function() {
    113                     var $this = $(this);
    114                     checked_all($this);
    11599                });
    116 
    117                 $('#toplevel_page_hipaatizer .item_target_blank').each(function(){
    118                     $(this).parent().attr('target', '_blank');
    119                 });
    120 
    121                 $.urlParam = function(name){
    122                 var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
    123                 if (results==null) {
    124                     return null;
    125                 }
    126                 return decodeURI(results[1]) || 0;
    127             }
    128             if( $.urlParam('change_account') == 1 ){
    129                 $('#item_change_account').parent().parent().addClass('current').siblings().removeClass('current');
    130             }
    131 
    132             $('.hippa_message').on('click', function(){
    133                     $(this).hide();
    134                 var uri = window.location.toString();
    135                 if (uri.indexOf("&") > 0) {
    136                     var clean_uri = uri.substring(0, uri.indexOf("&"));
    137                     window.history.replaceState({}, document.title, clean_uri);
    138                 }
    139 
    140                 });
    141 
    142             $('.hipaaIconMenu').on('click', function(){
    143                 $('body').addClass('hipaa-open-menu');
    144             });
    145 
    146             $('.hipaaIconClose').on('click', function(){
    147                 $('body').removeClass('hipaa-open-menu');
    148             });
    149         });
    150     function geneate_form($form_id){
    151                 var form_id = $form_id;
    152                 var basicUrl = $curl+form_id;
    153                 var iFrameParent = document.getElementById(form_id);
    154                 var iFrame = document.createElement('iframe');
    155 
    156                 iFrameParent.appendChild(iFrame).setAttribute('src', basicUrl)
    157 
    158     }
    159 
    160     $(document).on('change', '.hipaa-select select', function(){
    161         var $this = $(this);
    162         setTimeout( function(){
    163             var $hipaa = $this.parent().next('.hipaa-form'),
    164             $id = $hipaa.attr('id');
    165             geneate_form($id);
    166         },1000);
    167 
    168 
    169     });
    170 
    171     $( window ).load(function() {
     100            }
     101        });
     102
     103        function checked_all($el) {
     104            if ($el.is(':checked')) {
     105                $('#export-wpcf7').find('input[type="checkbox"]').prop('checked', true);
     106            } else {
     107                $('#export-wpcf7').find('input[type="checkbox"]').prop('checked', false);
     108            }
     109        }
     110        checked_all($('#select_all'));
     111
     112        $('#select_all').on('change', function () {
     113            var $this = $(this);
     114            checked_all($this);
     115        });
     116
     117        $('#toplevel_page_hipaatizer .item_target_blank').each(function () {
     118            $(this).parent().attr('target', '_blank');
     119        });
     120
     121        $.urlParam = function (name) {
     122            var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
     123            if (results == null) {
     124                return null;
     125            }
     126            return decodeURI(results[1]) || 0;
     127        }
     128        if ($.urlParam('change_account') == 1) {
     129            $('#item_change_account').parent().parent().addClass('current').siblings().removeClass('current');
     130        }
     131
     132        $('.hippa_message').on('click', function () {
     133            $(this).hide();
     134            var uri = window.location.toString();
     135            if (uri.indexOf("&") > 0) {
     136                var clean_uri = uri.substring(0, uri.indexOf("&"));
     137                window.history.replaceState({}, document.title, clean_uri);
     138            }
     139
     140        });
     141
     142        $('.hipaaIconMenu').on('click', function () {
     143            $('body').addClass('hipaa-open-menu');
     144        });
     145
     146        $('.hipaaIconClose').on('click', function () {
     147            $('body').removeClass('hipaa-open-menu');
     148        });
     149    });
     150    function geneate_form($form_id) {
     151        var form_id = $form_id;
     152        var basicUrl = $curl + form_id;
     153        var iFrameParent = document.getElementById(form_id);
     154        var iFrame = document.createElement('iframe');
     155
     156        iFrameParent.appendChild(iFrame).setAttribute('src', basicUrl)
     157
     158    }
     159
     160    $(document).on('change', '.hipaa-select select', function () {
     161        var $this = $(this);
     162        setTimeout(function () {
     163            var $hipaa = $this.parent().next('.hipaa-form'),
     164                $id = $hipaa.attr('id');
     165            geneate_form($id);
     166        }, 1000);
     167
     168
     169    });
     170
     171    $(window).load(function () {
    172172        const searchParams = new URLSearchParams(window.location.search);
    173173
     
    177177            document.cookie = `hipaaID = ${accountId}`;
    178178
    179             window.location.href = hipaa_params.admin_url+"?page=hipaatizer";
    180         }
    181 
    182         $('.hipaa-form').each(function(){
    183             var $id = $(this).attr('id')
    184             geneate_form($id);
    185         });
    186             hipaa_mobile();
    187     });
    188 
    189     $( window ).resize(function() {
     179            window.location.href = hipaa_params.admin_url + "?page=hipaatizer";
     180        }
     181
     182        $('.hipaa-form').each(function () {
     183            var $id = $(this).attr('id')
     184            geneate_form($id);
     185        });
    190186        hipaa_mobile();
    191187    });
    192188
     189    $(window).resize(function () {
     190        hipaa_mobile();
     191    });
     192
    193193    function hipaa_mobile() {
    194         if( $( window ).width() < 1181) {
    195             $('.hipaa-changeAccount').appendTo( '.nav-menu' );
     194        if ($(window).width() < 1181) {
     195            $('.hipaa-changeAccount').appendTo('.nav-menu');
    196196        } else {
    197197            $('.nav-menu .hipaa-changeAccount').remove();
     
    200200
    201201
    202 })( jQuery );
     202})(jQuery);
    203203
    204204window.addEventListener('message', event => {
     
    206206    const identityHeader = '#accountId';
    207207
    208     if (typeof eventData === 'string' && eventData.includes(identityHeader)){
     208    if (typeof eventData === 'string' && eventData.includes(identityHeader)) {
    209209        const accountId = eventData.substring(identityHeader.length);
    210210
     
    212212        console.log('accountId', accountId)
    213213
    214         document.cookie = `hipaaID = ${accountId}`;
    215         window.location.href = hipaa_params.admin_url+"?page=hipaatizer";
     214        document.cookie = `hipaaID = ${accountId}`;
     215        window.location.href = hipaa_params.admin_url + "?page=hipaatizer";
    216216    }
    217217});
    218218var logout = location.search.split('hipaa_account=')[1]
    219     if ( logout == 'login' ){
    220         document.cookie = 'hipaaID=; Max-Age=0'
    221     }
     219if (logout == 'login') {
     220    document.cookie = 'hipaaID=; Max-Age=0'
     221}
    222222
    223223window.fwSettings = {
    224224    widget_id: 72000002319,
    225     };
    226     !(function () {
     225};
     226!(function () {
    227227    if ("function" != typeof window.FreshworksWidget) {
    228228        var n = function () {
    229         n.q.push(arguments);
    230     };
    231     (n.q = []), (window.FreshworksWidget = n);
     229            n.q.push(arguments);
     230        };
     231        (n.q = []), (window.FreshworksWidget = n);
    232232    }
    233233})();
  • hipaatizer/trunk/hipaatizer.php

    r3192702 r3407370  
    55 * Plugin URI:        https://hipaatizer.com/free-developer-account
    66 * Description:       HIPAAtizer - Helps you create and manage HIPAA-Compliant web forms.
    7  * Version:           1.3.6
     7 * Version:           1.3.7
    88 * Author:            HIPAAtizer
    99 * Author URI:        https://hipaatizer.com
     
    3939 * Currentl plugin version.
    4040 */
    41 define('HIPAATIZER_VERSION', '1.3.6');
     41define('HIPAATIZER_VERSION', '1.3.7');
    4242
    4343/**
  • hipaatizer/trunk/readme.txt

    r3273947 r3407370  
    88Requires PHP: 5.6
    99Requires at least: 4.6
    10 Tested up to: 6.8
    11 Stable tag: 1.3.6
     10Tested up to: 6.9
     11Stable tag: 1.3.7
    1212
    1313Whether you are enhancing a new or existing website, HIPAAtizer delivers a seamless, flexible HIPAA‑Compliant form solution. Always free for developers.
     
    124124== Additional Resources ==
    125125
    126 1. [Docs](https://hipaatizer.com/free-developer-account#how-it-works/?utm_source=wps)
     1261. [Docs](https://www.hipaatizer.com/hipaa-form-solutions/developers/?utm_source=wps)
    1271272. [FAQ](https://www.hipaatizer.com/hipaa-compliance-resources/faq/?utm_source=wps)
    128128
     
    146146
    147147== Changelog ==
     148
     149= 1.3.7 =
     150* Improved performance and stability.
    148151
    149152= 1.3.6 =
Note: See TracChangeset for help on using the changeset viewer.