banner.php
1 year ago
cp-feedback.php
1 year ago
cp_admin_int_edition.inc.php
1 year ago
cpabc_appointments_admin_addbk.inc.php
1 year ago
cpabc_appointments_admin_int.inc.php
1 year ago
cpabc_appointments_admin_int_bookings_list.inc.php
1 year ago
cpabc_appointments_admin_int_calendar_list.inc.php
1 year ago
cpabc_appointments_admin_int_edit_booking.inc.php
1 year ago
cpabc_apps_go.inc.php
1 year ago
cpabc_apps_on.inc.php
1 year ago
cpabc_publish_wizzard.inc.php
1 year ago
cpabc_scheduler.inc.php
1 year ago
index.html
1 year ago
cp-feedback.php
203 lines
| 1 | <?php |
| 2 | add_action( 'admin_enqueue_scripts', 'cpabcal_feedback_insert_adminScripts', 1); |
| 3 | add_action( 'wp_ajax_cpabcal_feedback', 'cpabcal_feedback' ); |
| 4 | $cpabcal_plugfile = 'cpabc_appointments.php'; |
| 5 | $cpabcal_plugslug = 'appointment-booking-calendar'; |
| 6 | $cpabcal_supportlink = 'https://abc.dwbooster.com/contact-us'; |
| 7 | $cpabcal_supportlink_full = $cpabcal_supportlink . '?priority-support=yes'; |
| 8 | |
| 9 | if (!get_option('installed_'.$cpabcal_plugslug, '')) |
| 10 | update_option('installed_'.$cpabcal_plugslug, time() ); |
| 11 | |
| 12 | function cpabcal_feedback_insert_adminScripts($hook) { |
| 13 | if( 'plugins.php' == $hook ) |
| 14 | { |
| 15 | wp_enqueue_style('wp-jquery-ui-dialog'); |
| 16 | wp_enqueue_script('jquery'); |
| 17 | wp_enqueue_script('jquery-ui-dialog'); |
| 18 | add_action( 'admin_footer', 'cpabcal_feedback_javascript' ); |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | |
| 23 | |
| 24 | // This function is used only if explicitly accepted (opt-in) by the user |
| 25 | function cpabcal_feedback() { |
| 26 | global $cpabcal_plugfile, $cpabcal_plugslug; |
| 27 | if ( |
| 28 | isset( $_POST['_wpnonce'] ) && |
| 29 | wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ), 'abc-feedback' ) |
| 30 | ) { |
| 31 | $cpabcal_plugin_data = get_plugin_data( dirname(dirname(__FILE__)).'/'.$cpabcal_plugfile ); |
| 32 | $cpabcal_plugin_version = $cpabcal_plugin_data['Version']; |
| 33 | $time = time() - get_option('installed_'.$cpabcal_plugslug, ''); |
| 34 | $data = array( |
| 35 | 'answer' => sanitize_textarea_field(@$_POST["answer"]), |
| 36 | 'otherplugin' => sanitize_textarea_field(@$_POST["opinfo"]), |
| 37 | 'otherinfo' => sanitize_textarea_field(@$_POST["oinfo"]), |
| 38 | 'plugin' => ($cpabcal_plugin_data['Name']), |
| 39 | 'pluginv' => ($cpabcal_plugin_version), |
| 40 | 'wordpress' => (get_bloginfo( 'version' )), |
| 41 | 'itime' => ($time), |
| 42 | 'phpversion' => (phpversion ()) |
| 43 | ); |
| 44 | if (@$_POST["onymous"] == 'false') // send this data only if explicitly accepted |
| 45 | { |
| 46 | $current_user = wp_get_current_user(); |
| 47 | $data['email'] = ($current_user->user_email); |
| 48 | $data['website'] = ($_SERVER['HTTP_HOST']); |
| 49 | $data['url'] = (get_site_url()); |
| 50 | // for detecting theme and plugin conflicts: |
| 51 | $data['theme'] = (wp_get_theme()->get('Name') . " " .wp_get_theme()->get('Version')); |
| 52 | $plist = ""; |
| 53 | $activeplugins = get_option('active_plugins'); |
| 54 | $plugins = get_plugins(); |
| 55 | foreach ($activeplugins as $plugin) |
| 56 | $plist .= $plugins[$plugin]["Title"]." ".$plugins[$plugin]["Version"]."\n"; |
| 57 | $data['plugins'] = ($plist); |
| 58 | } |
| 59 | |
| 60 | //extract data from the post |
| 61 | //set POST variables |
| 62 | $url = 'https://wordpress.dwbooster.com/licensesystem/debug-data.php'; |
| 63 | $fields = $data; |
| 64 | |
| 65 | wp_remote_post( |
| 66 | $url, |
| 67 | array ( 'body' => $fields ) |
| 68 | ); |
| 69 | |
| 70 | wp_die(); // this is required to terminate immediately and return a proper response |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | |
| 75 | function cpabcal_feedback_javascript() { |
| 76 | global $cpabcal_plugslug, $cpabcal_supportlink, $cpabcal_supportlink_full; |
| 77 | ?> |
| 78 | <script type="text/javascript"> |
| 79 | |
| 80 | $ = jQuery.noConflict() |
| 81 | $(window).on('load',function () { |
| 82 | document.querySelector('[data-slug="<?php echo esc_js($cpabcal_plugslug); ?>"] .deactivate a').addEventListener('click', function(event){ |
| 83 | event.preventDefault() |
| 84 | var urlRedirect = document.querySelector('[data-slug="<?php echo esc_js($cpabcal_plugslug); ?>"] .deactivate a').getAttribute('href'); |
| 85 | |
| 86 | $('<div title="QUICK FEEDBACK"><div style="padding:10px;">'+ |
| 87 | '<style type="text/css">.abcreasonblock { margin-top:8px; }</style>'+ |
| 88 | '<h3><strong>If you have a moment, please let us know why you are deactivating:</strong></h3>'+ |
| 89 | '<form id="cpfeedbackform">'+ |
| 90 | |
| 91 | '<div class="abcreasonblock"><input type="radio" name="abcm_reason" onclick="cpabcal_update_reason(this);" value="no-work"> The plugin didn\'t work<br />'+ |
| 92 | '<div id="abcm_nowork" style="margin-left:25px;display:none;padding:10px;border:1px dotted gray;color:#660000"><strong>We can help!</strong> We offer <strong>free support</strong> for this plugin with <strong>timely answers</strong> and <strong>solution for almost 100% of cases</strong>. <a href="<?php echo esc_js($cpabcal_supportlink_full); ?>"><strong>Send a message to support</strong></a> and get a solution.</div></div>'+ |
| 93 | |
| 94 | |
| 95 | '<div class="abcreasonblock"><input type="radio" name="abcm_reason" onclick="cpabcal_update_reason(this);" value="no-paypal"> Don\'t want to use PayPal<br />'+ |
| 96 | '<div id="abcm_nopaypal" style="margin-left:25px;display:none;padding:10px;border:1px dotted gray;color:#660000"><strong>No problem, we have a solution!</strong> There is a similar free plugin without PayPal, the <a href="plugin-install.php?tab=plugin-information&plugin=appointment-hour-booking&TB_iframe=true" class="thickbox open-plugin-details-modal" onclick="javascript:cpabcal_apphourbk(this);"><strong>Appointment Hour Booking</strong></a>. Questions? <a href="<?php echo esc_js($cpabcal_supportlink_full); ?>"><strong>Send us a message</strong></a> and get a solution.</div></div>'+ |
| 97 | |
| 98 | |
| 99 | '<div class="abcreasonblock"><input type="radio" name="abcm_reason" onclick="cpabcal_update_reason(this);" value="-"> I don\'t like to share this information with you<br /></div>'+ |
| 100 | |
| 101 | '<div class="abcreasonblock"><input type="radio" name="abcm_reason" onclick="cpabcal_update_reason(this);" value="temporary-deactivation"> It\'s a temporary deactivation. I\'m just debugging an issue.<br /></div>'+ |
| 102 | |
| 103 | '<div class="abcreasonblock"><input type="radio" name="abcm_reason" onclick="cpabcal_update_reason(this);" value="better-plugin"> I found a better plugin<br />'+ |
| 104 | '<div id="abcm_otherplugin" style="margin-left:25px;display:none;"><input type="text" name="abcm_otherpinfo" placeholder="What\'s the plugin name?" style="width:100%"></div></div>'+ |
| 105 | |
| 106 | '<div class="abcreasonblock"><input type="radio" name="abcm_reason" onclick="cpabcal_update_reason(this);" value="other"> Other<br />'+ |
| 107 | '<div id="abcm_other" style="margin-left:25px;display:none;font-weight:bold;">Kindly tell us the reason so we can improve.<br /><input type="text" name="abcm_otherinfo" style="width:100%"></div></div>'+ |
| 108 | |
| 109 | '<div id="abcnofeedback" style="display:none;margin-top:30px;text-align:right"><input type="checkbox" name="cpabcanonymous" value="yes"> Anonymous feedback</div>'+ |
| 110 | |
| 111 | '</form>'+ |
| 112 | '</div></div>' |
| 113 | ).dialog({ |
| 114 | width:'600', |
| 115 | dialogClass: 'wp-dialog', |
| 116 | modal: true, |
| 117 | close: function(event, ui) |
| 118 | { |
| 119 | $(this).dialog("close"); |
| 120 | $(this).remove(); |
| 121 | }, |
| 122 | closeOnEscape: true, |
| 123 | buttons: [ |
| 124 | { |
| 125 | id: 'abcdeactivatebtn', |
| 126 | text: "Skip & Deactivate", |
| 127 | click: function() { |
| 128 | var answer = $("input[name='abcm_reason']:checked").val(); |
| 129 | if (answer == undefined || answer == '' || answer == '-') |
| 130 | window.location.href = urlRedirect; |
| 131 | else |
| 132 | { |
| 133 | var opinfo = $("input[name='abcm_otherpinfo']").val(); |
| 134 | var oinfo = $("input[name='abcm_otherinfo']").val(); |
| 135 | var isAnonymous = $("input[name='cpabcanonymous']:checked").length > 0; |
| 136 | var data = { |
| 137 | 'action': 'cpabcal_feedback', |
| 138 | '_wpnonce' : '<?php echo esc_js(wp_create_nonce( 'abc-feedback' )); ?>', |
| 139 | 'answer': $("input[name='abcm_reason']:checked").val(), |
| 140 | 'opinfo': $("input[name='abcm_otherpinfo']").val(), |
| 141 | 'oinfo': $("input[name='abcm_otherinfo']").val(), |
| 142 | 'onymous': $("input[name='cpabcanonymous']:checked").length > 0 |
| 143 | }; |
| 144 | $.post(ajaxurl, data, function(response) { |
| 145 | window.location.href = urlRedirect; |
| 146 | }); |
| 147 | } |
| 148 | } |
| 149 | }, |
| 150 | { |
| 151 | text: "We can help: Support Service", |
| 152 | click: function() { |
| 153 | window.open('<?php echo esc_js($cpabcal_supportlink_full); ?>'); |
| 154 | $(this).dialog("close"); |
| 155 | } |
| 156 | }, |
| 157 | { |
| 158 | text: "Cancel", |
| 159 | "class": 'button button-primary button-close', |
| 160 | click: function() { |
| 161 | $(this).dialog("close"); |
| 162 | } |
| 163 | } |
| 164 | ] |
| 165 | }); |
| 166 | }) |
| 167 | }); |
| 168 | |
| 169 | function cpabcal_apphourbk(item) |
| 170 | { |
| 171 | $("#abcm_nopaypal").closest('.ui-dialog-content').dialog('close'); |
| 172 | return true; |
| 173 | } |
| 174 | |
| 175 | function cpabcal_update_reason(field) |
| 176 | { |
| 177 | document.getElementById("abcdeactivatebtn").value = 'Submit & Deactivate'; |
| 178 | document.getElementById("abcdeactivatebtn").innerHTML = '<span class="ui-button-text">Submit & Deactivate</span>'; |
| 179 | document.getElementById("abcnofeedback").style.display = ''; |
| 180 | document.getElementById("abcm_other").style.display = 'none'; |
| 181 | document.getElementById("abcm_otherplugin").style.display = 'none'; |
| 182 | document.getElementById("abcm_nowork").style.display = 'none'; |
| 183 | document.getElementById("abcm_nopaypal").style.display = 'none'; |
| 184 | if (field.value == '-') |
| 185 | { |
| 186 | document.getElementById("abcdeactivatebtn").value = 'Skip & Deactivate'; |
| 187 | document.getElementById("abcdeactivatebtn").innerHTML = '<span class="ui-button-text">Skip & Deactivate</span>'; |
| 188 | document.getElementById("abcnofeedback").style.display = 'none'; |
| 189 | } |
| 190 | else if (field.value == 'other') |
| 191 | document.getElementById("abcm_other").style.display = ''; |
| 192 | else if (field.value == 'better-plugin') |
| 193 | document.getElementById("abcm_otherplugin").style.display = ''; |
| 194 | else if (field.value == 'no-work') |
| 195 | document.getElementById("abcm_nowork").style.display = ''; |
| 196 | else if (field.value == 'no-paypal') |
| 197 | document.getElementById("abcm_nopaypal").style.display = ''; |
| 198 | } |
| 199 | |
| 200 | </script><?php |
| 201 | } |
| 202 | |
| 203 | ?> |