@@ -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 | |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @return string |
26 | 26 | */ |
27 | -function give_admin_rate_us( $footer_text ) { |
|
27 | +function give_admin_rate_us($footer_text) { |
|
28 | 28 | global $typenow; |
29 | 29 | |
30 | - if ( $typenow == 'give_forms' ) { |
|
30 | + if ($typenow == 'give_forms') { |
|
31 | 31 | $rate_text = sprintf( |
32 | 32 | /* translators: %s: Link to 5 star rating */ |
33 | - __( 'If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give' ), |
|
34 | - '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" style="text-decoration:none;" data-rated="' . esc_attr__( 'Thanks :)', 'give' ) . '">★★★★★</a>' |
|
33 | + __('If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give'), |
|
34 | + '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" style="text-decoration:none;" data-rated="'.esc_attr__('Thanks :)', 'give').'">★★★★★</a>' |
|
35 | 35 | ); |
36 | 36 | |
37 | 37 | return $rate_text; |
@@ -40,4 +40,4 @@ discard block |
||
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | -add_filter( 'admin_footer_text', 'give_admin_rate_us' ); |
|
43 | +add_filter('admin_footer_text', 'give_admin_rate_us'); |
@@ -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,9 +21,9 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['label'] = esc_html__( 'Profile Editor', 'give' ); |
|
24 | + $this->shortcode['label'] = esc_html__('Profile Editor', 'give'); |
|
25 | 25 | |
26 | - parent::__construct( 'give_profile_editor' ); |
|
26 | + parent::__construct('give_profile_editor'); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 |
@@ -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 | |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function __construct() { |
26 | 26 | |
27 | - $this->shortcode['title'] = esc_html__( 'Donation Receipt', 'give' ); |
|
28 | - $this->shortcode['label'] = esc_html__( 'Donation Receipt', 'give' ); |
|
27 | + $this->shortcode['title'] = esc_html__('Donation Receipt', 'give'); |
|
28 | + $this->shortcode['label'] = esc_html__('Donation Receipt', 'give'); |
|
29 | 29 | |
30 | - parent::__construct( 'give_receipt' ); |
|
30 | + parent::__construct('give_receipt'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -40,60 +40,60 @@ discard block |
||
40 | 40 | return array( |
41 | 41 | array( |
42 | 42 | 'type' => 'container', |
43 | - 'html' => sprintf( '<p class="strong">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
43 | + 'html' => sprintf('<p class="strong">%s</p>', esc_html__('Optional settings', 'give')), |
|
44 | 44 | ), |
45 | 45 | array( |
46 | 46 | 'type' => 'listbox', |
47 | 47 | 'name' => 'price', |
48 | - 'label' => esc_html__( 'Show Donation Amount:', 'give' ), |
|
48 | + 'label' => esc_html__('Show Donation Amount:', 'give'), |
|
49 | 49 | 'options' => array( |
50 | - 'true' => esc_html__( 'Show', 'give' ), |
|
51 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
50 | + 'true' => esc_html__('Show', 'give'), |
|
51 | + 'false' => esc_html__('Hide', 'give'), |
|
52 | 52 | ), |
53 | 53 | ), |
54 | 54 | array( |
55 | 55 | 'type' => 'listbox', |
56 | 56 | 'name' => 'donor', |
57 | - 'label' => esc_html__( 'Show Donor Name:', 'give' ), |
|
57 | + 'label' => esc_html__('Show Donor Name:', 'give'), |
|
58 | 58 | 'options' => array( |
59 | - 'true' => esc_html__( 'Show', 'give' ), |
|
60 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
59 | + 'true' => esc_html__('Show', 'give'), |
|
60 | + 'false' => esc_html__('Hide', 'give'), |
|
61 | 61 | ), |
62 | 62 | ), |
63 | 63 | array( |
64 | 64 | 'type' => 'listbox', |
65 | 65 | 'name' => 'date', |
66 | - 'label' => esc_html__( 'Show Date:', 'give' ), |
|
66 | + 'label' => esc_html__('Show Date:', 'give'), |
|
67 | 67 | 'options' => array( |
68 | - 'true' => esc_html__( 'Show', 'give' ), |
|
69 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
68 | + 'true' => esc_html__('Show', 'give'), |
|
69 | + 'false' => esc_html__('Hide', 'give'), |
|
70 | 70 | ), |
71 | 71 | ), |
72 | 72 | array( |
73 | 73 | 'type' => 'listbox', |
74 | 74 | 'name' => 'payment_key', |
75 | - 'label' => esc_html__( 'Show Payment Key:', 'give' ), |
|
75 | + 'label' => esc_html__('Show Payment Key:', 'give'), |
|
76 | 76 | 'options' => array( |
77 | - 'true' => esc_html__( 'Show', 'give' ), |
|
78 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
77 | + 'true' => esc_html__('Show', 'give'), |
|
78 | + 'false' => esc_html__('Hide', 'give'), |
|
79 | 79 | ), |
80 | 80 | ), |
81 | 81 | array( |
82 | 82 | 'type' => 'listbox', |
83 | 83 | 'name' => 'payment_method', |
84 | - 'label' => esc_html__( 'Show Payment Method:', 'give' ), |
|
84 | + 'label' => esc_html__('Show Payment Method:', 'give'), |
|
85 | 85 | 'options' => array( |
86 | - 'true' => esc_html__( 'Show', 'give' ), |
|
87 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
86 | + 'true' => esc_html__('Show', 'give'), |
|
87 | + 'false' => esc_html__('Hide', 'give'), |
|
88 | 88 | ), |
89 | 89 | ), |
90 | 90 | array( |
91 | 91 | 'type' => 'listbox', |
92 | 92 | 'name' => 'payment_id', |
93 | - 'label' => esc_html__( 'Show Payment ID:', 'give' ), |
|
93 | + 'label' => esc_html__('Show Payment ID:', 'give'), |
|
94 | 94 | 'options' => array( |
95 | - 'true' => esc_html__( 'Show', 'give' ), |
|
96 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
95 | + 'true' => esc_html__('Show', 'give'), |
|
96 | + 'false' => esc_html__('Hide', 'give'), |
|
97 | 97 | ), |
98 | 98 | ), |
99 | 99 | ); |
@@ -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,10 +21,10 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['title'] = esc_html__( 'Register', 'give' ); |
|
25 | - $this->shortcode['label'] = esc_html__( 'Register', 'give' ); |
|
24 | + $this->shortcode['title'] = esc_html__('Register', 'give'); |
|
25 | + $this->shortcode['label'] = esc_html__('Register', 'give'); |
|
26 | 26 | |
27 | - parent::__construct( 'give_register' ); |
|
27 | + parent::__construct('give_register'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | return array( |
38 | 38 | array( |
39 | 39 | 'type' => 'container', |
40 | - 'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Redirect URL (optional):', 'give' ) ), |
|
40 | + 'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Redirect URL (optional):', 'give')), |
|
41 | 41 | ), |
42 | 42 | array( |
43 | 43 | 'type' => 'textbox', |
44 | 44 | 'name' => 'redirect', |
45 | 45 | 'minWidth' => 320, |
46 | - 'tooltip' => esc_attr__( 'Enter an URL here to redirect to after registering.', 'give' ), |
|
46 | + 'tooltip' => esc_attr__('Enter an URL here to redirect to after registering.', 'give'), |
|
47 | 47 | ), |
48 | 48 | ); |
49 | 49 | } |
@@ -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,9 +21,9 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['label'] = esc_html__( 'Donation History', 'give' ); |
|
24 | + $this->shortcode['label'] = esc_html__('Donation History', 'give'); |
|
25 | 25 | |
26 | - parent::__construct( 'donation_history' ); |
|
26 | + parent::__construct('donation_history'); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 |
@@ -812,10 +812,10 @@ discard block |
||
812 | 812 | } |
813 | 813 | |
814 | 814 | if ( ! is_int( $params[1] ) |
815 | - && ! is_float( $params[1] ) |
|
816 | - && ! is_string( $params[1] ) |
|
817 | - && $params[1] !== null |
|
818 | - && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) |
|
815 | + && ! is_float( $params[1] ) |
|
816 | + && ! is_string( $params[1] ) |
|
817 | + && $params[1] !== null |
|
818 | + && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) |
|
819 | 819 | ) { |
820 | 820 | trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
821 | 821 | |
@@ -823,10 +823,10 @@ discard block |
||
823 | 823 | } |
824 | 824 | |
825 | 825 | if ( isset( $params[2] ) |
826 | - && ! is_int( $params[2] ) |
|
827 | - && ! is_float( $params[2] ) |
|
828 | - && ! is_string( $params[2] ) |
|
829 | - && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) |
|
826 | + && ! is_int( $params[2] ) |
|
827 | + && ! is_float( $params[2] ) |
|
828 | + && ! is_string( $params[2] ) |
|
829 | + && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) |
|
830 | 830 | ) { |
831 | 831 | trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
832 | 832 |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * |
213 | 213 | * @since 1.8.17 |
214 | 214 | * |
215 | - * @return array|string |
|
215 | + * @return boolean |
|
216 | 216 | */ |
217 | 217 | function give_get_history_session() { |
218 | 218 | return (bool) Give()->session->get( 'history_access' ); |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | * |
686 | 686 | * @todo Remove this, when WordPress Core ticket is resolved (https://core.trac.wordpress.org/ticket/16828). |
687 | 687 | * |
688 | - * @return bool |
|
688 | + * @return false|null |
|
689 | 689 | */ |
690 | 690 | function give_donation_metabox_menu() { |
691 | 691 | |
@@ -1084,7 +1084,7 @@ discard block |
||
1084 | 1084 | * @param int $id |
1085 | 1085 | * @param string $meta_key |
1086 | 1086 | * @param mixed $meta_value |
1087 | - * @param mixed $prev_value |
|
1087 | + * @param string $prev_value |
|
1088 | 1088 | * |
1089 | 1089 | * @return mixed |
1090 | 1090 | */ |
@@ -1291,7 +1291,7 @@ discard block |
||
1291 | 1291 | * @since 1.8.13 |
1292 | 1292 | * |
1293 | 1293 | * @param array $list List of objects or arrays |
1294 | - * @param int|string $field Field from the object to place instead of the entire object |
|
1294 | + * @param string $field Field from the object to place instead of the entire object |
|
1295 | 1295 | * @param int|string $index_key Optional. Field from the object to use as keys for the new array. |
1296 | 1296 | * Default null. |
1297 | 1297 | * |
@@ -1738,7 +1738,7 @@ |
||
1738 | 1738 | |
1739 | 1739 | if( is_array( $post_type ) ) { |
1740 | 1740 | $where .= " post_type='" . implode( "' OR post_type='", $post_type ) . "'"; |
1741 | - }else{ |
|
1741 | + } else{ |
|
1742 | 1742 | $where .= " post_type='{$post_type}'"; |
1743 | 1743 | } |
1744 | 1744 | } |
@@ -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 | |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function give_is_test_mode() { |
25 | 25 | |
26 | - $ret = give_is_setting_enabled( give_get_option( 'test_mode' ) ); |
|
26 | + $ret = give_is_setting_enabled(give_get_option('test_mode')); |
|
27 | 27 | |
28 | - return (bool) apply_filters( 'give_is_test_mode', $ret ); |
|
28 | + return (bool) apply_filters('give_is_test_mode', $ret); |
|
29 | 29 | |
30 | 30 | } |
31 | 31 | |
@@ -39,18 +39,18 @@ discard block |
||
39 | 39 | |
40 | 40 | global $wp; |
41 | 41 | |
42 | - if ( get_option( 'permalink_structure' ) ) { |
|
43 | - $base = trailingslashit( home_url( $wp->request ) ); |
|
42 | + if (get_option('permalink_structure')) { |
|
43 | + $base = trailingslashit(home_url($wp->request)); |
|
44 | 44 | } else { |
45 | - $base = add_query_arg( $wp->query_string, '', trailingslashit( home_url( $wp->request ) ) ); |
|
46 | - $base = remove_query_arg( array( 'post_type', 'name' ), $base ); |
|
45 | + $base = add_query_arg($wp->query_string, '', trailingslashit(home_url($wp->request))); |
|
46 | + $base = remove_query_arg(array('post_type', 'name'), $base); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $scheme = is_ssl() ? 'https' : 'http'; |
50 | - $current_uri = set_url_scheme( $base, $scheme ); |
|
50 | + $current_uri = set_url_scheme($base, $scheme); |
|
51 | 51 | |
52 | - if ( is_front_page() ) { |
|
53 | - $current_uri = home_url( '/' ); |
|
52 | + if (is_front_page()) { |
|
53 | + $current_uri = home_url('/'); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @param string $current_uri |
62 | 62 | */ |
63 | - return apply_filters( 'give_get_current_page_url', $current_uri ); |
|
63 | + return apply_filters('give_get_current_page_url', $current_uri); |
|
64 | 64 | |
65 | 65 | } |
66 | 66 | |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | */ |
83 | 83 | $gateways = give_get_enabled_payment_gateways(); |
84 | 84 | |
85 | - if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) { |
|
85 | + if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) { |
|
86 | 86 | $ret = true; |
87 | - } elseif ( count( $gateways ) == 1 ) { |
|
87 | + } elseif (count($gateways) == 1) { |
|
88 | 88 | $ret = false; |
89 | - } elseif ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) { |
|
89 | + } elseif (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) { |
|
90 | 90 | $ret = false; |
91 | 91 | } |
92 | 92 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @param bool $ret |
99 | 99 | */ |
100 | - return (bool) apply_filters( 'give_is_cc_verify_enabled', $ret ); |
|
100 | + return (bool) apply_filters('give_is_cc_verify_enabled', $ret); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -109,26 +109,26 @@ discard block |
||
109 | 109 | function give_get_timezone_id() { |
110 | 110 | |
111 | 111 | // if site timezone string exists, return it. |
112 | - if ( $timezone = get_option( 'timezone_string' ) ) { |
|
112 | + if ($timezone = get_option('timezone_string')) { |
|
113 | 113 | return $timezone; |
114 | 114 | } |
115 | 115 | |
116 | 116 | // get UTC offset, if it isn't set return UTC. |
117 | - if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) { |
|
117 | + if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) { |
|
118 | 118 | return 'UTC'; |
119 | 119 | } |
120 | 120 | |
121 | 121 | // attempt to guess the timezone string from the UTC offset. |
122 | - $timezone = timezone_name_from_abbr( '', $utc_offset ); |
|
122 | + $timezone = timezone_name_from_abbr('', $utc_offset); |
|
123 | 123 | |
124 | 124 | // last try, guess timezone string manually. |
125 | - if ( $timezone === false ) { |
|
125 | + if ($timezone === false) { |
|
126 | 126 | |
127 | - $is_dst = date( 'I' ); |
|
127 | + $is_dst = date('I'); |
|
128 | 128 | |
129 | - foreach ( timezone_abbreviations_list() as $abbr ) { |
|
130 | - foreach ( $abbr as $city ) { |
|
131 | - if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) { |
|
129 | + foreach (timezone_abbreviations_list() as $abbr) { |
|
130 | + foreach ($abbr as $city) { |
|
131 | + if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) { |
|
132 | 132 | return $city['timezone_id']; |
133 | 133 | } |
134 | 134 | } |
@@ -152,13 +152,13 @@ discard block |
||
152 | 152 | |
153 | 153 | $ip = '127.0.0.1'; |
154 | 154 | |
155 | - if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { |
|
155 | + if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) { |
|
156 | 156 | // check ip from share internet |
157 | 157 | $ip = $_SERVER['HTTP_CLIENT_IP']; |
158 | - } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { |
|
158 | + } elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
159 | 159 | // to check ip is pass from proxy |
160 | 160 | $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |
161 | - } elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) { |
|
161 | + } elseif ( ! empty($_SERVER['REMOTE_ADDR'])) { |
|
162 | 162 | $ip = $_SERVER['REMOTE_ADDR']; |
163 | 163 | } |
164 | 164 | |
@@ -167,15 +167,15 @@ discard block |
||
167 | 167 | * |
168 | 168 | * @since 1.0 |
169 | 169 | */ |
170 | - $ip = apply_filters( 'give_get_ip', $ip ); |
|
170 | + $ip = apply_filters('give_get_ip', $ip); |
|
171 | 171 | |
172 | 172 | // Filter empty values. |
173 | - if( false !== strpos( $ip, ',' ) ) { |
|
174 | - $ip = give_clean( explode( ',', $ip ) ); |
|
175 | - $ip = array_filter( $ip ); |
|
176 | - $ip = implode( ',', $ip ); |
|
177 | - } else{ |
|
178 | - $ip = give_clean( $ip ); |
|
173 | + if (false !== strpos($ip, ',')) { |
|
174 | + $ip = give_clean(explode(',', $ip)); |
|
175 | + $ip = array_filter($ip); |
|
176 | + $ip = implode(',', $ip); |
|
177 | + } else { |
|
178 | + $ip = give_clean($ip); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | return $ip; |
@@ -193,9 +193,9 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @uses Give()->session->set() |
195 | 195 | */ |
196 | -function give_set_purchase_session( $purchase_data = array() ) { |
|
197 | - Give()->session->set( 'give_purchase', $purchase_data ); |
|
198 | - Give()->session->set( 'give_email', $purchase_data['user_email'] ); |
|
196 | +function give_set_purchase_session($purchase_data = array()) { |
|
197 | + Give()->session->set('give_purchase', $purchase_data); |
|
198 | + Give()->session->set('give_email', $purchase_data['user_email']); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @return mixed array | false |
210 | 210 | */ |
211 | 211 | function give_get_purchase_session() { |
212 | - return Give()->session->get( 'give_purchase' ); |
|
212 | + return Give()->session->get('give_purchase'); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @return array|string |
221 | 221 | */ |
222 | 222 | function give_get_receipt_session() { |
223 | - return Give()->session->get( 'receipt_access' ); |
|
223 | + return Give()->session->get('receipt_access'); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | /** |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * @return array|string |
232 | 232 | */ |
233 | 233 | function give_get_history_session() { |
234 | - return (bool) Give()->session->get( 'history_access' ); |
|
234 | + return (bool) Give()->session->get('history_access'); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -243,17 +243,17 @@ discard block |
||
243 | 243 | * |
244 | 244 | * @return string By default, the name of the form. Then the price level text if any is found. |
245 | 245 | */ |
246 | -function give_payment_gateway_item_title( $payment_data ) { |
|
246 | +function give_payment_gateway_item_title($payment_data) { |
|
247 | 247 | |
248 | - $form_id = intval( $payment_data['post_data']['give-form-id'] ); |
|
249 | - $item_name = isset( $payment_data['post_data']['give-form-title'] ) ? $payment_data['post_data']['give-form-title'] : ''; |
|
250 | - $price_id = isset( $payment_data['post_data']['give-price-id'] ) ? $payment_data['post_data']['give-price-id'] : ''; |
|
248 | + $form_id = intval($payment_data['post_data']['give-form-id']); |
|
249 | + $item_name = isset($payment_data['post_data']['give-form-title']) ? $payment_data['post_data']['give-form-title'] : ''; |
|
250 | + $price_id = isset($payment_data['post_data']['give-price-id']) ? $payment_data['post_data']['give-price-id'] : ''; |
|
251 | 251 | |
252 | 252 | |
253 | 253 | // Verify has variable prices. |
254 | - if ( give_has_variable_prices( $form_id ) && ! empty( $price_id ) ) { |
|
254 | + if (give_has_variable_prices($form_id) && ! empty($price_id)) { |
|
255 | 255 | |
256 | - $item_price_level_text = give_get_price_option_name( $form_id, $price_id, 0, false ); |
|
256 | + $item_price_level_text = give_get_price_option_name($form_id, $price_id, 0, false); |
|
257 | 257 | |
258 | 258 | /** |
259 | 259 | * Output donation level text if: |
@@ -263,10 +263,10 @@ discard block |
||
263 | 263 | */ |
264 | 264 | if ( |
265 | 265 | 'custom' !== $price_id |
266 | - && ! empty( $item_price_level_text ) |
|
266 | + && ! empty($item_price_level_text) |
|
267 | 267 | ) { |
268 | 268 | // Matches a donation level - append level text. |
269 | - $item_name .= ' - ' . $item_price_level_text; |
|
269 | + $item_name .= ' - '.$item_price_level_text; |
|
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * |
282 | 282 | * @return string |
283 | 283 | */ |
284 | - return apply_filters( 'give_payment_gateway_item_title', $item_name, $form_id, $payment_data ); |
|
284 | + return apply_filters('give_payment_gateway_item_title', $item_name, $form_id, $payment_data); |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | /** |
@@ -297,38 +297,38 @@ discard block |
||
297 | 297 | * |
298 | 298 | * @return string |
299 | 299 | */ |
300 | -function give_payment_gateway_donation_summary( $donation_data, $name_and_email = true, $length = 255 ) { |
|
300 | +function give_payment_gateway_donation_summary($donation_data, $name_and_email = true, $length = 255) { |
|
301 | 301 | |
302 | - $form_id = isset( $donation_data['post_data']['give-form-id'] ) ? $donation_data['post_data']['give-form-id'] : ''; |
|
303 | - $price_id = isset( $donation_data['post_data']['give-price-id'] ) ? $donation_data['post_data']['give-price-id'] : ''; |
|
302 | + $form_id = isset($donation_data['post_data']['give-form-id']) ? $donation_data['post_data']['give-form-id'] : ''; |
|
303 | + $price_id = isset($donation_data['post_data']['give-price-id']) ? $donation_data['post_data']['give-price-id'] : ''; |
|
304 | 304 | |
305 | 305 | // Form title. |
306 | - $summary = ( ! empty( $donation_data['post_data']['give-form-title'] ) ? $donation_data['post_data']['give-form-title'] : ( ! empty( $form_id ) ? wp_sprintf( __( 'Donation Form ID: %d', 'give' ), $form_id ) : __( 'Untitled donation form', 'give' ) ) ); |
|
306 | + $summary = ( ! empty($donation_data['post_data']['give-form-title']) ? $donation_data['post_data']['give-form-title'] : ( ! empty($form_id) ? wp_sprintf(__('Donation Form ID: %d', 'give'), $form_id) : __('Untitled donation form', 'give'))); |
|
307 | 307 | |
308 | 308 | // Form multilevel if applicable. |
309 | - if ( ! empty( $price_id ) && 'custom' !== $price_id ) { |
|
310 | - $summary .= ': ' . give_get_price_option_name( $form_id, $donation_data['post_data']['give-price-id'] ); |
|
309 | + if ( ! empty($price_id) && 'custom' !== $price_id) { |
|
310 | + $summary .= ': '.give_get_price_option_name($form_id, $donation_data['post_data']['give-price-id']); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | // Add Donor's name + email if requested. |
314 | - if ( $name_and_email ) { |
|
314 | + if ($name_and_email) { |
|
315 | 315 | |
316 | 316 | // First name |
317 | - if ( isset( $donation_data['user_info']['first_name'] ) && ! empty( $donation_data['user_info']['first_name'] ) ) { |
|
318 | - $summary .= ' - ' . $donation_data['user_info']['first_name']; |
|
317 | + if (isset($donation_data['user_info']['first_name']) && ! empty($donation_data['user_info']['first_name'])) { |
|
318 | + $summary .= ' - '.$donation_data['user_info']['first_name']; |
|
319 | 319 | } |
320 | 320 | |
321 | - if ( isset( $donation_data['user_info']['last_name'] ) && ! empty( $donation_data['user_info']['last_name'] ) ) { |
|
322 | - $summary .= ' ' . $donation_data['user_info']['last_name']; |
|
321 | + if (isset($donation_data['user_info']['last_name']) && ! empty($donation_data['user_info']['last_name'])) { |
|
322 | + $summary .= ' '.$donation_data['user_info']['last_name']; |
|
323 | 323 | } |
324 | 324 | |
325 | - $summary .= ' (' . $donation_data['user_email'] . ')'; |
|
325 | + $summary .= ' ('.$donation_data['user_email'].')'; |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | // Cut the length |
329 | - $summary = substr( $summary, 0, $length ); |
|
329 | + $summary = substr($summary, 0, $length); |
|
330 | 330 | |
331 | - return apply_filters( 'give_payment_gateway_donation_summary', $summary ); |
|
331 | + return apply_filters('give_payment_gateway_donation_summary', $summary); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | |
@@ -343,31 +343,31 @@ discard block |
||
343 | 343 | function give_get_host() { |
344 | 344 | $host = false; |
345 | 345 | |
346 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
346 | + if (defined('WPE_APIKEY')) { |
|
347 | 347 | $host = 'WP Engine'; |
348 | - } elseif ( defined( 'PAGELYBIN' ) ) { |
|
348 | + } elseif (defined('PAGELYBIN')) { |
|
349 | 349 | $host = 'Pagely'; |
350 | - } elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
350 | + } elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
351 | 351 | $host = 'ICDSoft'; |
352 | - } elseif ( DB_HOST == 'mysqlv5' ) { |
|
352 | + } elseif (DB_HOST == 'mysqlv5') { |
|
353 | 353 | $host = 'NetworkSolutions'; |
354 | - } elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
354 | + } elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
355 | 355 | $host = 'iPage'; |
356 | - } elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
356 | + } elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
357 | 357 | $host = 'IPower'; |
358 | - } elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
358 | + } elseif (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
359 | 359 | $host = 'MediaTemple Grid'; |
360 | - } elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
360 | + } elseif (strpos(DB_HOST, '.pair.com') !== false) { |
|
361 | 361 | $host = 'pair Networks'; |
362 | - } elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
362 | + } elseif (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
363 | 363 | $host = 'Rackspace Cloud'; |
364 | - } elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
364 | + } elseif (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
365 | 365 | $host = 'SysFix.eu Power Hosting'; |
366 | - } elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
366 | + } elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
367 | 367 | $host = 'Flywheel'; |
368 | 368 | } else { |
369 | 369 | // Adding a general fallback for data gathering |
370 | - $host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME']; |
|
370 | + $host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME']; |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | return $host; |
@@ -383,67 +383,67 @@ discard block |
||
383 | 383 | * |
384 | 384 | * @return bool true if host matches, false if not |
385 | 385 | */ |
386 | -function give_is_host( $host = false ) { |
|
386 | +function give_is_host($host = false) { |
|
387 | 387 | |
388 | 388 | $return = false; |
389 | 389 | |
390 | - if ( $host ) { |
|
391 | - $host = str_replace( ' ', '', strtolower( $host ) ); |
|
390 | + if ($host) { |
|
391 | + $host = str_replace(' ', '', strtolower($host)); |
|
392 | 392 | |
393 | - switch ( $host ) { |
|
393 | + switch ($host) { |
|
394 | 394 | case 'wpengine': |
395 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
395 | + if (defined('WPE_APIKEY')) { |
|
396 | 396 | $return = true; |
397 | 397 | } |
398 | 398 | break; |
399 | 399 | case 'pagely': |
400 | - if ( defined( 'PAGELYBIN' ) ) { |
|
400 | + if (defined('PAGELYBIN')) { |
|
401 | 401 | $return = true; |
402 | 402 | } |
403 | 403 | break; |
404 | 404 | case 'icdsoft': |
405 | - if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
405 | + if (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
406 | 406 | $return = true; |
407 | 407 | } |
408 | 408 | break; |
409 | 409 | case 'networksolutions': |
410 | - if ( DB_HOST == 'mysqlv5' ) { |
|
410 | + if (DB_HOST == 'mysqlv5') { |
|
411 | 411 | $return = true; |
412 | 412 | } |
413 | 413 | break; |
414 | 414 | case 'ipage': |
415 | - if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
415 | + if (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
416 | 416 | $return = true; |
417 | 417 | } |
418 | 418 | break; |
419 | 419 | case 'ipower': |
420 | - if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
420 | + if (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
421 | 421 | $return = true; |
422 | 422 | } |
423 | 423 | break; |
424 | 424 | case 'mediatemplegrid': |
425 | - if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
425 | + if (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
426 | 426 | $return = true; |
427 | 427 | } |
428 | 428 | break; |
429 | 429 | case 'pairnetworks': |
430 | - if ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
430 | + if (strpos(DB_HOST, '.pair.com') !== false) { |
|
431 | 431 | $return = true; |
432 | 432 | } |
433 | 433 | break; |
434 | 434 | case 'rackspacecloud': |
435 | - if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
435 | + if (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
436 | 436 | $return = true; |
437 | 437 | } |
438 | 438 | break; |
439 | 439 | case 'sysfix.eu': |
440 | 440 | case 'sysfix.eupowerhosting': |
441 | - if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
441 | + if (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
442 | 442 | $return = true; |
443 | 443 | } |
444 | 444 | break; |
445 | 445 | case 'flywheel': |
446 | - if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
446 | + if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
447 | 447 | $return = true; |
448 | 448 | } |
449 | 449 | break; |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | * @param string $replacement Optional. The function that should have been called. |
477 | 477 | * @param array $backtrace Optional. Contains stack backtrace of deprecated function. |
478 | 478 | */ |
479 | -function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) { |
|
479 | +function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) { |
|
480 | 480 | |
481 | 481 | /** |
482 | 482 | * Fires while give deprecated function call occurs. |
@@ -489,19 +489,19 @@ discard block |
||
489 | 489 | * @param string $replacement Optional. The function that should have been called. |
490 | 490 | * @param string $version The plugin version that deprecated the function. |
491 | 491 | */ |
492 | - do_action( 'give_deprecated_function_run', $function, $replacement, $version ); |
|
492 | + do_action('give_deprecated_function_run', $function, $replacement, $version); |
|
493 | 493 | |
494 | - $show_errors = current_user_can( 'manage_options' ); |
|
494 | + $show_errors = current_user_can('manage_options'); |
|
495 | 495 | |
496 | 496 | // Allow plugin to filter the output error trigger. |
497 | - if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) { |
|
498 | - if ( ! is_null( $replacement ) ) { |
|
499 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) ); |
|
500 | - trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
497 | + if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) { |
|
498 | + if ( ! is_null($replacement)) { |
|
499 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement)); |
|
500 | + trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
501 | 501 | // Alternatively we could dump this to a file. |
502 | 502 | } else { |
503 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) ); |
|
504 | - trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
503 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version)); |
|
504 | + trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
505 | 505 | // Alternatively we could dump this to a file. |
506 | 506 | } |
507 | 507 | } |
@@ -515,17 +515,17 @@ discard block |
||
515 | 515 | * @return string $post_id |
516 | 516 | */ |
517 | 517 | function give_get_admin_post_id() { |
518 | - $post_id = isset( $_REQUEST['post'] ) |
|
519 | - ? absint( $_REQUEST['post'] ) |
|
518 | + $post_id = isset($_REQUEST['post']) |
|
519 | + ? absint($_REQUEST['post']) |
|
520 | 520 | : null; |
521 | 521 | |
522 | - $post_id = ! empty( $post_id ) |
|
522 | + $post_id = ! empty($post_id) |
|
523 | 523 | ? $post_id |
524 | - : ( isset( $_REQUEST['post_id'] ) ? absint( $_REQUEST['post_id'] ) : null ); |
|
524 | + : (isset($_REQUEST['post_id']) ? absint($_REQUEST['post_id']) : null); |
|
525 | 525 | |
526 | - $post_id = ! empty( $post_id ) |
|
526 | + $post_id = ! empty($post_id) |
|
527 | 527 | ? $post_id |
528 | - : ( isset( $_REQUEST['post_ID'] ) ? absint( $_REQUEST['post_ID'] ) : null ); |
|
528 | + : (isset($_REQUEST['post_ID']) ? absint($_REQUEST['post_ID']) : null); |
|
529 | 529 | |
530 | 530 | return $post_id; |
531 | 531 | } |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | * @return string Arg separator output |
538 | 538 | */ |
539 | 539 | function give_get_php_arg_separator_output() { |
540 | - return ini_get( 'arg_separator.output' ); |
|
540 | + return ini_get('arg_separator.output'); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | |
@@ -552,10 +552,10 @@ discard block |
||
552 | 552 | * |
553 | 553 | * @return string Short month name |
554 | 554 | */ |
555 | -function give_month_num_to_name( $n ) { |
|
556 | - $timestamp = mktime( 0, 0, 0, $n, 1, 2005 ); |
|
555 | +function give_month_num_to_name($n) { |
|
556 | + $timestamp = mktime(0, 0, 0, $n, 1, 2005); |
|
557 | 557 | |
558 | - return date_i18n( 'M', $timestamp ); |
|
558 | + return date_i18n('M', $timestamp); |
|
559 | 559 | } |
560 | 560 | |
561 | 561 | |
@@ -568,10 +568,10 @@ discard block |
||
568 | 568 | * |
569 | 569 | * @return bool Whether or not function is disabled. |
570 | 570 | */ |
571 | -function give_is_func_disabled( $function ) { |
|
572 | - $disabled = explode( ',', ini_get( 'disable_functions' ) ); |
|
571 | +function give_is_func_disabled($function) { |
|
572 | + $disabled = explode(',', ini_get('disable_functions')); |
|
573 | 573 | |
574 | - return in_array( $function, $disabled ); |
|
574 | + return in_array($function, $disabled); |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | function give_get_newsletter() { |
584 | 584 | ?> |
585 | 585 | |
586 | - <p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p> |
|
586 | + <p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p> |
|
587 | 587 | |
588 | 588 | <div class="give-newsletter-form-wrap"> |
589 | 589 | |
@@ -591,33 +591,33 @@ discard block |
||
591 | 591 | method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" |
592 | 592 | target="_blank" novalidate> |
593 | 593 | <div class="give-newsletter-confirmation"> |
594 | - <p><?php esc_html_e( 'Thanks for Subscribing!', 'give' ); ?> :)</p> |
|
594 | + <p><?php esc_html_e('Thanks for Subscribing!', 'give'); ?> :)</p> |
|
595 | 595 | </div> |
596 | 596 | |
597 | 597 | <table class="form-table give-newsletter-form"> |
598 | 598 | <tr valign="middle"> |
599 | 599 | <td> |
600 | 600 | <label for="mce-EMAIL" |
601 | - class="screen-reader-text"><?php esc_html_e( 'Email Address (required)', 'give' ); ?></label> |
|
601 | + class="screen-reader-text"><?php esc_html_e('Email Address (required)', 'give'); ?></label> |
|
602 | 602 | <input type="email" name="EMAIL" id="mce-EMAIL" |
603 | - placeholder="<?php esc_attr_e( 'Email Address (required)', 'give' ); ?>" |
|
603 | + placeholder="<?php esc_attr_e('Email Address (required)', 'give'); ?>" |
|
604 | 604 | class="required email" value=""> |
605 | 605 | </td> |
606 | 606 | <td> |
607 | 607 | <label for="mce-FNAME" |
608 | - class="screen-reader-text"><?php esc_html_e( 'First Name', 'give' ); ?></label> |
|
608 | + class="screen-reader-text"><?php esc_html_e('First Name', 'give'); ?></label> |
|
609 | 609 | <input type="text" name="FNAME" id="mce-FNAME" |
610 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" class="" value=""> |
|
610 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" class="" value=""> |
|
611 | 611 | </td> |
612 | 612 | <td> |
613 | 613 | <label for="mce-LNAME" |
614 | - class="screen-reader-text"><?php esc_html_e( 'Last Name', 'give' ); ?></label> |
|
614 | + class="screen-reader-text"><?php esc_html_e('Last Name', 'give'); ?></label> |
|
615 | 615 | <input type="text" name="LNAME" id="mce-LNAME" |
616 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" class="" value=""> |
|
616 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" class="" value=""> |
|
617 | 617 | </td> |
618 | 618 | <td> |
619 | 619 | <input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" |
620 | - value="<?php esc_attr_e( 'Subscribe', 'give' ); ?>"> |
|
620 | + value="<?php esc_attr_e('Subscribe', 'give'); ?>"> |
|
621 | 621 | </td> |
622 | 622 | </tr> |
623 | 623 | </table> |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | * |
671 | 671 | * @return string |
672 | 672 | */ |
673 | -function give_svg_icons( $icon ) { |
|
673 | +function give_svg_icons($icon) { |
|
674 | 674 | |
675 | 675 | // Store your SVGs in an associative array |
676 | 676 | $svgs = array( |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | ); |
683 | 683 | |
684 | 684 | // Return the chosen icon's SVG string |
685 | - return $svgs[ $icon ]; |
|
685 | + return $svgs[$icon]; |
|
686 | 686 | } |
687 | 687 | |
688 | 688 | /** |
@@ -694,15 +694,15 @@ discard block |
||
694 | 694 | * |
695 | 695 | * @return mixed |
696 | 696 | */ |
697 | -function modify_nav_menu_meta_box_object( $post_type ) { |
|
698 | - if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) { |
|
699 | - $post_type->labels->name = esc_html__( 'Donation Forms', 'give' ); |
|
697 | +function modify_nav_menu_meta_box_object($post_type) { |
|
698 | + if (isset($post_type->name) && $post_type->name == 'give_forms') { |
|
699 | + $post_type->labels->name = esc_html__('Donation Forms', 'give'); |
|
700 | 700 | } |
701 | 701 | |
702 | 702 | return $post_type; |
703 | 703 | } |
704 | 704 | |
705 | -add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' ); |
|
705 | +add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object'); |
|
706 | 706 | |
707 | 707 | /** |
708 | 708 | * Show Donation Forms Post Type in Appearance > Menus by default on fresh install. |
@@ -721,35 +721,35 @@ discard block |
||
721 | 721 | // Proceed, if current screen is navigation menus. |
722 | 722 | if ( |
723 | 723 | 'nav-menus' === $screen->id && |
724 | - give_is_setting_enabled( give_get_option( 'forms_singular' ) ) && |
|
725 | - ! get_user_option( 'give_is_donation_forms_menu_updated' ) |
|
724 | + give_is_setting_enabled(give_get_option('forms_singular')) && |
|
725 | + ! get_user_option('give_is_donation_forms_menu_updated') |
|
726 | 726 | ) { |
727 | 727 | |
728 | 728 | // Return false, if it fails to retrieve hidden meta box list and is not admin. |
729 | 729 | if ( |
730 | 730 | ! is_admin() || |
731 | - ( ! $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus' ) ) |
|
731 | + ( ! $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus')) |
|
732 | 732 | ) { |
733 | 733 | return false; |
734 | 734 | } |
735 | 735 | |
736 | 736 | // Return false, In case, we don't find 'Donation Form' in hidden meta box list. |
737 | - if ( ! in_array( 'add-post-type-give_forms', $hidden_meta_boxes, true ) ) { |
|
737 | + if ( ! in_array('add-post-type-give_forms', $hidden_meta_boxes, true)) { |
|
738 | 738 | return false; |
739 | 739 | } |
740 | 740 | |
741 | 741 | // Exclude 'Donation Form' value from hidden meta box's list. |
742 | - $hidden_meta_boxes = array_diff( $hidden_meta_boxes, array( 'add-post-type-give_forms' ) ); |
|
742 | + $hidden_meta_boxes = array_diff($hidden_meta_boxes, array('add-post-type-give_forms')); |
|
743 | 743 | |
744 | 744 | // Get current user ID. |
745 | 745 | $user = wp_get_current_user(); |
746 | 746 | |
747 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true ); |
|
748 | - update_user_option( $user->ID, 'give_is_donation_forms_menu_updated', true, true ); |
|
747 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true); |
|
748 | + update_user_option($user->ID, 'give_is_donation_forms_menu_updated', true, true); |
|
749 | 749 | } |
750 | 750 | } |
751 | 751 | |
752 | -add_action( 'current_screen', 'give_donation_metabox_menu' ); |
|
752 | +add_action('current_screen', 'give_donation_metabox_menu'); |
|
753 | 753 | |
754 | 754 | /** |
755 | 755 | * Array_column backup usage |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | * @license https://opensource.org/licenses/MIT MIT |
763 | 763 | */ |
764 | 764 | |
765 | -if ( ! function_exists( 'array_column' ) ) { |
|
765 | +if ( ! function_exists('array_column')) { |
|
766 | 766 | /** |
767 | 767 | * Returns the values from a single column of the input array, identified by |
768 | 768 | * the $columnKey. |
@@ -781,53 +781,53 @@ discard block |
||
781 | 781 | * |
782 | 782 | * @return array |
783 | 783 | */ |
784 | - function array_column( $input = null, $columnKey = null, $indexKey = null ) { |
|
784 | + function array_column($input = null, $columnKey = null, $indexKey = null) { |
|
785 | 785 | // Using func_get_args() in order to check for proper number of |
786 | 786 | // parameters and trigger errors exactly as the built-in array_column() |
787 | 787 | // does in PHP 5.5. |
788 | 788 | $argc = func_num_args(); |
789 | 789 | $params = func_get_args(); |
790 | 790 | |
791 | - if ( $argc < 2 ) { |
|
792 | - trigger_error( sprintf( esc_html__( 'array_column() expects at least 2 parameters, %s given.', 'give' ), $argc ), E_USER_WARNING ); |
|
791 | + if ($argc < 2) { |
|
792 | + trigger_error(sprintf(esc_html__('array_column() expects at least 2 parameters, %s given.', 'give'), $argc), E_USER_WARNING); |
|
793 | 793 | |
794 | 794 | return null; |
795 | 795 | } |
796 | 796 | |
797 | - if ( ! is_array( $params[0] ) ) { |
|
798 | - trigger_error( sprintf( esc_html__( 'array_column() expects parameter 1 to be array, %s given.', 'give' ), gettype( $params[0] ) ), E_USER_WARNING ); |
|
797 | + if ( ! is_array($params[0])) { |
|
798 | + trigger_error(sprintf(esc_html__('array_column() expects parameter 1 to be array, %s given.', 'give'), gettype($params[0])), E_USER_WARNING); |
|
799 | 799 | |
800 | 800 | return null; |
801 | 801 | } |
802 | 802 | |
803 | - if ( ! is_int( $params[1] ) |
|
804 | - && ! is_float( $params[1] ) |
|
805 | - && ! is_string( $params[1] ) |
|
803 | + if ( ! is_int($params[1]) |
|
804 | + && ! is_float($params[1]) |
|
805 | + && ! is_string($params[1]) |
|
806 | 806 | && $params[1] !== null |
807 | - && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) |
|
807 | + && ! (is_object($params[1]) && method_exists($params[1], '__toString')) |
|
808 | 808 | ) { |
809 | - trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
|
809 | + trigger_error(esc_html__('array_column(): The column key should be either a string or an integer.', 'give'), E_USER_WARNING); |
|
810 | 810 | |
811 | 811 | return false; |
812 | 812 | } |
813 | 813 | |
814 | - if ( isset( $params[2] ) |
|
815 | - && ! is_int( $params[2] ) |
|
816 | - && ! is_float( $params[2] ) |
|
817 | - && ! is_string( $params[2] ) |
|
818 | - && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) |
|
814 | + if (isset($params[2]) |
|
815 | + && ! is_int($params[2]) |
|
816 | + && ! is_float($params[2]) |
|
817 | + && ! is_string($params[2]) |
|
818 | + && ! (is_object($params[2]) && method_exists($params[2], '__toString')) |
|
819 | 819 | ) { |
820 | - trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
|
820 | + trigger_error(esc_html__('array_column(): The index key should be either a string or an integer.', 'give'), E_USER_WARNING); |
|
821 | 821 | |
822 | 822 | return false; |
823 | 823 | } |
824 | 824 | |
825 | 825 | $paramsInput = $params[0]; |
826 | - $paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null; |
|
826 | + $paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null; |
|
827 | 827 | |
828 | 828 | $paramsIndexKey = null; |
829 | - if ( isset( $params[2] ) ) { |
|
830 | - if ( is_float( $params[2] ) || is_int( $params[2] ) ) { |
|
829 | + if (isset($params[2])) { |
|
830 | + if (is_float($params[2]) || is_int($params[2])) { |
|
831 | 831 | $paramsIndexKey = (int) $params[2]; |
832 | 832 | } else { |
833 | 833 | $paramsIndexKey = (string) $params[2]; |
@@ -836,26 +836,26 @@ discard block |
||
836 | 836 | |
837 | 837 | $resultArray = array(); |
838 | 838 | |
839 | - foreach ( $paramsInput as $row ) { |
|
839 | + foreach ($paramsInput as $row) { |
|
840 | 840 | $key = $value = null; |
841 | 841 | $keySet = $valueSet = false; |
842 | 842 | |
843 | - if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) { |
|
843 | + if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) { |
|
844 | 844 | $keySet = true; |
845 | - $key = (string) $row[ $paramsIndexKey ]; |
|
845 | + $key = (string) $row[$paramsIndexKey]; |
|
846 | 846 | } |
847 | 847 | |
848 | - if ( $paramsColumnKey === null ) { |
|
848 | + if ($paramsColumnKey === null) { |
|
849 | 849 | $valueSet = true; |
850 | 850 | $value = $row; |
851 | - } elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) { |
|
851 | + } elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) { |
|
852 | 852 | $valueSet = true; |
853 | - $value = $row[ $paramsColumnKey ]; |
|
853 | + $value = $row[$paramsColumnKey]; |
|
854 | 854 | } |
855 | 855 | |
856 | - if ( $valueSet ) { |
|
857 | - if ( $keySet ) { |
|
858 | - $resultArray[ $key ] = $value; |
|
856 | + if ($valueSet) { |
|
857 | + if ($keySet) { |
|
858 | + $resultArray[$key] = $value; |
|
859 | 859 | } else { |
860 | 860 | $resultArray[] = $value; |
861 | 861 | } |
@@ -875,54 +875,54 @@ discard block |
||
875 | 875 | * |
876 | 876 | * @return bool Whether the receipt is visible or not. |
877 | 877 | */ |
878 | -function give_can_view_receipt( $payment_key = '' ) { |
|
878 | +function give_can_view_receipt($payment_key = '') { |
|
879 | 879 | |
880 | 880 | $return = false; |
881 | 881 | |
882 | - if ( empty( $payment_key ) ) { |
|
882 | + if (empty($payment_key)) { |
|
883 | 883 | return $return; |
884 | 884 | } |
885 | 885 | |
886 | 886 | global $give_receipt_args; |
887 | 887 | |
888 | - $give_receipt_args['id'] = give_get_donation_id_by_key( $payment_key ); |
|
888 | + $give_receipt_args['id'] = give_get_donation_id_by_key($payment_key); |
|
889 | 889 | |
890 | - $user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] ); |
|
890 | + $user_id = (int) give_get_payment_user_id($give_receipt_args['id']); |
|
891 | 891 | |
892 | - $payment_meta = give_get_payment_meta( $give_receipt_args['id'] ); |
|
892 | + $payment_meta = give_get_payment_meta($give_receipt_args['id']); |
|
893 | 893 | |
894 | - if ( is_user_logged_in() ) { |
|
895 | - if ( $user_id === (int) get_current_user_id() ) { |
|
894 | + if (is_user_logged_in()) { |
|
895 | + if ($user_id === (int) get_current_user_id()) { |
|
896 | 896 | $return = true; |
897 | - } elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) { |
|
897 | + } elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) { |
|
898 | 898 | $return = true; |
899 | - } elseif ( current_user_can( 'view_give_sensitive_data' ) ) { |
|
899 | + } elseif (current_user_can('view_give_sensitive_data')) { |
|
900 | 900 | $return = true; |
901 | 901 | } |
902 | 902 | } |
903 | 903 | |
904 | 904 | // Check whether it is purchase session? |
905 | 905 | $purchase_session = give_get_purchase_session(); |
906 | - if ( ! empty( $purchase_session ) && ! is_user_logged_in() ) { |
|
907 | - if ( $purchase_session['purchase_key'] === $payment_meta['key'] ) { |
|
906 | + if ( ! empty($purchase_session) && ! is_user_logged_in()) { |
|
907 | + if ($purchase_session['purchase_key'] === $payment_meta['key']) { |
|
908 | 908 | $return = true; |
909 | 909 | } |
910 | 910 | } |
911 | 911 | |
912 | 912 | // Check whether it is receipt access session? |
913 | 913 | $receipt_session = give_get_receipt_session(); |
914 | - if ( ! empty( $receipt_session ) && ! is_user_logged_in() ) { |
|
915 | - if ( $receipt_session === $payment_meta['key'] ) { |
|
914 | + if ( ! empty($receipt_session) && ! is_user_logged_in()) { |
|
915 | + if ($receipt_session === $payment_meta['key']) { |
|
916 | 916 | $return = true; |
917 | 917 | } |
918 | 918 | } |
919 | 919 | |
920 | 920 | // Check whether it is history access session? |
921 | - if ( true === give_get_history_session() ) { |
|
921 | + if (true === give_get_history_session()) { |
|
922 | 922 | $return = true; |
923 | 923 | } |
924 | 924 | |
925 | - return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key ); |
|
925 | + return (bool) apply_filters('give_can_view_receipt', $return, $payment_key); |
|
926 | 926 | |
927 | 927 | } |
928 | 928 | |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | * |
932 | 932 | * Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar |
933 | 933 | */ |
934 | -if ( ! function_exists( 'cal_days_in_month' ) ) { |
|
934 | +if ( ! function_exists('cal_days_in_month')) { |
|
935 | 935 | /** |
936 | 936 | * cal_days_in_month |
937 | 937 | * |
@@ -941,8 +941,8 @@ discard block |
||
941 | 941 | * |
942 | 942 | * @return bool|string |
943 | 943 | */ |
944 | - function cal_days_in_month( $calendar, $month, $year ) { |
|
945 | - return date( 't', mktime( 0, 0, 0, $month, 1, $year ) ); |
|
944 | + function cal_days_in_month($calendar, $month, $year) { |
|
945 | + return date('t', mktime(0, 0, 0, $month, 1, $year)); |
|
946 | 946 | } |
947 | 947 | } |
948 | 948 | |
@@ -961,42 +961,42 @@ discard block |
||
961 | 961 | */ |
962 | 962 | function give_get_plugins() { |
963 | 963 | $plugins = get_plugins(); |
964 | - $active_plugin_paths = (array) get_option( 'active_plugins', array() ); |
|
964 | + $active_plugin_paths = (array) get_option('active_plugins', array()); |
|
965 | 965 | |
966 | - if ( is_multisite() ) { |
|
967 | - $network_activated_plugin_paths = array_keys( get_site_option( 'active_sitewide_plugins', array() ) ); |
|
968 | - $active_plugin_paths = array_merge( $active_plugin_paths, $network_activated_plugin_paths ); |
|
966 | + if (is_multisite()) { |
|
967 | + $network_activated_plugin_paths = array_keys(get_site_option('active_sitewide_plugins', array())); |
|
968 | + $active_plugin_paths = array_merge($active_plugin_paths, $network_activated_plugin_paths); |
|
969 | 969 | } |
970 | 970 | |
971 | - foreach ( $plugins as $plugin_path => $plugin_data ) { |
|
971 | + foreach ($plugins as $plugin_path => $plugin_data) { |
|
972 | 972 | // Is plugin active? |
973 | - if ( in_array( $plugin_path, $active_plugin_paths ) ) { |
|
974 | - $plugins[ $plugin_path ]['Status'] = 'active'; |
|
973 | + if (in_array($plugin_path, $active_plugin_paths)) { |
|
974 | + $plugins[$plugin_path]['Status'] = 'active'; |
|
975 | 975 | } else { |
976 | - $plugins[ $plugin_path ]['Status'] = 'inactive'; |
|
976 | + $plugins[$plugin_path]['Status'] = 'inactive'; |
|
977 | 977 | } |
978 | 978 | |
979 | - $dirname = strtolower( dirname( $plugin_path ) ); |
|
979 | + $dirname = strtolower(dirname($plugin_path)); |
|
980 | 980 | |
981 | 981 | // Is plugin a Give add-on by WordImpress? |
982 | - if ( strstr( $dirname, 'give-' ) && strstr( $plugin_data['AuthorURI'], 'wordimpress.com' ) ) { |
|
982 | + if (strstr($dirname, 'give-') && strstr($plugin_data['AuthorURI'], 'wordimpress.com')) { |
|
983 | 983 | // Plugin is a Give-addon. |
984 | - $plugins[ $plugin_path ]['Type'] = 'add-on'; |
|
984 | + $plugins[$plugin_path]['Type'] = 'add-on'; |
|
985 | 985 | |
986 | 986 | // Get license info from database. |
987 | - $plugin_name = str_replace( 'Give - ', '', $plugin_data['Name'] ); |
|
988 | - $db_option = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $plugin_name ) ) ) . '_license_active'; |
|
989 | - $license_active = get_option( $db_option ); |
|
987 | + $plugin_name = str_replace('Give - ', '', $plugin_data['Name']); |
|
988 | + $db_option = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($plugin_name))).'_license_active'; |
|
989 | + $license_active = get_option($db_option); |
|
990 | 990 | |
991 | 991 | // Does a valid license exist? |
992 | - if ( ! empty( $license_active ) && 'valid' === $license_active->license ) { |
|
993 | - $plugins[ $plugin_path ]['License'] = true; |
|
992 | + if ( ! empty($license_active) && 'valid' === $license_active->license) { |
|
993 | + $plugins[$plugin_path]['License'] = true; |
|
994 | 994 | } else { |
995 | - $plugins[ $plugin_path ]['License'] = false; |
|
995 | + $plugins[$plugin_path]['License'] = false; |
|
996 | 996 | } |
997 | 997 | } else { |
998 | 998 | // Plugin is not a Give add-on. |
999 | - $plugins[ $plugin_path ]['Type'] = 'other'; |
|
999 | + $plugins[$plugin_path]['Type'] = 'other'; |
|
1000 | 1000 | } |
1001 | 1001 | } |
1002 | 1002 | |
@@ -1013,16 +1013,16 @@ discard block |
||
1013 | 1013 | * |
1014 | 1014 | * @return bool |
1015 | 1015 | */ |
1016 | -function give_is_terms_enabled( $form_id ) { |
|
1017 | - $form_option = give_get_meta( $form_id, '_give_terms_option', true ); |
|
1016 | +function give_is_terms_enabled($form_id) { |
|
1017 | + $form_option = give_get_meta($form_id, '_give_terms_option', true); |
|
1018 | 1018 | |
1019 | 1019 | if ( |
1020 | - give_is_setting_enabled( $form_option, 'global' ) |
|
1021 | - && give_is_setting_enabled( give_get_option( 'terms' ) ) |
|
1020 | + give_is_setting_enabled($form_option, 'global') |
|
1021 | + && give_is_setting_enabled(give_get_option('terms')) |
|
1022 | 1022 | ) { |
1023 | 1023 | return true; |
1024 | 1024 | |
1025 | - } elseif ( give_is_setting_enabled( $form_option ) ) { |
|
1025 | + } elseif (give_is_setting_enabled($form_option)) { |
|
1026 | 1026 | return true; |
1027 | 1027 | |
1028 | 1028 | } else { |
@@ -1047,10 +1047,10 @@ discard block |
||
1047 | 1047 | * |
1048 | 1048 | * @return WP_Error|bool |
1049 | 1049 | */ |
1050 | -function give_delete_donation_stats( $date_range = '', $args = array() ) { |
|
1050 | +function give_delete_donation_stats($date_range = '', $args = array()) { |
|
1051 | 1051 | |
1052 | 1052 | // Delete all cache. |
1053 | - $status = Give_Cache::delete( Give_Cache::get_options_like( 'give_stats' ) ); |
|
1053 | + $status = Give_Cache::delete(Give_Cache::get_options_like('give_stats')); |
|
1054 | 1054 | |
1055 | 1055 | /** |
1056 | 1056 | * Fire the action when donation stats delete. |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | * @param string|array $date_range |
1061 | 1061 | * @param array $args |
1062 | 1062 | */ |
1063 | - do_action( 'give_delete_donation_stats', $status, $date_range, $args ); |
|
1063 | + do_action('give_delete_donation_stats', $status, $date_range, $args); |
|
1064 | 1064 | |
1065 | 1065 | return $status; |
1066 | 1066 | } |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | function give_is_add_new_form_page() { |
1075 | 1075 | $status = false; |
1076 | 1076 | |
1077 | - if ( false !== strpos( $_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms' ) ) { |
|
1077 | + if (false !== strpos($_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms')) { |
|
1078 | 1078 | $status = true; |
1079 | 1079 | } |
1080 | 1080 | |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | * |
1098 | 1098 | * @return mixed |
1099 | 1099 | */ |
1100 | -function give_get_meta( $id, $meta_key = '', $single = false, $default = false ) { |
|
1100 | +function give_get_meta($id, $meta_key = '', $single = false, $default = false) { |
|
1101 | 1101 | /** |
1102 | 1102 | * Filter the meta value |
1103 | 1103 | * |
@@ -1105,14 +1105,14 @@ discard block |
||
1105 | 1105 | */ |
1106 | 1106 | $meta_value = apply_filters( |
1107 | 1107 | 'give_get_meta', |
1108 | - get_post_meta( $id, $meta_key, $single ), |
|
1108 | + get_post_meta($id, $meta_key, $single), |
|
1109 | 1109 | $id, |
1110 | 1110 | $meta_key, |
1111 | 1111 | $default |
1112 | 1112 | ); |
1113 | 1113 | |
1114 | 1114 | if ( |
1115 | - ( empty( $meta_key ) || empty( $meta_value ) ) |
|
1115 | + (empty($meta_key) || empty($meta_value)) |
|
1116 | 1116 | && $default |
1117 | 1117 | ) { |
1118 | 1118 | $meta_value = $default; |
@@ -1133,15 +1133,15 @@ discard block |
||
1133 | 1133 | * |
1134 | 1134 | * @return mixed |
1135 | 1135 | */ |
1136 | -function give_update_meta( $id, $meta_key, $meta_value, $prev_value = '' ) { |
|
1137 | - $status = update_post_meta( $id, $meta_key, $meta_value, $prev_value ); |
|
1136 | +function give_update_meta($id, $meta_key, $meta_value, $prev_value = '') { |
|
1137 | + $status = update_post_meta($id, $meta_key, $meta_value, $prev_value); |
|
1138 | 1138 | |
1139 | 1139 | /** |
1140 | 1140 | * Filter the meta value update status |
1141 | 1141 | * |
1142 | 1142 | * @since 1.8.8 |
1143 | 1143 | */ |
1144 | - return apply_filters( 'give_update_meta', $status, $id, $meta_key, $meta_value ); |
|
1144 | + return apply_filters('give_update_meta', $status, $id, $meta_key, $meta_value); |
|
1145 | 1145 | } |
1146 | 1146 | |
1147 | 1147 | /** |
@@ -1155,15 +1155,15 @@ discard block |
||
1155 | 1155 | * |
1156 | 1156 | * @return mixed |
1157 | 1157 | */ |
1158 | -function give_delete_meta( $id, $meta_key, $meta_value = '' ) { |
|
1159 | - $status = delete_post_meta( $id, $meta_key, $meta_value ); |
|
1158 | +function give_delete_meta($id, $meta_key, $meta_value = '') { |
|
1159 | + $status = delete_post_meta($id, $meta_key, $meta_value); |
|
1160 | 1160 | |
1161 | 1161 | /** |
1162 | 1162 | * Filter the meta value delete status |
1163 | 1163 | * |
1164 | 1164 | * @since 1.8.8 |
1165 | 1165 | */ |
1166 | - return apply_filters( 'give_delete_meta', $status, $id, $meta_key, $meta_value ); |
|
1166 | + return apply_filters('give_delete_meta', $status, $id, $meta_key, $meta_value); |
|
1167 | 1167 | } |
1168 | 1168 | |
1169 | 1169 | /** |
@@ -1175,23 +1175,23 @@ discard block |
||
1175 | 1175 | * |
1176 | 1176 | * @return bool If the action has been added to the completed actions array |
1177 | 1177 | */ |
1178 | -function give_has_upgrade_completed( $upgrade_action = '' ) { |
|
1178 | +function give_has_upgrade_completed($upgrade_action = '') { |
|
1179 | 1179 | // Bailout. |
1180 | - if ( empty( $upgrade_action ) ) { |
|
1180 | + if (empty($upgrade_action)) { |
|
1181 | 1181 | return false; |
1182 | 1182 | } |
1183 | 1183 | |
1184 | 1184 | // Fresh install? |
1185 | 1185 | // If fresh install then all upgrades will be consider as completed. |
1186 | - $is_fresh_install = ! get_option( 'give_version' ); |
|
1187 | - if ( $is_fresh_install ) { |
|
1186 | + $is_fresh_install = ! get_option('give_version'); |
|
1187 | + if ($is_fresh_install) { |
|
1188 | 1188 | return true; |
1189 | 1189 | } |
1190 | 1190 | |
1191 | 1191 | |
1192 | 1192 | $completed_upgrades = give_get_completed_upgrades(); |
1193 | 1193 | |
1194 | - return in_array( $upgrade_action, $completed_upgrades ); |
|
1194 | + return in_array($upgrade_action, $completed_upgrades); |
|
1195 | 1195 | |
1196 | 1196 | } |
1197 | 1197 | |
@@ -1203,8 +1203,8 @@ discard block |
||
1203 | 1203 | * @return mixed When nothing to resume returns false, otherwise starts the upgrade where it left off |
1204 | 1204 | */ |
1205 | 1205 | function give_maybe_resume_upgrade() { |
1206 | - $doing_upgrade = get_option( 'give_doing_upgrade', false ); |
|
1207 | - if ( empty( $doing_upgrade ) ) { |
|
1206 | + $doing_upgrade = get_option('give_doing_upgrade', false); |
|
1207 | + if (empty($doing_upgrade)) { |
|
1208 | 1208 | return false; |
1209 | 1209 | } |
1210 | 1210 | |
@@ -1220,9 +1220,9 @@ discard block |
||
1220 | 1220 | * |
1221 | 1221 | * @return bool If the function was successfully added |
1222 | 1222 | */ |
1223 | -function give_set_upgrade_complete( $upgrade_action = '' ) { |
|
1223 | +function give_set_upgrade_complete($upgrade_action = '') { |
|
1224 | 1224 | |
1225 | - if ( empty( $upgrade_action ) ) { |
|
1225 | + if (empty($upgrade_action)) { |
|
1226 | 1226 | return false; |
1227 | 1227 | } |
1228 | 1228 | |
@@ -1230,16 +1230,16 @@ discard block |
||
1230 | 1230 | $completed_upgrades[] = $upgrade_action; |
1231 | 1231 | |
1232 | 1232 | // Remove any blanks, and only show uniques. |
1233 | - $completed_upgrades = array_unique( array_values( $completed_upgrades ) ); |
|
1233 | + $completed_upgrades = array_unique(array_values($completed_upgrades)); |
|
1234 | 1234 | |
1235 | 1235 | /** |
1236 | 1236 | * Fire the action when any upgrade set to complete. |
1237 | 1237 | * |
1238 | 1238 | * @since 1.8.12 |
1239 | 1239 | */ |
1240 | - do_action( 'give_set_upgrade_completed', $upgrade_action, $completed_upgrades ); |
|
1240 | + do_action('give_set_upgrade_completed', $upgrade_action, $completed_upgrades); |
|
1241 | 1241 | |
1242 | - return update_option( 'give_completed_upgrades', $completed_upgrades, 'no' ); |
|
1242 | + return update_option('give_completed_upgrades', $completed_upgrades, 'no'); |
|
1243 | 1243 | } |
1244 | 1244 | |
1245 | 1245 | /** |
@@ -1249,7 +1249,7 @@ discard block |
||
1249 | 1249 | * @return array The array of completed upgrades |
1250 | 1250 | */ |
1251 | 1251 | function give_get_completed_upgrades() { |
1252 | - return (array) get_option( 'give_completed_upgrades' ); |
|
1252 | + return (array) get_option('give_completed_upgrades'); |
|
1253 | 1253 | } |
1254 | 1254 | |
1255 | 1255 | /** |
@@ -1264,16 +1264,16 @@ discard block |
||
1264 | 1264 | * |
1265 | 1265 | * @return null|array |
1266 | 1266 | */ |
1267 | -function __give_v20_bc_table_details( $type ) { |
|
1267 | +function __give_v20_bc_table_details($type) { |
|
1268 | 1268 | global $wpdb; |
1269 | 1269 | $table = array(); |
1270 | 1270 | |
1271 | 1271 | // Bailout. |
1272 | - if ( empty( $type ) ) { |
|
1272 | + if (empty($type)) { |
|
1273 | 1273 | return null; |
1274 | 1274 | } |
1275 | 1275 | |
1276 | - switch ( $type ) { |
|
1276 | + switch ($type) { |
|
1277 | 1277 | case 'form': |
1278 | 1278 | $table['name'] = $wpdb->formmeta; |
1279 | 1279 | $table['column']['id'] = 'form_id'; |
@@ -1286,7 +1286,7 @@ discard block |
||
1286 | 1286 | } |
1287 | 1287 | |
1288 | 1288 | // Backward compatibility. |
1289 | - if ( ! give_has_upgrade_completed( 'v20_move_metadata_into_new_table' ) ) { |
|
1289 | + if ( ! give_has_upgrade_completed('v20_move_metadata_into_new_table')) { |
|
1290 | 1290 | $table['name'] = $wpdb->postmeta; |
1291 | 1291 | $table['column']['id'] = 'post_id'; |
1292 | 1292 | } |
@@ -1302,12 +1302,12 @@ discard block |
||
1302 | 1302 | * |
1303 | 1303 | * @param WP_Query $query |
1304 | 1304 | */ |
1305 | -function give_remove_pages_from_search( $query ) { |
|
1305 | +function give_remove_pages_from_search($query) { |
|
1306 | 1306 | |
1307 | - if ( ! $query->is_admin && $query->is_search && $query->is_main_query() ) { |
|
1307 | + if ( ! $query->is_admin && $query->is_search && $query->is_main_query()) { |
|
1308 | 1308 | |
1309 | - $transaction_failed = give_get_option( 'failure_page', 0 ); |
|
1310 | - $success_page = give_get_option( 'success_page', 0 ); |
|
1309 | + $transaction_failed = give_get_option('failure_page', 0); |
|
1310 | + $success_page = give_get_option('success_page', 0); |
|
1311 | 1311 | |
1312 | 1312 | $args = apply_filters( |
1313 | 1313 | 'give_remove_pages_from_search', array( |
@@ -1315,11 +1315,11 @@ discard block |
||
1315 | 1315 | $success_page, |
1316 | 1316 | ), $query |
1317 | 1317 | ); |
1318 | - $query->set( 'post__not_in', $args ); |
|
1318 | + $query->set('post__not_in', $args); |
|
1319 | 1319 | } |
1320 | 1320 | } |
1321 | 1321 | |
1322 | -add_action( 'pre_get_posts', 'give_remove_pages_from_search', 10, 1 ); |
|
1322 | +add_action('pre_get_posts', 'give_remove_pages_from_search', 10, 1); |
|
1323 | 1323 | |
1324 | 1324 | /** |
1325 | 1325 | * Inserts a new key/value before a key in the array. |
@@ -1335,14 +1335,14 @@ discard block |
||
1335 | 1335 | * |
1336 | 1336 | * @see array_insert_before() |
1337 | 1337 | */ |
1338 | -function give_array_insert_before( $key, array &$array, $new_key, $new_value ) { |
|
1339 | - if ( array_key_exists( $key, $array ) ) { |
|
1338 | +function give_array_insert_before($key, array &$array, $new_key, $new_value) { |
|
1339 | + if (array_key_exists($key, $array)) { |
|
1340 | 1340 | $new = array(); |
1341 | - foreach ( $array as $k => $value ) { |
|
1342 | - if ( $k === $key ) { |
|
1343 | - $new[ $new_key ] = $new_value; |
|
1341 | + foreach ($array as $k => $value) { |
|
1342 | + if ($k === $key) { |
|
1343 | + $new[$new_key] = $new_value; |
|
1344 | 1344 | } |
1345 | - $new[ $k ] = $value; |
|
1345 | + $new[$k] = $value; |
|
1346 | 1346 | } |
1347 | 1347 | |
1348 | 1348 | return $new; |
@@ -1365,13 +1365,13 @@ discard block |
||
1365 | 1365 | * |
1366 | 1366 | * @see array_insert_before() |
1367 | 1367 | */ |
1368 | -function give_array_insert_after( $key, array &$array, $new_key, $new_value ) { |
|
1369 | - if ( array_key_exists( $key, $array ) ) { |
|
1368 | +function give_array_insert_after($key, array &$array, $new_key, $new_value) { |
|
1369 | + if (array_key_exists($key, $array)) { |
|
1370 | 1370 | $new = array(); |
1371 | - foreach ( $array as $k => $value ) { |
|
1372 | - $new[ $k ] = $value; |
|
1373 | - if ( $k === $key ) { |
|
1374 | - $new[ $new_key ] = $new_value; |
|
1371 | + foreach ($array as $k => $value) { |
|
1372 | + $new[$k] = $value; |
|
1373 | + if ($k === $key) { |
|
1374 | + $new[$new_key] = $new_value; |
|
1375 | 1375 | } |
1376 | 1376 | } |
1377 | 1377 | |
@@ -1398,21 +1398,21 @@ discard block |
||
1398 | 1398 | * corresponding to `$index_key`. If `$index_key` is null, array keys from the original |
1399 | 1399 | * `$list` will be preserved in the results. |
1400 | 1400 | */ |
1401 | -function give_list_pluck( $list, $field, $index_key = null ) { |
|
1401 | +function give_list_pluck($list, $field, $index_key = null) { |
|
1402 | 1402 | |
1403 | - if ( ! $index_key ) { |
|
1403 | + if ( ! $index_key) { |
|
1404 | 1404 | /** |
1405 | 1405 | * This is simple. Could at some point wrap array_column() |
1406 | 1406 | * if we knew we had an array of arrays. |
1407 | 1407 | */ |
1408 | - foreach ( $list as $key => $value ) { |
|
1409 | - if ( is_object( $value ) ) { |
|
1410 | - if ( isset( $value->$field ) ) { |
|
1411 | - $list[ $key ] = $value->$field; |
|
1408 | + foreach ($list as $key => $value) { |
|
1409 | + if (is_object($value)) { |
|
1410 | + if (isset($value->$field)) { |
|
1411 | + $list[$key] = $value->$field; |
|
1412 | 1412 | } |
1413 | 1413 | } else { |
1414 | - if ( isset( $value[ $field ] ) ) { |
|
1415 | - $list[ $key ] = $value[ $field ]; |
|
1414 | + if (isset($value[$field])) { |
|
1415 | + $list[$key] = $value[$field]; |
|
1416 | 1416 | } |
1417 | 1417 | } |
1418 | 1418 | } |
@@ -1425,18 +1425,18 @@ discard block |
||
1425 | 1425 | * to the end of the stack. This is how array_column() behaves. |
1426 | 1426 | */ |
1427 | 1427 | $newlist = array(); |
1428 | - foreach ( $list as $value ) { |
|
1429 | - if ( is_object( $value ) ) { |
|
1430 | - if ( isset( $value->$index_key ) ) { |
|
1431 | - $newlist[ $value->$index_key ] = $value->$field; |
|
1428 | + foreach ($list as $value) { |
|
1429 | + if (is_object($value)) { |
|
1430 | + if (isset($value->$index_key)) { |
|
1431 | + $newlist[$value->$index_key] = $value->$field; |
|
1432 | 1432 | } else { |
1433 | 1433 | $newlist[] = $value->$field; |
1434 | 1434 | } |
1435 | 1435 | } else { |
1436 | - if ( isset( $value[ $index_key ] ) ) { |
|
1437 | - $newlist[ $value[ $index_key ] ] = $value[ $field ]; |
|
1436 | + if (isset($value[$index_key])) { |
|
1437 | + $newlist[$value[$index_key]] = $value[$field]; |
|
1438 | 1438 | } else { |
1439 | - $newlist[] = $value[ $field ]; |
|
1439 | + $newlist[] = $value[$field]; |
|
1440 | 1440 | } |
1441 | 1441 | } |
1442 | 1442 | } |
@@ -1459,8 +1459,8 @@ discard block |
||
1459 | 1459 | * |
1460 | 1460 | * @return int|false Meta ID on success, false on failure. |
1461 | 1461 | */ |
1462 | -function add_donor_meta( $donor_id, $meta_key, $meta_value, $unique = false ) { |
|
1463 | - return add_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $unique ); |
|
1462 | +function add_donor_meta($donor_id, $meta_key, $meta_value, $unique = false) { |
|
1463 | + return add_metadata('give_customer', $donor_id, $meta_key, $meta_value, $unique); |
|
1464 | 1464 | } |
1465 | 1465 | |
1466 | 1466 | /** |
@@ -1478,8 +1478,8 @@ discard block |
||
1478 | 1478 | * |
1479 | 1479 | * @return bool True on success, false on failure. |
1480 | 1480 | */ |
1481 | -function delete_donor_meta( $donor_id, $meta_key, $meta_value = '' ) { |
|
1482 | - return delete_metadata( 'give_customer', $donor_id, $meta_key, $meta_value ); |
|
1481 | +function delete_donor_meta($donor_id, $meta_key, $meta_value = '') { |
|
1482 | + return delete_metadata('give_customer', $donor_id, $meta_key, $meta_value); |
|
1483 | 1483 | } |
1484 | 1484 | |
1485 | 1485 | /** |
@@ -1494,8 +1494,8 @@ discard block |
||
1494 | 1494 | * @return mixed Will be an array if $single is false. Will be value of meta data field if $single |
1495 | 1495 | * is true. |
1496 | 1496 | */ |
1497 | -function get_donor_meta( $donor_id, $key = '', $single = false ) { |
|
1498 | - return get_metadata( 'give_customer', $donor_id, $key, $single ); |
|
1497 | +function get_donor_meta($donor_id, $key = '', $single = false) { |
|
1498 | + return get_metadata('give_customer', $donor_id, $key, $single); |
|
1499 | 1499 | } |
1500 | 1500 | |
1501 | 1501 | /** |
@@ -1512,8 +1512,8 @@ discard block |
||
1512 | 1512 | * |
1513 | 1513 | * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure. |
1514 | 1514 | */ |
1515 | -function update_donor_meta( $donor_id, $meta_key, $meta_value, $prev_value = '' ) { |
|
1516 | - return update_metadata( 'give_customer', $donor_id, $meta_key, $meta_value, $prev_value ); |
|
1515 | +function update_donor_meta($donor_id, $meta_key, $meta_value, $prev_value = '') { |
|
1516 | + return update_metadata('give_customer', $donor_id, $meta_key, $meta_value, $prev_value); |
|
1517 | 1517 | } |
1518 | 1518 | |
1519 | 1519 | |
@@ -1526,15 +1526,15 @@ discard block |
||
1526 | 1526 | * |
1527 | 1527 | * @return void |
1528 | 1528 | */ |
1529 | -function give_recount_form_income_donation( $form_id = 0 ) { |
|
1529 | +function give_recount_form_income_donation($form_id = 0) { |
|
1530 | 1530 | // Check if form id is not empty. |
1531 | - if ( ! empty( $form_id ) ) { |
|
1531 | + if ( ! empty($form_id)) { |
|
1532 | 1532 | /** |
1533 | 1533 | * Filter to modify payment status. |
1534 | 1534 | * |
1535 | 1535 | * @since 1.8.13 |
1536 | 1536 | */ |
1537 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
1537 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
1538 | 1538 | |
1539 | 1539 | /** |
1540 | 1540 | * Filter to modify args of payment query before recalculating the form total |
@@ -1545,7 +1545,7 @@ discard block |
||
1545 | 1545 | 'give_recount_form_stats_args', array( |
1546 | 1546 | 'give_forms' => $form_id, |
1547 | 1547 | 'status' => $accepted_statuses, |
1548 | - 'posts_per_page' => - 1, |
|
1548 | + 'posts_per_page' => -1, |
|
1549 | 1549 | 'fields' => 'ids', |
1550 | 1550 | ) |
1551 | 1551 | ); |
@@ -1555,28 +1555,28 @@ discard block |
||
1555 | 1555 | 'earnings' => 0, |
1556 | 1556 | ); |
1557 | 1557 | |
1558 | - $payments = new Give_Payments_Query( $args ); |
|
1558 | + $payments = new Give_Payments_Query($args); |
|
1559 | 1559 | $payments = $payments->get_payments(); |
1560 | 1560 | |
1561 | - if ( $payments ) { |
|
1562 | - foreach ( $payments as $payment ) { |
|
1561 | + if ($payments) { |
|
1562 | + foreach ($payments as $payment) { |
|
1563 | 1563 | // Ensure acceptible status only |
1564 | - if ( ! in_array( $payment->post_status, $accepted_statuses ) ) { |
|
1564 | + if ( ! in_array($payment->post_status, $accepted_statuses)) { |
|
1565 | 1565 | continue; |
1566 | 1566 | } |
1567 | 1567 | |
1568 | 1568 | // Ensure only payments for this form are counted |
1569 | - if ( $payment->form_id != $form_id ) { |
|
1569 | + if ($payment->form_id != $form_id) { |
|
1570 | 1570 | continue; |
1571 | 1571 | } |
1572 | 1572 | |
1573 | - $totals['sales'] ++; |
|
1573 | + $totals['sales']++; |
|
1574 | 1574 | $totals['earnings'] += $payment->total; |
1575 | 1575 | |
1576 | 1576 | } |
1577 | 1577 | } |
1578 | - give_update_meta( $form_id, '_give_form_sales', $totals['sales'] ); |
|
1579 | - give_update_meta( $form_id, '_give_form_earnings', give_sanitize_amount_for_db( $totals['earnings'] ) ); |
|
1578 | + give_update_meta($form_id, '_give_form_sales', $totals['sales']); |
|
1579 | + give_update_meta($form_id, '_give_form_earnings', give_sanitize_amount_for_db($totals['earnings'])); |
|
1580 | 1580 | }// End if(). |
1581 | 1581 | } |
1582 | 1582 | |
@@ -1590,18 +1590,18 @@ discard block |
||
1590 | 1590 | * |
1591 | 1591 | * @return string |
1592 | 1592 | */ |
1593 | -function give_get_attribute_str( $attributes ) { |
|
1593 | +function give_get_attribute_str($attributes) { |
|
1594 | 1594 | $attribute_str = ''; |
1595 | 1595 | |
1596 | - if ( empty( $attributes ) ) { |
|
1596 | + if (empty($attributes)) { |
|
1597 | 1597 | return $attribute_str; |
1598 | 1598 | } |
1599 | 1599 | |
1600 | - foreach ( $attributes as $tag => $value ) { |
|
1600 | + foreach ($attributes as $tag => $value) { |
|
1601 | 1601 | $attribute_str .= " {$tag}=\"{$value}\""; |
1602 | 1602 | } |
1603 | 1603 | |
1604 | - return trim( $attribute_str ); |
|
1604 | + return trim($attribute_str); |
|
1605 | 1605 | } |
1606 | 1606 | |
1607 | 1607 | /** |
@@ -1614,7 +1614,7 @@ discard block |
||
1614 | 1614 | function give_get_wp_upload_dir() { |
1615 | 1615 | $wp_upload_dir = wp_upload_dir(); |
1616 | 1616 | |
1617 | - return ( ! empty( $wp_upload_dir['path'] ) ? $wp_upload_dir['path'] : false ); |
|
1617 | + return ( ! empty($wp_upload_dir['path']) ? $wp_upload_dir['path'] : false); |
|
1618 | 1618 | } |
1619 | 1619 | |
1620 | 1620 | /** |
@@ -1626,15 +1626,15 @@ discard block |
||
1626 | 1626 | * |
1627 | 1627 | * @return string|bool $file_contents File content |
1628 | 1628 | */ |
1629 | -function give_get_core_settings_json( $file_name ) { |
|
1629 | +function give_get_core_settings_json($file_name) { |
|
1630 | 1630 | $upload_dir = give_get_wp_upload_dir(); |
1631 | - $file_path = $upload_dir . '/' . $file_name; |
|
1631 | + $file_path = $upload_dir.'/'.$file_name; |
|
1632 | 1632 | |
1633 | - if ( is_wp_error( $file_path ) || empty( $file_path ) ) { |
|
1634 | - Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid JSON file.', 'give' ) ); |
|
1633 | + if (is_wp_error($file_path) || empty($file_path)) { |
|
1634 | + Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid JSON file.', 'give')); |
|
1635 | 1635 | } |
1636 | 1636 | |
1637 | - $file_contents = file_get_contents( $file_path ); |
|
1637 | + $file_contents = file_get_contents($file_path); |
|
1638 | 1638 | |
1639 | 1639 | return $file_contents; |
1640 | 1640 | } |
@@ -1647,7 +1647,7 @@ discard block |
||
1647 | 1647 | * @return int $country The two letter country code for the site's base country |
1648 | 1648 | */ |
1649 | 1649 | function give_get_limit_display_donations() { |
1650 | - return give_get_option( 'limit_display_donations', 1 ); |
|
1650 | + return give_get_option('limit_display_donations', 1); |
|
1651 | 1651 | } |
1652 | 1652 | |
1653 | 1653 | /** |
@@ -1656,7 +1656,7 @@ discard block |
||
1656 | 1656 | * @since 1.8.17 |
1657 | 1657 | */ |
1658 | 1658 | function give_donation_history_table_end() { |
1659 | - $email = Give()->session->get( 'give_email' ); |
|
1659 | + $email = Give()->session->get('give_email'); |
|
1660 | 1660 | ?> |
1661 | 1661 | <tfoot> |
1662 | 1662 | <tr> |
@@ -1665,16 +1665,16 @@ discard block |
||
1665 | 1665 | <div class="give-security-column give-security-description-wrap"> |
1666 | 1666 | <?php |
1667 | 1667 | echo sprintf( |
1668 | - __( 'For security reasons, please confirm your email address (%s) to view your complete donation history.', 'give' ), |
|
1668 | + __('For security reasons, please confirm your email address (%s) to view your complete donation history.', 'give'), |
|
1669 | 1669 | |
1670 | 1670 | ); |
1671 | 1671 | ?> |
1672 | 1672 | </div> |
1673 | 1673 | <div class="give-security-column give-security-button-wrap"> |
1674 | 1674 | <a href="#" data-email="<?php echo $email; ?>" id="give-confirm-email-btn" class="give-confirm-email-btn give-btn"> |
1675 | - <?php _e( 'Confirm Email', 'give' ); ?> |
|
1675 | + <?php _e('Confirm Email', 'give'); ?> |
|
1676 | 1676 | </a> |
1677 | - <span><?php _e( 'Email Sent!', 'give' ); ?></span> |
|
1677 | + <span><?php _e('Email Sent!', 'give'); ?></span> |
|
1678 | 1678 | </div> |
1679 | 1679 | </div> |
1680 | 1680 | </td> |
@@ -1694,10 +1694,10 @@ discard block |
||
1694 | 1694 | * |
1695 | 1695 | * @return void |
1696 | 1696 | */ |
1697 | -function give_doing_it_wrong( $function, $message, $version ) { |
|
1698 | - $message .= "\nBacktrace:" . wp_debug_backtrace_summary(); |
|
1697 | +function give_doing_it_wrong($function, $message, $version) { |
|
1698 | + $message .= "\nBacktrace:".wp_debug_backtrace_summary(); |
|
1699 | 1699 | |
1700 | - _doing_it_wrong( $function, $message , $version ); |
|
1700 | + _doing_it_wrong($function, $message, $version); |
|
1701 | 1701 | } |
1702 | 1702 | |
1703 | 1703 | |
@@ -1706,11 +1706,11 @@ discard block |
||
1706 | 1706 | * |
1707 | 1707 | * @since 1.8.18 |
1708 | 1708 | */ |
1709 | -function give_ignore_user_abort(){ |
|
1710 | - ignore_user_abort( true ); |
|
1709 | +function give_ignore_user_abort() { |
|
1710 | + ignore_user_abort(true); |
|
1711 | 1711 | |
1712 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
1713 | - set_time_limit( 0 ); |
|
1712 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
1713 | + set_time_limit(0); |
|
1714 | 1714 | } |
1715 | 1715 | } |
1716 | 1716 | |
@@ -1724,28 +1724,28 @@ discard block |
||
1724 | 1724 | * |
1725 | 1725 | * @return int |
1726 | 1726 | */ |
1727 | -function give_get_total_post_type_count( $post_type = '', $args = array() ){ |
|
1727 | +function give_get_total_post_type_count($post_type = '', $args = array()) { |
|
1728 | 1728 | global $wpdb; |
1729 | 1729 | $where = ''; |
1730 | 1730 | |
1731 | - if( ! $post_type ) { |
|
1731 | + if ( ! $post_type) { |
|
1732 | 1732 | return 0; |
1733 | 1733 | } |
1734 | 1734 | |
1735 | 1735 | // Bulit where query |
1736 | - if( ! empty( $post_type ) ) { |
|
1737 | - $where.=' WHERE'; |
|
1736 | + if ( ! empty($post_type)) { |
|
1737 | + $where .= ' WHERE'; |
|
1738 | 1738 | |
1739 | - if( is_array( $post_type ) ) { |
|
1740 | - $where .= " post_type='" . implode( "' OR post_type='", $post_type ) . "'"; |
|
1741 | - }else{ |
|
1739 | + if (is_array($post_type)) { |
|
1740 | + $where .= " post_type='".implode("' OR post_type='", $post_type)."'"; |
|
1741 | + } else { |
|
1742 | 1742 | $where .= " post_type='{$post_type}'"; |
1743 | 1743 | } |
1744 | 1744 | } |
1745 | 1745 | |
1746 | 1746 | $result = $wpdb->get_var("SELECT count(ID) FROM {$wpdb->posts}{$where}"); |
1747 | 1747 | |
1748 | - return absint( $result ); |
|
1748 | + return absint($result); |
|
1749 | 1749 | } |
1750 | 1750 | |
1751 | 1751 | /** |
@@ -1757,8 +1757,8 @@ discard block |
||
1757 | 1757 | * |
1758 | 1758 | * @credit WooCommerce |
1759 | 1759 | */ |
1760 | -function give_maybe_define_constant( $name, $value ) { |
|
1761 | - if ( ! defined( $name ) ) { |
|
1762 | - define( $name, $value ); |
|
1760 | +function give_maybe_define_constant($name, $value) { |
|
1761 | + if ( ! defined($name)) { |
|
1762 | + define($name, $value); |
|
1763 | 1763 | } |
1764 | 1764 | } |
1765 | 1765 | \ No newline at end of file |
@@ -10,7 +10,7 @@ |
||
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 |
@@ -77,7 +77,7 @@ |
||
77 | 77 | * @uses api_request() |
78 | 78 | * |
79 | 79 | * @param array $_transient_data Update array build by WordPress. |
80 | - * @return array Modified update array with custom plugin data. |
|
80 | + * @return stdClass Modified update array with custom plugin data. |
|
81 | 81 | */ |
82 | 82 | public function check_update( $_transient_data ) { |
83 | 83 |
@@ -1,7 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly |
4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
4 | +if ( ! defined( 'ABSPATH' ) ) { |
|
5 | + exit; |
|
6 | +} |
|
5 | 7 | |
6 | 8 | /** |
7 | 9 | * Allows plugins to use their own update API. |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Exit if accessed directly |
4 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
4 | +if ( ! defined('ABSPATH')) exit; |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * Allows plugins to use their own update API. |
@@ -29,20 +29,20 @@ discard block |
||
29 | 29 | * @param string $_plugin_file Path to the plugin file. |
30 | 30 | * @param array $_api_data Optional data to send with API calls. |
31 | 31 | */ |
32 | - public function __construct( $_api_url, $_plugin_file, $_api_data = null ) { |
|
32 | + public function __construct($_api_url, $_plugin_file, $_api_data = null) { |
|
33 | 33 | |
34 | 34 | global $edd_plugin_data; |
35 | 35 | |
36 | - $this->api_url = trailingslashit( $_api_url ); |
|
36 | + $this->api_url = trailingslashit($_api_url); |
|
37 | 37 | $this->api_data = $_api_data; |
38 | - $this->name = plugin_basename( $_plugin_file ); |
|
39 | - $this->slug = basename( $_plugin_file, '.php' ); |
|
38 | + $this->name = plugin_basename($_plugin_file); |
|
39 | + $this->slug = basename($_plugin_file, '.php'); |
|
40 | 40 | $this->version = $_api_data['version']; |
41 | - $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false; |
|
42 | - $this->beta = ! empty( $this->api_data['beta'] ) ? true : false; |
|
43 | - $this->cache_key = md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ); |
|
41 | + $this->wp_override = isset($_api_data['wp_override']) ? (bool) $_api_data['wp_override'] : false; |
|
42 | + $this->beta = ! empty($this->api_data['beta']) ? true : false; |
|
43 | + $this->cache_key = md5(serialize($this->slug.$this->api_data['license'].$this->beta)); |
|
44 | 44 | |
45 | - $edd_plugin_data[ $this->slug ] = $this->api_data; |
|
45 | + $edd_plugin_data[$this->slug] = $this->api_data; |
|
46 | 46 | |
47 | 47 | // Set up hooks. |
48 | 48 | $this->init(); |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function init() { |
60 | 60 | |
61 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
62 | - add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 ); |
|
63 | - remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10 ); |
|
64 | - add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 ); |
|
65 | - add_action( 'admin_init', array( $this, 'show_changelog' ) ); |
|
61 | + add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update')); |
|
62 | + add_filter('plugins_api', array($this, 'plugins_api_filter'), 10, 3); |
|
63 | + remove_action('after_plugin_row_'.$this->name, 'wp_plugin_update_row', 10); |
|
64 | + add_action('after_plugin_row_'.$this->name, array($this, 'show_update_notification'), 10, 2); |
|
65 | + add_action('admin_init', array($this, 'show_changelog')); |
|
66 | 66 | |
67 | 67 | } |
68 | 68 | |
@@ -79,41 +79,41 @@ discard block |
||
79 | 79 | * @param array $_transient_data Update array build by WordPress. |
80 | 80 | * @return array Modified update array with custom plugin data. |
81 | 81 | */ |
82 | - public function check_update( $_transient_data ) { |
|
82 | + public function check_update($_transient_data) { |
|
83 | 83 | |
84 | 84 | global $pagenow; |
85 | 85 | |
86 | - if ( ! is_object( $_transient_data ) ) { |
|
86 | + if ( ! is_object($_transient_data)) { |
|
87 | 87 | $_transient_data = new stdClass; |
88 | 88 | } |
89 | 89 | |
90 | - if ( 'plugins.php' == $pagenow && is_multisite() ) { |
|
90 | + if ('plugins.php' == $pagenow && is_multisite()) { |
|
91 | 91 | return $_transient_data; |
92 | 92 | } |
93 | 93 | |
94 | - if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) { |
|
94 | + if ( ! empty($_transient_data->response) && ! empty($_transient_data->response[$this->name]) && false === $this->wp_override) { |
|
95 | 95 | return $_transient_data; |
96 | 96 | } |
97 | 97 | |
98 | 98 | $version_info = $this->get_cached_version_info(); |
99 | 99 | |
100 | - if ( false === $version_info ) { |
|
101 | - $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) ); |
|
100 | + if (false === $version_info) { |
|
101 | + $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug, 'beta' => $this->beta)); |
|
102 | 102 | |
103 | - $this->set_version_info_cache( $version_info ); |
|
103 | + $this->set_version_info_cache($version_info); |
|
104 | 104 | |
105 | 105 | } |
106 | 106 | |
107 | - if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) { |
|
107 | + if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) { |
|
108 | 108 | |
109 | - if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
109 | + if (version_compare($this->version, $version_info->new_version, '<')) { |
|
110 | 110 | |
111 | - $_transient_data->response[ $this->name ] = $version_info; |
|
111 | + $_transient_data->response[$this->name] = $version_info; |
|
112 | 112 | |
113 | 113 | } |
114 | 114 | |
115 | - $_transient_data->last_checked = current_time( 'timestamp' ); |
|
116 | - $_transient_data->checked[ $this->name ] = $this->version; |
|
115 | + $_transient_data->last_checked = current_time('timestamp'); |
|
116 | + $_transient_data->checked[$this->name] = $this->version; |
|
117 | 117 | |
118 | 118 | } |
119 | 119 | |
@@ -126,97 +126,97 @@ discard block |
||
126 | 126 | * @param string $file |
127 | 127 | * @param array $plugin |
128 | 128 | */ |
129 | - public function show_update_notification( $file, $plugin ) { |
|
129 | + public function show_update_notification($file, $plugin) { |
|
130 | 130 | |
131 | - if ( is_network_admin() ) { |
|
131 | + if (is_network_admin()) { |
|
132 | 132 | return; |
133 | 133 | } |
134 | 134 | |
135 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
135 | + if ( ! current_user_can('update_plugins')) { |
|
136 | 136 | return; |
137 | 137 | } |
138 | 138 | |
139 | - if( ! is_multisite() ) { |
|
139 | + if ( ! is_multisite()) { |
|
140 | 140 | return; |
141 | 141 | } |
142 | 142 | |
143 | - if ( $this->name != $file ) { |
|
143 | + if ($this->name != $file) { |
|
144 | 144 | return; |
145 | 145 | } |
146 | 146 | |
147 | 147 | // Remove our filter on the site transient |
148 | - remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 ); |
|
148 | + remove_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'), 10); |
|
149 | 149 | |
150 | - $update_cache = get_site_transient( 'update_plugins' ); |
|
150 | + $update_cache = get_site_transient('update_plugins'); |
|
151 | 151 | |
152 | - $update_cache = is_object( $update_cache ) ? $update_cache : new stdClass(); |
|
152 | + $update_cache = is_object($update_cache) ? $update_cache : new stdClass(); |
|
153 | 153 | |
154 | - if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) { |
|
154 | + if (empty($update_cache->response) || empty($update_cache->response[$this->name])) { |
|
155 | 155 | |
156 | 156 | $version_info = $this->get_cached_version_info(); |
157 | 157 | |
158 | - if ( false === $version_info ) { |
|
159 | - $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) ); |
|
158 | + if (false === $version_info) { |
|
159 | + $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug, 'beta' => $this->beta)); |
|
160 | 160 | |
161 | - $this->set_version_info_cache( $version_info ); |
|
161 | + $this->set_version_info_cache($version_info); |
|
162 | 162 | } |
163 | 163 | |
164 | - if ( ! is_object( $version_info ) ) { |
|
164 | + if ( ! is_object($version_info)) { |
|
165 | 165 | return; |
166 | 166 | } |
167 | 167 | |
168 | - if ( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
168 | + if (version_compare($this->version, $version_info->new_version, '<')) { |
|
169 | 169 | |
170 | - $update_cache->response[ $this->name ] = $version_info; |
|
170 | + $update_cache->response[$this->name] = $version_info; |
|
171 | 171 | |
172 | 172 | } |
173 | 173 | |
174 | - $update_cache->last_checked = current_time( 'timestamp' ); |
|
175 | - $update_cache->checked[ $this->name ] = $this->version; |
|
174 | + $update_cache->last_checked = current_time('timestamp'); |
|
175 | + $update_cache->checked[$this->name] = $this->version; |
|
176 | 176 | |
177 | - set_site_transient( 'update_plugins', $update_cache ); |
|
177 | + set_site_transient('update_plugins', $update_cache); |
|
178 | 178 | |
179 | 179 | } else { |
180 | 180 | |
181 | - $version_info = $update_cache->response[ $this->name ]; |
|
181 | + $version_info = $update_cache->response[$this->name]; |
|
182 | 182 | |
183 | 183 | } |
184 | 184 | |
185 | 185 | // Restore our filter |
186 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
186 | + add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update')); |
|
187 | 187 | |
188 | - if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
188 | + if ( ! empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) { |
|
189 | 189 | |
190 | 190 | // build a plugin list row, with update notification |
191 | - $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); |
|
191 | + $wp_list_table = _get_list_table('WP_Plugins_List_Table'); |
|
192 | 192 | # <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"> |
193 | - echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">'; |
|
193 | + echo '<tr class="plugin-update-tr" id="'.$this->slug.'-update" data-slug="'.$this->slug.'" data-plugin="'.$this->slug.'/'.$file.'">'; |
|
194 | 194 | echo '<td colspan="3" class="plugin-update colspanchange">'; |
195 | 195 | echo '<div class="update-message notice inline notice-warning notice-alt">'; |
196 | 196 | |
197 | - $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' ); |
|
197 | + $changelog_link = self_admin_url('index.php?edd_sl_action=view_plugin_changelog&plugin='.$this->name.'&slug='.$this->slug.'&TB_iframe=true&width=772&height=911'); |
|
198 | 198 | |
199 | - if ( empty( $version_info->download_link ) ) { |
|
199 | + if (empty($version_info->download_link)) { |
|
200 | 200 | printf( |
201 | - __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'give' ), |
|
202 | - esc_html( $version_info->name ), |
|
203 | - '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">', |
|
204 | - esc_html( $version_info->new_version ), |
|
201 | + __('There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'give'), |
|
202 | + esc_html($version_info->name), |
|
203 | + '<a target="_blank" class="thickbox" href="'.esc_url($changelog_link).'">', |
|
204 | + esc_html($version_info->new_version), |
|
205 | 205 | '</a>' |
206 | 206 | ); |
207 | 207 | } else { |
208 | 208 | printf( |
209 | - __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'give' ), |
|
210 | - esc_html( $version_info->name ), |
|
211 | - '<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">', |
|
212 | - esc_html( $version_info->new_version ), |
|
209 | + __('There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'give'), |
|
210 | + esc_html($version_info->name), |
|
211 | + '<a target="_blank" class="thickbox" href="'.esc_url($changelog_link).'">', |
|
212 | + esc_html($version_info->new_version), |
|
213 | 213 | '</a>', |
214 | - '<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">', |
|
214 | + '<a href="'.esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=').$this->name, 'upgrade-plugin_'.$this->name)).'">', |
|
215 | 215 | '</a>' |
216 | 216 | ); |
217 | 217 | } |
218 | 218 | |
219 | - do_action( "in_plugin_update_message-{$file}", $plugin, $version_info ); |
|
219 | + do_action("in_plugin_update_message-{$file}", $plugin, $version_info); |
|
220 | 220 | |
221 | 221 | echo '</div></td></tr>'; |
222 | 222 | } |
@@ -232,15 +232,15 @@ discard block |
||
232 | 232 | * @param object $_args |
233 | 233 | * @return object $_data |
234 | 234 | */ |
235 | - public function plugins_api_filter( $_data, $_action = '', $_args = null ) { |
|
235 | + public function plugins_api_filter($_data, $_action = '', $_args = null) { |
|
236 | 236 | |
237 | - if ( $_action != 'plugin_information' ) { |
|
237 | + if ($_action != 'plugin_information') { |
|
238 | 238 | |
239 | 239 | return $_data; |
240 | 240 | |
241 | 241 | } |
242 | 242 | |
243 | - if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) { |
|
243 | + if ( ! isset($_args->slug) || ($_args->slug != $this->slug)) { |
|
244 | 244 | |
245 | 245 | return $_data; |
246 | 246 | |
@@ -255,20 +255,20 @@ discard block |
||
255 | 255 | ) |
256 | 256 | ); |
257 | 257 | |
258 | - $cache_key = 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ); |
|
258 | + $cache_key = 'edd_api_request_'.md5(serialize($this->slug.$this->api_data['license'].$this->beta)); |
|
259 | 259 | |
260 | 260 | // Get the transient where we store the api request for this plugin for 24 hours |
261 | - $edd_api_request_transient = $this->get_cached_version_info( $cache_key ); |
|
261 | + $edd_api_request_transient = $this->get_cached_version_info($cache_key); |
|
262 | 262 | |
263 | 263 | //If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now. |
264 | - if ( empty( $edd_api_request_transient ) ) { |
|
264 | + if (empty($edd_api_request_transient)) { |
|
265 | 265 | |
266 | - $api_response = $this->api_request( 'plugin_information', $to_send ); |
|
266 | + $api_response = $this->api_request('plugin_information', $to_send); |
|
267 | 267 | |
268 | 268 | // Expires in 3 hours |
269 | - $this->set_version_info_cache( $api_response, $cache_key ); |
|
269 | + $this->set_version_info_cache($api_response, $cache_key); |
|
270 | 270 | |
271 | - if ( false !== $api_response ) { |
|
271 | + if (false !== $api_response) { |
|
272 | 272 | $_data = $api_response; |
273 | 273 | } |
274 | 274 | |
@@ -277,20 +277,20 @@ discard block |
||
277 | 277 | } |
278 | 278 | |
279 | 279 | // Convert sections into an associative array, since we're getting an object, but Core expects an array. |
280 | - if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) { |
|
280 | + if (isset($_data->sections) && ! is_array($_data->sections)) { |
|
281 | 281 | $new_sections = array(); |
282 | - foreach ( $_data->sections as $key => $value ) { |
|
283 | - $new_sections[ $key ] = $value; |
|
282 | + foreach ($_data->sections as $key => $value) { |
|
283 | + $new_sections[$key] = $value; |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | $_data->sections = $new_sections; |
287 | 287 | } |
288 | 288 | |
289 | 289 | // Convert banners into an associative array, since we're getting an object, but Core expects an array. |
290 | - if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) { |
|
290 | + if (isset($_data->banners) && ! is_array($_data->banners)) { |
|
291 | 291 | $new_banners = array(); |
292 | - foreach ( $_data->banners as $key => $value ) { |
|
293 | - $new_banners[ $key ] = $value; |
|
292 | + foreach ($_data->banners as $key => $value) { |
|
293 | + $new_banners[$key] = $value; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | $_data->banners = $new_banners; |
@@ -306,9 +306,9 @@ discard block |
||
306 | 306 | * @param string $url |
307 | 307 | * @return object $array |
308 | 308 | */ |
309 | - public function http_request_args( $args, $url ) { |
|
309 | + public function http_request_args($args, $url) { |
|
310 | 310 | // If it is an https request and we are performing a package download, disable ssl verification |
311 | - if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
|
311 | + if (strpos($url, 'https://') !== false && strpos($url, 'edd_action=package_download')) { |
|
312 | 312 | $args['sslverify'] = false; |
313 | 313 | } |
314 | 314 | return $args; |
@@ -325,50 +325,50 @@ discard block |
||
325 | 325 | * @param array $_data Parameters for the API action. |
326 | 326 | * @return false|object |
327 | 327 | */ |
328 | - private function api_request( $_action, $_data ) { |
|
328 | + private function api_request($_action, $_data) { |
|
329 | 329 | |
330 | 330 | global $wp_version; |
331 | 331 | |
332 | - $data = array_merge( $this->api_data, $_data ); |
|
332 | + $data = array_merge($this->api_data, $_data); |
|
333 | 333 | |
334 | - if ( $data['slug'] != $this->slug ) { |
|
334 | + if ($data['slug'] != $this->slug) { |
|
335 | 335 | return; |
336 | 336 | } |
337 | 337 | |
338 | - if( $this->api_url == trailingslashit (home_url() ) ) { |
|
338 | + if ($this->api_url == trailingslashit(home_url())) { |
|
339 | 339 | return false; // Don't allow a plugin to ping itself |
340 | 340 | } |
341 | 341 | |
342 | 342 | $api_params = array( |
343 | 343 | 'edd_action' => 'get_version', |
344 | - 'license' => ! empty( $data['license'] ) ? $data['license'] : '', |
|
345 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
346 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
347 | - 'version' => isset( $data['version'] ) ? $data['version'] : false, |
|
344 | + 'license' => ! empty($data['license']) ? $data['license'] : '', |
|
345 | + 'item_name' => isset($data['item_name']) ? $data['item_name'] : false, |
|
346 | + 'item_id' => isset($data['item_id']) ? $data['item_id'] : false, |
|
347 | + 'version' => isset($data['version']) ? $data['version'] : false, |
|
348 | 348 | 'slug' => $data['slug'], |
349 | 349 | 'author' => $data['author'], |
350 | 350 | 'url' => home_url(), |
351 | - 'beta' => ! empty( $data['beta'] ), |
|
351 | + 'beta' => ! empty($data['beta']), |
|
352 | 352 | ); |
353 | 353 | |
354 | - $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); |
|
354 | + $request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params)); |
|
355 | 355 | |
356 | - if ( ! is_wp_error( $request ) ) { |
|
357 | - $request = json_decode( wp_remote_retrieve_body( $request ) ); |
|
356 | + if ( ! is_wp_error($request)) { |
|
357 | + $request = json_decode(wp_remote_retrieve_body($request)); |
|
358 | 358 | } |
359 | 359 | |
360 | - if ( $request && isset( $request->sections ) ) { |
|
361 | - $request->sections = maybe_unserialize( $request->sections ); |
|
360 | + if ($request && isset($request->sections)) { |
|
361 | + $request->sections = maybe_unserialize($request->sections); |
|
362 | 362 | } else { |
363 | 363 | $request = false; |
364 | 364 | } |
365 | 365 | |
366 | - if ( $request && isset( $request->banners ) ) { |
|
367 | - $request->banners = maybe_unserialize( $request->banners ); |
|
366 | + if ($request && isset($request->banners)) { |
|
367 | + $request->banners = maybe_unserialize($request->banners); |
|
368 | 368 | } |
369 | 369 | |
370 | - if( ! empty( $request->sections ) ) { |
|
371 | - foreach( $request->sections as $key => $section ) { |
|
370 | + if ( ! empty($request->sections)) { |
|
371 | + foreach ($request->sections as $key => $section) { |
|
372 | 372 | $request->$key = (array) $section; |
373 | 373 | } |
374 | 374 | } |
@@ -380,97 +380,97 @@ discard block |
||
380 | 380 | |
381 | 381 | global $edd_plugin_data; |
382 | 382 | |
383 | - if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) { |
|
383 | + if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) { |
|
384 | 384 | return; |
385 | 385 | } |
386 | 386 | |
387 | - if( empty( $_REQUEST['plugin'] ) ) { |
|
387 | + if (empty($_REQUEST['plugin'])) { |
|
388 | 388 | return; |
389 | 389 | } |
390 | 390 | |
391 | - if( empty( $_REQUEST['slug'] ) ) { |
|
391 | + if (empty($_REQUEST['slug'])) { |
|
392 | 392 | return; |
393 | 393 | } |
394 | 394 | |
395 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
396 | - wp_die( __( 'You do not have permission to install plugin updates', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
395 | + if ( ! current_user_can('update_plugins')) { |
|
396 | + wp_die(__('You do not have permission to install plugin updates', 'give'), __('Error', 'give'), array('response' => 403)); |
|
397 | 397 | } |
398 | 398 | |
399 | - $data = $edd_plugin_data[ $_REQUEST['slug'] ]; |
|
400 | - $beta = ! empty( $data['beta'] ) ? true : false; |
|
401 | - $cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' ); |
|
402 | - $version_info = $this->get_cached_version_info( $cache_key ); |
|
399 | + $data = $edd_plugin_data[$_REQUEST['slug']]; |
|
400 | + $beta = ! empty($data['beta']) ? true : false; |
|
401 | + $cache_key = md5('edd_plugin_'.sanitize_key($_REQUEST['plugin']).'_'.$beta.'_version_info'); |
|
402 | + $version_info = $this->get_cached_version_info($cache_key); |
|
403 | 403 | |
404 | - if( false === $version_info ) { |
|
404 | + if (false === $version_info) { |
|
405 | 405 | |
406 | 406 | $api_params = array( |
407 | 407 | 'edd_action' => 'get_version', |
408 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
409 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
408 | + 'item_name' => isset($data['item_name']) ? $data['item_name'] : false, |
|
409 | + 'item_id' => isset($data['item_id']) ? $data['item_id'] : false, |
|
410 | 410 | 'slug' => $_REQUEST['slug'], |
411 | 411 | 'author' => $data['author'], |
412 | 412 | 'url' => home_url(), |
413 | - 'beta' => ! empty( $data['beta'] ) |
|
413 | + 'beta' => ! empty($data['beta']) |
|
414 | 414 | ); |
415 | 415 | |
416 | - $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); |
|
416 | + $request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params)); |
|
417 | 417 | |
418 | - if ( ! is_wp_error( $request ) ) { |
|
419 | - $version_info = json_decode( wp_remote_retrieve_body( $request ) ); |
|
418 | + if ( ! is_wp_error($request)) { |
|
419 | + $version_info = json_decode(wp_remote_retrieve_body($request)); |
|
420 | 420 | } |
421 | 421 | |
422 | 422 | |
423 | - if ( ! empty( $version_info ) && isset( $version_info->sections ) ) { |
|
424 | - $version_info->sections = maybe_unserialize( $version_info->sections ); |
|
423 | + if ( ! empty($version_info) && isset($version_info->sections)) { |
|
424 | + $version_info->sections = maybe_unserialize($version_info->sections); |
|
425 | 425 | } else { |
426 | 426 | $version_info = false; |
427 | 427 | } |
428 | 428 | |
429 | - if( ! empty( $version_info ) ) { |
|
430 | - foreach( $version_info->sections as $key => $section ) { |
|
429 | + if ( ! empty($version_info)) { |
|
430 | + foreach ($version_info->sections as $key => $section) { |
|
431 | 431 | $version_info->$key = (array) $section; |
432 | 432 | } |
433 | 433 | } |
434 | 434 | |
435 | - $this->set_version_info_cache( $version_info, $cache_key ); |
|
435 | + $this->set_version_info_cache($version_info, $cache_key); |
|
436 | 436 | |
437 | 437 | } |
438 | 438 | |
439 | - if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) { |
|
440 | - echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>'; |
|
439 | + if ( ! empty($version_info) && isset($version_info->sections['changelog'])) { |
|
440 | + echo '<div style="background:#fff;padding:10px;">'.$version_info->sections['changelog'].'</div>'; |
|
441 | 441 | } |
442 | 442 | |
443 | 443 | exit; |
444 | 444 | } |
445 | 445 | |
446 | - public function get_cached_version_info( $cache_key = '' ) { |
|
446 | + public function get_cached_version_info($cache_key = '') { |
|
447 | 447 | |
448 | - if( empty( $cache_key ) ) { |
|
448 | + if (empty($cache_key)) { |
|
449 | 449 | $cache_key = $this->cache_key; |
450 | 450 | } |
451 | 451 | |
452 | - $cache = get_option( $cache_key ); |
|
452 | + $cache = get_option($cache_key); |
|
453 | 453 | |
454 | - if( empty( $cache['timeout'] ) || current_time( 'timestamp' ) > $cache['timeout'] ) { |
|
454 | + if (empty($cache['timeout']) || current_time('timestamp') > $cache['timeout']) { |
|
455 | 455 | return false; // Cache is expired |
456 | 456 | } |
457 | 457 | |
458 | - return json_decode( $cache['value'] ); |
|
458 | + return json_decode($cache['value']); |
|
459 | 459 | |
460 | 460 | } |
461 | 461 | |
462 | - public function set_version_info_cache( $value = '', $cache_key = '' ) { |
|
462 | + public function set_version_info_cache($value = '', $cache_key = '') { |
|
463 | 463 | |
464 | - if( empty( $cache_key ) ) { |
|
464 | + if (empty($cache_key)) { |
|
465 | 465 | $cache_key = $this->cache_key; |
466 | 466 | } |
467 | 467 | |
468 | 468 | $data = array( |
469 | - 'timeout' => strtotime( '+3 hours', current_time( 'timestamp' ) ), |
|
470 | - 'value' => json_encode( $value ) |
|
469 | + 'timeout' => strtotime('+3 hours', current_time('timestamp')), |
|
470 | + 'value' => json_encode($value) |
|
471 | 471 | ); |
472 | 472 | |
473 | - update_option( $cache_key, $data ); |
|
473 | + update_option($cache_key, $data); |
|
474 | 474 | |
475 | 475 | } |
476 | 476 |
@@ -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 | |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function __construct() { |
26 | 26 | |
27 | - $this->shortcode['title'] = esc_html__( 'Donation Form', 'give' ); |
|
28 | - $this->shortcode['label'] = esc_html__( 'Donation Form', 'give' ); |
|
27 | + $this->shortcode['title'] = esc_html__('Donation Form', 'give'); |
|
28 | + $this->shortcode['label'] = esc_html__('Donation Form', 'give'); |
|
29 | 29 | |
30 | - parent::__construct( 'give_form' ); |
|
30 | + parent::__construct('give_form'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | |
40 | 40 | $create_form_link = sprintf( |
41 | 41 | /* translators: %s: create new form URL */ |
42 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
43 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
42 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
43 | + admin_url('post-new.php?post_type=give_forms') |
|
44 | 44 | ); |
45 | 45 | |
46 | 46 | return array( |
@@ -50,68 +50,68 @@ discard block |
||
50 | 50 | 'post_type' => 'give_forms', |
51 | 51 | ), |
52 | 52 | 'name' => 'id', |
53 | - 'tooltip' => esc_attr__( 'Select a Donation Form', 'give' ), |
|
54 | - 'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -', |
|
53 | + 'tooltip' => esc_attr__('Select a Donation Form', 'give'), |
|
54 | + 'placeholder' => '- '.esc_attr__('Select a Donation Form', 'give').' -', |
|
55 | 55 | 'required' => array( |
56 | - 'alert' => esc_html__( 'You must first select a Form!', 'give' ), |
|
57 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ), |
|
56 | + 'alert' => esc_html__('You must first select a Form!', 'give'), |
|
57 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No forms found.', 'give'), $create_form_link), |
|
58 | 58 | ), |
59 | 59 | ), |
60 | 60 | array( |
61 | 61 | 'type' => 'container', |
62 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
62 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')), |
|
63 | 63 | ), |
64 | 64 | array( |
65 | 65 | 'type' => 'listbox', |
66 | 66 | 'name' => 'show_title', |
67 | - 'label' => esc_attr__( 'Show Title', 'give' ), |
|
68 | - 'tooltip' => esc_attr__( 'Do you want to display the form title?', 'give' ), |
|
67 | + 'label' => esc_attr__('Show Title', 'give'), |
|
68 | + 'tooltip' => esc_attr__('Do you want to display the form title?', 'give'), |
|
69 | 69 | 'options' => array( |
70 | - 'true' => esc_html__( 'Show', 'give' ), |
|
71 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
70 | + 'true' => esc_html__('Show', 'give'), |
|
71 | + 'false' => esc_html__('Hide', 'give'), |
|
72 | 72 | ), |
73 | 73 | ), |
74 | 74 | array( |
75 | 75 | 'type' => 'listbox', |
76 | 76 | 'name' => 'show_goal', |
77 | - 'label' => esc_attr__( 'Show Goal', 'give' ), |
|
78 | - 'tooltip' => esc_attr__( 'Do you want to display the donation goal?', 'give' ), |
|
77 | + 'label' => esc_attr__('Show Goal', 'give'), |
|
78 | + 'tooltip' => esc_attr__('Do you want to display the donation goal?', 'give'), |
|
79 | 79 | 'options' => array( |
80 | - 'true' => esc_html__( 'Show', 'give' ), |
|
81 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
80 | + 'true' => esc_html__('Show', 'give'), |
|
81 | + 'false' => esc_html__('Hide', 'give'), |
|
82 | 82 | ), |
83 | 83 | ), |
84 | 84 | array( |
85 | 85 | 'type' => 'listbox', |
86 | 86 | 'name' => 'show_content', |
87 | 87 | 'minWidth' => 240, |
88 | - 'label' => esc_attr__( 'Display Content', 'give' ), |
|
89 | - 'tooltip' => esc_attr__( 'Do you want to display the form content?', 'give' ), |
|
88 | + 'label' => esc_attr__('Display Content', 'give'), |
|
89 | + 'tooltip' => esc_attr__('Do you want to display the form content?', 'give'), |
|
90 | 90 | 'options' => array( |
91 | - 'none' => esc_html__( 'No Content', 'give' ), |
|
92 | - 'above' => esc_html__( 'Display content ABOVE the fields', 'give' ), |
|
93 | - 'below' => esc_html__( 'Display content BELOW the fields', 'give' ), |
|
91 | + 'none' => esc_html__('No Content', 'give'), |
|
92 | + 'above' => esc_html__('Display content ABOVE the fields', 'give'), |
|
93 | + 'below' => esc_html__('Display content BELOW the fields', 'give'), |
|
94 | 94 | ), |
95 | 95 | ), |
96 | 96 | array( |
97 | 97 | 'type' => 'listbox', |
98 | 98 | 'name' => 'display_style', |
99 | 99 | 'classes' => 'give-display-style', |
100 | - 'label' => esc_attr__( 'Display Options', 'give' ), |
|
101 | - 'tooltip' => esc_attr__( 'How would you like to display donation information?', 'give' ), |
|
100 | + 'label' => esc_attr__('Display Options', 'give'), |
|
101 | + 'tooltip' => esc_attr__('How would you like to display donation information?', 'give'), |
|
102 | 102 | 'options' => array( |
103 | - 'onpage' => esc_html__( 'All Fields', 'give' ), |
|
104 | - 'modal' => esc_html__( 'Modal', 'give' ), |
|
105 | - 'reveal' => esc_html__( 'Reveal', 'give' ), |
|
106 | - 'button' => esc_html__( 'Button', 'give' ), |
|
103 | + 'onpage' => esc_html__('All Fields', 'give'), |
|
104 | + 'modal' => esc_html__('Modal', 'give'), |
|
105 | + 'reveal' => esc_html__('Reveal', 'give'), |
|
106 | + 'button' => esc_html__('Button', 'give'), |
|
107 | 107 | ), |
108 | 108 | ), |
109 | 109 | array( |
110 | 110 | 'type' => 'textbox', |
111 | 111 | 'classes' => 'give-hidden give-continue-button-title', |
112 | 112 | 'name' => 'continue_button_title', |
113 | - 'label' => esc_attr__( 'Button Text', 'give' ), |
|
114 | - 'tooltip' => esc_attr__( 'The button label for displaying the additional payment fields.', 'give' ), |
|
113 | + 'label' => esc_attr__('Button Text', 'give'), |
|
114 | + 'tooltip' => esc_attr__('The button label for displaying the additional payment fields.', 'give'), |
|
115 | 115 | ), |
116 | 116 | ); |
117 | 117 | } |