| Current Path : /home/bechata/mp/wp-content/uploads/2022/ejn73c/ |
| Current File : /home/bechata/mp/wp-content/uploads/2022/ejn73c/telemetry.tar |
js/deactivate.js 0000666 00000012733 15175401605 0007645 0 ustar 00 /**
* My Private Site by David Gewirtz, adopted from Jon ‘jonradio’ Pearkins
*
* Lab Notes: http://zatzlabs.com/lab-notes/
* Plugin Page: https://zatzlabs.com/project/my-private-site/
* Contact: http://zatzlabs.com/contact-us/
*
* Copyright (c) 2015-2020 by David Gewirtz
*/
// Based on code from https://github.com/CodeCabin/plugin-deactivation-survey
(function ($) {
if (!window.myPrivateSite)
window.myPrivateSite = {};
if (myPrivateSite.DeactivateFeedbackForm)
return;
myPrivateSite.DeactivateFeedbackForm = function (plugin) {
var self = this;
var strings = my_private_site_deactivate_feedback_form_strings;
this.plugin = plugin;
// Dialog HTML
//<input name="comments" placeholder="' + strings.brief_description + '"/>\
var element = $('\
<div class="my-private-site-deactivate-dialog" data-remodal-id="' + plugin.slug + '">\
<form>\
<input type="hidden" name="plugin"/>\
<h2>' + strings.quick_feedback + '</h2>\
<p>\
' + strings.foreword + '\
</p>\
<ul class="my-private-site-deactivate-reasons"></ul>\
<textarea rows="3" name="comments" placeholder="' + strings.brief_description + '"></textarea>\
<br>\
<p class="my-private-site-deactivate-dialog-buttons">\
<input type="submit" class="button confirm" value="' + strings.skip_and_deactivate + '"/>\
<button data-remodal-action="cancel" class="button button-primary">' + strings.cancel + '</button>\
</p>\
</form>\
</div>\
')[0];
this.element = element;
$(element).find("input[name='plugin']").val(JSON.stringify(plugin));
$(element).on("click", "input[name='reason']", function (event) {
$(element).find("input[type='submit']").val(
strings.submit_and_deactivate
);
});
$(element).find("form").on("submit", function (event) {
self.onSubmit(event);
});
// Reasons list
var ul = $(element).find("ul.my-private-site-deactivate-reasons");
for (var key in plugin.reasons) {
var li = $("<li><input type='radio' name='reason'/> <span></span></li>");
$(li).find("input").val(key);
$(li).find("span").html(plugin.reasons[key]);
$(ul).append(li);
}
// Listen for deactivate
$("#the-list [data-slug='" + plugin.slug + "'] .deactivate>a").on("click", function (event) {
self.onDeactivateClicked(event);
});
}
myPrivateSite.DeactivateFeedbackForm.prototype.onDeactivateClicked = function (event) {
this.deactivateURL = event.target.href;
event.preventDefault();
if (!this.dialog)
this.dialog = $(this.element).remodal();
this.dialog.open();
}
myPrivateSite.DeactivateFeedbackForm.prototype.onSubmit = function (event) {
var element = this.element;
var strings = my_private_site_deactivate_feedback_form_strings;
var preData = $(element).find("form");
var i;
var chosenOption; // the option that's been checked
var comment; // a comment, if provided
// build data summary
// process 8 radio button fields
for (i = 1; i <= 8; i++) {
if (preData[0][i].checked === true) {
if (i < 8) {
chosenOption = preData[0][i].value;
} else {
chosenOption = 'other';
}
comment = preData[0][9].value;
}
}
// quickly sanitize the comments string
// https://gomakethings.com/how-to-automatically-sanitize-reactive-data-with-vanilla-js/
var temp = document.createElement('div');
temp.textContent = comment;
comment = temp.innerHTML;
// prepare the telemetry variables
var timeNow = this.plugin.timeNow;
var installTime = this.plugin.installTime; // this will be the get_option install time value
var useDuration = this.plugin.useDuration; // this is the difference between the two in seconds -- TEMP VALUE
var packedData = {
slug: this.plugin.slug,
option: chosenOption,
version: this.plugin.version,
comment: comment,
install_time: installTime,
uninstall_time: timeNow,
duration: useDuration,
};
var self = this;
var data = JSON.stringify(packedData);
$(element).find("button, input[type='submit']").prop("disabled", true);
if ($(element).find("input[name='reason']:checked").length) {
$(element).find("input[type='submit']").val(strings.thank_you);
$.ajax({
type: "POST",
url: this.plugin.telemetryUrl + "/wp-json/zatz/v1/telemetry_uninstalls",
data: data,
complete: function () {
window.location.href = self.deactivateURL;
}
});
} else {
$(element).find("input[type='submit']").val(strings.please_wait);
window.location.href = self.deactivateURL;
}
event.preventDefault();
return false;
}
$(document).ready(function () {
for (var i = 0; i < my_private_site_deactivate_feedback_form_plugins.length; i++) {
var plugin = my_private_site_deactivate_feedback_form_plugins[i];
new myPrivateSite.DeactivateFeedbackForm(plugin);
}
});
})(jQuery);
css/deactivate.css 0000666 00000001520 15175401605 0010165 0 ustar 00 /**
* My Private Site by David Gewirtz, adopted from Jon ‘jonradio’ Pearkins
*
* Lab Notes: http://zatzlabs.com/lab-notes/
* Plugin Page: https://zatzlabs.com/project/my-private-site/
* Contact: http://zatzlabs.com/contact-us/
*
* Copyright (c) 2015-2020 by David Gewirtz
*/
/* // Based on code from https://github.com/CodeCabin/plugin-deactivation-survey */
.my-private-site-deactivate-dialog
{
text-align: left;
width: auto;
border-radius: 10px;
}
.my-private-site-deactivate-dialog-buttons
{
text-align: right;
}
.my-private-site-deactivate-dialog
{
width: auto !important;
}
.my-private-site-deactivate-dialog h2
{
color: gray;
font-variant: small-caps;
font-size: 1.2em;
padding-bottom: 0.2em;
border-bottom: 1px solid lightgray;
}
.my-private-site-deactivate-dialog textarea[name="comments"]
{
width: 100%;
}
deactivate.php 0000666 00000010261 15175401605 0007376 0 ustar 00 <?php
/**
* My Private Site by David Gewirtz, adopted from Jon ‘jonradio’ Pearkins
*
* Lab Notes: http://zatzlabs.com/lab-notes/
* Plugin Page: https://zatzlabs.com/project/my-private-site/
* Contact: http://zatzlabs.com/contact-us/
*
* Copyright (c) 2015-2020 by David Gewirtz
*/
// based on code from https://github.com/CodeCabin/plugin-deactivation-survey
add_filter('my_private_site_deactivate_feedback_form_plugins', function ($plugins) {
$time_now = time();
$time_then = get_option('jr_ps_first_run_time');
$internal_settings = get_option('jr_ps_internal_settings');
$plugins[] = (object)array(
'slug' => 'jonradio-private-site',
'version' => $internal_settings['version'],
'timeNow' => $time_now,
'installTime' => $time_then,
'useDuration' => $time_now - $time_then,
'telemetryUrl' => my_private_site_telemetry_url(),
);
return $plugins;
});
if (!is_admin())
return;
global $pagenow;
if ($pagenow != "plugins.php")
return;
if (defined('MY_PRIVATE_SITE_DEACTIVATE_FEEDBACK_FORM_INCLUDED'))
return;
define('MY_PRIVATE_SITE_DEACTIVATE_FEEDBACK_FORM_INCLUDED', true);
add_action('admin_enqueue_scripts', function () {
// Enqueue scripts
wp_enqueue_script('my-private-site-deactivate-feedback-form', plugin_dir_url(__FILE__) . 'js/deactivate.js');
wp_enqueue_style('my-private-site-deactivate-feedback-form', plugin_dir_url(__FILE__) . 'css/deactivate.css');
// Localized strings
wp_localize_script('my-private-site-deactivate-feedback-form', 'my_private_site_deactivate_feedback_form_strings', array(
'quick_feedback' => __('Help us improve. Why are you deactivating?', 'my-private-site'),
'foreword' => __('Your feedback is fully anonymous and will be read directly by the lead developer', 'my-private-site'),
'better_plugins_name' => __('Please tell us which plugin?', 'my-private-site'),
'please_tell_us' => __('Please tell us the reason so we can improve the plugin', 'my-private-site'),
'do_not_attach_email' => __('Do not send my e-mail address with this feedback', 'my-private-site'),
'brief_description' => __('Please share any feedback you wish', 'my-private-site'),
'cancel' => __('Cancel', 'my-private-site'),
'skip_and_deactivate' => __('Skip & Deactivate', 'my-private-site'),
'submit_and_deactivate' => __('Submit & Deactivate', 'my-private-site'),
'please_wait' => __('Please wait', 'my-private-site'),
'thank_you' => __('Thank you!', 'my-private-site'),
));
// Plugins
$plugins = apply_filters('my_private_site_deactivate_feedback_form_plugins', array());
// Reasons
$defaultReasons = array(
'no-longer-needed' => __('I don\'t need My Private Site any more', 'my-private-site'),
'missing-feature' => __('My Private Site is missing a feature I need', 'my-private-site'),
'not-get-to-work' => __('I couldn\'t get it to work right', 'my-private-site'),
'found-better-plugin' => __('I found a plugin I like better', 'my-private-site'),
'plugin-broke-site' => __('My Private Site broke my site', 'my-private-site'),
'short-period' => __('I only needed My Private Site for a short period', 'my-private-site'),
'temporary-deactivation' => __('It\'s a temporary deactivation. I\'m troubleshooting', 'my-private-site'),
'other' => __('Other', 'my-private-site'),
);
foreach ($plugins as $plugin) {
$plugin->reasons = apply_filters('my_private_site_deactivate_feedback_form_reasons', $defaultReasons, $plugin);
}
// Send plugin data
wp_localize_script('my-private-site-deactivate-feedback-form', 'my_private_site_deactivate_feedback_form_plugins', $plugins);
});
/**
* Hook for adding plugins, pass an array of objects in the following format:
* 'slug' => 'plugin-slug'
* 'version' => 'plugin-version'
* @return array The plugins in the format described above
*/
add_filter('my_private_site_deactivate_feedback_form_plugins', function ($plugins) {
return $plugins;
});