Skip to content

Commit 0f02c52

Browse files
committed
petition 2.0.12 released
1 parent 9c13db3 commit 0f02c52

341 files changed

Lines changed: 6363 additions & 11546 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

assets/css/cbxpetition-admin.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/cbxpetition-email-manager.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/cbxpetition-public.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/vanila/cbxpetition-public.js

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,92 @@
307307
});
308308

309309

310+
// frontend signature delete from petition details page (logged-in owner)
311+
$('.cbxpetition_signature_wrapper').on('click', '.cbxpetition-sign-delete-btn', function (e) {
312+
e.preventDefault();
313+
314+
var $this = $(this);
315+
316+
if (!Number(cbxpetition_public_js_vars.is_user_logged_in)) {
317+
new AWN().alert(cbxpetition_public_js_vars.logout.confirm_desc);
318+
return;
319+
}
320+
321+
var busy = Number($this.data('busy'));
322+
if (busy) {
323+
return;
324+
}
325+
326+
var notifier = new AWN(cbxpetition_awn_options);
327+
var onCancel = () => {};
328+
329+
var onOk = () => {
330+
var signatureId = Number($this.data('signature-id'));
331+
332+
if (!signatureId) {
333+
new AWN().alert(cbxpetition_public_js_vars.are_you_sure_delete_desc);
334+
return;
335+
}
336+
337+
$this.data('busy', 1);
338+
$this.prop('disabled', true);
339+
340+
var data = {
341+
signature_id: signatureId,
342+
action: 'cbxpetition_front_sign_delete',
343+
security: cbxpetition_public_js_vars.nonce
344+
};
345+
346+
var request = $.ajax({
347+
type: 'POST',
348+
url: cbxpetition_public_js_vars.ajaxurl,
349+
data: data,
350+
dataType: 'json'
351+
});
352+
353+
request.done(function (data) {
354+
if (typeof data.security !== 'undefined' && Number(data.security) === 1) {
355+
new AWN().alert(data.message);
356+
} else if (data.errors) {
357+
data.errors.forEach(function (error) {
358+
new AWN().alert(error);
359+
});
360+
} else if (data.error) {
361+
new AWN().alert(data.message);
362+
} else {
363+
new AWN().success(data.message);
364+
365+
var $item = $this.closest('.cbxpetition_signature_item');
366+
$item.slideUp(300, function () {
367+
$(this).remove();
368+
});
369+
}
370+
371+
$this.data('busy', 0);
372+
$this.prop('disabled', false);
373+
});
374+
375+
request.fail(function () {
376+
$this.data('busy', 0);
377+
$this.prop('disabled', false);
378+
379+
new AWN().alert(cbxpetition_public_js_vars.ajax.fail);
380+
});
381+
};
382+
383+
notifier.confirm(
384+
cbxpetition_public_js_vars.are_you_sure_delete_desc,
385+
onOk,
386+
onCancel,
387+
{
388+
labels: {
389+
confirm: cbxpetition_public_js_vars.are_you_sure_global
390+
}
391+
}
392+
);
393+
});
394+
395+
310396
//add gallery feature to
311397
$('.cbxpetition_photo_background').venobox({});
312398

cbxpetition.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Plugin Name: CBX Petition
1717
* Plugin URI: https://codeboxr.com/product/cbx-petition-for-wordpress/
1818
* Description: A plugin to create, manage petition and collect signatures for petition
19-
* Version: 2.0.11
19+
* Version: 2.0.12
2020
* Author: Codeboxr
2121
* Author URI: https://codeboxr.com
2222
* License: GPL-2.0+
@@ -33,14 +33,15 @@
3333
}
3434

3535
defined( 'CBXPETITION_PLUGIN_NAME' ) or define( 'CBXPETITION_PLUGIN_NAME', 'cbxpetition' );
36-
defined( 'CBXPETITION_PLUGIN_VERSION' ) or define( 'CBXPETITION_PLUGIN_VERSION', '2.0.11' );
36+
defined( 'CBXPETITION_PLUGIN_VERSION' ) or define( 'CBXPETITION_PLUGIN_VERSION', '2.0.12' );
3737
defined( 'CBXPETITION_BASE_NAME' ) or define( 'CBXPETITION_BASE_NAME', plugin_basename( __FILE__ ) );
3838
defined( 'CBXPETITION_ROOT_PATH' ) or define( 'CBXPETITION_ROOT_PATH', plugin_dir_path( __FILE__ ) );
3939
defined( 'CBXPETITION_ROOT_URL' ) or define( 'CBXPETITION_ROOT_URL', plugin_dir_url( __FILE__ ) );
4040

