Version Description
New features and Bug fixes.
Download this release
Release Info
Developer | wpexpertsio |
Plugin | myCRED |
Version | 2.4.1 |
Comparing to | |
See all releases |
Code changes from version 2.4 to 2.4.1
- addons/buy-creds/abstracts/mycred-abstract-payment-gateway.php +1 -1
- addons/buy-creds/includes/buycred-functions.php +0 -54
- addons/buy-creds/includes/buycred-shortcodes.php +1 -1
- addons/cash-creds/gateways/bank-transfer.php +1 -1
- addons/ranks/includes/mycred-rank-functions.php +3 -2
- addons/transfer/includes/mycred-transfer-object.php +9 -8
- addons/transfer/includes/mycred-transfer-shortcodes.php +1 -1
- assets/js/mycred-tools.js +22 -2
- assets/js/mycred-type-management.js +445 -429
- assets/js/video.js +6 -4
- includes/hooks/mycred-hook-referrals.php +9 -18
- includes/hooks/mycred-hook-watching-video.php +13 -5
- includes/mycred-blocks/blocks/mycred-affiliate-id/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-affiliate-id/mycred-affiliate-id.php +44 -17
- includes/mycred-blocks/blocks/mycred-affiliate-link/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-affiliate-link/mycred-affiliate-link.php +39 -14
- includes/mycred-blocks/blocks/mycred-badges/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-badges/mycred-badges.php +38 -12
- includes/mycred-blocks/blocks/mycred-best-user/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-best-user/mycred-best-user.php +47 -16
- includes/mycred-blocks/blocks/mycred-buy-form/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-buy-form/mycred-buy-form.php +38 -12
- includes/mycred-blocks/blocks/mycred-buy/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-buy/mycred-buy.php +51 -25
- includes/mycred-blocks/blocks/mycred-email-subsc/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-email-subsc/mycred-email-subsc.php +39 -12
- includes/mycred-blocks/blocks/mycred-exchange/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-exchange/mycred-exchange.php +39 -12
- includes/mycred-blocks/blocks/mycred-give/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-give/mycred-give.php +50 -19
- includes/mycred-blocks/blocks/mycred-history/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-history/mycred-history.php +42 -14
- includes/mycred-blocks/blocks/mycred-hook-table/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-hook-table/mycred-hook-table.php +42 -14
- includes/mycred-blocks/blocks/mycred-leaderboard/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-leaderboard/mycred-leaderboard.php +41 -14
- includes/mycred-blocks/blocks/mycred-link/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-link/mycred-link.php +52 -23
- includes/mycred-blocks/blocks/mycred-list-ranks/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-list-ranks/mycred-list-ranks.php +39 -14
- includes/mycred-blocks/blocks/mycred-load-coupon/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-load-coupon/mycred-load-coupon.php +38 -12
- includes/mycred-blocks/blocks/mycred-my-badges/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-my-badges/mycred-my-badges.php +37 -12
- includes/mycred-blocks/blocks/mycred-my-balance-converted/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-my-balance-converted/mycred-my-balance-converted.php +37 -12
- includes/mycred-blocks/blocks/mycred-my-balance/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-my-balance/mycred-my-balance.php +46 -20
- includes/mycred-blocks/blocks/mycred-my-rank/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-my-rank/mycred-my-rank.php +39 -14
- includes/mycred-blocks/blocks/mycred-my-ranks/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-my-ranks/mycred-my-ranks.php +40 -15
- includes/mycred-blocks/blocks/mycred-total-balance/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-total-balance/mycred-total-balance.php +40 -14
- includes/mycred-blocks/blocks/mycred-total-pts/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-total-pts/mycred-total-pts.php +40 -14
- includes/mycred-blocks/blocks/mycred-total-since/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-total-since/mycred-total-since.php +39 -14
- includes/mycred-blocks/blocks/mycred-transfer/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-transfer/mycred-transfer.php +39 -12
- includes/mycred-blocks/blocks/mycred-users-of-all-ranks/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-users-of-all-ranks/mycred-users-of-all-ranks.php +39 -14
- includes/mycred-blocks/blocks/mycred-users-of-rank/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-users-of-rank/mycred-users-of-rank.php +39 -14
- includes/mycred-blocks/blocks/mycred-video/index.js +1 -1
- includes/mycred-blocks/blocks/mycred-video/mycred-video.php +39 -14
- includes/mycred-blocks/includes/mycred-gutenberg-functions.php +16 -25
- includes/mycred-blocks/mycred-blocks.php +24 -4
- includes/mycred-functions.php +99 -3
- includes/mycred-tools.php +21 -0
- includes/shortcodes/mycred_video.php +16 -8
- modules/mycred-module-buddypress.php +15 -3
- modules/mycred-module-management.php +2 -0
- modules/mycred-module-settings.php +45 -20
- mycred.php +6 -6
- readme.txt +17 -2
addons/buy-creds/abstracts/mycred-abstract-payment-gateway.php
CHANGED
@@ -887,7 +887,7 @@ if ( ! class_exists( 'myCRED_Payment_Gateway' ) ) :
|
|
887 |
public function get_cost( $amount = 0, $point_type = MYCRED_DEFAULT_TYPE_KEY, $raw = false, $custom_rate = 0 ) {
|
888 |
|
889 |
if(isset($_REQUEST['er_random']) && !empty($_REQUEST['er_random'])){
|
890 |
-
$custom_rate=
|
891 |
}
|
892 |
|
893 |
$setup = mycred_get_buycred_sale_setup( $point_type );
|
887 |
public function get_cost( $amount = 0, $point_type = MYCRED_DEFAULT_TYPE_KEY, $raw = false, $custom_rate = 0 ) {
|
888 |
|
889 |
if(isset($_REQUEST['er_random']) && !empty($_REQUEST['er_random'])){
|
890 |
+
$custom_rate=mycred_decode_values($_REQUEST['er_random']);
|
891 |
}
|
892 |
|
893 |
$setup = mycred_get_buycred_sale_setup( $point_type );
|
addons/buy-creds/includes/buycred-functions.php
CHANGED
@@ -757,58 +757,4 @@ if ( ! function_exists( 'buycred_checkout_footer' ) ) :
|
|
757 |
$buycred_instance->gateway->checkout_page_footer();
|
758 |
|
759 |
}
|
760 |
-
endif;
|
761 |
-
|
762 |
-
if ( ! function_exists( 'mycred_buycred_encode' ) ) :
|
763 |
-
function mycred_buycred_encode($value) {
|
764 |
-
if (!$value) {
|
765 |
-
return false;
|
766 |
-
}
|
767 |
-
|
768 |
-
$key = sha1( AUTH_KEY );
|
769 |
-
$strLen = strlen($value);
|
770 |
-
$keyLen = strlen($key);
|
771 |
-
$j = 0;
|
772 |
-
$crypttext = '';
|
773 |
-
|
774 |
-
for ($i = 0; $i < $strLen; $i++) {
|
775 |
-
$ordStr = ord(substr($value, $i, 1));
|
776 |
-
if ($j == $keyLen) {
|
777 |
-
$j = 0;
|
778 |
-
}
|
779 |
-
$ordKey = ord(substr($key, $j, 1));
|
780 |
-
$j++;
|
781 |
-
$crypttext .= strrev(base_convert(dechex($ordStr + $ordKey), 16, 36));
|
782 |
-
}
|
783 |
-
|
784 |
-
return $crypttext;
|
785 |
-
}
|
786 |
-
endif;
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
if ( ! function_exists( 'mycred_buycred_decode' ) ) :
|
791 |
-
function mycred_buycred_decode($value) {
|
792 |
-
if (!$value) {
|
793 |
-
return false;
|
794 |
-
}
|
795 |
-
|
796 |
-
$key = sha1( AUTH_KEY );
|
797 |
-
$strLen = strlen($value);
|
798 |
-
$keyLen = strlen($key);
|
799 |
-
$j = 0;
|
800 |
-
$decrypttext = '';
|
801 |
-
|
802 |
-
for ($i = 0; $i < $strLen; $i += 2) {
|
803 |
-
$ordStr = hexdec(base_convert(strrev(substr($value, $i, 2)), 36, 16));
|
804 |
-
if ($j == $keyLen) {
|
805 |
-
$j = 0;
|
806 |
-
}
|
807 |
-
$ordKey = ord(substr($key, $j, 1));
|
808 |
-
$j++;
|
809 |
-
$decrypttext .= chr($ordStr - $ordKey);
|
810 |
-
}
|
811 |
-
|
812 |
-
return $decrypttext;
|
813 |
-
}
|
814 |
endif;
|
757 |
$buycred_instance->gateway->checkout_page_footer();
|
758 |
|
759 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
760 |
endif;
|
addons/buy-creds/includes/buycred-shortcodes.php
CHANGED
@@ -223,7 +223,7 @@ if ( ! function_exists( 'mycred_render_buy_form_points' ) ) :
|
|
223 |
}
|
224 |
|
225 |
if( isset($e_rate) && !empty($e_rate)){
|
226 |
-
$e_rate=
|
227 |
?>
|
228 |
<input type="hidden" name="er_random" value="<?php echo esc_attr($e_rate); ?>" />
|
229 |
<?php } ?>
|
223 |
}
|
224 |
|
225 |
if( isset($e_rate) && !empty($e_rate)){
|
226 |
+
$e_rate=mycred_encode_values($e_rate);
|
227 |
?>
|
228 |
<input type="hidden" name="er_random" value="<?php echo esc_attr($e_rate); ?>" />
|
229 |
<?php } ?>
|
addons/cash-creds/gateways/bank-transfer.php
CHANGED
@@ -196,7 +196,7 @@ if ( ! class_exists( 'myCRED_cashcred_Bank_Transfer' ) ) :
|
|
196 |
<div id="panel_<?php echo $data;?>" class="cashcred_panel">
|
197 |
|
198 |
<div class="form-group">
|
199 |
-
<label><h3><?php
|
200 |
</div>
|
201 |
|
202 |
<?php if( isset( $mycred_pref_cashcreds["gateway_prefs"]["bank"]["enable_additional_notes"] ) ): ?>
|
196 |
<div id="panel_<?php echo $data;?>" class="cashcred_panel">
|
197 |
|
198 |
<div class="form-group">
|
199 |
+
<label><h3><?php echo apply_filters( 'mycred_cashcred_bank_transfer_title', __( 'Bank account details', 'mycred' ) ); ?></h3></label>
|
200 |
</div>
|
201 |
|
202 |
<?php if( isset( $mycred_pref_cashcreds["gateway_prefs"]["bank"]["enable_additional_notes"] ) ): ?>
|
addons/ranks/includes/mycred-rank-functions.php
CHANGED
@@ -625,7 +625,7 @@ if ( ! function_exists( 'mycred_get_users_of_rank' ) ) :
|
|
625 |
$users = $wpdb->get_results( $wpdb->prepare( "
|
626 |
SELECT users.*, creds.meta_value AS balance
|
627 |
FROM {$wpdb->users} users
|
628 |
-
LEFT JOIN {$wpdb->usermeta}
|
629 |
LEFT JOIN {$wpdb->usermeta} creds ON ( users.ID = creds.user_id AND creds.meta_key = %s )
|
630 |
WHERE rank.meta_value = %d
|
631 |
ORDER BY creds.meta_value+0 DESC LIMIT 25;", $rank_meta_key, $balance_key, $rank_id ) );
|
@@ -762,7 +762,8 @@ if( !function_exists( 'mycred_update_user_rank_id' ) ):
|
|
762 |
|
763 |
if( !empty( $rank_ids ) )
|
764 |
{
|
765 |
-
|
|
|
766 |
|
767 |
$previous_rank_id = $rank_ids[$previous_rank_id];
|
768 |
|
625 |
$users = $wpdb->get_results( $wpdb->prepare( "
|
626 |
SELECT users.*, creds.meta_value AS balance
|
627 |
FROM {$wpdb->users} users
|
628 |
+
LEFT JOIN {$wpdb->usermeta} mycredrank ON ( users.ID = mycredrank.user_id AND mycredrank.meta_key = %s )
|
629 |
LEFT JOIN {$wpdb->usermeta} creds ON ( users.ID = creds.user_id AND creds.meta_key = %s )
|
630 |
WHERE rank.meta_value = %d
|
631 |
ORDER BY creds.meta_value+0 DESC LIMIT 25;", $rank_meta_key, $balance_key, $rank_id ) );
|
762 |
|
763 |
if( !empty( $rank_ids ) )
|
764 |
{
|
765 |
+
end($rank_ids);
|
766 |
+
$previous_rank_id = key($rank_ids);
|
767 |
|
768 |
$previous_rank_id = $rank_ids[$previous_rank_id];
|
769 |
|
addons/transfer/includes/mycred-transfer-object.php
CHANGED
@@ -319,7 +319,6 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
|
|
319 |
), $request ) );
|
320 |
|
321 |
$sender_id = absint( $sender_id );
|
322 |
-
|
323 |
$this->transfer_id = $this->generate_new_transfer_id( $sender_id );
|
324 |
$this->sender_id = $sender_id;
|
325 |
$this->reference = sanitize_key( $reference );
|
@@ -379,10 +378,16 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
|
|
379 |
|
380 |
$this->transfer_amount = $requested_amount;
|
381 |
|
|
|
|
|
|
|
|
|
|
|
|
|
382 |
// We can't make a transfer
|
383 |
if ( empty( $this->transferable_types ) ) {
|
384 |
|
385 |
-
$this->errors['excluded'] = '
|
386 |
|
387 |
return false;
|
388 |
|
@@ -391,7 +396,7 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
|
|
391 |
// Enforce minimum requirements
|
392 |
if ( ! $this->user_can_transfer_minimum() ) {
|
393 |
|
394 |
-
$this->errors['minimum'] =
|
395 |
|
396 |
return false;
|
397 |
|
@@ -400,7 +405,7 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
|
|
400 |
// Enforce limits (if used)
|
401 |
if ( $this->user_is_over_limit() ) {
|
402 |
|
403 |
-
$this->errors['limit'] = '
|
404 |
|
405 |
return false;
|
406 |
|
@@ -695,10 +700,6 @@ if ( ! class_exists( 'myCRED_Transfer' ) ) :
|
|
695 |
$this->message = $message;
|
696 |
}
|
697 |
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
$this->transfer_id = $this->generate_new_transfer_id( $this->sender_id, $this->recipient_id );
|
703 |
$this->data = apply_filters( 'mycred_transfer_data', array(
|
704 |
'ref_type' => 'user',
|
319 |
), $request ) );
|
320 |
|
321 |
$sender_id = absint( $sender_id );
|
|
|
322 |
$this->transfer_id = $this->generate_new_transfer_id( $sender_id );
|
323 |
$this->sender_id = $sender_id;
|
324 |
$this->reference = sanitize_key( $reference );
|
378 |
|
379 |
$this->transfer_amount = $requested_amount;
|
380 |
|
381 |
+
$transfer_notices = apply_filters( 'mycred_transfer_notices', array(
|
382 |
+
'excluded' => __( 'You do not have access to this point type.','mycred' ),
|
383 |
+
'minimum' => __( 'You do not have enough points to make a transfer.','mycred' ),
|
384 |
+
'limit' => __( 'You have reached your transfer limit.','mycred' )
|
385 |
+
) );
|
386 |
+
|
387 |
// We can't make a transfer
|
388 |
if ( empty( $this->transferable_types ) ) {
|
389 |
|
390 |
+
$this->errors['excluded'] = $transfer_notices['excluded'];
|
391 |
|
392 |
return false;
|
393 |
|
396 |
// Enforce minimum requirements
|
397 |
if ( ! $this->user_can_transfer_minimum() ) {
|
398 |
|
399 |
+
$this->errors['minimum'] = $transfer_notices['minimum'];
|
400 |
|
401 |
return false;
|
402 |
|
405 |
// Enforce limits (if used)
|
406 |
if ( $this->user_is_over_limit() ) {
|
407 |
|
408 |
+
$this->errors['limit'] = $transfer_notices['limit'];
|
409 |
|
410 |
return false;
|
411 |
|
700 |
$this->message = $message;
|
701 |
}
|
702 |
|
|
|
|
|
|
|
|
|
703 |
$this->transfer_id = $this->generate_new_transfer_id( $this->sender_id, $this->recipient_id );
|
704 |
$this->data = apply_filters( 'mycred_transfer_data', array(
|
705 |
'ref_type' => 'user',
|
addons/transfer/includes/mycred-transfer-shortcodes.php
CHANGED
@@ -43,7 +43,7 @@ if ( ! function_exists( 'mycred_transfer_render' ) ) :
|
|
43 |
// Visitors can't do much
|
44 |
if ( ! is_user_logged_in() ) {
|
45 |
|
46 |
-
$output = do_shortcode( $transfer->
|
47 |
|
48 |
}
|
49 |
|
43 |
// Visitors can't do much
|
44 |
if ( ! is_user_logged_in() ) {
|
45 |
|
46 |
+
$output = do_shortcode( $transfer->settings['templates']['login'] );
|
47 |
|
48 |
}
|
49 |
|
assets/js/mycred-tools.js
CHANGED
@@ -63,8 +63,28 @@ jQuery(document).ready(function() {
|
|
63 |
});
|
64 |
|
65 |
//Users
|
66 |
-
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
var $awardToAll = jQuery('.award-to-all').is(':checked');
|
70 |
|
63 |
});
|
64 |
|
65 |
//Users
|
66 |
+
jQuery('.bulk-users').select2({
|
67 |
+
|
68 |
+
ajax: {
|
69 |
+
url: ajaxurl,
|
70 |
+
dataType: 'json',
|
71 |
+
data: function(params) {
|
72 |
+
var query = {
|
73 |
+
search: params.term,
|
74 |
+
action: 'mycred-tools-select-user'
|
75 |
+
}
|
76 |
+
|
77 |
+
// Query parameters will be ?search=[term]&type=public
|
78 |
+
return query;
|
79 |
+
}
|
80 |
+
},
|
81 |
+
processResults: function(data, params) {
|
82 |
+
return {
|
83 |
+
results: data.results
|
84 |
+
};
|
85 |
+
},
|
86 |
+
minimumInputLength: 3
|
87 |
+
});
|
88 |
|
89 |
var $awardToAll = jQuery('.award-to-all').is(':checked');
|
90 |
|
assets/js/mycred-type-management.js
CHANGED
@@ -6,433 +6,449 @@
|
|
6 |
jQuery(function($) {
|
7 |
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
$( '.point-type-image-wrapper' ).fadeOut(function(){
|
162 |
-
$( '.point-type-image-wrapper' ).empty().removeClass( 'default-image dashicons' ).html( `<img src="${attachment.url}" alt="Point type image" \/><input type="hidden" name="${fieldName}[attachment_id]" value="${attachment.id}" \/>` ).fadeIn();
|
163 |
-
$( buttonDiv ).html( `
|
164 |
<button type="button" class="button button-secondary" id="point-type-change-default-image" >${myCREDmanage.changeImage}</button>
|
165 |
-
`
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
jQuery(function($) {
|
7 |
|
8 |
|
9 |
+
var ChangeDefaultImageButton = $('#point-type-change-default-image');
|
10 |
+
|
11 |
+
var LevelImageSelector;
|
12 |
+
var DefaultImageSelector;
|
13 |
+
|
14 |
+
var wWidth = $(window).width();
|
15 |
+
var dWidth = wWidth * 0.75;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Make sure new point type key is
|
19 |
+
* correctly formatted. Only lowercase letters and underscores
|
20 |
+
* are allowed. Warn user if needed.
|
21 |
+
*/
|
22 |
+
$('#mycred-new-ctype-key-value').on('change', function() {
|
23 |
+
|
24 |
+
var ctype_key = $(this).val();
|
25 |
+
var re = /^[a-z_]+$/;
|
26 |
+
if (!re.test(ctype_key)) {
|
27 |
+
$(this).css('border-color', 'red');
|
28 |
+
$('#mycred-ctype-warning').css('color', 'red');
|
29 |
+
} else {
|
30 |
+
$(this).css('border-color', 'green');
|
31 |
+
$('#mycred-ctype-warning').css('color', '');
|
32 |
+
}
|
33 |
+
|
34 |
+
});
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Empty Log AJAX Caller
|
38 |
+
*/
|
39 |
+
var mycred_action_empty_log = function(button) {
|
40 |
+
|
41 |
+
var label = button.val();
|
42 |
+
$.ajax({
|
43 |
+
type: "POST",
|
44 |
+
data: {
|
45 |
+
action: 'mycred-action-empty-log',
|
46 |
+
token: myCREDmanage.token,
|
47 |
+
type: button.attr('data-type')
|
48 |
+
},
|
49 |
+
dataType: "JSON",
|
50 |
+
url: myCREDmanage.ajaxurl,
|
51 |
+
beforeSend: function() {
|
52 |
+
button.attr('value', myCREDmanage.working);
|
53 |
+
button.attr('disabled', 'disabled');
|
54 |
+
},
|
55 |
+
success: function(response) {
|
56 |
+
|
57 |
+
if (response.success) {
|
58 |
+
$('input#mycred-manage-table-rows').val(response.data);
|
59 |
+
button.val(myCREDmanage.done);
|
60 |
+
button.removeClass('button-primary');
|
61 |
+
} else {
|
62 |
+
button.val(label);
|
63 |
+
button.removeAttr('disabled');
|
64 |
+
alert(response.data);
|
65 |
+
}
|
66 |
+
|
67 |
+
}
|
68 |
+
});
|
69 |
+
|
70 |
+
};
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Empty Log Trigger
|
74 |
+
*/
|
75 |
+
$('#mycred-manage-action-empty-log').click(function() {
|
76 |
+
|
77 |
+
// Confirm action
|
78 |
+
if (confirm(myCREDmanage.confirm_log))
|
79 |
+
mycred_action_empty_log($(this));
|
80 |
+
|
81 |
+
});
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Reset Balance AJAX Caller
|
85 |
+
*/
|
86 |
+
var mycred_action_reset_balance = function(button) {
|
87 |
+
|
88 |
+
var label = button.val();
|
89 |
+
|
90 |
+
$.ajax({
|
91 |
+
type: "POST",
|
92 |
+
data: {
|
93 |
+
action: 'mycred-action-reset-accounts',
|
94 |
+
token: myCREDmanage.token,
|
95 |
+
type: button.attr('data-type')
|
96 |
+
},
|
97 |
+
dataType: "JSON",
|
98 |
+
url: myCREDmanage.ajaxurl,
|
99 |
+
beforeSend: function() {
|
100 |
+
button.attr('value', myCREDmanage.working);
|
101 |
+
button.attr('disabled', 'disabled');
|
102 |
+
},
|
103 |
+
success: function(response) {
|
104 |
+
|
105 |
+
console.log(response);
|
106 |
+
if (response.success) {
|
107 |
+
button.text(response.data);
|
108 |
+
button.removeClass('button-primary');
|
109 |
+
} else {
|
110 |
+
button.text(label);
|
111 |
+
button.removeAttr('disabled');
|
112 |
+
alert(response.data);
|
113 |
+
}
|
114 |
+
|
115 |
+
}
|
116 |
+
});
|
117 |
+
|
118 |
+
};
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Reset Balance Trigger
|
122 |
+
*/
|
123 |
+
$('#mycred-manage-action-reset-accounts').click(function() {
|
124 |
+
|
125 |
+
// Confirm action
|
126 |
+
if (confirm(myCREDmanage.confirm_reset))
|
127 |
+
mycred_action_reset_balance($(this));
|
128 |
+
|
129 |
+
});
|
130 |
+
|
131 |
+
$(document).ready(function() {
|
132 |
+
|
133 |
+
// Set / Change Point Image Action
|
134 |
+
$('#mycred-image-setup').on('click', '#point-type-change-default-image', function(e) {
|
135 |
+
|
136 |
+
console.log('Change point type image button');
|
137 |
+
|
138 |
+
var button = $(this);
|
139 |
+
|
140 |
+
var buttonDiv = $('.point-image-buttons');
|
141 |
+
|
142 |
+
fieldName = myCREDmanage.fieldName.replace('[]', '');
|
143 |
+
|
144 |
+
LevelImageSelector = wp.media.frames.file_frame = wp.media({
|
145 |
+
title: myCREDmanage.uploadtitle,
|
146 |
+
button: {
|
147 |
+
text: myCREDmanage.uploadbutton
|
148 |
+
},
|
149 |
+
multiple: false
|
150 |
+
});
|
151 |
+
|
152 |
+
// When a file is selected, grab the URL and set it as the text field's value
|
153 |
+
LevelImageSelector.on('select', function() {
|
154 |
+
|
155 |
+
attachment = LevelImageSelector.state().get('selection').first().toJSON();
|
156 |
+
if (attachment.url != '') {
|
157 |
+
|
158 |
+
$('.point-type-image-wrapper').fadeOut(function() {
|
159 |
+
$('.point-type-image-wrapper').empty().removeClass('default-image dashicons').html(`<img src="${attachment.url}" alt="Point type image" \/><input type="hidden" name="${fieldName}[attachment_id]" value="${attachment.id}" \/>`).fadeIn();
|
160 |
+
$(buttonDiv).html(`
|
|
|
|
|
|
|
161 |
<button type="button" class="button button-secondary" id="point-type-change-default-image" >${myCREDmanage.changeImage}</button>
|
162 |
+
`);
|
163 |
+
});
|
164 |
+
|
165 |
+
}
|
166 |
+
|
167 |
+
});
|
168 |
+
|
169 |
+
// Open the uploader dialog
|
170 |
+
LevelImageSelector.open();
|
171 |
+
|
172 |
+
});
|
173 |
+
|
174 |
+
|
175 |
+
|
176 |
+
// Point type ends
|
177 |
+
if (dWidth < 250)
|
178 |
+
dWidth = wWidth;
|
179 |
+
|
180 |
+
if (dWidth > 960)
|
181 |
+
dWidth = 960;
|
182 |
+
|
183 |
+
/**
|
184 |
+
* Export Balances Modal
|
185 |
+
*/
|
186 |
+
$('#export-points').dialog({
|
187 |
+
dialogClass: 'mycred-export-points',
|
188 |
+
draggable: true,
|
189 |
+
autoOpen: false,
|
190 |
+
title: myCREDmanage.export_title,
|
191 |
+
closeText: myCREDmanage.export_close,
|
192 |
+
modal: true,
|
193 |
+
width: dWidth,
|
194 |
+
height: 'auto',
|
195 |
+
resizable: false,
|
196 |
+
position: { my: "center", at: "top+25%", of: window },
|
197 |
+
show: {
|
198 |
+
effect: 'fadeIn',
|
199 |
+
duration: 250
|
200 |
+
},
|
201 |
+
hide: {
|
202 |
+
effect: 'fadeOut',
|
203 |
+
duration: 250
|
204 |
+
}
|
205 |
+
});
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Export balances Modal Trigger
|
209 |
+
*/
|
210 |
+
$('#mycred-export-users-points').click(function() {
|
211 |
+
|
212 |
+
$(this).blur();
|
213 |
+
|
214 |
+
$('#export-points').dialog('open');
|
215 |
+
|
216 |
+
});
|
217 |
+
|
218 |
+
});
|
219 |
+
|
220 |
+
/**
|
221 |
+
* Export Balances AJAX Caller
|
222 |
+
*/
|
223 |
+
var mycred_action_export_balances = function(button) {
|
224 |
+
|
225 |
+
var label = button.val();
|
226 |
+
$.ajax({
|
227 |
+
type: "POST",
|
228 |
+
data: {
|
229 |
+
action: 'mycred-action-export-balances',
|
230 |
+
token: myCREDmanage.token,
|
231 |
+
identify: $('#mycred-export-identify-by').val(),
|
232 |
+
log_temp: $('#mycred-export-log-template').val(),
|
233 |
+
type: button.attr('data-type')
|
234 |
+
},
|
235 |
+
dataType: "JSON",
|
236 |
+
url: myCREDmanage.ajaxurl,
|
237 |
+
beforeSend: function() {
|
238 |
+
button.attr('value', myCREDmanage.working);
|
239 |
+
button.attr('disabled', 'disabled');
|
240 |
+
},
|
241 |
+
success: function(response) {
|
242 |
+
|
243 |
+
if (response.success) {
|
244 |
+
setTimeout(function() {
|
245 |
+
window.location.href = response.data;
|
246 |
+
button.val(myCREDmanage.done);
|
247 |
+
}, 2000);
|
248 |
+
setTimeout(function() {
|
249 |
+
button.removeAttr('disabled');
|
250 |
+
button.val(label);
|
251 |
+
}, 4000);
|
252 |
+
} else {
|
253 |
+
button.val(label);
|
254 |
+
button.before(response.data);
|
255 |
+
}
|
256 |
+
|
257 |
+
}
|
258 |
+
});
|
259 |
+
|
260 |
+
};
|
261 |
+
|
262 |
+
/**
|
263 |
+
* Balance Export Trigger
|
264 |
+
*/
|
265 |
+
$('#mycred-run-exporter').click(function() {
|
266 |
+
|
267 |
+
mycred_action_export_balances($(this));
|
268 |
+
|
269 |
+
});
|
270 |
+
|
271 |
+
/**
|
272 |
+
* Generate Key AJAX Caller
|
273 |
+
*/
|
274 |
+
var mycred_generate_key = function() {
|
275 |
+
|
276 |
+
$.ajax({
|
277 |
+
type: "POST",
|
278 |
+
data: {
|
279 |
+
action: 'mycred-action-generate-key',
|
280 |
+
token: myCREDmanage.token
|
281 |
+
},
|
282 |
+
dataType: "JSON",
|
283 |
+
url: myCREDmanage.ajaxurl,
|
284 |
+
success: function(response) {
|
285 |
+
$('#myCRED-remote-key').val(response.data);
|
286 |
+
$('#mycred-length-counter').text(response.data.length);
|
287 |
+
}
|
288 |
+
});
|
289 |
+
|
290 |
+
};
|
291 |
+
|
292 |
+
/**
|
293 |
+
* Generate Key Trigger
|
294 |
+
*/
|
295 |
+
$('#mycred-generate-api-key').click(function() {
|
296 |
+
mycred_generate_key();
|
297 |
+
});
|
298 |
+
|
299 |
+
/**
|
300 |
+
* Key Length Indicator
|
301 |
+
*/
|
302 |
+
$('#myCRED-remote-key').change(function() {
|
303 |
+
$('#mycred-length-counter').text($(this).val().length);
|
304 |
+
});
|
305 |
+
|
306 |
+
/**
|
307 |
+
* Key Length Indicator
|
308 |
+
*/
|
309 |
+
$('#myCRED-remote-key').keyup(function() {
|
310 |
+
$('#mycred-length-counter').text($(this).val().length);
|
311 |
+
});
|
312 |
+
|
313 |
+
/**
|
314 |
+
* Adjust Decimals AJAX Caller
|
315 |
+
*/
|
316 |
+
var mycred_adjust_max_decimals = function(button, label, decval) {
|
317 |
+
|
318 |
+
$.ajax({
|
319 |
+
type: "POST",
|
320 |
+
data: {
|
321 |
+
action: 'mycred-action-max-decimals',
|
322 |
+
token: myCREDmanage.token,
|
323 |
+
decimals: decval
|
324 |
+
},
|
325 |
+
dataType: "JSON",
|
326 |
+
url: myCREDmanage.ajaxurl,
|
327 |
+
beforeSend: function() {
|
328 |
+
button.attr('value', myCREDmanage.working);
|
329 |
+
button.attr('disabled', 'disabled');
|
330 |
+
},
|
331 |
+
success: function(response) {
|
332 |
+
|
333 |
+
if (response.success) {
|
334 |
+
button.val(response.data.label);
|
335 |
+
setTimeout(function() {
|
336 |
+
window.location.href = response.data.url;
|
337 |
+
}, 4000);
|
338 |
+
} else {
|
339 |
+
button.val(response.data);
|
340 |
+
setTimeout(function() {
|
341 |
+
button.removeAttr('disabled');
|
342 |
+
button.val(label);
|
343 |
+
}, 4000);
|
344 |
+
}
|
345 |
+
|
346 |
+
}
|
347 |
+
});
|
348 |
+
|
349 |
+
};
|
350 |
+
|
351 |
+
/**
|
352 |
+
* Show / Hide Update Button
|
353 |
+
*/
|
354 |
+
$('#mycred-adjust-decimal-places').change(function() {
|
355 |
+
|
356 |
+
var originaldec = $(this).data('org');
|
357 |
+
var newvalue = $(this).val();
|
358 |
+
|
359 |
+
if (originaldec != newvalue)
|
360 |
+
$('#mycred-update-log-decimals').show();
|
361 |
+
else
|
362 |
+
$('#mycred-update-log-decimals').hide();
|
363 |
+
|
364 |
+
});
|
365 |
+
|
366 |
+
/**
|
367 |
+
* Update Log Decimals Trigger
|
368 |
+
*/
|
369 |
+
$('#mycred-update-log-decimals').click(function() {
|
370 |
+
|
371 |
+
if (confirm(myCREDmanage.decimals)) {
|
372 |
+
mycred_adjust_max_decimals($(this), $(this).val(), $('#mycred-adjust-decimal-places').val());
|
373 |
+
}
|
374 |
+
|
375 |
+
});
|
376 |
+
|
377 |
+
var clearing_cache = false;
|
378 |
+
|
379 |
+
/**
|
380 |
+
* Cache Clearing
|
381 |
+
*/
|
382 |
+
var mycred_clear_the_cache = function(button, label) {
|
383 |
+
|
384 |
+
if (clearing_cache) return false;
|
385 |
+
|
386 |
+
clearing_cache = true;
|
387 |
+
|
388 |
+
$.ajax({
|
389 |
+
type: "POST",
|
390 |
+
data: {
|
391 |
+
action: 'mycred-action-clear-cache',
|
392 |
+
token: myCREDmanage.cache,
|
393 |
+
ctype: button.attr('data-type'),
|
394 |
+
cache: button.attr('data-cache')
|
395 |
+
},
|
396 |
+
dataType: "JSON",
|
397 |
+
url: myCREDmanage.ajaxurl,
|
398 |
+
beforeSend: function() {
|
399 |
+
button.html(myCREDmanage.working);
|
400 |
+
button.attr('disabled', 'disabled');
|
401 |
+
},
|
402 |
+
success: function(response) {
|
403 |
+
|
404 |
+
alert(response.data);
|
405 |
+
button.html(label);
|
406 |
+
|
407 |
+
},
|
408 |
+
complete: function() {
|
409 |
+
clearing_cache = false;
|
410 |
+
}
|
411 |
+
});
|
412 |
+
|
413 |
+
};
|
414 |
+
|
415 |
+
/**
|
416 |
+
* Clear Cache Trigger
|
417 |
+
*/
|
418 |
+
$('button.clear-type-cache-button').click(function() {
|
419 |
+
|
420 |
+
mycred_clear_the_cache($(this), $(this).html());
|
421 |
+
|
422 |
+
});
|
423 |
+
|
424 |
+
/**
|
425 |
+
* Select2 Exclude User by ID and Roles
|
426 |
+
* @since 2.3
|
427 |
+
*/
|
428 |
+
jQuery('#generalexcludelist').select2({
|
429 |
+
|
430 |
+
ajax: {
|
431 |
+
url: ajaxurl,
|
432 |
+
dataType: 'json',
|
433 |
+
data: function(params) {
|
434 |
+
var query = {
|
435 |
+
search: params.term,
|
436 |
+
action: 'mycred-get-users-to-exclude'
|
437 |
+
}
|
438 |
+
|
439 |
+
// Query parameters will be ?search=[term]&type=public
|
440 |
+
return query;
|
441 |
+
}
|
442 |
+
},
|
443 |
+
processResults: function(data, params) {
|
444 |
+
return {
|
445 |
+
results: data.results
|
446 |
+
};
|
447 |
+
},
|
448 |
+
data: myCREDmanage.excludedUsers,
|
449 |
+
minimumInputLength: 3
|
450 |
+
});
|
451 |
+
|
452 |
+
jQuery('#generalexcludebyroles').select2();
|
453 |
+
|
454 |
+
});
|
assets/js/video.js
CHANGED
@@ -18,7 +18,7 @@ var done = {};
|
|
18 |
* @since 1.2
|
19 |
* @version 1.1
|
20 |
*/
|
21 |
-
function mycred_view_video( id, state, custom_logic, custom_interval, key, ctype ) {
|
22 |
|
23 |
var videoid = id;
|
24 |
|
@@ -97,14 +97,14 @@ function mycred_view_video( id, state, custom_logic, custom_interval, key, ctype
|
|
97 |
var laps = parseInt( interval[ id ] / 1000, 10 );
|
98 |
seconds[ id ] = seconds[ id ] + laps;
|
99 |
// key, state, id, actions, seconds, duration
|
100 |
-
mycred_video_call( videoid, key, videostate, actions[ videoid ], seconds[ videoid ], ctype );
|
101 |
}, interval[ id ] );
|
102 |
}
|
103 |
|
104 |
// Video has ended
|
105 |
else if ( state == 0 ) {
|
106 |
clearInterval( timer );
|
107 |
-
mycred_video_call( videoid, key, videostate, actions[ videoid ], seconds[ videoid ], ctype );
|
108 |
|
109 |
seconds[ id ] = 0;
|
110 |
actions[ id ] = '';
|
@@ -124,7 +124,7 @@ function mycred_view_video( id, state, custom_logic, custom_interval, key, ctype
|
|
124 |
* @since 1.2
|
125 |
* @version 1.1
|
126 |
*/
|
127 |
-
function mycred_video_call( id, key, state, actions, seconds, pointtype ) {
|
128 |
|
129 |
if ( done[ id ] === undefined ) {
|
130 |
|
@@ -141,6 +141,8 @@ function mycred_video_call( id, key, state, actions, seconds, pointtype ) {
|
|
141 |
video_b : seconds,
|
142 |
video_c : duration[ id ],
|
143 |
video_d : state,
|
|
|
|
|
144 |
type : pointtype
|
145 |
},
|
146 |
dataType : "JSON",
|
18 |
* @since 1.2
|
19 |
* @version 1.1
|
20 |
*/
|
21 |
+
function mycred_view_video( id, state, custom_logic, custom_interval, key, ctype, streaming, stream_live ) {
|
22 |
|
23 |
var videoid = id;
|
24 |
|
97 |
var laps = parseInt( interval[ id ] / 1000, 10 );
|
98 |
seconds[ id ] = seconds[ id ] + laps;
|
99 |
// key, state, id, actions, seconds, duration
|
100 |
+
mycred_video_call( videoid, key, videostate, actions[ videoid ], seconds[ videoid ], ctype, streaming, stream_live );
|
101 |
}, interval[ id ] );
|
102 |
}
|
103 |
|
104 |
// Video has ended
|
105 |
else if ( state == 0 ) {
|
106 |
clearInterval( timer );
|
107 |
+
mycred_video_call( videoid, key, videostate, actions[ videoid ], seconds[ videoid ], ctype, streaming, stream_live );
|
108 |
|
109 |
seconds[ id ] = 0;
|
110 |
actions[ id ] = '';
|
124 |
* @since 1.2
|
125 |
* @version 1.1
|
126 |
*/
|
127 |
+
function mycred_video_call( id, key, state, actions, seconds, pointtype, streaming, stream_live ) {
|
128 |
|
129 |
if ( done[ id ] === undefined ) {
|
130 |
|
141 |
video_b : seconds,
|
142 |
video_c : duration[ id ],
|
143 |
video_d : state,
|
144 |
+
video_e : streaming,
|
145 |
+
video_f : stream_live,
|
146 |
type : pointtype
|
147 |
},
|
148 |
dataType : "JSON",
|
includes/hooks/mycred-hook-referrals.php
CHANGED
@@ -345,9 +345,6 @@ if ( ! class_exists( 'myCRED_Hook_Affiliate' ) ) :
|
|
345 |
|
346 |
if ( $this->ref_counts( $user_id, $IP, 'signup' ) ) {
|
347 |
|
348 |
-
$hooks = mycred_get_option( 'mycred_pref_hooks', false );
|
349 |
-
|
350 |
-
$active_hooks = $hooks['active'];
|
351 |
|
352 |
// Award when users account gets activated
|
353 |
if ( function_exists( 'buddypress' ) ) {
|
@@ -356,26 +353,17 @@ if ( ! class_exists( 'myCRED_Hook_Affiliate' ) ) :
|
|
356 |
mycred_add_user_meta( $new_user_id, 'referred_by_type', '', $this->mycred_type, true );
|
357 |
}
|
358 |
|
359 |
-
|
360 |
-
{
|
361 |
-
$user_log = array(
|
362 |
-
'reference' => 'signup_referral',
|
363 |
-
'referrer' => $user_id,
|
364 |
-
'creds' => $this->prefs['signup']['creds'],
|
365 |
-
'log' => $this->prefs['signup']['log'],
|
366 |
-
'referred' => $new_user_id,
|
367 |
-
'IP' => $IP,
|
368 |
-
'point_type' => $this->mycred_type
|
369 |
-
);
|
370 |
-
|
371 |
-
do_action( 'mycred_after_signup_referred', $user_log );
|
372 |
-
}
|
373 |
|
374 |
// Award now
|
375 |
else {
|
376 |
|
|
|
|
|
|
|
377 |
if ( $this->core->has_entry( 'signup_referral', $new_user_id, $user_id, $IP, $this->mycred_type ) ) return;
|
378 |
|
|
|
379 |
$this->core->add_creds(
|
380 |
'signup_referral',
|
381 |
$user_id,
|
@@ -386,6 +374,8 @@ if ( ! class_exists( 'myCRED_Hook_Affiliate' ) ) :
|
|
386 |
$this->mycred_type
|
387 |
);
|
388 |
|
|
|
|
|
389 |
do_action( 'mycred_signup_referral', $user_id, $IP, $new_user_id, $this );
|
390 |
|
391 |
}
|
@@ -655,8 +645,9 @@ if ( ! class_exists( 'myCRED_Hook_Affiliate' ) ) :
|
|
655 |
<span class="description"><?php echo $this->available_template_tags( array( 'general' ), '%user_name%' ); ?></span>
|
656 |
</div>
|
657 |
</div>
|
658 |
-
<?php do_action( 'mycred_after_referring_signups', $this, $prefs ); ?>
|
659 |
</div>
|
|
|
|
|
660 |
|
661 |
<?php else : ?>
|
662 |
|
345 |
|
346 |
if ( $this->ref_counts( $user_id, $IP, 'signup' ) ) {
|
347 |
|
|
|
|
|
|
|
348 |
|
349 |
// Award when users account gets activated
|
350 |
if ( function_exists( 'buddypress' ) ) {
|
353 |
mycred_add_user_meta( $new_user_id, 'referred_by_type', '', $this->mycred_type, true );
|
354 |
}
|
355 |
|
356 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
|
358 |
// Award now
|
359 |
else {
|
360 |
|
361 |
+
$execute = apply_filters( 'mycred_signup_referral_execute_woo', true, $user_id, $IP, $new_user_id , $this );
|
362 |
+
|
363 |
+
|
364 |
if ( $this->core->has_entry( 'signup_referral', $new_user_id, $user_id, $IP, $this->mycred_type ) ) return;
|
365 |
|
366 |
+
if ( $execute === true ) {
|
367 |
$this->core->add_creds(
|
368 |
'signup_referral',
|
369 |
$user_id,
|
374 |
$this->mycred_type
|
375 |
);
|
376 |
|
377 |
+
}
|
378 |
+
|
379 |
do_action( 'mycred_signup_referral', $user_id, $IP, $new_user_id, $this );
|
380 |
|
381 |
}
|
645 |
<span class="description"><?php echo $this->available_template_tags( array( 'general' ), '%user_name%' ); ?></span>
|
646 |
</div>
|
647 |
</div>
|
|
|
648 |
</div>
|
649 |
+
|
650 |
+
<?php do_action( 'mycred_after_referring_signups', $this, $prefs ); ?>
|
651 |
|
652 |
<?php else : ?>
|
653 |
|
includes/hooks/mycred-hook-watching-video.php
CHANGED
@@ -82,11 +82,13 @@ if ( ! class_exists( 'myCRED_Hook_Video_Views' ) ) :
|
|
82 |
$interval = abs( floatval( $interval ) / 1000 );
|
83 |
|
84 |
// Get playback details
|
85 |
-
$actions
|
86 |
-
$seconds
|
87 |
-
$duration
|
88 |
-
$state
|
89 |
-
|
|
|
|
|
90 |
// Apply Leniency
|
91 |
$leniency = $duration * ( $this->prefs['leniency'] / 100 );
|
92 |
$leniency = floor( $leniency );
|
@@ -164,6 +166,10 @@ if ( ! class_exists( 'myCRED_Hook_Video_Views' ) ) :
|
|
164 |
// Award points in intervals
|
165 |
case 'interval' :
|
166 |
|
|
|
|
|
|
|
|
|
167 |
// The maximum points a video can earn you
|
168 |
$num_intervals = floor( $duration / $interval );
|
169 |
$max = abs( $num_intervals * $amount );
|
@@ -171,6 +177,7 @@ if ( ! class_exists( 'myCRED_Hook_Video_Views' ) ) :
|
|
171 |
|
172 |
// Execution Override
|
173 |
// Allows us to stop an execution.
|
|
|
174 |
$execute = apply_filters( 'mycred_video_interval', true, $video_data, false );
|
175 |
|
176 |
if ( $execute ) {
|
@@ -479,6 +486,7 @@ if ( ! function_exists( 'mycred_video_detect_views' ) ) :
|
|
479 |
foreach ( explode( ',', $setup[5] ) as $type_key ) {
|
480 |
|
481 |
$type_key = sanitize_key( $type_key );
|
|
|
482 |
if ( mycred_point_type_exists( $type_key ) && ! in_array( $type_key, $types ) )
|
483 |
$types[] = $type_key;
|
484 |
|
82 |
$interval = abs( floatval( $interval ) / 1000 );
|
83 |
|
84 |
// Get playback details
|
85 |
+
$actions = sanitize_text_field( $_POST['video_a'] );
|
86 |
+
$seconds = absint( $_POST['video_b'] );
|
87 |
+
$duration = absint( $_POST['video_c'] );
|
88 |
+
$state = absint( $_POST['video_d'] );
|
89 |
+
$streaming = sanitize_text_field( mycred_decode_values( $_POST['video_e'] ) );
|
90 |
+
$stream_live_duration = absint( mycred_decode_values( $_POST['video_f'] ) );
|
91 |
+
|
92 |
// Apply Leniency
|
93 |
$leniency = $duration * ( $this->prefs['leniency'] / 100 );
|
94 |
$leniency = floor( $leniency );
|
166 |
// Award points in intervals
|
167 |
case 'interval' :
|
168 |
|
169 |
+
if ( $streaming == 'on' ) {
|
170 |
+
$duration = $stream_live_duration;
|
171 |
+
}
|
172 |
+
|
173 |
// The maximum points a video can earn you
|
174 |
$num_intervals = floor( $duration / $interval );
|
175 |
$max = abs( $num_intervals * $amount );
|
177 |
|
178 |
// Execution Override
|
179 |
// Allows us to stop an execution.
|
180 |
+
$video_data = array( $num_intervals, $max, $users_log );
|
181 |
$execute = apply_filters( 'mycred_video_interval', true, $video_data, false );
|
182 |
|
183 |
if ( $execute ) {
|
486 |
foreach ( explode( ',', $setup[5] ) as $type_key ) {
|
487 |
|
488 |
$type_key = sanitize_key( $type_key );
|
489 |
+
|
490 |
if ( mycred_point_type_exists( $type_key ) && ! in_array( $type_key, $types ) )
|
491 |
$types[] = $type_key;
|
492 |
|
includes/mycred-blocks/blocks/mycred-affiliate-id/index.js
CHANGED
@@ -10,7 +10,7 @@
|
|
10 |
var SelectControl = wp.components.SelectControl;
|
11 |
var __ = wp.i18n.__;
|
12 |
|
13 |
-
registerBlockType('mycred-blocks/mycred-affiliate-id', {
|
14 |
title: __('Affiliate ID', 'mycred'),
|
15 |
category: 'mycred',
|
16 |
attributes: {
|
10 |
var SelectControl = wp.components.SelectControl;
|
11 |
var __ = wp.i18n.__;
|
12 |
|
13 |
+
registerBlockType('mycred-gb-blocks/mycred-affiliate-id', {
|
14 |
title: __('Affiliate ID', 'mycred'),
|
15 |
category: 'mycred',
|
16 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-affiliate-id/mycred-affiliate-id.php
CHANGED
@@ -1,24 +1,51 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
'mycred-affiliate-id', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor', 'wp-rich-text')
|
9 |
-
);
|
10 |
-
$mycred_types = mycred_get_types(true);
|
11 |
-
$mycred_types = array_merge(array('' => __('Select point type', 'mycred')), $mycred_types);
|
12 |
-
wp_localize_script('mycred-affiliate-id', 'mycred_types', $mycred_types);
|
13 |
-
}
|
14 |
|
15 |
-
|
16 |
-
'render_callback' => 'mycred_affiliate_id_callback',
|
17 |
-
));
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
22 |
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_affiliate_id_block') ) :
|
7 |
+
class mycred_affiliate_id_block {
|
8 |
|
9 |
+
public function __construct() {
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
|
|
|
|
12 |
|
13 |
+
register_block_type(
|
14 |
+
'mycred-gb-blocks/mycred-affiliate-id',
|
15 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
16 |
+
);
|
17 |
+
|
18 |
+
}
|
19 |
|
20 |
+
public function register_assets() {
|
21 |
+
|
22 |
+
wp_enqueue_script(
|
23 |
+
'mycred-affiliate-id',
|
24 |
+
plugins_url('index.js', __FILE__),
|
25 |
+
array(
|
26 |
+
'wp-blocks',
|
27 |
+
'wp-element',
|
28 |
+
'wp-components',
|
29 |
+
'wp-editor',
|
30 |
+
'wp-rich-text'
|
31 |
+
)
|
32 |
+
);
|
33 |
+
|
34 |
+
$mycred_types = mycred_get_types(true);
|
35 |
+
$mycred_types = array_merge( array( '' => __('Select point type', 'mycred') ), $mycred_types );
|
36 |
+
wp_localize_script('mycred-affiliate-id', 'mycred_types', $mycred_types);
|
37 |
+
|
38 |
+
}
|
39 |
+
|
40 |
+
public function render_block( $attributes, $content ) {
|
41 |
+
|
42 |
+
if ( empty( $attributes['type'] ) )
|
43 |
+
$attributes['type'] = 'mycred_default';
|
44 |
+
|
45 |
+
return "[mycred_affiliate_id " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]";
|
46 |
+
}
|
47 |
+
|
48 |
+
}
|
49 |
+
endif;
|
50 |
+
|
51 |
+
new mycred_affiliate_id_block();
|
includes/mycred-blocks/blocks/mycred-affiliate-link/index.js
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
var TextControl = wp.components.TextControl;
|
12 |
var __ = wp.i18n.__;
|
13 |
|
14 |
-
registerBlockType('mycred-blocks/mycred-affiliate-link', {
|
15 |
title: __('Affiliate Link', 'mycred'),
|
16 |
category: 'mycred',
|
17 |
attributes: {
|
11 |
var TextControl = wp.components.TextControl;
|
12 |
var __ = wp.i18n.__;
|
13 |
|
14 |
+
registerBlockType('mycred-gb-blocks/mycred-affiliate-link', {
|
15 |
title: __('Affiliate Link', 'mycred'),
|
16 |
category: 'mycred',
|
17 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-affiliate-link/mycred-affiliate-link.php
CHANGED
@@ -1,21 +1,46 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
'mycred-affiliate-link', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
-
}
|
11 |
|
12 |
-
|
13 |
-
'render_callback' => 'mycred_affiliate_link_callback'
|
14 |
-
));
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
19 |
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_affiliate_link_block') ) :
|
7 |
+
class mycred_affiliate_link_block {
|
8 |
|
9 |
+
public function __construct() {
|
|
|
|
|
|
|
10 |
|
11 |
+
add_action( 'enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
|
|
|
|
12 |
|
13 |
+
register_block_type(
|
14 |
+
'mycred-gb-blocks/mycred-affiliate-link',
|
15 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
16 |
+
);
|
17 |
+
|
18 |
+
}
|
19 |
|
20 |
+
public function register_assets() {
|
21 |
+
|
22 |
+
wp_enqueue_script(
|
23 |
+
'mycred-affiliate-link',
|
24 |
+
plugins_url('index.js', __FILE__),
|
25 |
+
array(
|
26 |
+
'wp-blocks',
|
27 |
+
'wp-element',
|
28 |
+
'wp-components',
|
29 |
+
'wp-editor'
|
30 |
+
)
|
31 |
+
);
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
public function render_block( $attributes, $content ) {
|
36 |
+
|
37 |
+
if ( empty( $attributes['pt_type'] ) )
|
38 |
+
$attributes['pt_type'] = 'mycred_default';
|
39 |
+
|
40 |
+
return "[mycred_affiliate_link " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]";
|
41 |
+
}
|
42 |
+
|
43 |
+
}
|
44 |
+
endif;
|
45 |
+
|
46 |
+
new mycred_affiliate_link_block();
|
includes/mycred-blocks/blocks/mycred-badges/index.js
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
var TextControl = wp.components.TextControl;
|
6 |
|
7 |
var __ = wp.i18n.__;
|
8 |
-
registerBlockType('mycred-blocks/mycred-badges', {
|
9 |
title: __('Badges', 'mycred'),
|
10 |
category: 'mycred',
|
11 |
attributes: {
|
5 |
var TextControl = wp.components.TextControl;
|
6 |
|
7 |
var __ = wp.i18n.__;
|
8 |
+
registerBlockType('mycred-gb-blocks/mycred-badges', {
|
9 |
title: __('Badges', 'mycred'),
|
10 |
category: 'mycred',
|
11 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-badges/mycred-badges.php
CHANGED
@@ -1,17 +1,43 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
'mycred-badges', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
-
}
|
11 |
-
register_block_type('mycred-blocks/mycred-badges', array(
|
12 |
-
'render_callback' => 'mycred_badges_callback'
|
13 |
-
));
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_badges_block') ) :
|
7 |
+
class mycred_badges_block {
|
8 |
|
9 |
+
public function __construct() {
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
12 |
+
|
13 |
+
register_block_type(
|
14 |
+
'mycred-gb-blocks/mycred-badges',
|
15 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
16 |
+
);
|
17 |
+
|
18 |
+
}
|
19 |
+
|
20 |
+
public function register_assets() {
|
21 |
+
|
22 |
+
wp_enqueue_script(
|
23 |
+
'mycred-badges',
|
24 |
+
plugins_url('index.js', __FILE__),
|
25 |
+
array(
|
26 |
+
'wp-blocks',
|
27 |
+
'wp-element',
|
28 |
+
'wp-components',
|
29 |
+
'wp-editor',
|
30 |
+
'wp-rich-text'
|
31 |
+
)
|
32 |
+
);
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
public function render_block( $attributes, $content ) {
|
37 |
+
return "[mycred_badges " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]";
|
38 |
+
}
|
39 |
+
|
40 |
+
}
|
41 |
+
endif;
|
42 |
+
|
43 |
+
new mycred_badges_block();
|
includes/mycred-blocks/blocks/mycred-best-user/index.js
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
var __ = wp.i18n.__;
|
15 |
|
16 |
|
17 |
-
registerBlockType('mycred-blocks/mycred-best-user', {
|
18 |
title: __('Best User', 'mycred'),
|
19 |
category: 'mycred',
|
20 |
attributes: {
|
14 |
var __ = wp.i18n.__;
|
15 |
|
16 |
|
17 |
+
registerBlockType('mycred-gb-blocks/mycred-best-user', {
|
18 |
title: __('Best User', 'mycred'),
|
19 |
category: 'mycred',
|
20 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-best-user/mycred-best-user.php
CHANGED
@@ -1,23 +1,54 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
6 |
|
7 |
-
|
8 |
-
'mycred-best-user', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
-
}
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
-
function mycred_best_user_callback($attributes) {
|
17 |
-
$content = "";
|
18 |
-
if (isset($attributes['content'])) {
|
19 |
-
$content = $attributes['content'];
|
20 |
}
|
21 |
-
|
22 |
-
|
23 |
-
|
|
1 |
<?php
|
2 |
|
3 |
+
namespace MG_Blocks;
|
4 |
|
5 |
+
if ( ! defined('ABSPATH') ) exit;
|
6 |
|
7 |
+
if ( ! class_exists('mycred_best_user_block') ) :
|
|
|
|
|
|
|
8 |
|
9 |
+
class mycred_best_user_block {
|
10 |
+
|
11 |
+
public function __construct() {
|
12 |
+
|
13 |
+
add_action( 'enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
14 |
+
|
15 |
+
register_block_type(
|
16 |
+
'mycred-gb-blocks/mycred-best-user',
|
17 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
18 |
+
);
|
19 |
+
|
20 |
+
}
|
21 |
+
|
22 |
+
public function register_assets() {
|
23 |
+
|
24 |
+
wp_enqueue_script(
|
25 |
+
'mycred-best-user',
|
26 |
+
plugins_url('index.js', __FILE__),
|
27 |
+
array(
|
28 |
+
'wp-blocks',
|
29 |
+
'wp-element',
|
30 |
+
'wp-components',
|
31 |
+
'wp-editor'
|
32 |
+
)
|
33 |
+
);
|
34 |
+
|
35 |
+
}
|
36 |
+
|
37 |
+
public function render_block( $attributes, $content ) {
|
38 |
+
|
39 |
+
$content = "";
|
40 |
+
|
41 |
+
if ( isset( $attributes['content'] ) )
|
42 |
+
$content = $attributes['content'];
|
43 |
+
|
44 |
+
unset( $attributes['content'] );
|
45 |
+
|
46 |
+
return "[mycred_best_user " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]" . $content . "[/mycred_best_user]";
|
47 |
+
|
48 |
+
}
|
49 |
|
|
|
|
|
|
|
|
|
50 |
}
|
51 |
+
|
52 |
+
endif;
|
53 |
+
|
54 |
+
new mycred_best_user_block();
|
includes/mycred-blocks/blocks/mycred-buy-form/index.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
var SelectControl = wp.components.SelectControl;
|
7 |
var ToggleControl = wp.components.ToggleControl;
|
8 |
var __ = wp.i18n.__;
|
9 |
-
registerBlockType('mycred-blocks/mycred-buy-form', {
|
10 |
title: __('Buy Form', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
6 |
var SelectControl = wp.components.SelectControl;
|
7 |
var ToggleControl = wp.components.ToggleControl;
|
8 |
var __ = wp.i18n.__;
|
9 |
+
registerBlockType('mycred-gb-blocks/mycred-buy-form', {
|
10 |
title: __('Buy Form', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-buy-form/mycred-buy-form.php
CHANGED
@@ -1,18 +1,44 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
'mycred-buy-form', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
-
}
|
11 |
|
12 |
-
|
13 |
-
'render_callback' => 'mycred_buy_form_callback'
|
14 |
-
));
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_buy_form_block') ) :
|
7 |
+
class mycred_buy_form_block {
|
8 |
|
9 |
+
public function __construct() {
|
|
|
|
|
|
|
10 |
|
11 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
|
|
|
|
12 |
|
13 |
+
register_block_type(
|
14 |
+
'mycred-gb-blocks/mycred-buy-form',
|
15 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
16 |
+
);
|
17 |
+
|
18 |
+
}
|
19 |
+
|
20 |
+
public function register_assets() {
|
21 |
+
|
22 |
+
wp_enqueue_script(
|
23 |
+
'mycred-buy-form',
|
24 |
+
plugins_url('index.js', __FILE__),
|
25 |
+
array(
|
26 |
+
'wp-blocks',
|
27 |
+
'wp-element',
|
28 |
+
'wp-components',
|
29 |
+
'wp-editor'
|
30 |
+
)
|
31 |
+
);
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
public function render_block( $attributes, $content ) {
|
36 |
+
|
37 |
+
return "[mycred_buy_form " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]";
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
+
}
|
42 |
+
endif;
|
43 |
+
|
44 |
+
new mycred_buy_form_block();
|
includes/mycred-blocks/blocks/mycred-buy/index.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
var SelectControl = wp.components.SelectControl;
|
7 |
|
8 |
var __ = wp.i18n.__;
|
9 |
-
registerBlockType('mycred-blocks/mycred-buy', {
|
10 |
title: __('Buy', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
6 |
var SelectControl = wp.components.SelectControl;
|
7 |
|
8 |
var __ = wp.i18n.__;
|
9 |
+
registerBlockType('mycred-gb-blocks/mycred-buy', {
|
10 |
title: __('Buy', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-buy/mycred-buy.php
CHANGED
@@ -1,36 +1,62 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
'mycred-buy', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
|
11 |
-
|
12 |
-
$gateways = array();
|
13 |
-
foreach ($buycred->get() as $gateway_id => $gateway) {
|
14 |
-
$gateways[$gateway['title']] = $gateway_id;
|
15 |
-
}
|
16 |
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
19 |
|
20 |
-
|
21 |
-
'render_callback' => 'mycred_buy_callback'
|
22 |
-
));
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
-
if ($attributes['link_title']) {
|
31 |
-
$content = $attributes['link_title'];
|
32 |
}
|
33 |
-
|
34 |
|
35 |
-
|
36 |
-
}
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_buy_block') ) :
|
7 |
+
class mycred_buy_block {
|
8 |
|
9 |
+
public function __construct() {
|
|
|
|
|
10 |
|
11 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
register_block_type(
|
14 |
+
'mycred-gb-blocks/mycred-buy',
|
15 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
16 |
+
);
|
17 |
+
|
18 |
+
}
|
19 |
|
20 |
+
public function register_assets() {
|
|
|
|
|
21 |
|
22 |
+
wp_enqueue_script(
|
23 |
+
'mycred-buy',
|
24 |
+
plugins_url('index.js', __FILE__),
|
25 |
+
array(
|
26 |
+
'wp-blocks',
|
27 |
+
'wp-element',
|
28 |
+
'wp-components',
|
29 |
+
'wp-editor'
|
30 |
+
)
|
31 |
+
);
|
32 |
+
|
33 |
+
$buycred = new \myCRED_buyCRED_Module();
|
34 |
+
$gateways = array();
|
35 |
+
foreach ( $buycred->get() as $gateway_id => $gateway ) {
|
36 |
+
$gateways[$gateway['title']] = $gateway_id;
|
37 |
+
}
|
38 |
+
|
39 |
+
wp_localize_script( 'mycred-buy', 'mycred_buy', $gateways );
|
40 |
+
|
41 |
+
}
|
42 |
+
|
43 |
+
public function render_block( $attributes, $content ) {
|
44 |
+
|
45 |
+
if ( ! empty( $attributes['clss'] ) ) {
|
46 |
+
$attributes['class'] = $attributes['clss'];
|
47 |
+
unset($attributes['clss']);
|
48 |
+
}
|
49 |
+
|
50 |
+
if ( ! empty( $attributes['link_title'] ) ) {
|
51 |
+
$content = $attributes['link_title'];
|
52 |
+
unset($attributes['link_title']);
|
53 |
+
}
|
54 |
+
|
55 |
+
return "[mycred_buy " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]" . $content . "[/mycred_buy]";
|
56 |
+
|
57 |
+
}
|
58 |
|
|
|
|
|
59 |
}
|
60 |
+
endif;
|
61 |
|
62 |
+
new mycred_buy_block();
|
|
includes/mycred-blocks/blocks/mycred-email-subsc/index.js
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
var TextControl = wp.components.TextControl;
|
6 |
|
7 |
var __ = wp.i18n.__;
|
8 |
-
registerBlockType('mycred-blocks/mycred-email-subsc', {
|
9 |
title: __('Email Subscriptions', 'mycred'),
|
10 |
category: 'mycred',
|
11 |
attributes: {
|
5 |
var TextControl = wp.components.TextControl;
|
6 |
|
7 |
var __ = wp.i18n.__;
|
8 |
+
registerBlockType('mycred-gb-blocks/mycred-email-subsc', {
|
9 |
title: __('Email Subscriptions', 'mycred'),
|
10 |
category: 'mycred',
|
11 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-email-subsc/mycred-email-subsc.php
CHANGED
@@ -1,18 +1,45 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
'mycred-email-subsc', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
|
11 |
-
|
12 |
-
register_block_type('mycred-blocks/mycred-email-subsc', array(
|
13 |
-
'render_callback' => 'mycred_email_subsc_callback'
|
14 |
-
));
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_email_subscriptions_block') ) :
|
7 |
+
class mycred_email_subscriptions_block {
|
8 |
|
9 |
+
public function __construct() {
|
|
|
|
|
10 |
|
11 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
|
|
|
|
|
|
12 |
|
13 |
+
register_block_type(
|
14 |
+
'mycred-gb-blocks/mycred-email-subsc',
|
15 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
16 |
+
);
|
17 |
+
|
18 |
+
}
|
19 |
+
|
20 |
+
public function register_assets() {
|
21 |
+
|
22 |
+
wp_enqueue_script(
|
23 |
+
'mycred-email-subsc',
|
24 |
+
plugins_url('index.js', __FILE__),
|
25 |
+
array(
|
26 |
+
'wp-blocks',
|
27 |
+
'wp-element',
|
28 |
+
'wp-components',
|
29 |
+
'wp-editor',
|
30 |
+
'wp-rich-text'
|
31 |
+
)
|
32 |
+
);
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
public function render_block( $attributes, $content ) {
|
37 |
+
|
38 |
+
return "[mycred_email_subscriptions " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]";
|
39 |
+
|
40 |
+
}
|
41 |
+
|
42 |
+
}
|
43 |
+
endif;
|
44 |
+
|
45 |
+
new mycred_email_subscriptions_block();
|
includes/mycred-blocks/blocks/mycred-exchange/index.js
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
var SelectControl = wp.components.SelectControl;
|
12 |
var TextControl = wp.components.TextControl;
|
13 |
var __ = wp.i18n.__;
|
14 |
-
registerBlockType('mycred-blocks/mycred-exchange', {
|
15 |
title: __('Exchange', 'mycred'),
|
16 |
category: 'mycred',
|
17 |
attributes: {
|
11 |
var SelectControl = wp.components.SelectControl;
|
12 |
var TextControl = wp.components.TextControl;
|
13 |
var __ = wp.i18n.__;
|
14 |
+
registerBlockType('mycred-gb-blocks/mycred-exchange', {
|
15 |
title: __('Exchange', 'mycred'),
|
16 |
category: 'mycred',
|
17 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-exchange/mycred-exchange.php
CHANGED
@@ -1,18 +1,45 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
6 |
|
7 |
-
|
8 |
-
'mycred-exchange', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
-
}
|
11 |
|
12 |
-
|
13 |
-
'render_callback' => 'mycred_exchange_user_callback',
|
14 |
-
));
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_exchange_block') ) :
|
7 |
|
8 |
+
class mycred_exchange_block {
|
|
|
|
|
|
|
9 |
|
10 |
+
public function __construct() {
|
|
|
|
|
11 |
|
12 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
13 |
+
|
14 |
+
register_block_type(
|
15 |
+
'mycred-gb-blocks/mycred-exchange',
|
16 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
17 |
+
);
|
18 |
+
|
19 |
+
}
|
20 |
+
|
21 |
+
public function register_assets() {
|
22 |
+
|
23 |
+
wp_enqueue_script(
|
24 |
+
'mycred-exchange',
|
25 |
+
plugins_url('index.js', __FILE__),
|
26 |
+
array(
|
27 |
+
'wp-blocks',
|
28 |
+
'wp-element',
|
29 |
+
'wp-components',
|
30 |
+
'wp-editor',
|
31 |
+
'wp-rich-text'
|
32 |
+
)
|
33 |
+
);
|
34 |
+
|
35 |
+
}
|
36 |
+
|
37 |
+
public function render_block( $attributes, $content ) {
|
38 |
+
return "[mycred_exchange " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]";
|
39 |
+
}
|
40 |
+
|
41 |
+
}
|
42 |
+
|
43 |
+
endif;
|
44 |
+
|
45 |
+
new mycred_exchange_block();
|
includes/mycred-blocks/blocks/mycred-give/index.js
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
var TextareaControl = wp.components.TextareaControl;
|
13 |
var __ = wp.i18n.__;
|
14 |
|
15 |
-
registerBlockType('mycred-blocks/mycred-give', {
|
16 |
title: __('Give'),
|
17 |
category: 'mycred',
|
18 |
attributes: {
|
12 |
var TextareaControl = wp.components.TextareaControl;
|
13 |
var __ = wp.i18n.__;
|
14 |
|
15 |
+
registerBlockType('mycred-gb-blocks/mycred-give', {
|
16 |
title: __('Give'),
|
17 |
category: 'mycred',
|
18 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-give/mycred-give.php
CHANGED
@@ -1,26 +1,57 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
6 |
|
7 |
-
|
8 |
-
'mycred-give', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
-
}
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
-
function mycred_give_callback($attributes) {
|
17 |
-
if ($attributes['type'] == ''){
|
18 |
-
$attributes['type'] = 'mycred_default';
|
19 |
-
}
|
20 |
-
$content='';
|
21 |
-
if ($attributes['content'] == '') {
|
22 |
-
$content = $attributes['content'];
|
23 |
}
|
24 |
-
|
25 |
-
|
26 |
-
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_give_block') ) :
|
7 |
|
8 |
+
class mycred_give_block {
|
|
|
|
|
|
|
9 |
|
10 |
+
public function __construct() {
|
11 |
+
|
12 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
13 |
+
|
14 |
+
register_block_type(
|
15 |
+
'mycred-gb-blocks/mycred-give',
|
16 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
17 |
+
);
|
18 |
+
|
19 |
+
}
|
20 |
+
|
21 |
+
public function register_assets() {
|
22 |
+
|
23 |
+
wp_enqueue_script(
|
24 |
+
'mycred-give',
|
25 |
+
plugins_url('index.js', __FILE__),
|
26 |
+
array(
|
27 |
+
'wp-blocks',
|
28 |
+
'wp-element',
|
29 |
+
'wp-components',
|
30 |
+
'wp-editor',
|
31 |
+
'wp-rich-text'
|
32 |
+
)
|
33 |
+
);
|
34 |
+
|
35 |
+
}
|
36 |
+
|
37 |
+
public function render_block( $attributes, $content ) {
|
38 |
+
|
39 |
+
$content = '';
|
40 |
+
|
41 |
+
if ( empty( $attributes['type'] ) )
|
42 |
+
$attributes['type'] = 'mycred_default';
|
43 |
+
|
44 |
+
if ( ! empty( $attributes['content'] ) )
|
45 |
+
$content = $attributes['content'];
|
46 |
+
|
47 |
+
unset( $attributes['content'] );
|
48 |
+
|
49 |
+
return "[mycred_give " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]" . $content . "[/mycred_give]";
|
50 |
+
|
51 |
+
}
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
}
|
54 |
+
|
55 |
+
endif;
|
56 |
+
|
57 |
+
new mycred_give_block();
|
includes/mycred-blocks/blocks/mycred-history/index.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
var SelectControl = wp.components.SelectControl;
|
7 |
var ToggleControl = wp.components.ToggleControl;
|
8 |
var __ = wp.i18n.__;
|
9 |
-
registerBlockType('mycred-blocks/mycred-history', {
|
10 |
title: __('History', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
6 |
var SelectControl = wp.components.SelectControl;
|
7 |
var ToggleControl = wp.components.ToggleControl;
|
8 |
var __ = wp.i18n.__;
|
9 |
+
registerBlockType('mycred-gb-blocks/mycred-history', {
|
10 |
title: __('History', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-history/mycred-history.php
CHANGED
@@ -1,22 +1,50 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
6 |
|
7 |
-
|
8 |
-
'mycred-history', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
-
}
|
11 |
|
12 |
-
|
13 |
-
'render_callback' => 'mycred_history_callback'
|
14 |
-
));
|
15 |
|
16 |
-
|
17 |
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
20 |
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_history_block') ) :
|
7 |
|
8 |
+
class mycred_history_block {
|
|
|
|
|
|
|
9 |
|
10 |
+
public function __construct() {
|
|
|
|
|
11 |
|
12 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
13 |
|
14 |
+
register_block_type(
|
15 |
+
'mycred-gb-blocks/mycred-history',
|
16 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
17 |
+
);
|
18 |
+
|
19 |
+
}
|
20 |
|
21 |
+
public function register_assets() {
|
22 |
+
|
23 |
+
wp_enqueue_script(
|
24 |
+
'mycred-history',
|
25 |
+
plugins_url('index.js', __FILE__),
|
26 |
+
array(
|
27 |
+
'wp-blocks',
|
28 |
+
'wp-element',
|
29 |
+
'wp-components',
|
30 |
+
'wp-editor',
|
31 |
+
'wp-rich-text'
|
32 |
+
)
|
33 |
+
);
|
34 |
+
|
35 |
+
}
|
36 |
+
|
37 |
+
public function render_block( $attributes, $content ) {
|
38 |
+
|
39 |
+
if ( empty( $attributes['type'] ) )
|
40 |
+
$attributes['type'] = 'mycred_default';
|
41 |
+
|
42 |
+
return "[mycred_history " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]";
|
43 |
+
|
44 |
+
}
|
45 |
+
|
46 |
+
}
|
47 |
+
|
48 |
+
endif;
|
49 |
+
|
50 |
+
new mycred_history_block();
|
includes/mycred-blocks/blocks/mycred-hook-table/index.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
var SelectControl = wp.components.SelectControl;
|
7 |
var ToggleControl = wp.components.ToggleControl;
|
8 |
var __ = wp.i18n.__;
|
9 |
-
registerBlockType('mycred-blocks/mycred-hook-table', {
|
10 |
title: __('Hook Table', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
6 |
var SelectControl = wp.components.SelectControl;
|
7 |
var ToggleControl = wp.components.ToggleControl;
|
8 |
var __ = wp.i18n.__;
|
9 |
+
registerBlockType('mycred-gb-blocks/mycred-hook-table', {
|
10 |
title: __('Hook Table', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-hook-table/mycred-hook-table.php
CHANGED
@@ -1,21 +1,49 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
6 |
|
7 |
-
|
8 |
-
'mycred-hook-table', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
-
}
|
11 |
|
12 |
-
|
13 |
-
'render_callback' => 'mycred_hook_table_callback'
|
14 |
-
));
|
15 |
|
16 |
-
|
17 |
-
if ($attributes['type'] == '')
|
18 |
-
$attributes['type'] = 'mycred_default';
|
19 |
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_hook_table_block') ) :
|
7 |
|
8 |
+
class mycred_hook_table_block {
|
|
|
|
|
|
|
9 |
|
10 |
+
public function __construct() {
|
|
|
|
|
11 |
|
12 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
|
|
|
|
13 |
|
14 |
+
register_block_type(
|
15 |
+
'mycred-gb-blocks/mycred-hook-table',
|
16 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
17 |
+
);
|
18 |
+
|
19 |
+
}
|
20 |
+
|
21 |
+
public function register_assets() {
|
22 |
+
|
23 |
+
wp_enqueue_script(
|
24 |
+
'mycred-hook-table',
|
25 |
+
plugins_url('index.js', __FILE__),
|
26 |
+
array(
|
27 |
+
'wp-blocks',
|
28 |
+
'wp-element',
|
29 |
+
'wp-components',
|
30 |
+
'wp-editor',
|
31 |
+
'wp-rich-text'
|
32 |
+
)
|
33 |
+
);
|
34 |
+
|
35 |
+
}
|
36 |
+
|
37 |
+
public function render_block( $attributes, $content ) {
|
38 |
+
|
39 |
+
if ( empty( $attributes['type'] ) )
|
40 |
+
$attributes['type'] = 'mycred_default';
|
41 |
+
|
42 |
+
return "[mycred_hook_table " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]";
|
43 |
+
}
|
44 |
+
|
45 |
+
}
|
46 |
+
|
47 |
+
endif;
|
48 |
+
|
49 |
+
new mycred_hook_table_block();
|
includes/mycred-blocks/blocks/mycred-leaderboard/index.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
var SelectControl = wp.components.SelectControl;
|
7 |
var ToggleControl = wp.components.ToggleControl;
|
8 |
var __ = wp.i18n.__;
|
9 |
-
registerBlockType('mycred-blocks/mycred-leaderboard', {
|
10 |
title: __('Leaderboard', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
6 |
var SelectControl = wp.components.SelectControl;
|
7 |
var ToggleControl = wp.components.ToggleControl;
|
8 |
var __ = wp.i18n.__;
|
9 |
+
registerBlockType('mycred-gb-blocks/mycred-leaderboard', {
|
10 |
title: __('Leaderboard', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-leaderboard/mycred-leaderboard.php
CHANGED
@@ -1,21 +1,48 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
'mycred-leaderboard', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
-
}
|
11 |
|
12 |
-
|
13 |
-
'render_callback' => 'mycred_leaderboard_callback'
|
14 |
-
));
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
19 |
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_leaderboard_block') ) :
|
7 |
+
class mycred_leaderboard_block {
|
8 |
|
9 |
+
public function __construct() {
|
|
|
|
|
|
|
10 |
|
11 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
|
|
|
|
12 |
|
13 |
+
register_block_type(
|
14 |
+
'mycred-gb-blocks/mycred-leaderboard',
|
15 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
16 |
+
);
|
17 |
+
|
18 |
+
}
|
19 |
|
20 |
+
public function register_assets() {
|
21 |
+
|
22 |
+
wp_enqueue_script(
|
23 |
+
'mycred-leaderboard',
|
24 |
+
plugins_url('index.js', __FILE__),
|
25 |
+
array(
|
26 |
+
'wp-blocks',
|
27 |
+
'wp-element',
|
28 |
+
'wp-components',
|
29 |
+
'wp-editor',
|
30 |
+
'wp-rich-text'
|
31 |
+
)
|
32 |
+
);
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
public function render_block( $attributes, $content ) {
|
37 |
+
|
38 |
+
if ( empty( $attributes['type'] ) )
|
39 |
+
$attributes['type'] = 'mycred_default';
|
40 |
+
|
41 |
+
return "[mycred_leaderboard " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]";
|
42 |
+
|
43 |
+
}
|
44 |
+
|
45 |
+
}
|
46 |
+
endif;
|
47 |
+
|
48 |
+
new mycred_leaderboard_block();
|
includes/mycred-blocks/blocks/mycred-link/index.js
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
var TextareaControl = wp.components.TextareaControl;
|
8 |
|
9 |
var __ = wp.i18n.__;
|
10 |
-
registerBlockType('mycred-blocks/mycred-link', {
|
11 |
title: __('Link', 'mycred'),
|
12 |
category: 'mycred',
|
13 |
attributes: {
|
7 |
var TextareaControl = wp.components.TextareaControl;
|
8 |
|
9 |
var __ = wp.i18n.__;
|
10 |
+
registerBlockType('mycred-gb-blocks/mycred-link', {
|
11 |
title: __('Link', 'mycred'),
|
12 |
category: 'mycred',
|
13 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-link/mycred-link.php
CHANGED
@@ -1,30 +1,59 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
'mycred-link', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
-
}
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
-
function mycred_link_callback($attributes) {
|
17 |
-
if ($attributes['ctype'] == '') {
|
18 |
-
$attributes['ctype'] = 'mycred_default';
|
19 |
-
}
|
20 |
-
$content = "";
|
21 |
-
if (isset($attributes['clss'])) {
|
22 |
-
$attributes['class'] = $attributes['clss'];
|
23 |
-
unset($attributes['clss']);
|
24 |
-
}
|
25 |
-
if ($attributes['content'] == '') {
|
26 |
-
$content = $attributes['content'];
|
27 |
}
|
28 |
-
|
29 |
-
|
30 |
-
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_link_block') ) :
|
7 |
+
class mycred_link_block {
|
8 |
|
9 |
+
public function __construct() {
|
|
|
|
|
|
|
10 |
|
11 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
12 |
+
|
13 |
+
register_block_type(
|
14 |
+
'mycred-gb-blocks/mycred-link',
|
15 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
16 |
+
);
|
17 |
+
|
18 |
+
}
|
19 |
+
|
20 |
+
public function register_assets() {
|
21 |
+
|
22 |
+
wp_enqueue_script(
|
23 |
+
'mycred-link',
|
24 |
+
plugins_url('index.js', __FILE__),
|
25 |
+
array(
|
26 |
+
'wp-blocks',
|
27 |
+
'wp-element',
|
28 |
+
'wp-components',
|
29 |
+
'wp-editor'
|
30 |
+
)
|
31 |
+
);
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
public function render_block( $attributes, $content ) {
|
36 |
+
|
37 |
+
$content = '';
|
38 |
+
|
39 |
+
if ( empty( $attributes['ctype'] ) )
|
40 |
+
$attributes['ctype'] = 'mycred_default';
|
41 |
+
|
42 |
+
if ( isset( $attributes['clss'] ) ) {
|
43 |
+
$attributes['class'] = $attributes['clss'];
|
44 |
+
unset($attributes['clss']);
|
45 |
+
}
|
46 |
+
|
47 |
+
if ( ! empty( $attributes['content'] ) ) {
|
48 |
+
$content = $attributes['content'];
|
49 |
+
unset( $attributes['content'] );
|
50 |
+
}
|
51 |
+
|
52 |
+
return "[mycred_link " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]" . $content . "[/mycred_link]";
|
53 |
+
|
54 |
+
}
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
}
|
57 |
+
endif;
|
58 |
+
|
59 |
+
new mycred_link_block();
|
includes/mycred-blocks/blocks/mycred-list-ranks/index.js
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
var TextControl = wp.components.TextControl;
|
6 |
var SelectControl = wp.components.SelectControl;
|
7 |
var __ = wp.i18n.__;
|
8 |
-
registerBlockType('mycred-blocks/mycred-list-ranks', {
|
9 |
title: __('List Ranks', 'mycred'),
|
10 |
category: 'mycred',
|
11 |
attributes: {
|
5 |
var TextControl = wp.components.TextControl;
|
6 |
var SelectControl = wp.components.SelectControl;
|
7 |
var __ = wp.i18n.__;
|
8 |
+
registerBlockType('mycred-gb-blocks/mycred-list-ranks', {
|
9 |
title: __('List Ranks', 'mycred'),
|
10 |
category: 'mycred',
|
11 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-list-ranks/mycred-list-ranks.php
CHANGED
@@ -1,22 +1,47 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
'mycred-list-ranks', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
-
}
|
11 |
|
12 |
-
|
13 |
-
'render_callback' => 'mycred_list_ranks_callback'
|
14 |
-
));
|
15 |
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
-
|
19 |
-
$attributes['ctype'] = 'mycred_default';
|
20 |
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_list_ranks_block') ) :
|
7 |
+
class mycred_list_ranks_block {
|
8 |
|
9 |
+
public function __construct() {
|
|
|
|
|
|
|
10 |
|
11 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
|
|
|
|
12 |
|
13 |
+
register_block_type(
|
14 |
+
'mycred-gb-blocks/mycred-list-ranks',
|
15 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
16 |
+
);
|
17 |
+
|
18 |
+
}
|
19 |
|
20 |
+
public function register_assets() {
|
|
|
21 |
|
22 |
+
wp_enqueue_script(
|
23 |
+
'mycred-list-ranks',
|
24 |
+
plugins_url('index.js', __FILE__),
|
25 |
+
array(
|
26 |
+
'wp-blocks',
|
27 |
+
'wp-element',
|
28 |
+
'wp-components',
|
29 |
+
'wp-editor'
|
30 |
+
)
|
31 |
+
);
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
public function render_block( $attributes, $content ) {
|
36 |
+
|
37 |
+
if ( empty( $attributes['ctype'] ) )
|
38 |
+
$attributes['ctype'] = 'mycred_default';
|
39 |
+
|
40 |
+
return "[mycred_list_ranks " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]";
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
45 |
+
endif;
|
46 |
+
|
47 |
+
new mycred_list_ranks_block();
|
includes/mycred-blocks/blocks/mycred-load-coupon/index.js
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
var TextControl = wp.components.TextControl;
|
6 |
|
7 |
var __ = wp.i18n.__;
|
8 |
-
registerBlockType('mycred-blocks/mycred-load-coupon', {
|
9 |
title: __('Load Coupon', 'mycred'),
|
10 |
category: 'mycred',
|
11 |
attributes: {
|
5 |
var TextControl = wp.components.TextControl;
|
6 |
|
7 |
var __ = wp.i18n.__;
|
8 |
+
registerBlockType('mycred-gb-blocks/mycred-load-coupon', {
|
9 |
title: __('Load Coupon', 'mycred'),
|
10 |
category: 'mycred',
|
11 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-load-coupon/mycred-load-coupon.php
CHANGED
@@ -1,18 +1,44 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
'mycred-load-coupon', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
-
}
|
11 |
|
12 |
-
|
13 |
-
'render_callback' => 'mycred_load_coupon_callback'
|
14 |
-
));
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_load_coupon_block') ) :
|
7 |
+
class mycred_load_coupon_block {
|
8 |
|
9 |
+
public function __construct() {
|
|
|
|
|
|
|
10 |
|
11 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
|
|
|
|
12 |
|
13 |
+
register_block_type(
|
14 |
+
'mycred-gb-blocks/mycred-load-coupon',
|
15 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
16 |
+
);
|
17 |
+
|
18 |
+
}
|
19 |
+
|
20 |
+
public function register_assets() {
|
21 |
+
|
22 |
+
wp_enqueue_script(
|
23 |
+
'mycred-load-coupon',
|
24 |
+
plugins_url('index.js', __FILE__),
|
25 |
+
array(
|
26 |
+
'wp-blocks',
|
27 |
+
'wp-element',
|
28 |
+
'wp-components',
|
29 |
+
'wp-editor'
|
30 |
+
)
|
31 |
+
);
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
public function render_block( $attributes, $content ) {
|
36 |
+
|
37 |
+
return "[mycred_load_coupon " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]";
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
+
}
|
42 |
+
endif;
|
43 |
+
|
44 |
+
new mycred_load_coupon_block();
|
includes/mycred-blocks/blocks/mycred-my-badges/index.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
var SelectControl = wp.components.SelectControl;
|
7 |
|
8 |
var __ = wp.i18n.__;
|
9 |
-
registerBlockType('mycred-blocks/mycred-my-badges', {
|
10 |
title: __('My Badges', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
6 |
var SelectControl = wp.components.SelectControl;
|
7 |
|
8 |
var __ = wp.i18n.__;
|
9 |
+
registerBlockType('mycred-gb-blocks/mycred-my-badges', {
|
10 |
title: __('My Badges', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-my-badges/mycred-my-badges.php
CHANGED
@@ -1,17 +1,42 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
'mycred-my-badges', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
-
}
|
11 |
-
register_block_type('mycred-blocks/mycred-my-badges', array(
|
12 |
-
'render_callback' => 'mycred_my_badges_callback'
|
13 |
-
));
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_my_badges_block') ) :
|
7 |
+
class mycred_my_badges_block {
|
8 |
|
9 |
+
public function __construct() {
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
12 |
+
|
13 |
+
register_block_type(
|
14 |
+
'mycred-gb-blocks/mycred-my-badges',
|
15 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
16 |
+
);
|
17 |
+
|
18 |
+
}
|
19 |
+
|
20 |
+
public function register_assets() {
|
21 |
+
|
22 |
+
wp_enqueue_script(
|
23 |
+
'mycred-my-badges',
|
24 |
+
plugins_url('index.js', __FILE__),
|
25 |
+
array(
|
26 |
+
'wp-blocks',
|
27 |
+
'wp-element',
|
28 |
+
'wp-components',
|
29 |
+
'wp-editor'
|
30 |
+
)
|
31 |
+
);
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
public function render_block( $attributes, $content ) {
|
36 |
+
return "[mycred_my_badges " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]";
|
37 |
+
}
|
38 |
+
|
39 |
+
}
|
40 |
+
endif;
|
41 |
+
|
42 |
+
new mycred_my_badges_block();
|
includes/mycred-blocks/blocks/mycred-my-balance-converted/index.js
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
var TextControl = wp.components.TextControl;
|
6 |
var SelectControl = wp.components.SelectControl;
|
7 |
var __ = wp.i18n.__;
|
8 |
-
registerBlockType('mycred-blocks/mycred-my-balance-converted', {
|
9 |
title: __('My Balance Converted', 'mycred'),
|
10 |
category: 'mycred',
|
11 |
attributes: {
|
5 |
var TextControl = wp.components.TextControl;
|
6 |
var SelectControl = wp.components.SelectControl;
|
7 |
var __ = wp.i18n.__;
|
8 |
+
registerBlockType('mycred-gb-blocks/mycred-my-balance-converted', {
|
9 |
title: __('My Balance Converted', 'mycred'),
|
10 |
category: 'mycred',
|
11 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-my-balance-converted/mycred-my-balance-converted.php
CHANGED
@@ -1,19 +1,44 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
'mycred-my-balance-converted', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
-
}
|
11 |
|
12 |
-
|
13 |
-
'render_callback' => 'mycred_my_balance_converted_callback'
|
14 |
-
));
|
15 |
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_my_balance_converted_block') ) :
|
7 |
+
class mycred_my_balance_converted_block {
|
8 |
|
9 |
+
public function __construct() {
|
|
|
|
|
|
|
10 |
|
11 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
|
|
|
|
12 |
|
13 |
+
register_block_type(
|
14 |
+
'mycred-gb-blocks/mycred-my-balance-converted',
|
15 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
16 |
+
);
|
17 |
+
|
18 |
+
}
|
19 |
|
20 |
+
public function register_assets() {
|
21 |
+
|
22 |
+
wp_enqueue_script(
|
23 |
+
'mycred-my-balance-converted',
|
24 |
+
plugins_url('index.js', __FILE__),
|
25 |
+
array(
|
26 |
+
'wp-blocks',
|
27 |
+
'wp-element',
|
28 |
+
'wp-components',
|
29 |
+
'wp-editor'
|
30 |
+
)
|
31 |
+
);
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
public function render_block( $attributes, $content ) {
|
36 |
+
|
37 |
+
return "[mycred_my_balance_converted " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]";
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
+
}
|
42 |
+
endif;
|
43 |
+
|
44 |
+
new mycred_my_balance_converted_block();
|
includes/mycred-blocks/blocks/mycred-my-balance/index.js
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
var ToggleControl = wp.components.ToggleControl;
|
8 |
var TextareaControl = wp.components.TextareaControl;
|
9 |
var __ = wp.i18n.__;
|
10 |
-
registerBlockType('mycred-blocks/mycred-my-balance', {
|
11 |
title: __('My Balance', 'mycred'),
|
12 |
category: 'mycred',
|
13 |
attributes: {
|
7 |
var ToggleControl = wp.components.ToggleControl;
|
8 |
var TextareaControl = wp.components.TextareaControl;
|
9 |
var __ = wp.i18n.__;
|
10 |
+
registerBlockType('mycred-gb-blocks/mycred-my-balance', {
|
11 |
title: __('My Balance', 'mycred'),
|
12 |
category: 'mycred',
|
13 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-my-balance/mycred-my-balance.php
CHANGED
@@ -1,28 +1,54 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
'mycred-my-balance', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
-
}
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
-
function mycred_my_balance_callback($attributes) {
|
17 |
-
if ($attributes['type'] == ''){
|
18 |
-
$attributes['type'] = 'mycred_default';
|
19 |
-
}
|
20 |
-
|
21 |
-
$content = "";
|
22 |
-
if (isset($attributes['content'])) {
|
23 |
-
$content = $attributes['content'];
|
24 |
}
|
25 |
-
|
26 |
|
27 |
-
|
28 |
-
}
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_my_balance_block') ) :
|
7 |
+
class mycred_my_balance_block {
|
8 |
|
9 |
+
public function __construct() {
|
|
|
|
|
|
|
10 |
|
11 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
12 |
+
|
13 |
+
register_block_type(
|
14 |
+
'mycred-gb-blocks/mycred-my-balance',
|
15 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
16 |
+
);
|
17 |
+
|
18 |
+
}
|
19 |
+
|
20 |
+
public function register_assets() {
|
21 |
+
|
22 |
+
wp_enqueue_script(
|
23 |
+
'mycred-my-balance',
|
24 |
+
plugins_url('index.js', __FILE__),
|
25 |
+
array(
|
26 |
+
'wp-blocks',
|
27 |
+
'wp-element',
|
28 |
+
'wp-components',
|
29 |
+
'wp-editor'
|
30 |
+
)
|
31 |
+
);
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
public function render_block( $attributes, $content ) {
|
36 |
+
|
37 |
+
$content = '';
|
38 |
+
|
39 |
+
if ( empty( $attributes['type'] ) )
|
40 |
+
$attributes['type'] = 'mycred_default';
|
41 |
+
|
42 |
+
if ( isset( $attributes['content'] ) ) {
|
43 |
+
$content = $attributes['content'];
|
44 |
+
unset( $attributes['content'] );
|
45 |
+
}
|
46 |
+
|
47 |
+
return "[mycred_my_balance " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]" . $content . "[/mycred_my_balance]";
|
48 |
+
|
49 |
+
}
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
}
|
52 |
+
endif;
|
53 |
|
54 |
+
new mycred_my_balance_block();
|
|
includes/mycred-blocks/blocks/mycred-my-rank/index.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
var ToggleControl = wp.components.ToggleControl;
|
7 |
var SelectControl = wp.components.SelectControl;
|
8 |
var __ = wp.i18n.__;
|
9 |
-
registerBlockType('mycred-blocks/mycred-my-rank', {
|
10 |
title: __('My Rank', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
6 |
var ToggleControl = wp.components.ToggleControl;
|
7 |
var SelectControl = wp.components.SelectControl;
|
8 |
var __ = wp.i18n.__;
|
9 |
+
registerBlockType('mycred-gb-blocks/mycred-my-rank', {
|
10 |
title: __('My Rank', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-my-rank/mycred-my-rank.php
CHANGED
@@ -1,22 +1,47 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
'mycred-my-rank', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
-
}
|
11 |
|
12 |
-
|
13 |
-
'render_callback' => 'mycred_my_rank_callback'
|
14 |
-
));
|
15 |
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
-
|
19 |
-
$attributes['ctype'] = 'mycred_default';
|
20 |
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_my_rank_block') ) :
|
7 |
+
class mycred_my_rank_block {
|
8 |
|
9 |
+
public function __construct() {
|
|
|
|
|
|
|
10 |
|
11 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
|
|
|
|
12 |
|
13 |
+
register_block_type(
|
14 |
+
'mycred-gb-blocks/mycred-my-rank',
|
15 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
16 |
+
);
|
17 |
+
|
18 |
+
}
|
19 |
|
20 |
+
public function register_assets() {
|
|
|
21 |
|
22 |
+
wp_enqueue_script(
|
23 |
+
'mycred-my-rank',
|
24 |
+
plugins_url('index.js', __FILE__),
|
25 |
+
array(
|
26 |
+
'wp-blocks',
|
27 |
+
'wp-element',
|
28 |
+
'wp-components',
|
29 |
+
'wp-editor'
|
30 |
+
)
|
31 |
+
);
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
public function render_block( $attributes, $content ) {
|
36 |
+
|
37 |
+
if ( empty( $attributes['ctype'] ) )
|
38 |
+
$attributes['ctype'] = 'mycred_default';
|
39 |
+
|
40 |
+
return "[mycred_my_rank " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]";
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
45 |
+
endif;
|
46 |
+
|
47 |
+
new mycred_my_rank_block();
|
includes/mycred-blocks/blocks/mycred-my-ranks/index.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
var ToggleControl = wp.components.ToggleControl;
|
7 |
var SelectControl = wp.components.SelectControl;
|
8 |
var __ = wp.i18n.__;
|
9 |
-
registerBlockType('mycred-blocks/mycred-my-ranks', {
|
10 |
title: __('My Ranks', 'mycred'),
|
11 |
description: __('This Block allows you to show all ranks a user currently has. Note that this is only usable when you have ranks for multiple point types.', 'mycred'),
|
12 |
category: 'mycred',
|
6 |
var ToggleControl = wp.components.ToggleControl;
|
7 |
var SelectControl = wp.components.SelectControl;
|
8 |
var __ = wp.i18n.__;
|
9 |
+
registerBlockType('mycred-gb-blocks/mycred-my-ranks', {
|
10 |
title: __('My Ranks', 'mycred'),
|
11 |
description: __('This Block allows you to show all ranks a user currently has. Note that this is only usable when you have ranks for multiple point types.', 'mycred'),
|
12 |
category: 'mycred',
|
includes/mycred-blocks/blocks/mycred-my-ranks/mycred-my-ranks.php
CHANGED
@@ -1,22 +1,47 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
'mycred-my-ranks', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
-
}
|
11 |
|
12 |
-
|
13 |
-
'render_callback' => 'mycred_my_ranks_callback'
|
14 |
-
));
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
20 |
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_my_ranks_block') ) :
|
7 |
+
class mycred_my_ranks_block {
|
8 |
|
9 |
+
public function __construct() {
|
|
|
|
|
|
|
10 |
|
11 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
|
|
|
|
12 |
|
13 |
+
register_block_type(
|
14 |
+
'mycred-gb-blocks/mycred-my-ranks',
|
15 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
16 |
+
);
|
17 |
+
|
18 |
+
}
|
19 |
|
20 |
+
public function register_assets() {
|
21 |
+
|
22 |
+
wp_enqueue_script(
|
23 |
+
'mycred-my-ranks',
|
24 |
+
plugins_url('index.js', __FILE__),
|
25 |
+
array(
|
26 |
+
'wp-blocks',
|
27 |
+
'wp-element',
|
28 |
+
'wp-components',
|
29 |
+
'wp-editor'
|
30 |
+
)
|
31 |
+
);
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
public function render_block( $attributes, $content ) {
|
36 |
+
|
37 |
+
if ( empty( $attributes['ctype'] ) )
|
38 |
+
$attributes['ctype'] = 'mycred_default';
|
39 |
+
|
40 |
+
return "[mycred_my_ranks " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]";
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
45 |
+
endif;
|
46 |
+
|
47 |
+
new mycred_my_ranks_block();
|
includes/mycred-blocks/blocks/mycred-total-balance/index.js
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
var TextareaControl = wp.components.TextareaControl;
|
8 |
|
9 |
var __ = wp.i18n.__;
|
10 |
-
registerBlockType('mycred-blocks/mycred-total-balance', {
|
11 |
title: __('Total Balance', 'mycred'),
|
12 |
category: 'mycred',
|
13 |
attributes: {
|
7 |
var TextareaControl = wp.components.TextareaControl;
|
8 |
|
9 |
var __ = wp.i18n.__;
|
10 |
+
registerBlockType('mycred-gb-blocks/mycred-total-balance', {
|
11 |
title: __('Total Balance', 'mycred'),
|
12 |
category: 'mycred',
|
13 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-total-balance/mycred-total-balance.php
CHANGED
@@ -1,21 +1,47 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
'mycred-total-balance', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
-
}
|
11 |
|
12 |
-
|
13 |
-
'render_callback' => 'mycred_total_balance_callback'
|
14 |
-
));
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
19 |
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_total_balance_block') ) :
|
7 |
+
class mycred_total_balance_block {
|
8 |
|
9 |
+
public function __construct() {
|
|
|
|
|
|
|
10 |
|
11 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
|
|
|
|
12 |
|
13 |
+
register_block_type(
|
14 |
+
'mycred-gb-blocks/mycred-total-balance',
|
15 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
16 |
+
);
|
17 |
+
|
18 |
+
}
|
19 |
|
20 |
+
public function register_assets() {
|
21 |
+
|
22 |
+
wp_enqueue_script(
|
23 |
+
'mycred-total-balance',
|
24 |
+
plugins_url('index.js', __FILE__),
|
25 |
+
array(
|
26 |
+
'wp-blocks',
|
27 |
+
'wp-element',
|
28 |
+
'wp-components',
|
29 |
+
'wp-editor',
|
30 |
+
)
|
31 |
+
);
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
public function render_block( $attributes, $content ) {
|
36 |
+
|
37 |
+
if ( empty( $attributes['types'] ) )
|
38 |
+
$attributes['types'] = 'mycred_default';
|
39 |
+
|
40 |
+
return "[mycred_total_balance " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]";
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
45 |
+
endif;
|
46 |
+
|
47 |
+
new mycred_total_balance_block();
|
includes/mycred-blocks/blocks/mycred-total-pts/index.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
var ToggleControl = wp.components.ToggleControl;
|
7 |
var SelectControl = wp.components.SelectControl;
|
8 |
var __ = wp.i18n.__;
|
9 |
-
registerBlockType('mycred-blocks/mycred-total-pts', {
|
10 |
title: __('Total Points', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
6 |
var ToggleControl = wp.components.ToggleControl;
|
7 |
var SelectControl = wp.components.SelectControl;
|
8 |
var __ = wp.i18n.__;
|
9 |
+
registerBlockType('mycred-gb-blocks/mycred-total-pts', {
|
10 |
title: __('Total Points', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-total-pts/mycred-total-pts.php
CHANGED
@@ -1,22 +1,48 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
'mycred-total-pts', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
-
}
|
11 |
|
12 |
-
|
13 |
-
'render_callback' => 'mycred_total_pts_callback'
|
14 |
-
));
|
15 |
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
-
|
19 |
-
$attributes['type'] = 'mycred_default';
|
20 |
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_total_points_block') ) :
|
7 |
+
class mycred_total_points_block {
|
8 |
|
9 |
+
public function __construct() {
|
|
|
|
|
|
|
10 |
|
11 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
|
|
|
|
12 |
|
13 |
+
register_block_type(
|
14 |
+
'mycred-gb-blocks/mycred-total-pts',
|
15 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
16 |
+
);
|
17 |
+
|
18 |
+
}
|
19 |
|
20 |
+
public function register_assets() {
|
|
|
21 |
|
22 |
+
wp_enqueue_script(
|
23 |
+
'mycred-total-pts',
|
24 |
+
plugins_url('index.js', __FILE__),
|
25 |
+
array(
|
26 |
+
'wp-blocks',
|
27 |
+
'wp-element',
|
28 |
+
'wp-components',
|
29 |
+
'wp-editor',
|
30 |
+
'wp-rich-text'
|
31 |
+
)
|
32 |
+
);
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
public function render_block( $attributes, $content ) {
|
37 |
+
|
38 |
+
if ( empty( $attributes['type'] ) )
|
39 |
+
$attributes['type'] = 'mycred_default';
|
40 |
+
|
41 |
+
return "[mycred_total_points " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]";
|
42 |
+
|
43 |
+
}
|
44 |
+
|
45 |
+
}
|
46 |
+
endif;
|
47 |
+
|
48 |
+
new mycred_total_points_block();
|
includes/mycred-blocks/blocks/mycred-total-since/index.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
var ToggleControl = wp.components.ToggleControl;
|
7 |
var SelectControl = wp.components.SelectControl;
|
8 |
var __ = wp.i18n.__;
|
9 |
-
registerBlockType('mycred-blocks/mycred-total-since', {
|
10 |
title: __('Total Since', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
6 |
var ToggleControl = wp.components.ToggleControl;
|
7 |
var SelectControl = wp.components.SelectControl;
|
8 |
var __ = wp.i18n.__;
|
9 |
+
registerBlockType('mycred-gb-blocks/mycred-total-since', {
|
10 |
title: __('Total Since', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-total-since/mycred-total-since.php
CHANGED
@@ -1,22 +1,47 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
'mycred-total-since', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
-
}
|
11 |
|
12 |
-
|
13 |
-
'render_callback' => 'mycred_total_since_callback'
|
14 |
-
));
|
15 |
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
-
|
19 |
-
$attributes['type'] = 'mycred_default';
|
20 |
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_total_since_block') ) :
|
7 |
+
class mycred_total_since_block {
|
8 |
|
9 |
+
public function __construct() {
|
|
|
|
|
|
|
10 |
|
11 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
|
|
|
|
12 |
|
13 |
+
register_block_type(
|
14 |
+
'mycred-gb-blocks/mycred-total-since',
|
15 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
16 |
+
);
|
17 |
+
|
18 |
+
}
|
19 |
|
20 |
+
public function register_assets() {
|
|
|
21 |
|
22 |
+
wp_enqueue_script(
|
23 |
+
'mycred-total-since',
|
24 |
+
plugins_url('index.js', __FILE__),
|
25 |
+
array(
|
26 |
+
'wp-blocks',
|
27 |
+
'wp-element',
|
28 |
+
'wp-components',
|
29 |
+
'wp-editor'
|
30 |
+
)
|
31 |
+
);
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
public function render_block( $attributes, $content ) {
|
36 |
+
|
37 |
+
if ( empty( $attributes['type'] ) )
|
38 |
+
$attributes['type'] = 'mycred_default';
|
39 |
+
|
40 |
+
return "[mycred_total_since " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]";
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
45 |
+
endif;
|
46 |
+
|
47 |
+
new mycred_total_since_block();
|
includes/mycred-blocks/blocks/mycred-transfer/index.js
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
var TextareaControl = wp.components.TextareaControl;
|
8 |
|
9 |
var __ = wp.i18n.__;
|
10 |
-
registerBlockType('mycred-blocks/mycred-transfers', {
|
11 |
title: __('Transfer', 'mycred'),
|
12 |
category: 'mycred',
|
13 |
attributes: {
|
7 |
var TextareaControl = wp.components.TextareaControl;
|
8 |
|
9 |
var __ = wp.i18n.__;
|
10 |
+
registerBlockType('mycred-gb-blocks/mycred-transfers', {
|
11 |
title: __('Transfer', 'mycred'),
|
12 |
category: 'mycred',
|
13 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-transfer/mycred-transfer.php
CHANGED
@@ -1,17 +1,44 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
'mycred-transfers', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
8 |
-
);
|
9 |
-
}
|
10 |
|
11 |
-
|
12 |
-
'render_callback' => 'mycred_transfer_callback'
|
13 |
-
));
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_transfer_block') ) :
|
7 |
+
class mycred_transfer_block {
|
|
|
|
|
|
|
8 |
|
9 |
+
public function __construct() {
|
|
|
|
|
10 |
|
11 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
12 |
+
|
13 |
+
register_block_type(
|
14 |
+
'mycred-gb-blocks/mycred-transfers',
|
15 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
16 |
+
);
|
17 |
+
|
18 |
+
}
|
19 |
+
|
20 |
+
public function register_assets() {
|
21 |
+
|
22 |
+
wp_enqueue_script(
|
23 |
+
'mycred-transfers',
|
24 |
+
plugins_url('index.js', __FILE__),
|
25 |
+
array(
|
26 |
+
'wp-blocks',
|
27 |
+
'wp-element',
|
28 |
+
'wp-components',
|
29 |
+
'wp-editor'
|
30 |
+
)
|
31 |
+
);
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
public function render_block( $attributes, $content ) {
|
36 |
+
|
37 |
+
return "[mycred_transfer " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]";
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
+
}
|
42 |
+
endif;
|
43 |
+
|
44 |
+
new mycred_transfer_block();
|
includes/mycred-blocks/blocks/mycred-users-of-all-ranks/index.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
var ToggleControl = wp.components.ToggleControl;
|
7 |
var SelectControl = wp.components.SelectControl;
|
8 |
var __ = wp.i18n.__;
|
9 |
-
registerBlockType('mycred-blocks/mycred-users-of-all-ranks', {
|
10 |
title: __('Users of all ranks', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
6 |
var ToggleControl = wp.components.ToggleControl;
|
7 |
var SelectControl = wp.components.SelectControl;
|
8 |
var __ = wp.i18n.__;
|
9 |
+
registerBlockType('mycred-gb-blocks/mycred-users-of-all-ranks', {
|
10 |
title: __('Users of all ranks', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-users-of-all-ranks/mycred-users-of-all-ranks.php
CHANGED
@@ -1,22 +1,47 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
'mycred-users-of-all-ranks', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
-
}
|
11 |
|
12 |
-
|
13 |
-
'render_callback' => 'mycred_users_of_all_ranks_callback'
|
14 |
-
));
|
15 |
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
-
|
19 |
-
$attributes['ctype'] = 'mycred_default';
|
20 |
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_users_of_all_ranks_block') ) :
|
7 |
+
class mycred_users_of_all_ranks_block {
|
8 |
|
9 |
+
public function __construct() {
|
|
|
|
|
|
|
10 |
|
11 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
|
|
|
|
12 |
|
13 |
+
register_block_type(
|
14 |
+
'mycred-gb-blocks/mycred-users-of-all-ranks',
|
15 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
16 |
+
);
|
17 |
+
|
18 |
+
}
|
19 |
|
20 |
+
public function register_assets() {
|
|
|
21 |
|
22 |
+
wp_enqueue_script(
|
23 |
+
'mycred-users-of-all-ranks',
|
24 |
+
plugins_url('index.js', __FILE__),
|
25 |
+
array(
|
26 |
+
'wp-blocks',
|
27 |
+
'wp-element',
|
28 |
+
'wp-components',
|
29 |
+
'wp-editor'
|
30 |
+
)
|
31 |
+
);
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
public function render_block( $attributes, $content ) {
|
36 |
+
|
37 |
+
if ( empty( $attributes['ctype'] ) )
|
38 |
+
$attributes['ctype'] = 'mycred_default';
|
39 |
+
|
40 |
+
return "[mycred_users_of_all_ranks " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]";
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
45 |
+
endif;
|
46 |
+
|
47 |
+
new mycred_users_of_all_ranks_block();
|
includes/mycred-blocks/blocks/mycred-users-of-rank/index.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
var SelectControl = wp.components.SelectControl;
|
7 |
var __ = wp.i18n.__;
|
8 |
|
9 |
-
registerBlockType('mycred-blocks/mycred-users-of-rank', {
|
10 |
title: __('Users of rank', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
6 |
var SelectControl = wp.components.SelectControl;
|
7 |
var __ = wp.i18n.__;
|
8 |
|
9 |
+
registerBlockType('mycred-gb-blocks/mycred-users-of-rank', {
|
10 |
title: __('Users of rank', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-users-of-rank/mycred-users-of-rank.php
CHANGED
@@ -1,22 +1,47 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
'mycred-users-of-rank', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
-
}
|
11 |
|
12 |
-
|
13 |
-
'render_callback' => 'mycred_users_of_rank_callback'
|
14 |
-
));
|
15 |
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
-
|
19 |
-
$attributes['ctype'] = 'mycred_default';
|
20 |
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_users_of_rank_block') ) :
|
7 |
+
class mycred_users_of_rank_block {
|
8 |
|
9 |
+
public function __construct() {
|
|
|
|
|
|
|
10 |
|
11 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
|
|
|
|
12 |
|
13 |
+
register_block_type(
|
14 |
+
'mycred-gb-blocks/mycred-users-of-rank',
|
15 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
16 |
+
);
|
17 |
+
|
18 |
+
}
|
19 |
|
20 |
+
public function register_assets() {
|
|
|
21 |
|
22 |
+
wp_enqueue_script(
|
23 |
+
'mycred-users-of-rank',
|
24 |
+
plugins_url('index.js', __FILE__),
|
25 |
+
array(
|
26 |
+
'wp-blocks',
|
27 |
+
'wp-element',
|
28 |
+
'wp-components',
|
29 |
+
'wp-editor'
|
30 |
+
)
|
31 |
+
);
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
public function render_block( $attributes, $content ) {
|
36 |
+
|
37 |
+
if ( empty( $attributes['ctype'] ) )
|
38 |
+
$attributes['ctype'] = 'mycred_default';
|
39 |
+
|
40 |
+
return "[mycred_users_of_rank " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]";
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
45 |
+
endif;
|
46 |
+
|
47 |
+
new mycred_users_of_rank_block();
|
includes/mycred-blocks/blocks/mycred-video/index.js
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
var SelectControl = wp.components.SelectControl;
|
7 |
|
8 |
var __ = wp.i18n.__;
|
9 |
-
registerBlockType('mycred-blocks/mycred-video', {
|
10 |
title: __('Video', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
6 |
var SelectControl = wp.components.SelectControl;
|
7 |
|
8 |
var __ = wp.i18n.__;
|
9 |
+
registerBlockType('mycred-gb-blocks/mycred-video', {
|
10 |
title: __('Video', 'mycred'),
|
11 |
category: 'mycred',
|
12 |
attributes: {
|
includes/mycred-blocks/blocks/mycred-video/mycred-video.php
CHANGED
@@ -1,22 +1,47 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
'mycred-video', plugins_url('index.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-components', 'wp-editor')
|
9 |
-
);
|
10 |
-
}
|
11 |
|
12 |
-
|
13 |
-
'render_callback' => 'mycred_video_callback'
|
14 |
-
));
|
15 |
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
-
|
19 |
-
$attributes['ctype'] = 'mycred_default';
|
20 |
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
5 |
|
6 |
+
if ( ! class_exists('mycred_video_block') ) :
|
7 |
+
class mycred_video_block {
|
8 |
|
9 |
+
public function __construct() {
|
|
|
|
|
|
|
10 |
|
11 |
+
add_action('enqueue_block_editor_assets', array( $this, 'register_assets' ) );
|
|
|
|
|
12 |
|
13 |
+
register_block_type(
|
14 |
+
'mycred-gb-blocks/mycred-video',
|
15 |
+
array( 'render_callback' => array( $this, 'render_block' ) )
|
16 |
+
);
|
17 |
+
|
18 |
+
}
|
19 |
|
20 |
+
public function register_assets() {
|
|
|
21 |
|
22 |
+
wp_enqueue_script(
|
23 |
+
'mycred-video',
|
24 |
+
plugins_url('index.js', __FILE__),
|
25 |
+
array(
|
26 |
+
'wp-blocks',
|
27 |
+
'wp-element',
|
28 |
+
'wp-components',
|
29 |
+
'wp-editor'
|
30 |
+
)
|
31 |
+
);
|
32 |
+
|
33 |
+
}
|
34 |
+
|
35 |
+
public function render_block( $attributes, $content ) {
|
36 |
+
|
37 |
+
if ( empty( $attributes['ctype'] ) )
|
38 |
+
$attributes['ctype'] = 'mycred_default';
|
39 |
+
|
40 |
+
return "[mycred_video " . mycred_blocks_functions::mycred_extract_attributes( $attributes ) . "]";
|
41 |
+
|
42 |
+
}
|
43 |
+
|
44 |
+
}
|
45 |
+
endif;
|
46 |
+
|
47 |
+
new mycred_video_block();
|
includes/mycred-blocks/includes/mycred-gutenberg-functions.php
CHANGED
@@ -1,29 +1,20 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
|
4 |
-
if (empty($attributes)) {
|
5 |
-
return;
|
6 |
-
}
|
7 |
-
foreach ($attributes as $k => $attribute) {
|
8 |
-
$attr[] = $k . '=' . "'" . $attribute . "'";
|
9 |
-
}
|
10 |
-
return implode(' ',$attr);
|
11 |
-
}
|
12 |
|
13 |
-
if (
|
14 |
-
|
15 |
-
} else {
|
16 |
-
add_filter('block_categories_all', 'mb_block_categories', 10, 2);
|
17 |
-
}
|
18 |
|
19 |
-
function
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
}
|
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) exit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
+
if ( ! class_exists('mycred_blocks_functions') ) :
|
7 |
+
class mycred_blocks_functions {
|
|
|
|
|
|
|
8 |
|
9 |
+
public static function mycred_extract_attributes($attributes) {
|
10 |
+
if (empty($attributes)) {
|
11 |
+
return;
|
12 |
+
}
|
13 |
+
foreach ($attributes as $k => $attribute) {
|
14 |
+
$attr[] = $k . '=' . "'" . $attribute . "'";
|
15 |
+
}
|
16 |
+
return implode(' ',$attr);
|
17 |
+
}
|
18 |
+
|
19 |
+
}
|
20 |
+
endif;
|
includes/mycred-blocks/mycred-blocks.php
CHANGED
@@ -1,12 +1,13 @@
|
|
1 |
<?php
|
|
|
2 |
|
3 |
-
if (!defined('ABSPATH')) {
|
4 |
exit; // Exit if accessed directly.
|
5 |
}
|
6 |
|
7 |
-
define( '
|
8 |
-
define( '
|
9 |
-
define( '
|
10 |
|
11 |
final class MyCred_Gutenberg {
|
12 |
|
@@ -43,6 +44,7 @@ final class MyCred_Gutenberg {
|
|
43 |
return;
|
44 |
|
45 |
$this->includes();
|
|
|
46 |
add_action('init', [$this, 'load_modules']);
|
47 |
}
|
48 |
|
@@ -62,6 +64,24 @@ final class MyCred_Gutenberg {
|
|
62 |
require_once( __DIR__ . '/includes/mycred-gutenberg-functions.php' );
|
63 |
}
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
public function load_modules() {
|
66 |
|
67 |
$mycred_modules = [
|
1 |
<?php
|
2 |
+
namespace MG_Blocks;
|
3 |
|
4 |
+
if ( ! defined('ABSPATH') ) {
|
5 |
exit; // Exit if accessed directly.
|
6 |
}
|
7 |
|
8 |
+
define( 'mycred_gb_gutenberg_SLUG', 'mycred-gutenberg-blocks' );
|
9 |
+
define( 'mycred_gb_gutenberg_VERSION', '1.1.2' );
|
10 |
+
define( 'mycred_gb_gutenberg', __FILE__ );
|
11 |
|
12 |
final class MyCred_Gutenberg {
|
13 |
|
44 |
return;
|
45 |
|
46 |
$this->includes();
|
47 |
+
$this->register_block_category();
|
48 |
add_action('init', [$this, 'load_modules']);
|
49 |
}
|
50 |
|
64 |
require_once( __DIR__ . '/includes/mycred-gutenberg-functions.php' );
|
65 |
}
|
66 |
|
67 |
+
public function register_block_category() {
|
68 |
+
|
69 |
+
add_filter( 'block_categories_all', array( $this, 'mb_block_categories' ), 10, 2 );
|
70 |
+
|
71 |
+
}
|
72 |
+
|
73 |
+
public function mb_block_categories( $categories, $post ) {
|
74 |
+
return array_merge(
|
75 |
+
$categories,
|
76 |
+
array(
|
77 |
+
array(
|
78 |
+
'slug' => 'mycred',
|
79 |
+
'title' => __('MYCRED', 'mycred'),
|
80 |
+
),
|
81 |
+
)
|
82 |
+
);
|
83 |
+
}
|
84 |
+
|
85 |
public function load_modules() {
|
86 |
|
87 |
$mycred_modules = [
|
includes/mycred-functions.php
CHANGED
@@ -1297,7 +1297,7 @@ if ( ! class_exists( 'myCRED_Settings' ) ) :
|
|
1297 |
// Minimum Requirements: User id and amount can not be null
|
1298 |
if ( $user_id === NULL || $amount === NULL || $amount == $this->zero() ) return $amount;
|
1299 |
|
1300 |
-
global $mycred_types, $mycred_current_account;
|
1301 |
|
1302 |
// Point type
|
1303 |
if ( $point_type === NULL || ! array_key_exists( $point_type, $mycred_types ) )
|
@@ -1318,6 +1318,9 @@ if ( ! class_exists( 'myCRED_Settings' ) ) :
|
|
1318 |
if ( mycred_is_current_account( $user_id ) && $mycred_current_account->balance[ $point_type ] !== false )
|
1319 |
$mycred_current_account->balance[ $point_type ]->set( 'current', $new_balance );
|
1320 |
|
|
|
|
|
|
|
1321 |
// Let others play
|
1322 |
do_action( 'mycred_update_user_balance', $user_id, $current_balance, $amount, $point_type );
|
1323 |
|
@@ -1340,7 +1343,7 @@ if ( ! class_exists( 'myCRED_Settings' ) ) :
|
|
1340 |
|
1341 |
if ( ! MYCRED_ENABLE_TOTAL_BALANCE || ! MYCRED_ENABLE_LOGGING || $amount == 0 ) return $amount;
|
1342 |
|
1343 |
-
global $mycred_current_account;
|
1344 |
|
1345 |
if ( mycred_is_current_account( $user_id ) && $mycred_current_account->balance[ $point_type ] !== false )
|
1346 |
$total_balance = $mycred_current_account->balance[ $point_type ]->get( 'accumulated' );
|
@@ -1358,6 +1361,9 @@ if ( ! class_exists( 'myCRED_Settings' ) ) :
|
|
1358 |
|
1359 |
if ( mycred_is_current_account( $user_id ) && $mycred_current_account->balance[ $point_type ] !== false )
|
1360 |
$mycred_current_account->balance[ $point_type ]->set( 'accumulated', $total_balance );
|
|
|
|
|
|
|
1361 |
|
1362 |
do_action( 'mycred_update_user_total_balance', $total_balance, $user_id, $point_type, $this );
|
1363 |
|
@@ -4279,4 +4285,94 @@ function mycred_sanitize_array( $_array )
|
|
4279 |
|
4280 |
return $_array;
|
4281 |
}
|
4282 |
-
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1297 |
// Minimum Requirements: User id and amount can not be null
|
1298 |
if ( $user_id === NULL || $amount === NULL || $amount == $this->zero() ) return $amount;
|
1299 |
|
1300 |
+
global $mycred_types, $mycred_current_account, $mycred_account;
|
1301 |
|
1302 |
// Point type
|
1303 |
if ( $point_type === NULL || ! array_key_exists( $point_type, $mycred_types ) )
|
1318 |
if ( mycred_is_current_account( $user_id ) && $mycred_current_account->balance[ $point_type ] !== false )
|
1319 |
$mycred_current_account->balance[ $point_type ]->set( 'current', $new_balance );
|
1320 |
|
1321 |
+
if ( mycred_is_account( $user_id ) && $mycred_account->balance[ $point_type ] !== false )
|
1322 |
+
$mycred_account->balance[ $point_type ]->set( 'current', $new_balance );
|
1323 |
+
|
1324 |
// Let others play
|
1325 |
do_action( 'mycred_update_user_balance', $user_id, $current_balance, $amount, $point_type );
|
1326 |
|
1343 |
|
1344 |
if ( ! MYCRED_ENABLE_TOTAL_BALANCE || ! MYCRED_ENABLE_LOGGING || $amount == 0 ) return $amount;
|
1345 |
|
1346 |
+
global $mycred_current_account, $mycred_account;
|
1347 |
|
1348 |
if ( mycred_is_current_account( $user_id ) && $mycred_current_account->balance[ $point_type ] !== false )
|
1349 |
$total_balance = $mycred_current_account->balance[ $point_type ]->get( 'accumulated' );
|
1361 |
|
1362 |
if ( mycred_is_current_account( $user_id ) && $mycred_current_account->balance[ $point_type ] !== false )
|
1363 |
$mycred_current_account->balance[ $point_type ]->set( 'accumulated', $total_balance );
|
1364 |
+
|
1365 |
+
if ( mycred_is_account( $user_id ) && $mycred_account->balance[ $point_type ] !== false )
|
1366 |
+
$mycred_account->balance[ $point_type ]->set( 'accumulated', $total_balance );
|
1367 |
|
1368 |
do_action( 'mycred_update_user_total_balance', $total_balance, $user_id, $point_type, $this );
|
1369 |
|
4285 |
|
4286 |
return $_array;
|
4287 |
}
|
4288 |
+
endif;
|
4289 |
+
|
4290 |
+
/**
|
4291 |
+
* Get encrypted values
|
4292 |
+
* @since 2.4.1
|
4293 |
+
* @since 1.0
|
4294 |
+
*/
|
4295 |
+
if ( ! function_exists( 'mycred_encode_values' ) ) :
|
4296 |
+
function mycred_encode_values($value) {
|
4297 |
+
|
4298 |
+
|
4299 |
+
if ( $value === '' ) {
|
4300 |
+
return false;
|
4301 |
+
}
|
4302 |
+
|
4303 |
+
$key = sha1( AUTH_KEY );
|
4304 |
+
$strLen = strlen($value);
|
4305 |
+
$keyLen = strlen($key);
|
4306 |
+
$j = 0;
|
4307 |
+
$crypttext = '';
|
4308 |
+
|
4309 |
+
for ($i = 0; $i < $strLen; $i++) {
|
4310 |
+
$ordStr = ord(substr($value, $i, 1));
|
4311 |
+
if ($j == $keyLen) {
|
4312 |
+
$j = 0;
|
4313 |
+
}
|
4314 |
+
$ordKey = ord(substr($key, $j, 1));
|
4315 |
+
$j++;
|
4316 |
+
$crypttext .= strrev(base_convert(dechex($ordStr + $ordKey), 16, 36));
|
4317 |
+
}
|
4318 |
+
|
4319 |
+
return $crypttext;
|
4320 |
+
}
|
4321 |
+
endif;
|
4322 |
+
|
4323 |
+
|
4324 |
+
/**
|
4325 |
+
* Get decrypted values
|
4326 |
+
* @since 2.4.1
|
4327 |
+
* @since 1.0
|
4328 |
+
*/
|
4329 |
+
if ( ! function_exists( 'mycred_decode_values' ) ) :
|
4330 |
+
function mycred_decode_values($value) {
|
4331 |
+
|
4332 |
+
if ( $value == '' ) {
|
4333 |
+
return false;
|
4334 |
+
}
|
4335 |
+
|
4336 |
+
$key = sha1( AUTH_KEY );
|
4337 |
+
$strLen = strlen($value);
|
4338 |
+
$keyLen = strlen($key);
|
4339 |
+
$j = 0;
|
4340 |
+
$decrypttext = '';
|
4341 |
+
|
4342 |
+
for ($i = 0; $i < $strLen; $i += 2) {
|
4343 |
+
$ordStr = hexdec(base_convert(strrev(substr($value, $i, 2)), 36, 16));
|
4344 |
+
if ($j == $keyLen) {
|
4345 |
+
$j = 0;
|
4346 |
+
}
|
4347 |
+
$ordKey = ord(substr($key, $j, 1));
|
4348 |
+
$j++;
|
4349 |
+
$decrypttext .= chr($ordStr - $ordKey);
|
4350 |
+
}
|
4351 |
+
|
4352 |
+
return $decrypttext;
|
4353 |
+
}
|
4354 |
+
endif;
|
4355 |
+
|
4356 |
+
/**
|
4357 |
+
* @since 4.2.1
|
4358 |
+
* @version 1.0
|
4359 |
+
*/
|
4360 |
+
function mycred_get_users_by_name_email( $query, $get = 'ID' )
|
4361 |
+
{
|
4362 |
+
global $wpdb;
|
4363 |
+
|
4364 |
+
$results = array();
|
4365 |
+
|
4366 |
+
$query = "%{$query}%";
|
4367 |
+
|
4368 |
+
$results['results'] = $wpdb->get_results(
|
4369 |
+
$wpdb->prepare(
|
4370 |
+
"SELECT {$get} as `id`, user_login as `text` FROM {$wpdb->users} WHERE user_login LIKE %s || user_email LIKE %s",
|
4371 |
+
$query,
|
4372 |
+
$query
|
4373 |
+
),
|
4374 |
+
ARRAY_A
|
4375 |
+
);
|
4376 |
+
|
4377 |
+
return $results;
|
4378 |
+
}
|
includes/mycred-tools.php
CHANGED
@@ -15,6 +15,8 @@ class myCRED_Tools {
|
|
15 |
|
16 |
add_action( 'admin_menu', array( $this, 'tools_sub_menu' ) );
|
17 |
|
|
|
|
|
18 |
if( isset( $_GET['page'] ) && $_GET['page'] == 'mycred-tools' )
|
19 |
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
20 |
|
@@ -385,6 +387,25 @@ class myCRED_Tools {
|
|
385 |
|
386 |
endif;
|
387 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
388 |
}
|
389 |
endif;
|
390 |
|
15 |
|
16 |
add_action( 'admin_menu', array( $this, 'tools_sub_menu' ) );
|
17 |
|
18 |
+
add_action( 'wp_ajax_mycred-tools-select-user', array( $this, 'tools_select_user' ) );
|
19 |
+
|
20 |
if( isset( $_GET['page'] ) && $_GET['page'] == 'mycred-tools' )
|
21 |
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
22 |
|
387 |
|
388 |
endif;
|
389 |
}
|
390 |
+
|
391 |
+
/**
|
392 |
+
* Ajax Call-back
|
393 |
+
* @since 2.4.1
|
394 |
+
* @version 1.0
|
395 |
+
*/
|
396 |
+
public function tools_select_user()
|
397 |
+
{
|
398 |
+
if( isset( $_GET['action'] ) && $_GET['action'] == 'mycred-tools-select-user' )
|
399 |
+
{
|
400 |
+
$search = sanitize_text_field( $_GET['search'] );
|
401 |
+
|
402 |
+
$results = mycred_get_users_by_name_email( $search, 'user_email' );
|
403 |
+
|
404 |
+
echo json_encode( $results );
|
405 |
+
|
406 |
+
die;
|
407 |
+
}
|
408 |
+
}
|
409 |
}
|
410 |
endif;
|
411 |
|
includes/shortcodes/mycred_video.php
CHANGED
@@ -16,13 +16,15 @@ if ( ! function_exists( 'mycred_render_shortcode_video' ) ) :
|
|
16 |
global $mycred_video_points;
|
17 |
|
18 |
extract( shortcode_atts( array(
|
19 |
-
'id'
|
20 |
-
'width'
|
21 |
-
'height'
|
22 |
-
'amount'
|
23 |
-
'logic'
|
24 |
-
'interval'
|
25 |
-
'
|
|
|
|
|
26 |
), $atts, MYCRED_SLUG . '_video' ) );
|
27 |
|
28 |
$prf_hook = apply_filters( 'mycred_option_id', 'mycred_pref_hooks' );
|
@@ -42,6 +44,12 @@ if ( ! function_exists( 'mycred_render_shortcode_video' ) ) :
|
|
42 |
if ( $interval == '' )
|
43 |
$interval = $prefs['interval'];
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
// ID is required
|
46 |
if ( $id === NULL || empty( $id ) ) return __( 'A video ID is required for this shortcode', 'mycred' );
|
47 |
|
@@ -95,7 +103,7 @@ if ( ! function_exists( 'mycred_render_shortcode_video' ) ) :
|
|
95 |
if ( is_user_logged_in() ) :
|
96 |
|
97 |
?>
|
98 |
-
<script type="text/javascript">function mycred_vvideo_v<?php echo $video_id; ?>( state ) { duration[ "<?php echo $video_id; ?>" ] = state.target.getDuration(); mycred_view_video( "<?php echo $video_id; ?>", state.data, "<?php echo $logic; ?>", "<?php echo $interval; ?>", "<?php echo $key; ?>", "<?php echo $ctype; ?>" ); }</script>
|
99 |
<?php
|
100 |
|
101 |
endif;
|
16 |
global $mycred_video_points;
|
17 |
|
18 |
extract( shortcode_atts( array(
|
19 |
+
'id' => NULL,
|
20 |
+
'width' => 560,
|
21 |
+
'height' => 315,
|
22 |
+
'amount' => '',
|
23 |
+
'logic' => '',
|
24 |
+
'interval' => '',
|
25 |
+
'streaming' => '',
|
26 |
+
'duration' => '',
|
27 |
+
'ctype' => MYCRED_DEFAULT_TYPE_KEY
|
28 |
), $atts, MYCRED_SLUG . '_video' ) );
|
29 |
|
30 |
$prf_hook = apply_filters( 'mycred_option_id', 'mycred_pref_hooks' );
|
44 |
if ( $interval == '' )
|
45 |
$interval = $prefs['interval'];
|
46 |
|
47 |
+
if ( $streaming == '' )
|
48 |
+
$streaming = 'off';
|
49 |
+
|
50 |
+
if ( $duration == '' )
|
51 |
+
$duration = 300;
|
52 |
+
|
53 |
// ID is required
|
54 |
if ( $id === NULL || empty( $id ) ) return __( 'A video ID is required for this shortcode', 'mycred' );
|
55 |
|
103 |
if ( is_user_logged_in() ) :
|
104 |
|
105 |
?>
|
106 |
+
<script type="text/javascript">function mycred_vvideo_v<?php echo $video_id; ?>( state ) { duration[ "<?php echo $video_id; ?>" ] = state.target.getDuration(); mycred_view_video( "<?php echo $video_id; ?>", state.data, "<?php echo $logic; ?>", "<?php echo $interval; ?>", "<?php echo $key; ?>", "<?php echo $ctype; ?>" , "<?php echo mycred_encode_values($streaming); ?>" , "<?php echo mycred_encode_values($duration); ?>" ); }</script>
|
107 |
<?php
|
108 |
|
109 |
endif;
|
modules/mycred-module-buddypress.php
CHANGED
@@ -136,6 +136,8 @@ if ( ! class_exists( 'myCRED_BuddyPress_Module' ) ) :
|
|
136 |
|
137 |
echo apply_filters( 'mycred_bp_profile_details', $output, $balance, $this );
|
138 |
|
|
|
|
|
139 |
}
|
140 |
|
141 |
/**
|
@@ -157,6 +159,7 @@ if ( ! class_exists( 'myCRED_BuddyPress_Module' ) ) :
|
|
157 |
|
158 |
// Parse template
|
159 |
$template = $this->buddypress['balance_template'];
|
|
|
160 |
|
161 |
// Loop though all post types
|
162 |
$mycred_types = mycred_get_types();
|
@@ -177,9 +180,16 @@ if ( ! class_exists( 'myCRED_BuddyPress_Module' ) ) :
|
|
177 |
$balance = $mycred->get_users_balance( $user_id, $type );
|
178 |
|
179 |
// Output
|
180 |
-
$
|
181 |
-
|
182 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
|
184 |
}
|
185 |
|
@@ -187,6 +197,8 @@ if ( ! class_exists( 'myCRED_BuddyPress_Module' ) ) :
|
|
187 |
|
188 |
echo apply_filters( 'mycred_bp_profile_header', $output, $this->buddypress['balance_template'], $this );
|
189 |
|
|
|
|
|
190 |
}
|
191 |
|
192 |
/**
|
136 |
|
137 |
echo apply_filters( 'mycred_bp_profile_details', $output, $balance, $this );
|
138 |
|
139 |
+
do_action('mycred_buddypress_profile_details');
|
140 |
+
|
141 |
}
|
142 |
|
143 |
/**
|
159 |
|
160 |
// Parse template
|
161 |
$template = $this->buddypress['balance_template'];
|
162 |
+
$buddyboss_settings = mycred_get_addon_settings( 'buddyboss' );
|
163 |
|
164 |
// Loop though all post types
|
165 |
$mycred_types = mycred_get_types();
|
180 |
$balance = $mycred->get_users_balance( $user_id, $type );
|
181 |
|
182 |
// Output
|
183 |
+
if($buddyboss_settings['types']['sort'][$type] == true && class_exists( 'BuddyPress' ) && is_plugin_active('mycred-buddyboss/mycred-buddyboss.php')) {
|
184 |
+
$template = str_replace( '%label%', $label, $template );
|
185 |
+
$template = $mycred->template_tags_general( $template );
|
186 |
+
$output .= '<div class="mycred-balance mycred-' . $type . '">' . $template . ' ' . $mycred->format_creds( $balance ) . '</div>';
|
187 |
+
}
|
188 |
+
elseif(!is_plugin_active('mycred-buddyboss/mycred-buddyboss.php')) {
|
189 |
+
$template = str_replace( '%label%', $label, $template );
|
190 |
+
$template = $mycred->template_tags_general( $template );
|
191 |
+
$output .= '<div class="mycred-balance mycred-' . $type . '">' . $template . ' ' . $mycred->format_creds( $balance ) . '</div>';
|
192 |
+
}
|
193 |
|
194 |
}
|
195 |
|
197 |
|
198 |
echo apply_filters( 'mycred_bp_profile_header', $output, $this->buddypress['balance_template'], $this );
|
199 |
|
200 |
+
do_action('mycred_buddypress_profile_header');
|
201 |
+
|
202 |
}
|
203 |
|
204 |
/**
|
modules/mycred-module-management.php
CHANGED
@@ -513,6 +513,8 @@ if ( ! class_exists( 'myCRED_Management_Module' ) ) :
|
|
513 |
*/
|
514 |
public function show_my_balance( $user ) {
|
515 |
|
|
|
|
|
516 |
$user_id = $user->ID;
|
517 |
$editor_id = get_current_user_id();
|
518 |
$mycred_types = mycred_get_types( true );
|
513 |
*/
|
514 |
public function show_my_balance( $user ) {
|
515 |
|
516 |
+
if ( empty( $user->ID ) ) return;
|
517 |
+
|
518 |
$user_id = $user->ID;
|
519 |
$editor_id = get_current_user_id();
|
520 |
$mycred_types = mycred_get_types( true );
|
modules/mycred-module-settings.php
CHANGED
@@ -49,7 +49,7 @@ if ( ! class_exists( 'myCRED_Settings_Module' ) ) :
|
|
49 |
add_action( 'wp_ajax_mycred-action-export-balances', array( $this, 'action_export_balances' ) );
|
50 |
add_action( 'wp_ajax_mycred-action-generate-key', array( $this, 'action_generate_key' ) );
|
51 |
add_action( 'wp_ajax_mycred-action-max-decimals', array( $this, 'action_update_log_cred_format' ) );
|
52 |
-
|
53 |
}
|
54 |
|
55 |
/**
|
@@ -479,7 +479,8 @@ if ( ! class_exists( 'myCRED_Settings_Module' ) ) :
|
|
479 |
'export_close' => esc_attr__( 'Close', 'mycred' ),
|
480 |
'export_title' => $mycred->template_tags_general( esc_attr__( 'Export %singular% Balances', 'mycred' ) ),
|
481 |
'decimals' => esc_attr__( 'In order to adjust the number of decimal places you want to use we must update your log. It is highly recommended that you backup your current log before continuing!', 'mycred' ),
|
482 |
-
'fieldName' => $this->field_name()
|
|
|
483 |
)
|
484 |
);
|
485 |
wp_enqueue_script( 'mycred-type-management' );
|
@@ -572,8 +573,9 @@ if ( ! class_exists( 'myCRED_Settings_Module' ) ) :
|
|
572 |
$social[] = '<a href="https://twitter.com/my_cred" class="twitter" target="_blank">Twitter</a>';
|
573 |
|
574 |
// Exclude Users by ID
|
575 |
-
$
|
576 |
-
$
|
|
|
577 |
$excluded_ids_args = array(
|
578 |
'name' => $this->field_name( array( 'exclude' => 'list' ) ) . '[]',
|
579 |
'id' => $this->field_id( array( 'exclude' => 'list' ) ),
|
@@ -1199,22 +1201,6 @@ if ( ! class_exists( 'myCRED_Settings_Module' ) ) :
|
|
1199 |
|
1200 |
}
|
1201 |
|
1202 |
-
/**
|
1203 |
-
* @since 2.3
|
1204 |
-
* @version 1.0
|
1205 |
-
*/
|
1206 |
-
public function get_all_users()
|
1207 |
-
{
|
1208 |
-
$users = array();
|
1209 |
-
|
1210 |
-
$wp_users = get_users();
|
1211 |
-
|
1212 |
-
foreach( $wp_users as $user )
|
1213 |
-
$users[$user->ID] = $user->display_name;
|
1214 |
-
|
1215 |
-
return $users;
|
1216 |
-
}
|
1217 |
-
|
1218 |
/**
|
1219 |
* @since 2.3
|
1220 |
* @version 1.0
|
@@ -1241,6 +1227,45 @@ if ( ! class_exists( 'myCRED_Settings_Module' ) ) :
|
|
1241 |
return $user_ids;
|
1242 |
}
|
1243 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1244 |
}
|
1245 |
endif;
|
1246 |
|
49 |
add_action( 'wp_ajax_mycred-action-export-balances', array( $this, 'action_export_balances' ) );
|
50 |
add_action( 'wp_ajax_mycred-action-generate-key', array( $this, 'action_generate_key' ) );
|
51 |
add_action( 'wp_ajax_mycred-action-max-decimals', array( $this, 'action_update_log_cred_format' ) );
|
52 |
+
add_action( 'wp_ajax_mycred-get-users-to-exclude', array( $this, 'get_users' ) );
|
53 |
}
|
54 |
|
55 |
/**
|
479 |
'export_close' => esc_attr__( 'Close', 'mycred' ),
|
480 |
'export_title' => $mycred->template_tags_general( esc_attr__( 'Export %singular% Balances', 'mycred' ) ),
|
481 |
'decimals' => esc_attr__( 'In order to adjust the number of decimal places you want to use we must update your log. It is highly recommended that you backup your current log before continuing!', 'mycred' ),
|
482 |
+
'fieldName' => $this->field_name(),
|
483 |
+
'excludedUsers' => $this->get_excluded_users()
|
484 |
)
|
485 |
);
|
486 |
wp_enqueue_script( 'mycred-type-management' );
|
573 |
$social[] = '<a href="https://twitter.com/my_cred" class="twitter" target="_blank">Twitter</a>';
|
574 |
|
575 |
// Exclude Users by ID
|
576 |
+
$all_users = array();
|
577 |
+
$excluded_ids = array();
|
578 |
+
|
579 |
$excluded_ids_args = array(
|
580 |
'name' => $this->field_name( array( 'exclude' => 'list' ) ) . '[]',
|
581 |
'id' => $this->field_id( array( 'exclude' => 'list' ) ),
|
1201 |
|
1202 |
}
|
1203 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1204 |
/**
|
1205 |
* @since 2.3
|
1206 |
* @version 1.0
|
1227 |
return $user_ids;
|
1228 |
}
|
1229 |
|
1230 |
+
/**
|
1231 |
+
* Get users by username/ email ajax callback
|
1232 |
+
* @since 2.4.1
|
1233 |
+
* @version 1.0
|
1234 |
+
*/
|
1235 |
+
public function get_users()
|
1236 |
+
{
|
1237 |
+
if( isset( $_GET['action'] ) && $_GET['action'] == 'mycred-get-users-to-exclude' )
|
1238 |
+
{
|
1239 |
+
$search = sanitize_text_field( $_GET['search'] );
|
1240 |
+
|
1241 |
+
$results = mycred_get_users_by_name_email( $search );
|
1242 |
+
|
1243 |
+
echo json_encode( $results );
|
1244 |
+
|
1245 |
+
die;
|
1246 |
+
}
|
1247 |
+
}
|
1248 |
+
|
1249 |
+
public function get_excluded_users()
|
1250 |
+
{
|
1251 |
+
$users = array();
|
1252 |
+
|
1253 |
+
$user_ids = explode( ',', esc_attr( $this->core->exclude['list'] ) );
|
1254 |
+
|
1255 |
+
if( $user_ids[0] != '' )
|
1256 |
+
{
|
1257 |
+
foreach( $user_ids as $key => $user_id )
|
1258 |
+
{
|
1259 |
+
$user_data = get_userdata( $user_id );
|
1260 |
+
|
1261 |
+
$users[$key]['id'] = $user_data->ID;
|
1262 |
+
$users[$key]['text'] = $user_data->user_login;
|
1263 |
+
$users[$key]['selected'] = true;
|
1264 |
+
}
|
1265 |
+
}
|
1266 |
+
|
1267 |
+
return empty( $users ) ? false : $users;
|
1268 |
+
}
|
1269 |
}
|
1270 |
endif;
|
1271 |
|
mycred.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: myCred
|
4 |
* Plugin URI: https://mycred.me
|
5 |
* Description: An adaptive points management system for WordPress powered websites.
|
6 |
-
* Version: 2.4
|
7 |
* Tags: point, credit, loyalty program, engagement, reward, woocommerce rewards
|
8 |
* Author: myCred
|
9 |
* Author URI: https://mycred.me
|
@@ -20,7 +20,7 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
|
|
20 |
final class myCRED_Core {
|
21 |
|
22 |
// Plugin Version
|
23 |
-
public $version = '2.4';
|
24 |
|
25 |
// Instnace
|
26 |
protected static $_instance = NULL;
|
@@ -54,14 +54,14 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
|
|
54 |
* @since 1.7
|
55 |
* @version 1.0
|
56 |
*/
|
57 |
-
public function __clone() { _doing_it_wrong( __FUNCTION__, 'Cheatin’ huh?', '2.4' ); }
|
58 |
|
59 |
/**
|
60 |
* Not allowed
|
61 |
* @since 1.7
|
62 |
* @version 1.0
|
63 |
*/
|
64 |
-
public function __wakeup() { _doing_it_wrong( __FUNCTION__, 'Cheatin’ huh?', '2.4' ); }
|
65 |
|
66 |
/**
|
67 |
* Get
|
@@ -82,7 +82,7 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
|
|
82 |
if ( ! defined( $name ) )
|
83 |
define( $name, $value );
|
84 |
elseif ( ! $definable && defined( $name ) )
|
85 |
-
_doing_it_wrong( 'myCRED_Core->define()', 'Could not define: ' . $name . ' as it is already defined somewhere else!', '2.4' );
|
86 |
}
|
87 |
|
88 |
/**
|
@@ -94,7 +94,7 @@ if ( ! class_exists( 'myCRED_Core' ) ) :
|
|
94 |
if ( file_exists( $required_file ) )
|
95 |
require_once $required_file;
|
96 |
else
|
97 |
-
_doing_it_wrong( 'myCRED_Core->file()', 'Requested file ' . $required_file . ' not found.', '2.4' );
|
98 |
}
|
99 |
|
100 |
/**
|
3 |
* Plugin Name: myCred
|
4 |
* Plugin URI: https://mycred.me
|
5 |
* Description: An adaptive points management system for WordPress powered websites.
|
6 |
+
* Version: 2.4.1
|
7 |
* Tags: point, credit, loyalty program, engagement, reward, woocommerce rewards
|
8 |
* Author: myCred
|
9 |
* Author URI: https://mycred.me
|
20 |
final class myCRED_Core {
|
21 |
|
22 |
// Plugin Version
|
23 |
+
public $version = '2.4.1';
|
24 |
|
25 |
// Instnace
|
26 |
protected static $_instance = NULL;
|
54 |
* @since 1.7
|
55 |
* @version 1.0
|
56 |
*/
|
57 |
+
public function __clone() { _doing_it_wrong( __FUNCTION__, 'Cheatin’ huh?', '2.4.1' ); }
|
58 |
|
59 |
/**
|
60 |
* Not allowed
|
61 |
* @since 1.7
|
62 |
* @version 1.0
|
63 |
*/
|
64 |
+
public function __wakeup() { _doing_it_wrong( __FUNCTION__, 'Cheatin’ huh?', '2.4.1' ); }
|
65 |
|
66 |
/**
|
67 |
* Get
|
82 |
if ( ! defined( $name ) )
|
83 |
define( $name, $value );
|
84 |
elseif ( ! $definable && defined( $name ) )
|
85 |
+
_doing_it_wrong( 'myCRED_Core->define()', 'Could not define: ' . $name . ' as it is already defined somewhere else!', '2.4.1' );
|
86 |
}
|
87 |
|
88 |
/**
|
94 |
if ( file_exists( $required_file ) )
|
95 |
require_once $required_file;
|
96 |
else
|
97 |
+
_doing_it_wrong( 'myCRED_Core->file()', 'Requested file ' . $required_file . ' not found.', '2.4.1' );
|
98 |
}
|
99 |
|
100 |
/**
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: mycred,wpexpertsio
|
|
3 |
Tags: badges, gamification, loyalty, points, rewards
|
4 |
Requires at least: 4.8
|
5 |
Tested up to: 5.8.2
|
6 |
-
Stable tag: 2.4
|
7 |
Requires PHP: 7.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -35,6 +35,7 @@ myCred allows **THREE different ways** through which you can award your users:
|
|
35 |
**myCred v2.4** focuses on expanding the plugin’s ability to import and export points, ranks, and badges from and to other sites. What’s better is that you can choose to export or import complete setup settings like point types, achievements level, and created badges with achievements level with the simplest of ease.
|
36 |
|
37 |
Here is a list of the complete features introduced in myCred v2.4:
|
|
|
38 |
* Import or export user points
|
39 |
* Export all or specific point types
|
40 |
* Export setup settings for all point types
|
@@ -299,6 +300,9 @@ You can find a list of [frequently asked questions](https://mycred.me/about/faq/
|
|
299 |
|
300 |
== Upgrade Notice ==
|
301 |
|
|
|
|
|
|
|
302 |
= 2.4 =
|
303 |
New features and Bug fixes.
|
304 |
|
@@ -344,6 +348,17 @@ The banking module have been replaced by Central deposite module, and interest r
|
|
344 |
|
345 |
== Changelog ==
|
346 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
347 |
= 2.4 =
|
348 |
- **NEW** - Introduced an Import/Export tool.
|
349 |
- **NEW** - Admin can assign "Badges" and "Manual Ranks" using coupons.
|
@@ -372,7 +387,7 @@ The banking module have been replaced by Central deposite module, and interest r
|
|
372 |
- **FIX** - Sometimes user's ranks were not updating automatically.
|
373 |
- **FIX** - Membership page layout issues.
|
374 |
- **FIX** - Points conversion not working when using arrows to increase or decrease the amount in [mycred_cashcred] shortcode.
|
375 |
-
- **FIX** - buyCred payment dialog couldn
|
376 |
- **FIX** - After deleting the badge their data will keep existing on the user's meta.
|
377 |
- **FIX** - "this-week" value not working in [mycred_leaderboard] timeframe attribute when the week starts other than "Monday" in your WordPress setting.
|
378 |
|
3 |
Tags: badges, gamification, loyalty, points, rewards
|
4 |
Requires at least: 4.8
|
5 |
Tested up to: 5.8.2
|
6 |
+
Stable tag: 2.4.1
|
7 |
Requires PHP: 7.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
35 |
**myCred v2.4** focuses on expanding the plugin’s ability to import and export points, ranks, and badges from and to other sites. What’s better is that you can choose to export or import complete setup settings like point types, achievements level, and created badges with achievements level with the simplest of ease.
|
36 |
|
37 |
Here is a list of the complete features introduced in myCred v2.4:
|
38 |
+
|
39 |
* Import or export user points
|
40 |
* Export all or specific point types
|
41 |
* Export setup settings for all point types
|
300 |
|
301 |
== Upgrade Notice ==
|
302 |
|
303 |
+
= 2.4.1 =
|
304 |
+
New features and Bug fixes.
|
305 |
+
|
306 |
= 2.4 =
|
307 |
New features and Bug fixes.
|
308 |
|
348 |
|
349 |
== Changelog ==
|
350 |
|
351 |
+
= 2.4.1 =
|
352 |
+
- **NEW** - Added new attributes "streaming" and "duration" in mycred_video shortcode.
|
353 |
+
- **NEW** - Added filter "mycred_transfer_notices".
|
354 |
+
- **NEW** - Added filter "mycred_cashcred_bank_transfer_title".
|
355 |
+
- **TWEAK** - Users will be fetched when the user types in the "Exclude by User" dropdown.
|
356 |
+
- **FIX** - Errors and warnings in mycred_video shortcode.
|
357 |
+
- **FIX** - Ranks were not promoted when points were earned from login and referral hooks.
|
358 |
+
- **FIX** - Undefined function array_key_last() in php 7.2 and below.
|
359 |
+
- **FIX** - Facing errors in frontend user profile with some themes.
|
360 |
+
- **FIX** - Resolve conflict with myCred Gutenberg Block addon.
|
361 |
+
|
362 |
= 2.4 =
|
363 |
- **NEW** - Introduced an Import/Export tool.
|
364 |
- **NEW** - Admin can assign "Badges" and "Manual Ranks" using coupons.
|
387 |
- **FIX** - Sometimes user's ranks were not updating automatically.
|
388 |
- **FIX** - Membership page layout issues.
|
389 |
- **FIX** - Points conversion not working when using arrows to increase or decrease the amount in [mycred_cashcred] shortcode.
|
390 |
+
- **FIX** - buyCred payment dialog couldn't load on the subsite.
|
391 |
- **FIX** - After deleting the badge their data will keep existing on the user's meta.
|
392 |
- **FIX** - "this-week" value not working in [mycred_leaderboard] timeframe attribute when the week starts other than "Monday" in your WordPress setting.
|
393 |
|