@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Donation_History extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['label'] = __( 'Donation History', 'give' ); |
|
21 | + $this->shortcode['label'] = __('Donation History', 'give'); |
|
22 | 22 | |
23 | - parent::__construct( 'donation_history' ); |
|
23 | + parent::__construct('donation_history'); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Donation_Form extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = __( 'Donation Form', 'give' ); |
|
22 | - $this->shortcode['label'] = __( 'Donation Form', 'give' ); |
|
21 | + $this->shortcode['title'] = __('Donation Form', 'give'); |
|
22 | + $this->shortcode['label'] = __('Donation Form', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_form' ); |
|
24 | + parent::__construct('give_form'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function define_fields() { |
33 | 33 | |
34 | - $create_form_link = sprintf( __( '%sClick here%s to create a new Donation Form.', 'give' ), |
|
35 | - '<a href="' . admin_url( 'post-new.php?post_type=give_forms' ) . '">', |
|
34 | + $create_form_link = sprintf(__('%sClick here%s to create a new Donation Form.', 'give'), |
|
35 | + '<a href="'.admin_url('post-new.php?post_type=give_forms').'">', |
|
36 | 36 | '</a>' |
37 | 37 | ); |
38 | 38 | |
@@ -43,68 +43,68 @@ discard block |
||
43 | 43 | 'post_type' => 'give_forms', |
44 | 44 | ), |
45 | 45 | 'name' => 'id', |
46 | - 'tooltip' => __( 'Select a Donation Form', 'give' ), |
|
47 | - 'placeholder' => sprintf( '– %s –', __( 'Select a Form', 'give' ) ), |
|
46 | + 'tooltip' => __('Select a Donation Form', 'give'), |
|
47 | + 'placeholder' => sprintf('– %s –', __('Select a Form', 'give')), |
|
48 | 48 | 'required' => array( |
49 | - 'alert' => __( 'You must first select a Form!', 'give' ), |
|
50 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', __( 'No donation forms were found!', 'give' ), $create_form_link ), |
|
49 | + 'alert' => __('You must first select a Form!', 'give'), |
|
50 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', __('No donation forms were found!', 'give'), $create_form_link), |
|
51 | 51 | ), |
52 | 52 | ), |
53 | 53 | array( |
54 | 54 | 'type' => 'container', |
55 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', __( 'Optional form settings', 'give' ) ), |
|
55 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', __('Optional form settings', 'give')), |
|
56 | 56 | ), |
57 | 57 | array( |
58 | 58 | 'type' => 'listbox', |
59 | 59 | 'name' => 'show_title', |
60 | - 'label' => __( 'Show Title:', 'give' ), |
|
61 | - 'tooltip' => __( 'Do you want to display the form title?', 'give' ), |
|
60 | + 'label' => __('Show Title:', 'give'), |
|
61 | + 'tooltip' => __('Do you want to display the form title?', 'give'), |
|
62 | 62 | 'options' => array( |
63 | - 'true' => __( 'Show', 'give' ), |
|
64 | - 'false' => __( 'Hide', 'give' ), |
|
63 | + 'true' => __('Show', 'give'), |
|
64 | + 'false' => __('Hide', 'give'), |
|
65 | 65 | ), |
66 | 66 | ), |
67 | 67 | array( |
68 | 68 | 'type' => 'listbox', |
69 | 69 | 'name' => 'show_goal', |
70 | - 'label' => __( 'Show Goal:', 'give' ), |
|
71 | - 'tooltip' => __( 'Do you want to display the donation goal?', 'give' ), |
|
70 | + 'label' => __('Show Goal:', 'give'), |
|
71 | + 'tooltip' => __('Do you want to display the donation goal?', 'give'), |
|
72 | 72 | 'options' => array( |
73 | - 'true' => __( 'Show', 'give' ), |
|
74 | - 'false' => __( 'Hide', 'give' ), |
|
73 | + 'true' => __('Show', 'give'), |
|
74 | + 'false' => __('Hide', 'give'), |
|
75 | 75 | ), |
76 | 76 | ), |
77 | 77 | array( |
78 | 78 | 'type' => 'listbox', |
79 | 79 | 'name' => 'show_content', |
80 | 80 | 'minWidth' => 240, |
81 | - 'label' => __( 'Display Content:', 'give' ), |
|
82 | - 'tooltip' => __( 'Do you want to display the form content?', 'give' ), |
|
81 | + 'label' => __('Display Content:', 'give'), |
|
82 | + 'tooltip' => __('Do you want to display the form content?', 'give'), |
|
83 | 83 | 'options' => array( |
84 | - 'none' => __( 'No Content', 'give' ), |
|
85 | - 'above' => __( 'Display above the form fields', 'give' ), |
|
86 | - 'below' => __( 'Display below the form fields', 'give' ), |
|
84 | + 'none' => __('No Content', 'give'), |
|
85 | + 'above' => __('Display above the form fields', 'give'), |
|
86 | + 'below' => __('Display below the form fields', 'give'), |
|
87 | 87 | ), |
88 | 88 | ), |
89 | 89 | array( |
90 | 90 | 'type' => 'listbox', |
91 | 91 | 'name' => 'display_style', |
92 | - 'label' => __( 'Payment Fields:', 'give' ), |
|
93 | - 'tooltip' => __( 'How would you like to display payment information?', 'give' ), |
|
92 | + 'label' => __('Payment Fields:', 'give'), |
|
93 | + 'tooltip' => __('How would you like to display payment information?', 'give'), |
|
94 | 94 | 'options' => array( |
95 | - 'onpage' => __( 'Show on Page', 'give' ), |
|
96 | - 'reveal' => __( 'Reveal Upon Click', 'give' ), |
|
97 | - 'modal' => __( 'Modal Window Upon Click', 'give' ), |
|
95 | + 'onpage' => __('Show on Page', 'give'), |
|
96 | + 'reveal' => __('Reveal Upon Click', 'give'), |
|
97 | + 'modal' => __('Modal Window Upon Click', 'give'), |
|
98 | 98 | ), |
99 | 99 | ), |
100 | 100 | array( |
101 | 101 | 'type' => 'listbox', |
102 | 102 | 'name' => 'float_labels', |
103 | - 'label' => __( 'Floating Labels:', 'give' ), |
|
104 | - 'tooltip' => __( 'Override the default floating labels setting for this form?', 'give' ), |
|
103 | + 'label' => __('Floating Labels:', 'give'), |
|
104 | + 'tooltip' => __('Override the default floating labels setting for this form?', 'give'), |
|
105 | 105 | 'options' => array( |
106 | - 'enabled' => __( 'Enabled', 'give' ), |
|
107 | - 'disabled' => __( 'Disabled', 'give' ), |
|
106 | + 'enabled' => __('Enabled', 'give'), |
|
107 | + 'disabled' => __('Disabled', 'give'), |
|
108 | 108 | ), |
109 | 109 | ), |
110 | 110 | ); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Donation_Form_Goal extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = __( 'Donation Form Goal', 'give' ); |
|
22 | - $this->shortcode['label'] = __( 'Donation Form Goal', 'give' ); |
|
21 | + $this->shortcode['title'] = __('Donation Form Goal', 'give'); |
|
22 | + $this->shortcode['label'] = __('Donation Form Goal', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_goal' ); |
|
24 | + parent::__construct('give_goal'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function define_fields() { |
33 | 33 | |
34 | - $create_form_link = sprintf( __( '%sClick here%s to create a new Donation Form.', 'give' ), |
|
35 | - '<a href="' . admin_url( 'post-new.php?post_type=give_forms' ) . '">', |
|
34 | + $create_form_link = sprintf(__('%sClick here%s to create a new Donation Form.', 'give'), |
|
35 | + '<a href="'.admin_url('post-new.php?post_type=give_forms').'">', |
|
36 | 36 | '</a>' |
37 | 37 | ); |
38 | 38 | |
@@ -43,35 +43,35 @@ discard block |
||
43 | 43 | 'post_type' => 'give_forms', |
44 | 44 | ), |
45 | 45 | 'name' => 'id', |
46 | - 'tooltip' => __( 'Select a Donation Form', 'give' ), |
|
47 | - 'placeholder' => sprintf( '– %s –', __( 'Select a Form', 'give' ) ), |
|
46 | + 'tooltip' => __('Select a Donation Form', 'give'), |
|
47 | + 'placeholder' => sprintf('– %s –', __('Select a Form', 'give')), |
|
48 | 48 | 'required' => array( |
49 | - 'alert' => __( 'You must first select a Form!', 'give' ), |
|
50 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', __( 'No donation forms were found!', 'give' ), $create_form_link ), |
|
49 | + 'alert' => __('You must first select a Form!', 'give'), |
|
50 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', __('No donation forms were found!', 'give'), $create_form_link), |
|
51 | 51 | ), |
52 | 52 | ), |
53 | 53 | array( |
54 | 54 | 'type' => 'container', |
55 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', __( 'Optional settings', 'give' ) ), |
|
55 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', __('Optional settings', 'give')), |
|
56 | 56 | ), |
57 | 57 | array( |
58 | 58 | 'type' => 'listbox', |
59 | 59 | 'name' => 'show_text', |
60 | - 'label' => __( 'Show Text:', 'give' ), |
|
61 | - 'tooltip' => __( 'This text displays the amount of income raised compared to the goal.', 'give' ), |
|
60 | + 'label' => __('Show Text:', 'give'), |
|
61 | + 'tooltip' => __('This text displays the amount of income raised compared to the goal.', 'give'), |
|
62 | 62 | 'options' => array( |
63 | - 'true' => __( 'Show', 'give' ), |
|
64 | - 'false' => __( 'Hide', 'give' ), |
|
63 | + 'true' => __('Show', 'give'), |
|
64 | + 'false' => __('Hide', 'give'), |
|
65 | 65 | ), |
66 | 66 | ), |
67 | 67 | array( |
68 | 68 | 'type' => 'listbox', |
69 | 69 | 'name' => 'show_bar', |
70 | - 'label' => __( 'Show Progress Bar:', 'give' ), |
|
71 | - 'tooltip' => __( 'Do you want to display the goal\'s progress bar?', 'give' ), |
|
70 | + 'label' => __('Show Progress Bar:', 'give'), |
|
71 | + 'tooltip' => __('Do you want to display the goal\'s progress bar?', 'give'), |
|
72 | 72 | 'options' => array( |
73 | - 'true' => __( 'Show', 'give' ), |
|
74 | - 'false' => __( 'Hide', 'give' ), |
|
73 | + 'true' => __('Show', 'give'), |
|
74 | + 'false' => __('Hide', 'give'), |
|
75 | 75 | ), |
76 | 76 | ), |
77 | 77 | ); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Login extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = __( 'Login', 'give' ); |
|
22 | - $this->shortcode['label'] = __( 'Login', 'give' ); |
|
21 | + $this->shortcode['title'] = __('Login', 'give'); |
|
22 | + $this->shortcode['label'] = __('Login', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_login' ); |
|
24 | + parent::__construct('give_login'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | return array( |
35 | 35 | array( |
36 | 36 | 'type' => 'container', |
37 | - 'html' => sprintf( '<p class="no-margin">%s</p>', __( 'Redirect URL (optional):', 'give' ) ), |
|
37 | + 'html' => sprintf('<p class="no-margin">%s</p>', __('Redirect URL (optional):', 'give')), |
|
38 | 38 | ), |
39 | 39 | array( |
40 | 40 | 'type' => 'textbox', |
41 | 41 | 'name' => 'redirect', |
42 | 42 | 'minWidth' => 320, |
43 | - 'tooltip' => __( 'Enter an URL here to redirect to after login.', 'give' ), |
|
43 | + 'tooltip' => __('Enter an URL here to redirect to after login.', 'give'), |
|
44 | 44 | ), |
45 | 45 | ); |
46 | 46 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Profile_Editor extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['label'] = __( 'Profile Editor', 'give' ); |
|
21 | + $this->shortcode['label'] = __('Profile Editor', 'give'); |
|
22 | 22 | |
23 | - parent::__construct( 'give_profile_editor' ); |
|
23 | + parent::__construct('give_profile_editor'); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Register extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = __( 'Register', 'give' ); |
|
22 | - $this->shortcode['label'] = __( 'Register', 'give' ); |
|
21 | + $this->shortcode['title'] = __('Register', 'give'); |
|
22 | + $this->shortcode['label'] = __('Register', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_register' ); |
|
24 | + parent::__construct('give_register'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | return array( |
35 | 35 | array( |
36 | 36 | 'type' => 'container', |
37 | - 'html' => sprintf( '<p class="no-margin">%s</p>', __( 'Redirect URL (optional):', 'give' ) ), |
|
37 | + 'html' => sprintf('<p class="no-margin">%s</p>', __('Redirect URL (optional):', 'give')), |
|
38 | 38 | ), |
39 | 39 | array( |
40 | 40 | 'type' => 'textbox', |
41 | 41 | 'name' => 'redirect', |
42 | 42 | 'minWidth' => 320, |
43 | - 'tooltip' => __( 'Enter an URL here to redirect to after registering.', 'give' ), |
|
43 | + 'tooltip' => __('Enter an URL here to redirect to after registering.', 'give'), |
|
44 | 44 | ), |
45 | 45 | ); |
46 | 46 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * @return void |
22 | 22 | */ |
23 | 23 | function give_upgrades_screen() { |
24 | - $action = isset( $_GET['give-upgrade'] ) ? sanitize_text_field( $_GET['give-upgrade'] ) : ''; |
|
25 | - $step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1; |
|
26 | - $total = isset( $_GET['total'] ) ? absint( $_GET['total'] ) : false; |
|
27 | - $custom = isset( $_GET['custom'] ) ? absint( $_GET['custom'] ) : 0; |
|
28 | - $number = isset( $_GET['number'] ) ? absint( $_GET['number'] ) : 100; |
|
29 | - $steps = round( ( $total / $number ), 0 ); |
|
24 | + $action = isset($_GET['give-upgrade']) ? sanitize_text_field($_GET['give-upgrade']) : ''; |
|
25 | + $step = isset($_GET['step']) ? absint($_GET['step']) : 1; |
|
26 | + $total = isset($_GET['total']) ? absint($_GET['total']) : false; |
|
27 | + $custom = isset($_GET['custom']) ? absint($_GET['custom']) : 0; |
|
28 | + $number = isset($_GET['number']) ? absint($_GET['number']) : 100; |
|
29 | + $steps = round(($total / $number), 0); |
|
30 | 30 | |
31 | 31 | $doing_upgrade_args = array( |
32 | 32 | 'page' => 'give-upgrades', |
@@ -36,25 +36,25 @@ discard block |
||
36 | 36 | 'custom' => $custom, |
37 | 37 | 'steps' => $steps |
38 | 38 | ); |
39 | - update_option( 'give_doing_upgrade', $doing_upgrade_args ); |
|
40 | - if ( $step > $steps ) { |
|
39 | + update_option('give_doing_upgrade', $doing_upgrade_args); |
|
40 | + if ($step > $steps) { |
|
41 | 41 | // Prevent a weird case where the estimate was off. Usually only a couple. |
42 | 42 | $steps = $step; |
43 | 43 | } |
44 | 44 | ?> |
45 | 45 | <div class="wrap"> |
46 | - <h2><?php _e( 'Give - Upgrades', 'give' ); ?></h2> |
|
46 | + <h2><?php _e('Give - Upgrades', 'give'); ?></h2> |
|
47 | 47 | |
48 | - <?php if ( ! empty( $action ) ) : ?> |
|
48 | + <?php if ( ! empty($action)) : ?> |
|
49 | 49 | |
50 | 50 | <div id="give-upgrade-status"> |
51 | - <p style="font-size: 20px;max-width: 900px;"><?php _e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); ?> |
|
52 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
51 | + <p style="font-size: 20px;max-width: 900px;"><?php _e('The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give'); ?> |
|
52 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
53 | 53 | </p> |
54 | 54 | |
55 | - <?php if ( ! empty( $total ) ) : ?> |
|
55 | + <?php if ( ! empty($total)) : ?> |
|
56 | 56 | <p> |
57 | - <strong><?php printf( __( 'Step %d of approximately %d running', 'give' ), $step, $steps ); ?></strong> |
|
57 | + <strong><?php printf(__('Step %d of approximately %d running', 'give'), $step, $steps); ?></strong> |
|
58 | 58 | </p> |
59 | 59 | <?php endif; ?> |
60 | 60 | </div> |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | |
69 | 69 | <div id="give-upgrade-status"> |
70 | 70 | <p style="font-size: 20px;max-width: 900px;"> |
71 | - <?php _e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); ?> |
|
72 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
71 | + <?php _e('The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give'); ?> |
|
72 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
73 | 73 | </p> |
74 | 74 | </div> |
75 | 75 | <script type="text/javascript"> |
@@ -64,11 +64,14 @@ |
||
64 | 64 | }, 250 ); |
65 | 65 | </script> |
66 | 66 | |
67 | - <?php else : ?> |
|
67 | + <?php else { |
|
68 | + : ?> |
|
68 | 69 | |
69 | 70 | <div id="give-upgrade-status"> |
70 | 71 | <p style="font-size: 20px;max-width: 900px;"> |
71 | - <?php _e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); ?> |
|
72 | + <?php _e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); |
|
73 | +} |
|
74 | +?> |
|
72 | 75 | <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
73 | 76 | </p> |
74 | 77 | </div> |
@@ -10,7 +10,7 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
13 | +if ( ! defined('ABSPATH')) exit; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Give_API_V1 Class |
@@ -10,7 +10,9 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
13 | +if ( ! defined( 'ABSPATH' ) ) { |
|
14 | + exit; |
|
15 | +} |
|
14 | 16 | |
15 | 17 | /** |
16 | 18 | * Give_API_V1 Class |
@@ -8,11 +8,11 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | // Exit if accessed directly |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; |
13 | 13 | } |
14 | 14 | |
15 | -if ( ! class_exists( 'Give_License' ) ) : |
|
15 | +if ( ! class_exists('Give_License')) : |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * Give_License Class |
@@ -38,16 +38,16 @@ discard block |
||
38 | 38 | * @param string $_optname |
39 | 39 | * @param string $_api_url |
40 | 40 | */ |
41 | - public function __construct( $_file, $_item_name, $_version, $_author, $_optname = null, $_api_url = null ) { |
|
41 | + public function __construct($_file, $_item_name, $_version, $_author, $_optname = null, $_api_url = null) { |
|
42 | 42 | global $give_options; |
43 | 43 | |
44 | 44 | $this->file = $_file; |
45 | 45 | $this->item_name = $_item_name; |
46 | - $this->item_shortname = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $this->item_name ) ) ); |
|
46 | + $this->item_shortname = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($this->item_name))); |
|
47 | 47 | $this->version = $_version; |
48 | - $this->license = isset( $give_options[ $this->item_shortname . '_license_key' ] ) ? trim( $give_options[ $this->item_shortname . '_license_key' ] ) : ''; |
|
48 | + $this->license = isset($give_options[$this->item_shortname.'_license_key']) ? trim($give_options[$this->item_shortname.'_license_key']) : ''; |
|
49 | 49 | $this->author = $_author; |
50 | - $this->api_url = is_null( $_api_url ) ? $this->api_url : $_api_url; |
|
50 | + $this->api_url = is_null($_api_url) ? $this->api_url : $_api_url; |
|
51 | 51 | |
52 | 52 | |
53 | 53 | // Setup hooks |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @return void |
64 | 64 | */ |
65 | 65 | private function includes() { |
66 | - if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) { |
|
66 | + if ( ! class_exists('EDD_SL_Plugin_Updater')) { |
|
67 | 67 | require_once 'admin/EDD_SL_Plugin_Updater.php'; |
68 | 68 | } |
69 | 69 | } |
@@ -77,18 +77,18 @@ discard block |
||
77 | 77 | private function hooks() { |
78 | 78 | |
79 | 79 | // Register settings |
80 | - add_filter( 'give_settings_licenses', array( $this, 'settings' ), 1 ); |
|
80 | + add_filter('give_settings_licenses', array($this, 'settings'), 1); |
|
81 | 81 | |
82 | 82 | // Activate license key on settings save |
83 | - add_action( 'admin_init', array( $this, 'activate_license' ) ); |
|
83 | + add_action('admin_init', array($this, 'activate_license')); |
|
84 | 84 | |
85 | 85 | // Deactivate license key |
86 | - add_action( 'admin_init', array( $this, 'deactivate_license' ) ); |
|
86 | + add_action('admin_init', array($this, 'deactivate_license')); |
|
87 | 87 | |
88 | 88 | // Updater |
89 | - add_action( 'admin_init', array( $this, 'auto_updater' ), 0 ); |
|
89 | + add_action('admin_init', array($this, 'auto_updater'), 0); |
|
90 | 90 | |
91 | - add_action( 'admin_notices', array( $this, 'notices' ) ); |
|
91 | + add_action('admin_notices', array($this, 'notices')); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function auto_updater() { |
102 | 102 | |
103 | - if ( 'valid' !== get_option( $this->item_shortname . '_license_active' ) ) { |
|
103 | + if ('valid' !== get_option($this->item_shortname.'_license_active')) { |
|
104 | 104 | return; |
105 | 105 | } |
106 | 106 | |
@@ -127,20 +127,20 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @return array |
129 | 129 | */ |
130 | - public function settings( $settings ) { |
|
130 | + public function settings($settings) { |
|
131 | 131 | |
132 | 132 | $give_license_settings = array( |
133 | 133 | array( |
134 | - 'name' => sprintf( __( '%1$s', 'give' ), $this->item_name ), |
|
135 | - 'id' => $this->item_shortname . '_license_key', |
|
134 | + 'name' => sprintf(__('%1$s', 'give'), $this->item_name), |
|
135 | + 'id' => $this->item_shortname.'_license_key', |
|
136 | 136 | 'desc' => '', |
137 | 137 | 'type' => 'license_key', |
138 | - 'options' => array( 'is_valid_license_option' => $this->item_shortname . '_license_active' ), |
|
138 | + 'options' => array('is_valid_license_option' => $this->item_shortname.'_license_active'), |
|
139 | 139 | 'size' => 'regular' |
140 | 140 | ) |
141 | 141 | ); |
142 | 142 | |
143 | - return array_merge( $settings, $give_license_settings ); |
|
143 | + return array_merge($settings, $give_license_settings); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -152,18 +152,18 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return array |
154 | 154 | */ |
155 | - public function license_settings_content( $settings ) { |
|
155 | + public function license_settings_content($settings) { |
|
156 | 156 | |
157 | 157 | $give_license_settings = array( |
158 | 158 | array( |
159 | - 'name' => __( 'Add-on Licenses', 'give' ), |
|
159 | + 'name' => __('Add-on Licenses', 'give'), |
|
160 | 160 | 'desc' => '<hr>', |
161 | 161 | 'type' => 'give_title', |
162 | 162 | 'id' => 'give_title' |
163 | 163 | ), |
164 | 164 | ); |
165 | 165 | |
166 | - return array_merge( $settings, $give_license_settings ); |
|
166 | + return array_merge($settings, $give_license_settings); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | |
@@ -175,34 +175,34 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function activate_license() { |
177 | 177 | |
178 | - if ( ! isset( $_POST[ $this->item_shortname . '_license_key' ] ) ) { |
|
178 | + if ( ! isset($_POST[$this->item_shortname.'_license_key'])) { |
|
179 | 179 | return; |
180 | 180 | } |
181 | 181 | |
182 | - foreach ( $_POST as $key => $value ) { |
|
183 | - if ( false !== strpos( $key, 'license_key_deactivate' ) ) { |
|
182 | + foreach ($_POST as $key => $value) { |
|
183 | + if (false !== strpos($key, 'license_key_deactivate')) { |
|
184 | 184 | // Don't activate a key when deactivating a different key |
185 | 185 | return; |
186 | 186 | } |
187 | 187 | } |
188 | 188 | |
189 | - if ( ! wp_verify_nonce( $_REQUEST[ $this->item_shortname . '_license_key-nonce' ], $this->item_shortname . '_license_key-nonce' ) ) { |
|
189 | + if ( ! wp_verify_nonce($_REQUEST[$this->item_shortname.'_license_key-nonce'], $this->item_shortname.'_license_key-nonce')) { |
|
190 | 190 | |
191 | - wp_die( __( 'Nonce verification failed', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
191 | + wp_die(__('Nonce verification failed', 'give'), __('Error', 'give'), array('response' => 403)); |
|
192 | 192 | |
193 | 193 | } |
194 | 194 | |
195 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
195 | + if ( ! current_user_can('manage_give_settings')) { |
|
196 | 196 | return; |
197 | 197 | } |
198 | 198 | |
199 | - if ( 'valid' === get_option( $this->item_shortname . '_license_active' ) ) { |
|
199 | + if ('valid' === get_option($this->item_shortname.'_license_active')) { |
|
200 | 200 | return; |
201 | 201 | } |
202 | 202 | |
203 | - $license = sanitize_text_field( $_POST[ $this->item_shortname . '_license_key' ] ); |
|
203 | + $license = sanitize_text_field($_POST[$this->item_shortname.'_license_key']); |
|
204 | 204 | |
205 | - if ( empty( $license ) ) { |
|
205 | + if (empty($license)) { |
|
206 | 206 | return; |
207 | 207 | } |
208 | 208 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | $api_params = array( |
211 | 211 | 'edd_action' => 'activate_license', //never change from "edd_" to "give_"! |
212 | 212 | 'license' => $license, |
213 | - 'item_name' => urlencode( $this->item_name ), |
|
213 | + 'item_name' => urlencode($this->item_name), |
|
214 | 214 | 'url' => home_url() |
215 | 215 | ); |
216 | 216 | |
@@ -225,22 +225,22 @@ discard block |
||
225 | 225 | ); |
226 | 226 | |
227 | 227 | // Make sure there are no errors |
228 | - if ( is_wp_error( $response ) ) { |
|
228 | + if (is_wp_error($response)) { |
|
229 | 229 | return; |
230 | 230 | } |
231 | 231 | |
232 | 232 | // Tell WordPress to look for updates |
233 | - set_site_transient( 'update_plugins', null ); |
|
233 | + set_site_transient('update_plugins', null); |
|
234 | 234 | |
235 | 235 | // Decode license data |
236 | - $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
236 | + $license_data = json_decode(wp_remote_retrieve_body($response)); |
|
237 | 237 | |
238 | - update_option( $this->item_shortname . '_license_active', $license_data->license ); |
|
238 | + update_option($this->item_shortname.'_license_active', $license_data->license); |
|
239 | 239 | |
240 | - if ( ! (bool) $license_data->success ) { |
|
241 | - set_transient( 'give_license_error', $license_data, 1000 ); |
|
240 | + if ( ! (bool) $license_data->success) { |
|
241 | + set_transient('give_license_error', $license_data, 1000); |
|
242 | 242 | } else { |
243 | - delete_transient( 'give_license_error' ); |
|
243 | + delete_transient('give_license_error'); |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 | |
@@ -253,28 +253,28 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function deactivate_license() { |
255 | 255 | |
256 | - if ( ! isset( $_POST[ $this->item_shortname . '_license_key' ] ) ) { |
|
256 | + if ( ! isset($_POST[$this->item_shortname.'_license_key'])) { |
|
257 | 257 | return; |
258 | 258 | } |
259 | 259 | |
260 | - if ( ! wp_verify_nonce( $_REQUEST[ $this->item_shortname . '_license_key-nonce' ], $this->item_shortname . '_license_key-nonce' ) ) { |
|
260 | + if ( ! wp_verify_nonce($_REQUEST[$this->item_shortname.'_license_key-nonce'], $this->item_shortname.'_license_key-nonce')) { |
|
261 | 261 | |
262 | - wp_die( __( 'Nonce verification failed', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
262 | + wp_die(__('Nonce verification failed', 'give'), __('Error', 'give'), array('response' => 403)); |
|
263 | 263 | |
264 | 264 | } |
265 | 265 | |
266 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
266 | + if ( ! current_user_can('manage_give_settings')) { |
|
267 | 267 | return; |
268 | 268 | } |
269 | 269 | |
270 | 270 | // Run on deactivate button press |
271 | - if ( isset( $_POST[ $this->item_shortname . '_license_key_deactivate' ] ) ) { |
|
271 | + if (isset($_POST[$this->item_shortname.'_license_key_deactivate'])) { |
|
272 | 272 | |
273 | 273 | // Data to send to the API |
274 | 274 | $api_params = array( |
275 | 275 | 'edd_action' => 'deactivate_license', //never change from "edd_" to "give_"! |
276 | 276 | 'license' => $this->license, |
277 | - 'item_name' => urlencode( $this->item_name ), |
|
277 | + 'item_name' => urlencode($this->item_name), |
|
278 | 278 | 'url' => home_url() |
279 | 279 | ); |
280 | 280 | |
@@ -290,19 +290,19 @@ discard block |
||
290 | 290 | |
291 | 291 | |
292 | 292 | // Make sure there are no errors |
293 | - if ( is_wp_error( $response ) ) { |
|
293 | + if (is_wp_error($response)) { |
|
294 | 294 | return; |
295 | 295 | } |
296 | 296 | |
297 | 297 | // Decode the license data |
298 | - $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
298 | + $license_data = json_decode(wp_remote_retrieve_body($response)); |
|
299 | 299 | |
300 | - delete_option( $this->item_shortname . '_license_active' ); |
|
300 | + delete_option($this->item_shortname.'_license_active'); |
|
301 | 301 | |
302 | - if ( ! (bool) $license_data->success ) { |
|
303 | - set_transient( 'give_license_error', $license_data, 1000 ); |
|
302 | + if ( ! (bool) $license_data->success) { |
|
303 | + set_transient('give_license_error', $license_data, 1000); |
|
304 | 304 | } else { |
305 | - delete_transient( 'give_license_error' ); |
|
305 | + delete_transient('give_license_error'); |
|
306 | 306 | } |
307 | 307 | } |
308 | 308 | } |
@@ -316,57 +316,57 @@ discard block |
||
316 | 316 | */ |
317 | 317 | public function notices() { |
318 | 318 | |
319 | - if ( ! isset( $_GET['page'] ) || 'give-settings' !== $_GET['page'] ) { |
|
319 | + if ( ! isset($_GET['page']) || 'give-settings' !== $_GET['page']) { |
|
320 | 320 | return; |
321 | 321 | } |
322 | 322 | |
323 | - if ( ! isset( $_GET['tab'] ) || 'licenses' !== $_GET['tab'] ) { |
|
323 | + if ( ! isset($_GET['tab']) || 'licenses' !== $_GET['tab']) { |
|
324 | 324 | return; |
325 | 325 | } |
326 | 326 | |
327 | - $license_error = get_transient( 'give_license_error' ); |
|
327 | + $license_error = get_transient('give_license_error'); |
|
328 | 328 | |
329 | - if ( false === $license_error ) { |
|
329 | + if (false === $license_error) { |
|
330 | 330 | return; |
331 | 331 | } |
332 | 332 | |
333 | - if ( ! empty( $license_error->error ) ) { |
|
333 | + if ( ! empty($license_error->error)) { |
|
334 | 334 | |
335 | - switch ( $license_error->error ) { |
|
335 | + switch ($license_error->error) { |
|
336 | 336 | |
337 | 337 | case 'item_name_mismatch' : |
338 | 338 | |
339 | - $message = __( 'This license does not belong to the product you have entered it for.', 'give' ); |
|
339 | + $message = __('This license does not belong to the product you have entered it for.', 'give'); |
|
340 | 340 | break; |
341 | 341 | |
342 | 342 | case 'no_activations_left' : |
343 | 343 | |
344 | - $message = __( 'This license does not have any activations left', 'give' ); |
|
344 | + $message = __('This license does not have any activations left', 'give'); |
|
345 | 345 | break; |
346 | 346 | |
347 | 347 | case 'expired' : |
348 | 348 | |
349 | - $message = __( 'This license key is expired. Please renew it.', 'give' ); |
|
349 | + $message = __('This license key is expired. Please renew it.', 'give'); |
|
350 | 350 | break; |
351 | 351 | |
352 | 352 | default : |
353 | 353 | |
354 | - $message = sprintf( __( 'There was a problem activating your license key, please try again or contact support. Error code: %s', 'give' ), $license_error->error ); |
|
354 | + $message = sprintf(__('There was a problem activating your license key, please try again or contact support. Error code: %s', 'give'), $license_error->error); |
|
355 | 355 | break; |
356 | 356 | |
357 | 357 | } |
358 | 358 | |
359 | 359 | } |
360 | 360 | |
361 | - if ( ! empty( $message ) ) { |
|
361 | + if ( ! empty($message)) { |
|
362 | 362 | |
363 | 363 | echo '<div class="error">'; |
364 | - echo '<p>' . $message . '</p>'; |
|
364 | + echo '<p>'.$message.'</p>'; |
|
365 | 365 | echo '</div>'; |
366 | 366 | |
367 | 367 | } |
368 | 368 | |
369 | - delete_transient( 'give_license_error' ); |
|
369 | + delete_transient('give_license_error'); |
|
370 | 370 | |
371 | 371 | } |
372 | 372 | } |