4141
defined( 'CBXPETITION_WP_MIN_VERSION' ) or define( 'CBXPETITION_WP_MIN_VERSION', '5.3' );
4242
defined( 'CBXPETITION_PHP_MIN_VERSION' ) or define( 'CBXPETITION_PHP_MIN_VERSION', '7.4' );
43-
defined( 'CBXPETITION_PRO_VERSION' ) or define( 'CBXPETITION_PRO_VERSION', '2.0.7' );
43+
44+
defined( 'CBXPETITION_PRO_VERSION' ) or define( 'CBXPETITION_PRO_VERSION', '2.0.8' );
4445

4546
// Include the main class
4647
if ( ! class_exists( 'CBXPetition', false ) ) {

composer.json

Lines changed: 0 additions & 30 deletions
This file was deleted.

includes/CBXPetition.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
<?php
2+
// If this file is called directly, abort.
3+
if ( ! defined( 'WPINC' ) ) {
4+
die;
5+
}
6+
27
use Cbx\Petition\Helpers\PetitionHelper;
38
use Cbx\Petition\CBXPetitionAdmin;
49
use Cbx\Petition\CBXPetitionPublic;
@@ -240,13 +245,17 @@ private function public_hooks() {
240245
add_filter( 'query_vars', [ $public, 'add_query_vars' ] );
241246
add_action( 'init', [ $public, 'rewrite_rules' ] );
242247
add_action( 'template_redirect', [ $public, 'guest_email_validation' ] );
248+
add_action( 'template_redirect', [ $public, 'signature_delete_handler' ] );
243249

244250
add_action( 'wp_ajax_cbxpetition_sign_submit', [ $public, 'petition_sign_submit' ] );
245251
add_action( 'wp_ajax_nopriv_cbxpetition_sign_submit', [ $public, 'petition_sign_submit' ] );
246252

247253
add_action( 'wp_ajax_cbxpetition_load_more_signs', [ $public, 'petition_load_more_signs' ] );
248254
add_action( 'wp_ajax_nopriv_cbxpetition_load_more_signs', [ $public, 'petition_load_more_signs' ] );
249255

256+
//frontend signature delete by logged-in owner
257+
add_action( 'wp_ajax_cbxpetition_front_sign_delete', [ $public, 'petition_sign_delete_front' ] );
258+
250259
add_action( 'wp_enqueue_scripts', [ $public, 'enqueue_styles' ] );
251260
add_action( 'wp_enqueue_scripts', [ $public, 'enqueue_scripts' ] );
252261

includes/CBXPetitionAdmin.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
<?php
2-
32
namespace Cbx\Petition;
43

4+
// If this file is called directly, abort.
5+
if ( ! defined( 'WPINC' ) ) {
6+
die;
7+
}
8+
59
use Cbx\Petition\CBXSetting;
610
use Cbx\Petition\Helpers\PetitionHelper;
711
use Intervention\Image\ImageManager;
@@ -514,6 +518,10 @@ public function petition_sign_edit() {
514518
do_action( 'cbxpetition_sign_approved', $signature, $old_state, $new_state );
515519
}//end signature approve
516520

521+
if ( $old_state !== $new_state ) {
522+
do_action( 'cbxpetition_sign_status_change',$signature_id, $petition_id, $signature, $old_state, $new_state );
523+
}
524+
517525
} else {
518526
//update failed
519527
$single_message = [

includes/CBXPetitionEmails.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
<?php
2+
// If this file is called directly, abort.
3+
if ( ! defined( 'WPINC' ) ) {
4+
die;
5+
}
26
class CBXPetitionEmails {
37
/**
48
* The single instance of the class

0 commit comments

Comments
 (0)