@@ -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,12 +23,12 @@ discard block |
||
| 23 | 23 | * @return void |
| 24 | 24 | */ |
| 25 | 25 | function give_get_actions() { |
| 26 | - if ( isset( $_GET['give_action'] ) ) { |
|
| 27 | - do_action( 'give_' . $_GET['give_action'], $_GET ); |
|
| 26 | + if (isset($_GET['give_action'])) { |
|
| 27 | + do_action('give_'.$_GET['give_action'], $_GET); |
|
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | -add_action( 'init', 'give_get_actions' ); |
|
| 31 | +add_action('init', 'give_get_actions'); |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Hooks Give actions, when present in the $_POST superglobal. Every give_action |
@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | * @return void |
| 40 | 40 | */ |
| 41 | 41 | function give_post_actions() { |
| 42 | - if ( isset( $_POST['give_action'] ) ) { |
|
| 43 | - do_action( 'give_' . $_POST['give_action'], $_POST ); |
|
| 42 | + if (isset($_POST['give_action'])) { |
|
| 43 | + do_action('give_'.$_POST['give_action'], $_POST); |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | -add_action( 'init', 'give_post_actions' ); |
|
| 48 | 47 | \ No newline at end of file |
| 48 | +add_action('init', 'give_post_actions'); |
|
| 49 | 49 | \ No newline at end of file |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | //set_site_transient( 'update_plugins', null ); |
| 5 | 5 | |
| 6 | 6 | // Exit if accessed directly |
| 7 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
| 7 | +if ( ! defined('ABSPATH')) exit; |
|
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Allows plugins to use their own update API. |
@@ -29,16 +29,16 @@ discard block |
||
| 29 | 29 | * @param array $_api_data Optional data to send with API calls. |
| 30 | 30 | * @return void |
| 31 | 31 | */ |
| 32 | - function __construct( $_api_url, $_plugin_file, $_api_data = null ) { |
|
| 33 | - $this->api_url = trailingslashit( $_api_url ); |
|
| 32 | + function __construct($_api_url, $_plugin_file, $_api_data = null) { |
|
| 33 | + $this->api_url = trailingslashit($_api_url); |
|
| 34 | 34 | $this->api_data = $_api_data; |
| 35 | - $this->name = plugin_basename( $_plugin_file ); |
|
| 36 | - $this->slug = basename( $_plugin_file, '.php' ); |
|
| 35 | + $this->name = plugin_basename($_plugin_file); |
|
| 36 | + $this->slug = basename($_plugin_file, '.php'); |
|
| 37 | 37 | $this->version = $_api_data['version']; |
| 38 | 38 | |
| 39 | 39 | // Set up hooks. |
| 40 | 40 | $this->init(); |
| 41 | - add_action( 'admin_init', array( $this, 'show_changelog' ) ); |
|
| 41 | + add_action('admin_init', array($this, 'show_changelog')); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -50,10 +50,10 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function init() { |
| 52 | 52 | |
| 53 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
| 54 | - add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 ); |
|
| 53 | + add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update')); |
|
| 54 | + add_filter('plugins_api', array($this, 'plugins_api_filter'), 10, 3); |
|
| 55 | 55 | |
| 56 | - add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 ); |
|
| 56 | + add_action('after_plugin_row_'.$this->name, array($this, 'show_update_notification'), 10, 2); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -69,34 +69,34 @@ discard block |
||
| 69 | 69 | * @param array $_transient_data Update array build by WordPress. |
| 70 | 70 | * @return array Modified update array with custom plugin data. |
| 71 | 71 | */ |
| 72 | - function check_update( $_transient_data ) { |
|
| 72 | + function check_update($_transient_data) { |
|
| 73 | 73 | |
| 74 | 74 | global $pagenow; |
| 75 | 75 | |
| 76 | - if( ! is_object( $_transient_data ) ) { |
|
| 76 | + if ( ! is_object($_transient_data)) { |
|
| 77 | 77 | $_transient_data = new stdClass; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if( 'plugins.php' == $pagenow && is_multisite() ) { |
|
| 80 | + if ('plugins.php' == $pagenow && is_multisite()) { |
|
| 81 | 81 | return $_transient_data; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) { |
|
| 84 | + if (empty($_transient_data->response) || empty($_transient_data->response[$this->name])) { |
|
| 85 | 85 | |
| 86 | - $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); |
|
| 86 | + $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug)); |
|
| 87 | 87 | |
| 88 | - if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) { |
|
| 88 | + if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) { |
|
| 89 | 89 | |
| 90 | 90 | $this->did_check = true; |
| 91 | 91 | |
| 92 | - if( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
| 92 | + if (version_compare($this->version, $version_info->new_version, '<')) { |
|
| 93 | 93 | |
| 94 | - $_transient_data->response[ $this->name ] = $version_info; |
|
| 94 | + $_transient_data->response[$this->name] = $version_info; |
|
| 95 | 95 | |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | $_transient_data->last_checked = time(); |
| 99 | - $_transient_data->checked[ $this->name ] = $this->version; |
|
| 99 | + $_transient_data->checked[$this->name] = $this->version; |
|
| 100 | 100 | |
| 101 | 101 | } |
| 102 | 102 | |
@@ -111,84 +111,84 @@ discard block |
||
| 111 | 111 | * @param string $file |
| 112 | 112 | * @param array $plugin |
| 113 | 113 | */ |
| 114 | - public function show_update_notification( $file, $plugin ) { |
|
| 114 | + public function show_update_notification($file, $plugin) { |
|
| 115 | 115 | |
| 116 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
| 116 | + if ( ! current_user_can('update_plugins')) { |
|
| 117 | 117 | return; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if( ! is_multisite() ) { |
|
| 120 | + if ( ! is_multisite()) { |
|
| 121 | 121 | return; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - if ( $this->name != $file ) { |
|
| 124 | + if ($this->name != $file) { |
|
| 125 | 125 | return; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | // Remove our filter on the site transient |
| 129 | - remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 ); |
|
| 129 | + remove_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'), 10); |
|
| 130 | 130 | |
| 131 | - $update_cache = get_site_transient( 'update_plugins' ); |
|
| 131 | + $update_cache = get_site_transient('update_plugins'); |
|
| 132 | 132 | |
| 133 | - if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) { |
|
| 133 | + if ( ! is_object($update_cache) || empty($update_cache->response) || empty($update_cache->response[$this->name])) { |
|
| 134 | 134 | |
| 135 | - $cache_key = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' ); |
|
| 136 | - $version_info = get_transient( $cache_key ); |
|
| 135 | + $cache_key = md5('edd_plugin_'.sanitize_key($this->name).'_version_info'); |
|
| 136 | + $version_info = get_transient($cache_key); |
|
| 137 | 137 | |
| 138 | - if( false === $version_info ) { |
|
| 138 | + if (false === $version_info) { |
|
| 139 | 139 | |
| 140 | - $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); |
|
| 140 | + $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug)); |
|
| 141 | 141 | |
| 142 | - set_transient( $cache_key, $version_info, 3600 ); |
|
| 142 | + set_transient($cache_key, $version_info, 3600); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | |
| 146 | - if( ! is_object( $version_info ) ) { |
|
| 146 | + if ( ! is_object($version_info)) { |
|
| 147 | 147 | return; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - if( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
| 150 | + if (version_compare($this->version, $version_info->new_version, '<')) { |
|
| 151 | 151 | |
| 152 | - $update_cache->response[ $this->name ] = $version_info; |
|
| 152 | + $update_cache->response[$this->name] = $version_info; |
|
| 153 | 153 | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | $update_cache->last_checked = time(); |
| 157 | - $update_cache->checked[ $this->name ] = $this->version; |
|
| 157 | + $update_cache->checked[$this->name] = $this->version; |
|
| 158 | 158 | |
| 159 | - set_site_transient( 'update_plugins', $update_cache ); |
|
| 159 | + set_site_transient('update_plugins', $update_cache); |
|
| 160 | 160 | |
| 161 | 161 | } else { |
| 162 | 162 | |
| 163 | - $version_info = $update_cache->response[ $this->name ]; |
|
| 163 | + $version_info = $update_cache->response[$this->name]; |
|
| 164 | 164 | |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | // Restore our filter |
| 168 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
| 168 | + add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update')); |
|
| 169 | 169 | |
| 170 | - if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
| 170 | + if ( ! empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) { |
|
| 171 | 171 | |
| 172 | 172 | // build a plugin list row, with update notification |
| 173 | - $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); |
|
| 174 | - echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">'; |
|
| 173 | + $wp_list_table = _get_list_table('WP_Plugins_List_Table'); |
|
| 174 | + echo '<tr class="plugin-update-tr"><td colspan="'.$wp_list_table->get_column_count().'" class="plugin-update colspanchange"><div class="update-message">'; |
|
| 175 | 175 | |
| 176 | - $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' ); |
|
| 176 | + $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'); |
|
| 177 | 177 | |
| 178 | - if ( empty( $version_info->download_link ) ) { |
|
| 178 | + if (empty($version_info->download_link)) { |
|
| 179 | 179 | printf( |
| 180 | - __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd' ), |
|
| 181 | - esc_html( $version_info->name ), |
|
| 182 | - esc_url( $changelog_link ), |
|
| 183 | - esc_html( $version_info->new_version ) |
|
| 180 | + __('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd'), |
|
| 181 | + esc_html($version_info->name), |
|
| 182 | + esc_url($changelog_link), |
|
| 183 | + esc_html($version_info->new_version) |
|
| 184 | 184 | ); |
| 185 | 185 | } else { |
| 186 | 186 | printf( |
| 187 | - __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd' ), |
|
| 188 | - esc_html( $version_info->name ), |
|
| 189 | - esc_url( $changelog_link ), |
|
| 190 | - esc_html( $version_info->new_version ), |
|
| 191 | - esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) |
|
| 187 | + __('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd'), |
|
| 188 | + esc_html($version_info->name), |
|
| 189 | + esc_url($changelog_link), |
|
| 190 | + esc_html($version_info->new_version), |
|
| 191 | + esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=').$this->name, 'upgrade-plugin_'.$this->name)) |
|
| 192 | 192 | ); |
| 193 | 193 | } |
| 194 | 194 | |
@@ -207,16 +207,16 @@ discard block |
||
| 207 | 207 | * @param object $_args |
| 208 | 208 | * @return object $_data |
| 209 | 209 | */ |
| 210 | - function plugins_api_filter( $_data, $_action = '', $_args = null ) { |
|
| 210 | + function plugins_api_filter($_data, $_action = '', $_args = null) { |
|
| 211 | 211 | |
| 212 | 212 | |
| 213 | - if ( $_action != 'plugin_information' ) { |
|
| 213 | + if ($_action != 'plugin_information') { |
|
| 214 | 214 | |
| 215 | 215 | return $_data; |
| 216 | 216 | |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) { |
|
| 219 | + if ( ! isset($_args->slug) || ($_args->slug != $this->slug)) { |
|
| 220 | 220 | |
| 221 | 221 | return $_data; |
| 222 | 222 | |
@@ -231,9 +231,9 @@ discard block |
||
| 231 | 231 | ) |
| 232 | 232 | ); |
| 233 | 233 | |
| 234 | - $api_response = $this->api_request( 'plugin_information', $to_send ); |
|
| 234 | + $api_response = $this->api_request('plugin_information', $to_send); |
|
| 235 | 235 | |
| 236 | - if ( false !== $api_response ) { |
|
| 236 | + if (false !== $api_response) { |
|
| 237 | 237 | $_data = $api_response; |
| 238 | 238 | } |
| 239 | 239 | |
@@ -248,9 +248,9 @@ discard block |
||
| 248 | 248 | * @param string $url |
| 249 | 249 | * @return object $array |
| 250 | 250 | */ |
| 251 | - function http_request_args( $args, $url ) { |
|
| 251 | + function http_request_args($args, $url) { |
|
| 252 | 252 | // If it is an https request and we are performing a package download, disable ssl verification |
| 253 | - if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
|
| 253 | + if (strpos($url, 'https://') !== false && strpos($url, 'edd_action=package_download')) { |
|
| 254 | 254 | $args['sslverify'] = false; |
| 255 | 255 | } |
| 256 | 256 | return $args; |
@@ -267,40 +267,40 @@ discard block |
||
| 267 | 267 | * @param array $_data Parameters for the API action. |
| 268 | 268 | * @return false||object |
| 269 | 269 | */ |
| 270 | - private function api_request( $_action, $_data ) { |
|
| 270 | + private function api_request($_action, $_data) { |
|
| 271 | 271 | |
| 272 | 272 | global $wp_version; |
| 273 | 273 | |
| 274 | - $data = array_merge( $this->api_data, $_data ); |
|
| 274 | + $data = array_merge($this->api_data, $_data); |
|
| 275 | 275 | |
| 276 | - if ( $data['slug'] != $this->slug ) |
|
| 276 | + if ($data['slug'] != $this->slug) |
|
| 277 | 277 | return; |
| 278 | 278 | |
| 279 | - if ( empty( $data['license'] ) ) |
|
| 279 | + if (empty($data['license'])) |
|
| 280 | 280 | return; |
| 281 | 281 | |
| 282 | - if( $this->api_url == home_url() ) { |
|
| 282 | + if ($this->api_url == home_url()) { |
|
| 283 | 283 | return false; // Don't allow a plugin to ping itself |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | $api_params = array( |
| 287 | 287 | 'edd_action' => 'get_version', |
| 288 | 288 | 'license' => $data['license'], |
| 289 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
| 290 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
| 289 | + 'item_name' => isset($data['item_name']) ? $data['item_name'] : false, |
|
| 290 | + 'item_id' => isset($data['item_id']) ? $data['item_id'] : false, |
|
| 291 | 291 | 'slug' => $data['slug'], |
| 292 | 292 | 'author' => $data['author'], |
| 293 | 293 | 'url' => home_url() |
| 294 | 294 | ); |
| 295 | 295 | |
| 296 | - $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); |
|
| 296 | + $request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params)); |
|
| 297 | 297 | |
| 298 | - if ( ! is_wp_error( $request ) ) { |
|
| 299 | - $request = json_decode( wp_remote_retrieve_body( $request ) ); |
|
| 298 | + if ( ! is_wp_error($request)) { |
|
| 299 | + $request = json_decode(wp_remote_retrieve_body($request)); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | - if ( $request && isset( $request->sections ) ) { |
|
| 303 | - $request->sections = maybe_unserialize( $request->sections ); |
|
| 302 | + if ($request && isset($request->sections)) { |
|
| 303 | + $request->sections = maybe_unserialize($request->sections); |
|
| 304 | 304 | } else { |
| 305 | 305 | $request = false; |
| 306 | 306 | } |
@@ -311,26 +311,26 @@ discard block |
||
| 311 | 311 | public function show_changelog() { |
| 312 | 312 | |
| 313 | 313 | |
| 314 | - if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) { |
|
| 314 | + if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) { |
|
| 315 | 315 | return; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - if( empty( $_REQUEST['plugin'] ) ) { |
|
| 318 | + if (empty($_REQUEST['plugin'])) { |
|
| 319 | 319 | return; |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | - if( empty( $_REQUEST['slug'] ) ) { |
|
| 322 | + if (empty($_REQUEST['slug'])) { |
|
| 323 | 323 | return; |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
| 327 | - wp_die( __( 'You do not have permission to install plugin updates', 'edd' ), __( 'Error', 'edd' ), array( 'response' => 403 ) ); |
|
| 326 | + if ( ! current_user_can('update_plugins')) { |
|
| 327 | + wp_die(__('You do not have permission to install plugin updates', 'edd'), __('Error', 'edd'), array('response' => 403)); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - $response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) ); |
|
| 330 | + $response = $this->api_request('plugin_latest_version', array('slug' => $_REQUEST['slug'])); |
|
| 331 | 331 | |
| 332 | - if( $response && isset( $response->sections['changelog'] ) ) { |
|
| 333 | - echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>'; |
|
| 332 | + if ($response && isset($response->sections['changelog'])) { |
|
| 333 | + echo '<div style="background:#fff;padding:10px;">'.$response->sections['changelog'].'</div>'; |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | |
@@ -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 | |
@@ -22,13 +22,13 @@ discard block |
||
| 22 | 22 | * @return void |
| 23 | 23 | */ |
| 24 | 24 | function give_process_actions() { |
| 25 | - if ( isset( $_POST['give-action'] ) ) { |
|
| 26 | - do_action( 'give_' . $_POST['give-action'], $_POST ); |
|
| 25 | + if (isset($_POST['give-action'])) { |
|
| 26 | + do_action('give_'.$_POST['give-action'], $_POST); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - if ( isset( $_GET['give-action'] ) ) { |
|
| 30 | - do_action( 'give_' . $_GET['give-action'], $_GET ); |
|
| 29 | + if (isset($_GET['give-action'])) { |
|
| 30 | + do_action('give_'.$_GET['give-action'], $_GET); |
|
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | -add_action( 'admin_init', 'give_process_actions' ); |
|
| 35 | 34 | \ No newline at end of file |
| 35 | +add_action('admin_init', 'give_process_actions'); |
|
| 36 | 36 | \ No newline at end of file |
@@ -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,11 +24,11 @@ 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' ) { |
|
| 31 | - $rate_text = sprintf( __( 'If you like <strong>Give</strong> please leave us a %s★★★★★%s rating. It takes a minute and helps a lot. Thanks in advance!', 'give' ), '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="' . __( 'Thanks :)', 'give' ) . '">', '</a>' ); |
|
| 30 | + if ($typenow == 'give_forms') { |
|
| 31 | + $rate_text = sprintf(__('If you like <strong>Give</strong> please leave us a %s★★★★★%s rating. It takes a minute and helps a lot. Thanks in advance!', 'give'), '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="'.__('Thanks :)', 'give').'">', '</a>'); |
|
| 32 | 32 | |
| 33 | 33 | return $rate_text; |
| 34 | 34 | } else { |
@@ -36,4 +36,4 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | -add_filter( 'admin_footer_text', 'give_admin_rate_us' ); |
|
| 39 | +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 | |
@@ -34,31 +34,31 @@ discard block |
||
| 34 | 34 | // $give_campaigns_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_campaigns->labels->menu_name, $give_campaigns->labels->add_new, 'edit_' . $give_campaigns->capability_type . 's', 'post-new.php?post_type=give_campaigns', null ); |
| 35 | 35 | |
| 36 | 36 | //Payments |
| 37 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
| 38 | - $give_payments_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page' ); |
|
| 37 | + $give_payment = get_post_type_object('give_payment'); |
|
| 38 | + $give_payments_page = add_submenu_page('edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page'); |
|
| 39 | 39 | |
| 40 | 40 | //Donors |
| 41 | - $give_donors_page = add_submenu_page( 'edit.php?post_type=give_forms', __( 'Donors', 'give' ), __( 'Donors', 'give' ), 'view_give_reports', 'give-donors', 'give_customers_page' ); |
|
| 41 | + $give_donors_page = add_submenu_page('edit.php?post_type=give_forms', __('Donors', 'give'), __('Donors', 'give'), 'view_give_reports', 'give-donors', 'give_customers_page'); |
|
| 42 | 42 | |
| 43 | 43 | //Reports |
| 44 | - $give_reports_page = add_submenu_page( 'edit.php?post_type=give_forms', __( 'Donation Reports', 'give' ), __( 'Reports', 'give' ), 'view_give_reports', 'give-reports', 'give_reports_page' ); |
|
| 44 | + $give_reports_page = add_submenu_page('edit.php?post_type=give_forms', __('Donation Reports', 'give'), __('Reports', 'give'), 'view_give_reports', 'give-reports', 'give_reports_page'); |
|
| 45 | 45 | |
| 46 | 46 | //Settings |
| 47 | - $give_settings_page = add_submenu_page( 'edit.php?post_type=give_forms', __( 'Give Settings', 'give' ), __( 'Settings', 'give' ), 'manage_give_settings', 'give-settings', array( |
|
| 47 | + $give_settings_page = add_submenu_page('edit.php?post_type=give_forms', __('Give Settings', 'give'), __('Settings', 'give'), 'manage_give_settings', 'give-settings', array( |
|
| 48 | 48 | Give()->give_settings, |
| 49 | 49 | 'admin_page_display' |
| 50 | - ) ); |
|
| 50 | + )); |
|
| 51 | 51 | |
| 52 | 52 | //Add-ons |
| 53 | - $give_add_ons_page = add_submenu_page( 'edit.php?post_type=give_forms', __( 'Give Add-ons', 'give' ), __( 'Add-ons', 'give' ), 'install_plugins', 'give-addons', 'give_add_ons_page' ); |
|
| 53 | + $give_add_ons_page = add_submenu_page('edit.php?post_type=give_forms', __('Give Add-ons', 'give'), __('Add-ons', 'give'), 'install_plugins', 'give-addons', 'give_add_ons_page'); |
|
| 54 | 54 | |
| 55 | 55 | //Upgrades |
| 56 | - $give_upgrades_screen = add_submenu_page( null, __( 'Give Upgrades', 'give' ), __( 'Give Upgrades', 'give' ), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen' ); |
|
| 56 | + $give_upgrades_screen = add_submenu_page(null, __('Give Upgrades', 'give'), __('Give Upgrades', 'give'), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen'); |
|
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | -add_action( 'admin_menu', 'give_add_options_links', 10 ); |
|
| 61 | +add_action('admin_menu', 'give_add_options_links', 10); |
|
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | 64 | * Determines whether the current admin page is a Give admin page. |
@@ -73,224 +73,224 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @return bool True if Give admin page. |
| 75 | 75 | */ |
| 76 | -function give_is_admin_page( $passed_page = '', $passed_view = '' ) { |
|
| 76 | +function give_is_admin_page($passed_page = '', $passed_view = '') { |
|
| 77 | 77 | |
| 78 | 78 | global $pagenow, $typenow; |
| 79 | 79 | |
| 80 | 80 | $found = false; |
| 81 | - $post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false; |
|
| 82 | - $action = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false; |
|
| 83 | - $taxonomy = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false; |
|
| 84 | - $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false; |
|
| 85 | - $view = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false; |
|
| 86 | - $tab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false; |
|
| 81 | + $post_type = isset($_GET['post_type']) ? strtolower($_GET['post_type']) : false; |
|
| 82 | + $action = isset($_GET['action']) ? strtolower($_GET['action']) : false; |
|
| 83 | + $taxonomy = isset($_GET['taxonomy']) ? strtolower($_GET['taxonomy']) : false; |
|
| 84 | + $page = isset($_GET['page']) ? strtolower($_GET['page']) : false; |
|
| 85 | + $view = isset($_GET['view']) ? strtolower($_GET['view']) : false; |
|
| 86 | + $tab = isset($_GET['tab']) ? strtolower($_GET['tab']) : false; |
|
| 87 | 87 | |
| 88 | - switch ( $passed_page ) { |
|
| 88 | + switch ($passed_page) { |
|
| 89 | 89 | case 'give_forms': |
| 90 | - switch ( $passed_view ) { |
|
| 90 | + switch ($passed_view) { |
|
| 91 | 91 | case 'list-table': |
| 92 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) { |
|
| 92 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php') { |
|
| 93 | 93 | $found = true; |
| 94 | 94 | } |
| 95 | 95 | break; |
| 96 | 96 | case 'edit': |
| 97 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) { |
|
| 97 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post.php') { |
|
| 98 | 98 | $found = true; |
| 99 | 99 | } |
| 100 | 100 | break; |
| 101 | 101 | case 'new': |
| 102 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) { |
|
| 102 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post-new.php') { |
|
| 103 | 103 | $found = true; |
| 104 | 104 | } |
| 105 | 105 | break; |
| 106 | 106 | default: |
| 107 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) { |
|
| 107 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) || 'give_forms' === $post_type || ('post-new.php' == $pagenow && 'give_forms' === $post_type)) { |
|
| 108 | 108 | $found = true; |
| 109 | 109 | } |
| 110 | 110 | break; |
| 111 | 111 | } |
| 112 | 112 | break; |
| 113 | 113 | case 'categories': |
| 114 | - switch ( $passed_view ) { |
|
| 114 | + switch ($passed_view) { |
|
| 115 | 115 | case 'list-table': |
| 116 | 116 | case 'new': |
| 117 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) { |
|
| 117 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy) { |
|
| 118 | 118 | $found = true; |
| 119 | 119 | } |
| 120 | 120 | break; |
| 121 | 121 | case 'edit': |
| 122 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) { |
|
| 122 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy) { |
|
| 123 | 123 | $found = true; |
| 124 | 124 | } |
| 125 | 125 | break; |
| 126 | 126 | default: |
| 127 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) { |
|
| 127 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy) { |
|
| 128 | 128 | $found = true; |
| 129 | 129 | } |
| 130 | 130 | break; |
| 131 | 131 | } |
| 132 | 132 | break; |
| 133 | 133 | case 'tags': |
| 134 | - switch ( $passed_view ) { |
|
| 134 | + switch ($passed_view) { |
|
| 135 | 135 | case 'list-table': |
| 136 | 136 | case 'new': |
| 137 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) { |
|
| 137 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy) { |
|
| 138 | 138 | $found = true; |
| 139 | 139 | } |
| 140 | 140 | break; |
| 141 | 141 | case 'edit': |
| 142 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) { |
|
| 142 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy) { |
|
| 143 | 143 | $found = true; |
| 144 | 144 | } |
| 145 | 145 | break; |
| 146 | 146 | default: |
| 147 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) { |
|
| 147 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy) { |
|
| 148 | 148 | $found = true; |
| 149 | 149 | } |
| 150 | 150 | break; |
| 151 | 151 | } |
| 152 | 152 | break; |
| 153 | 153 | case 'payments': |
| 154 | - switch ( $passed_view ) { |
|
| 154 | + switch ($passed_view) { |
|
| 155 | 155 | case 'list-table': |
| 156 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) { |
|
| 156 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view) { |
|
| 157 | 157 | $found = true; |
| 158 | 158 | } |
| 159 | 159 | break; |
| 160 | 160 | case 'edit': |
| 161 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view ) { |
|
| 161 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view) { |
|
| 162 | 162 | $found = true; |
| 163 | 163 | } |
| 164 | 164 | break; |
| 165 | 165 | default: |
| 166 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) { |
|
| 166 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page) { |
|
| 167 | 167 | $found = true; |
| 168 | 168 | } |
| 169 | 169 | break; |
| 170 | 170 | } |
| 171 | 171 | break; |
| 172 | 172 | case 'reports': |
| 173 | - switch ( $passed_view ) { |
|
| 173 | + switch ($passed_view) { |
|
| 174 | 174 | // If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ] |
| 175 | 175 | case 'earnings': |
| 176 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) { |
|
| 176 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && ('earnings' === $view || '-1' === $view || false === $view)) { |
|
| 177 | 177 | $found = true; |
| 178 | 178 | } |
| 179 | 179 | break; |
| 180 | 180 | case 'donors': |
| 181 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) { |
|
| 181 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view) { |
|
| 182 | 182 | $found = true; |
| 183 | 183 | } |
| 184 | 184 | break; |
| 185 | 185 | case 'gateways': |
| 186 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) { |
|
| 186 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view) { |
|
| 187 | 187 | $found = true; |
| 188 | 188 | } |
| 189 | 189 | break; |
| 190 | 190 | case 'export': |
| 191 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) { |
|
| 191 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view) { |
|
| 192 | 192 | $found = true; |
| 193 | 193 | } |
| 194 | 194 | break; |
| 195 | 195 | case 'logs': |
| 196 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) { |
|
| 196 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view) { |
|
| 197 | 197 | $found = true; |
| 198 | 198 | } |
| 199 | 199 | break; |
| 200 | 200 | default: |
| 201 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
| 201 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
| 202 | 202 | $found = true; |
| 203 | 203 | } |
| 204 | 204 | break; |
| 205 | 205 | } |
| 206 | 206 | break; |
| 207 | 207 | case 'settings': |
| 208 | - switch ( $passed_view ) { |
|
| 208 | + switch ($passed_view) { |
|
| 209 | 209 | case 'general': |
| 210 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) { |
|
| 210 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && ('general' === $tab || false === $tab)) { |
|
| 211 | 211 | $found = true; |
| 212 | 212 | } |
| 213 | 213 | break; |
| 214 | 214 | case 'gateways': |
| 215 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) { |
|
| 215 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab) { |
|
| 216 | 216 | $found = true; |
| 217 | 217 | } |
| 218 | 218 | break; |
| 219 | 219 | case 'emails': |
| 220 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) { |
|
| 220 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab) { |
|
| 221 | 221 | $found = true; |
| 222 | 222 | } |
| 223 | 223 | break; |
| 224 | 224 | case 'display': |
| 225 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) { |
|
| 225 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab) { |
|
| 226 | 226 | $found = true; |
| 227 | 227 | } |
| 228 | 228 | break; |
| 229 | 229 | case 'licenses': |
| 230 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) { |
|
| 230 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab) { |
|
| 231 | 231 | $found = true; |
| 232 | 232 | } |
| 233 | 233 | break; |
| 234 | 234 | case 'api': |
| 235 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) { |
|
| 235 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab) { |
|
| 236 | 236 | $found = true; |
| 237 | 237 | } |
| 238 | 238 | break; |
| 239 | 239 | case 'advanced': |
| 240 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) { |
|
| 240 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab) { |
|
| 241 | 241 | $found = true; |
| 242 | 242 | } |
| 243 | 243 | break; |
| 244 | 244 | case 'system_info': |
| 245 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) { |
|
| 245 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab) { |
|
| 246 | 246 | $found = true; |
| 247 | 247 | } |
| 248 | 248 | break; |
| 249 | 249 | default: |
| 250 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) { |
|
| 250 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page) { |
|
| 251 | 251 | $found = true; |
| 252 | 252 | } |
| 253 | 253 | break; |
| 254 | 254 | } |
| 255 | 255 | break; |
| 256 | 256 | case 'addons': |
| 257 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) { |
|
| 257 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-addons' === $page) { |
|
| 258 | 258 | $found = true; |
| 259 | 259 | } |
| 260 | 260 | break; |
| 261 | 261 | case 'donors': |
| 262 | - switch ( $passed_view ) { |
|
| 262 | + switch ($passed_view) { |
|
| 263 | 263 | case 'list-table': |
| 264 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) { |
|
| 264 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view) { |
|
| 265 | 265 | $found = true; |
| 266 | 266 | } |
| 267 | 267 | break; |
| 268 | 268 | case 'overview': |
| 269 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) { |
|
| 269 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view) { |
|
| 270 | 270 | $found = true; |
| 271 | 271 | } |
| 272 | 272 | break; |
| 273 | 273 | case 'notes': |
| 274 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) { |
|
| 274 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view) { |
|
| 275 | 275 | $found = true; |
| 276 | 276 | } |
| 277 | 277 | break; |
| 278 | 278 | default: |
| 279 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) { |
|
| 279 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page) { |
|
| 280 | 280 | $found = true; |
| 281 | 281 | } |
| 282 | 282 | break; |
| 283 | 283 | } |
| 284 | 284 | break; |
| 285 | 285 | case 'reports': |
| 286 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
| 286 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
| 287 | 287 | $found = true; |
| 288 | 288 | } |
| 289 | 289 | break; |
| 290 | 290 | default: |
| 291 | 291 | global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_upgrades_screen, $give_customers_page; |
| 292 | 292 | |
| 293 | - $admin_pages = apply_filters( 'give_admin_pages', array( |
|
| 293 | + $admin_pages = apply_filters('give_admin_pages', array( |
|
| 294 | 294 | $give_payments_page, |
| 295 | 295 | $give_settings_page, |
| 296 | 296 | $give_reports_page, |
@@ -299,18 +299,18 @@ discard block |
||
| 299 | 299 | $give_upgrades_screen, |
| 300 | 300 | $give_settings_export, |
| 301 | 301 | $give_customers_page |
| 302 | - ) ); |
|
| 303 | - if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) { |
|
| 302 | + )); |
|
| 303 | + if ('give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow) { |
|
| 304 | 304 | $found = true; |
| 305 | - if ( 'give-upgrades' === $page ) { |
|
| 305 | + if ('give-upgrades' === $page) { |
|
| 306 | 306 | $found = false; |
| 307 | 307 | } |
| 308 | - } elseif ( in_array( $pagenow, $admin_pages ) ) { |
|
| 308 | + } elseif (in_array($pagenow, $admin_pages)) { |
|
| 309 | 309 | $found = true; |
| 310 | 310 | } |
| 311 | 311 | break; |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view ); |
|
| 314 | + return (bool) apply_filters('give_is_admin_page', $found, $page, $view, $passed_page, $passed_view); |
|
| 315 | 315 | |
| 316 | 316 | } |
| 317 | 317 | \ No newline at end of file |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | |
| 11 | 11 | // Exit if accessed directly |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; |
| 14 | 14 | } |
| 15 | 15 | |
@@ -24,12 +24,12 @@ discard block |
||
| 24 | 24 | * |
| 25 | 25 | * @param $_banner_details |
| 26 | 26 | */ |
| 27 | - function __construct( $_banner_details ) { |
|
| 27 | + function __construct($_banner_details) { |
|
| 28 | 28 | |
| 29 | 29 | global $current_user; |
| 30 | 30 | $this->banner_details = $_banner_details; |
| 31 | - $this->test_mode = ( $this->banner_details['testing'] == 'true' ) ? true : false; |
|
| 32 | - $this->nag_meta_key = 'give_addon_activation_ignore_' . sanitize_title( $this->banner_details['name'] ); |
|
| 31 | + $this->test_mode = ($this->banner_details['testing'] == 'true') ? true : false; |
|
| 32 | + $this->nag_meta_key = 'give_addon_activation_ignore_'.sanitize_title($this->banner_details['name']); |
|
| 33 | 33 | |
| 34 | 34 | //Get current user |
| 35 | 35 | $this->user_id = $current_user->ID; |
@@ -48,13 +48,13 @@ discard block |
||
| 48 | 48 | public function init() { |
| 49 | 49 | |
| 50 | 50 | //Testing? |
| 51 | - if ( $this->test_mode ) { |
|
| 52 | - delete_user_meta( $this->user_id, $this->nag_meta_key ); |
|
| 51 | + if ($this->test_mode) { |
|
| 52 | + delete_user_meta($this->user_id, $this->nag_meta_key); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | //Get the current page to add the notice to |
| 56 | - add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) ); |
|
| 57 | - add_action( 'admin_notices', array( $this, 'give_addon_activation_admin_notice' ) ); |
|
| 56 | + add_action('current_screen', array($this, 'give_addon_notice_ignore')); |
|
| 57 | + add_action('admin_notices', array($this, 'give_addon_activation_admin_notice')); |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | } |
@@ -69,13 +69,13 @@ discard block |
||
| 69 | 69 | global $pagenow; |
| 70 | 70 | |
| 71 | 71 | //Make sure we're on the plugins page. |
| 72 | - if ( $pagenow !== 'plugins.php' ) { |
|
| 72 | + if ($pagenow !== 'plugins.php') { |
|
| 73 | 73 | return false; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // If the user hasn't already dismissed our alert, |
| 77 | 77 | // Output the activation banner |
| 78 | - if ( ! get_user_meta( $this->user_id, $this->nag_meta_key ) ) { ?> |
|
| 78 | + if ( ! get_user_meta($this->user_id, $this->nag_meta_key)) { ?> |
|
| 79 | 79 | |
| 80 | 80 | <!-- * I output inline styles here |
| 81 | 81 | * because there's no reason to keep these |
@@ -152,12 +152,12 @@ discard block |
||
| 152 | 152 | <img src="<?php echo GIVE_PLUGIN_URL; ?>assets/images/svg/give-icon-full-circle.svg" class="give-logo" /> |
| 153 | 153 | |
| 154 | 154 | <!-- Your Message --> |
| 155 | - <h3><?php echo sprintf( __( 'Thank you for installing Give\'s %1$s%2$s%3$s Add-on!', 'give' ), '<span>', $this->banner_details['name'], '</span>' ); ?></h3> |
|
| 155 | + <h3><?php echo sprintf(__('Thank you for installing Give\'s %1$s%2$s%3$s Add-on!', 'give'), '<span>', $this->banner_details['name'], '</span>'); ?></h3> |
|
| 156 | 156 | |
| 157 | 157 | <a href="<?php |
| 158 | 158 | //The Dismiss Button |
| 159 | - $nag_admin_dismiss_url = 'plugins.php?' . $this->nag_meta_key . '=0'; |
|
| 160 | - echo admin_url( $nag_admin_dismiss_url ); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
| 159 | + $nag_admin_dismiss_url = 'plugins.php?'.$this->nag_meta_key.'=0'; |
|
| 160 | + echo admin_url($nag_admin_dismiss_url); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
| 161 | 161 | |
| 162 | 162 | <!-- * Now we output a few "actions" |
| 163 | 163 | * that the user can take from here --> |
@@ -165,24 +165,24 @@ discard block |
||
| 165 | 165 | <div class="alert-actions"> |
| 166 | 166 | |
| 167 | 167 | <?php //Point them to your settings page |
| 168 | - if ( isset( $this->banner_details['settings_url'] ) ) { ?> |
|
| 168 | + if (isset($this->banner_details['settings_url'])) { ?> |
|
| 169 | 169 | <a href="<?php echo $this->banner_details['settings_url']; ?>"> |
| 170 | - <span class="dashicons dashicons-admin-settings"></span><?php _e( 'Go to Settings', 'give' ); ?> |
|
| 170 | + <span class="dashicons dashicons-admin-settings"></span><?php _e('Go to Settings', 'give'); ?> |
|
| 171 | 171 | </a> |
| 172 | 172 | <?php } ?> |
| 173 | 173 | |
| 174 | 174 | <?php |
| 175 | 175 | // Show them how to configure the Addon |
| 176 | - if ( isset( $this->banner_details['documentation_url'] ) ) { ?> |
|
| 177 | - <a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank"><span class="dashicons dashicons-media-text"></span><?php echo sprintf( __( 'Documentation: %1$s Add-on', 'give' ), $this->banner_details['name'] ); ?> |
|
| 176 | + if (isset($this->banner_details['documentation_url'])) { ?> |
|
| 177 | + <a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank"><span class="dashicons dashicons-media-text"></span><?php echo sprintf(__('Documentation: %1$s Add-on', 'give'), $this->banner_details['name']); ?> |
|
| 178 | 178 | </a> |
| 179 | 179 | <?php } ?> |
| 180 | 180 | <?php |
| 181 | 181 | //Let them signup for plugin updates |
| 182 | - if ( isset( $this->banner_details['support_url'] ) ) { ?> |
|
| 182 | + if (isset($this->banner_details['support_url'])) { ?> |
|
| 183 | 183 | |
| 184 | 184 | <a href="<?php echo $this->banner_details['support_url'] ?>" target="_blank"> |
| 185 | - <span class="dashicons dashicons-sos"></span><?php _e( 'Get Support', 'give' ); ?> |
|
| 185 | + <span class="dashicons dashicons-sos"></span><?php _e('Get Support', 'give'); ?> |
|
| 186 | 186 | </a> |
| 187 | 187 | |
| 188 | 188 | <?php } ?> |
@@ -203,13 +203,13 @@ discard block |
||
| 203 | 203 | /* If user clicks to ignore the notice, add that to their user meta the banner then checks whether this tag exists already or not. |
| 204 | 204 | * See here: http://codex.wordpress.org/Function_Reference/add_user_meta |
| 205 | 205 | */ |
| 206 | - if ( isset( $_GET[ $this->nag_meta_key ] ) && '0' == $_GET[ $this->nag_meta_key ] ) { |
|
| 206 | + if (isset($_GET[$this->nag_meta_key]) && '0' == $_GET[$this->nag_meta_key]) { |
|
| 207 | 207 | |
| 208 | 208 | //Get the global user |
| 209 | 209 | global $current_user; |
| 210 | 210 | $user_id = $current_user->ID; |
| 211 | 211 | |
| 212 | - add_user_meta( $user_id, $this->nag_meta_key, 'true', true ); |
|
| 212 | + add_user_meta($user_id, $this->nag_meta_key, 'true', true); |
|
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | |
@@ -10,13 +10,13 @@ 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 | |
| 17 | 17 | // Load WP_List_Table if not loaded |
| 18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 18 | +if ( ! class_exists('WP_List_Table')) { |
|
| 19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -50,11 +50,11 @@ discard block |
||
| 50 | 50 | global $status, $page; |
| 51 | 51 | |
| 52 | 52 | // Set parent defaults |
| 53 | - parent::__construct( array( |
|
| 54 | - 'singular' => __( 'API Key', 'give' ), // Singular name of the listed records |
|
| 55 | - 'plural' => __( 'API Keys', 'give' ), // Plural name of the listed records |
|
| 53 | + parent::__construct(array( |
|
| 54 | + 'singular' => __('API Key', 'give'), // Singular name of the listed records |
|
| 55 | + 'plural' => __('API Keys', 'give'), // Plural name of the listed records |
|
| 56 | 56 | 'ajax' => false // Does this table support ajax? |
| 57 | - ) ); |
|
| 57 | + )); |
|
| 58 | 58 | |
| 59 | 59 | $this->query(); |
| 60 | 60 | } |
@@ -70,8 +70,8 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * @return string Column Name |
| 72 | 72 | */ |
| 73 | - public function column_default( $item, $column_name ) { |
|
| 74 | - return $item[ $column_name ]; |
|
| 73 | + public function column_default($item, $column_name) { |
|
| 74 | + return $item[$column_name]; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | * |
| 86 | 86 | * @return string Column Name |
| 87 | 87 | */ |
| 88 | - public function column_key( $item ) { |
|
| 89 | - return '<input readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['key'] ) . '"/>'; |
|
| 88 | + public function column_key($item) { |
|
| 89 | + return '<input readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['key']).'"/>'; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | * |
| 101 | 101 | * @return string Column Name |
| 102 | 102 | */ |
| 103 | - public function column_token( $item ) { |
|
| 104 | - return '<input readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['token'] ) . '"/>'; |
|
| 103 | + public function column_token($item) { |
|
| 104 | + return '<input readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['token']).'"/>'; |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | * |
| 116 | 116 | * @return string Column Name |
| 117 | 117 | */ |
| 118 | - public function column_secret( $item ) { |
|
| 119 | - return '<input readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['secret'] ) . '"/>'; |
|
| 118 | + public function column_secret($item) { |
|
| 119 | + return '<input readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['secret']).'"/>'; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -126,43 +126,43 @@ discard block |
||
| 126 | 126 | * @since 1.1 |
| 127 | 127 | * @return void |
| 128 | 128 | */ |
| 129 | - public function column_user( $item ) { |
|
| 129 | + public function column_user($item) { |
|
| 130 | 130 | |
| 131 | 131 | $actions = array(); |
| 132 | 132 | |
| 133 | - if ( apply_filters( 'give_api_log_requests', true ) ) { |
|
| 133 | + if (apply_filters('give_api_log_requests', true)) { |
|
| 134 | 134 | $actions['view'] = sprintf( |
| 135 | 135 | '<a href="%s">%s</a>', |
| 136 | - esc_url( add_query_arg( array( 'view' => 'api_requests', |
|
| 136 | + esc_url(add_query_arg(array('view' => 'api_requests', |
|
| 137 | 137 | 'post_type' => 'give_forms', |
| 138 | 138 | 'page' => 'give-reports', |
| 139 | 139 | 'tab' => 'logs', |
| 140 | 140 | 's' => $item['email'] |
| 141 | - ), 'edit.php' ) ), |
|
| 142 | - __( 'View API Log', 'give' ) |
|
| 141 | + ), 'edit.php')), |
|
| 142 | + __('View API Log', 'give') |
|
| 143 | 143 | ); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | $actions['reissue'] = sprintf( |
| 147 | 147 | '<a href="%s" class="give-regenerate-api-key">%s</a>', |
| 148 | - esc_url( wp_nonce_url( add_query_arg( array( 'user_id' => $item['id'], |
|
| 148 | + esc_url(wp_nonce_url(add_query_arg(array('user_id' => $item['id'], |
|
| 149 | 149 | 'give_action' => 'process_api_key', |
| 150 | 150 | 'give_api_process' => 'regenerate' |
| 151 | - ) ), 'give-api-nonce' ) ), |
|
| 152 | - __( 'Reissue', 'give' ) |
|
| 151 | + )), 'give-api-nonce')), |
|
| 152 | + __('Reissue', 'give') |
|
| 153 | 153 | ); |
| 154 | - $actions['revoke'] = sprintf( |
|
| 154 | + $actions['revoke'] = sprintf( |
|
| 155 | 155 | '<a href="%s" class="give-revoke-api-key give-delete">%s</a>', |
| 156 | - esc_url( wp_nonce_url( add_query_arg( array( 'user_id' => $item['id'], |
|
| 156 | + esc_url(wp_nonce_url(add_query_arg(array('user_id' => $item['id'], |
|
| 157 | 157 | 'give_action' => 'process_api_key', |
| 158 | 158 | 'give_api_process' => 'revoke' |
| 159 | - ) ), 'give-api-nonce' ) ), |
|
| 160 | - __( 'Revoke', 'give' ) |
|
| 159 | + )), 'give-api-nonce')), |
|
| 160 | + __('Revoke', 'give') |
|
| 161 | 161 | ); |
| 162 | 162 | |
| 163 | - $actions = apply_filters( 'give_api_row_actions', array_filter( $actions ) ); |
|
| 163 | + $actions = apply_filters('give_api_row_actions', array_filter($actions)); |
|
| 164 | 164 | |
| 165 | - return sprintf( '%1$s %2$s', $item['user'], $this->row_actions( $actions ) ); |
|
| 165 | + return sprintf('%1$s %2$s', $item['user'], $this->row_actions($actions)); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | /** |
@@ -174,10 +174,10 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | public function get_columns() { |
| 176 | 176 | $columns = array( |
| 177 | - 'user' => __( 'Username', 'give' ), |
|
| 178 | - 'key' => __( 'Public Key', 'give' ), |
|
| 179 | - 'token' => __( 'Token', 'give' ), |
|
| 180 | - 'secret' => __( 'Secret Key', 'give' ) |
|
| 177 | + 'user' => __('Username', 'give'), |
|
| 178 | + 'key' => __('Public Key', 'give'), |
|
| 179 | + 'token' => __('Token', 'give'), |
|
| 180 | + 'secret' => __('Secret Key', 'give') |
|
| 181 | 181 | ); |
| 182 | 182 | |
| 183 | 183 | return $columns; |
@@ -190,20 +190,20 @@ discard block |
||
| 190 | 190 | * @since 1.1 |
| 191 | 191 | * @return void |
| 192 | 192 | */ |
| 193 | - function bulk_actions( $which = '' ) { |
|
| 193 | + function bulk_actions($which = '') { |
|
| 194 | 194 | // These aren't really bulk actions but this outputs the markup in the right place |
| 195 | 195 | static $give_api_is_bottom; |
| 196 | 196 | |
| 197 | - if ( $give_api_is_bottom ) { |
|
| 197 | + if ($give_api_is_bottom) { |
|
| 198 | 198 | return; |
| 199 | 199 | } |
| 200 | 200 | ?> |
| 201 | - <form method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=api' ); ?>"> |
|
| 201 | + <form method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-settings&tab=api'); ?>"> |
|
| 202 | 202 | <input type="hidden" name="give_action" value="process_api_key" /> |
| 203 | 203 | <input type="hidden" name="give_api_process" value="generate" /> |
| 204 | - <?php wp_nonce_field( 'give-api-nonce' ); ?> |
|
| 204 | + <?php wp_nonce_field('give-api-nonce'); ?> |
|
| 205 | 205 | <?php echo Give()->html->ajax_user_search(); ?> |
| 206 | - <?php submit_button( __( 'Generate New API Keys', 'give' ), 'secondary', 'submit', false ); ?> |
|
| 206 | + <?php submit_button(__('Generate New API Keys', 'give'), 'secondary', 'submit', false); ?> |
|
| 207 | 207 | </form> |
| 208 | 208 | <?php |
| 209 | 209 | $give_api_is_bottom = true; |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | * @return int Current page number |
| 218 | 218 | */ |
| 219 | 219 | public function get_paged() { |
| 220 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 220 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | /** |
@@ -228,21 +228,21 @@ discard block |
||
| 228 | 228 | * @return void |
| 229 | 229 | */ |
| 230 | 230 | public function query() { |
| 231 | - $users = get_users( array( |
|
| 231 | + $users = get_users(array( |
|
| 232 | 232 | 'meta_value' => 'give_user_secret_key', |
| 233 | 233 | 'number' => $this->per_page, |
| 234 | - 'offset' => $this->per_page * ( $this->get_paged() - 1 ) |
|
| 235 | - ) ); |
|
| 236 | - $keys = array(); |
|
| 237 | - |
|
| 238 | - foreach ( $users as $user ) { |
|
| 239 | - $keys[ $user->ID ]['id'] = $user->ID; |
|
| 240 | - $keys[ $user->ID ]['email'] = $user->user_email; |
|
| 241 | - $keys[ $user->ID ]['user'] = '<a href="' . add_query_arg( 'user_id', $user->ID, 'user-edit.php' ) . '"><strong>' . $user->user_login . '</strong></a>'; |
|
| 242 | - |
|
| 243 | - $keys[ $user->ID ]['key'] = Give()->api->get_user_public_key( $user->ID ); |
|
| 244 | - $keys[ $user->ID ]['secret'] = Give()->api->get_user_secret_key( $user->ID ); |
|
| 245 | - $keys[ $user->ID ]['token'] = Give()->api->get_token( $user->ID ); |
|
| 234 | + 'offset' => $this->per_page * ($this->get_paged() - 1) |
|
| 235 | + )); |
|
| 236 | + $keys = array(); |
|
| 237 | + |
|
| 238 | + foreach ($users as $user) { |
|
| 239 | + $keys[$user->ID]['id'] = $user->ID; |
|
| 240 | + $keys[$user->ID]['email'] = $user->user_email; |
|
| 241 | + $keys[$user->ID]['user'] = '<a href="'.add_query_arg('user_id', $user->ID, 'user-edit.php').'"><strong>'.$user->user_login.'</strong></a>'; |
|
| 242 | + |
|
| 243 | + $keys[$user->ID]['key'] = Give()->api->get_user_public_key($user->ID); |
|
| 244 | + $keys[$user->ID]['secret'] = Give()->api->get_user_secret_key($user->ID); |
|
| 245 | + $keys[$user->ID]['token'] = Give()->api->get_token($user->ID); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | return $keys; |
@@ -259,13 +259,13 @@ discard block |
||
| 259 | 259 | public function total_items() { |
| 260 | 260 | global $wpdb; |
| 261 | 261 | |
| 262 | - if ( ! get_transient( 'give_total_api_keys' ) ) { |
|
| 263 | - $total_items = $wpdb->get_var( "SELECT count(user_id) FROM $wpdb->usermeta WHERE meta_value='give_user_secret_key'" ); |
|
| 262 | + if ( ! get_transient('give_total_api_keys')) { |
|
| 263 | + $total_items = $wpdb->get_var("SELECT count(user_id) FROM $wpdb->usermeta WHERE meta_value='give_user_secret_key'"); |
|
| 264 | 264 | |
| 265 | - set_transient( 'give_total_api_keys', $total_items, 60 * 60 ); |
|
| 265 | + set_transient('give_total_api_keys', $total_items, 60 * 60); |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - return get_transient( 'give_total_api_keys' ); |
|
| 268 | + return get_transient('give_total_api_keys'); |
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | /** |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | $hidden = array(); // No hidden columns |
| 282 | 282 | $sortable = array(); // Not sortable... for now |
| 283 | 283 | |
| 284 | - $this->_column_headers = array( $columns, $hidden, $sortable, 'id' ); |
|
| 284 | + $this->_column_headers = array($columns, $hidden, $sortable, 'id'); |
|
| 285 | 285 | |
| 286 | 286 | $data = $this->query(); |
| 287 | 287 | |
@@ -289,10 +289,10 @@ discard block |
||
| 289 | 289 | |
| 290 | 290 | $this->items = $data; |
| 291 | 291 | |
| 292 | - $this->set_pagination_args( array( |
|
| 292 | + $this->set_pagination_args(array( |
|
| 293 | 293 | 'total_items' => $total_items, |
| 294 | 294 | 'per_page' => $this->per_page, |
| 295 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
| 295 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
| 296 | 296 | ) |
| 297 | 297 | ); |
| 298 | 298 | } |
@@ -10,13 +10,13 @@ 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 | |
| 17 | 17 | // Load WP_List_Table if not loaded |
| 18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 18 | +if ( ! class_exists('WP_List_Table')) { |
|
| 19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -62,11 +62,11 @@ discard block |
||
| 62 | 62 | global $status, $page; |
| 63 | 63 | |
| 64 | 64 | // Set parent defaults |
| 65 | - parent::__construct( array( |
|
| 66 | - 'singular' => __( 'Donor', 'give' ), // Singular name of the listed records |
|
| 67 | - 'plural' => __( 'Donors', 'give' ), // Plural name of the listed records |
|
| 65 | + parent::__construct(array( |
|
| 66 | + 'singular' => __('Donor', 'give'), // Singular name of the listed records |
|
| 67 | + 'plural' => __('Donors', 'give'), // Plural name of the listed records |
|
| 68 | 68 | 'ajax' => false // Does this table support ajax? |
| 69 | - ) ); |
|
| 69 | + )); |
|
| 70 | 70 | |
| 71 | 71 | } |
| 72 | 72 | |
@@ -81,20 +81,20 @@ discard block |
||
| 81 | 81 | * |
| 82 | 82 | * @return void |
| 83 | 83 | */ |
| 84 | - public function search_box( $text, $input_id ) { |
|
| 85 | - $input_id = $input_id . '-search-input'; |
|
| 84 | + public function search_box($text, $input_id) { |
|
| 85 | + $input_id = $input_id.'-search-input'; |
|
| 86 | 86 | |
| 87 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
| 88 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
| 87 | + if ( ! empty($_REQUEST['orderby'])) { |
|
| 88 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
| 89 | 89 | } |
| 90 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
| 91 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
| 90 | + if ( ! empty($_REQUEST['order'])) { |
|
| 91 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
| 92 | 92 | } |
| 93 | 93 | ?> |
| 94 | 94 | <p class="search-box"> |
| 95 | 95 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
| 96 | 96 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
| 97 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
| 97 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
| 98 | 98 | </p> |
| 99 | 99 | <?php |
| 100 | 100 | } |
@@ -110,41 +110,41 @@ discard block |
||
| 110 | 110 | * |
| 111 | 111 | * @return string Column Name |
| 112 | 112 | */ |
| 113 | - public function column_default( $item, $column_name ) { |
|
| 114 | - switch ( $column_name ) { |
|
| 113 | + public function column_default($item, $column_name) { |
|
| 114 | + switch ($column_name) { |
|
| 115 | 115 | |
| 116 | 116 | case 'num_purchases' : |
| 117 | - $value = '<a href="' . |
|
| 118 | - admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&user=' . urlencode( $item['email'] ) |
|
| 119 | - ) . '">' . esc_html( $item['num_purchases'] ) . '</a>'; |
|
| 117 | + $value = '<a href="'. |
|
| 118 | + admin_url('/edit.php?post_type=give_forms&page=give-payment-history&user='.urlencode($item['email']) |
|
| 119 | + ).'">'.esc_html($item['num_purchases']).'</a>'; |
|
| 120 | 120 | break; |
| 121 | 121 | |
| 122 | 122 | case 'amount_spent' : |
| 123 | - $value = give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
| 123 | + $value = give_currency_filter(give_format_amount($item[$column_name])); |
|
| 124 | 124 | break; |
| 125 | 125 | |
| 126 | 126 | case 'date_created' : |
| 127 | - $value = date_i18n( get_option( 'date_format' ), strtotime( $item['date_created'] ) ); |
|
| 127 | + $value = date_i18n(get_option('date_format'), strtotime($item['date_created'])); |
|
| 128 | 128 | break; |
| 129 | 129 | |
| 130 | 130 | default: |
| 131 | - $value = isset( $item[ $column_name ] ) ? $item[ $column_name ] : null; |
|
| 131 | + $value = isset($item[$column_name]) ? $item[$column_name] : null; |
|
| 132 | 132 | break; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - return apply_filters( 'give_report_column_' . $column_name, $value, $item['id'] ); |
|
| 135 | + return apply_filters('give_report_column_'.$column_name, $value, $item['id']); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - public function column_name( $item ) { |
|
| 139 | - $name = '#' . $item['id'] . ' '; |
|
| 140 | - $name .= ! empty( $item['name'] ) ? $item['name'] : '<em>' . __( 'Unnamed Donor', 'give' ) . '</em>'; |
|
| 141 | - $view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $item['id'] ); |
|
| 138 | + public function column_name($item) { |
|
| 139 | + $name = '#'.$item['id'].' '; |
|
| 140 | + $name .= ! empty($item['name']) ? $item['name'] : '<em>'.__('Unnamed Donor', 'give').'</em>'; |
|
| 141 | + $view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$item['id']); |
|
| 142 | 142 | $actions = array( |
| 143 | - 'view' => sprintf( __( '<a href="%s">View Donor</a>', 'give' ), $view_url ), |
|
| 144 | - 'delete' => sprintf( __( '<a href="%s">Delete</a>', 'give' ), admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $item['id'] ) ) |
|
| 143 | + 'view' => sprintf(__('<a href="%s">View Donor</a>', 'give'), $view_url), |
|
| 144 | + 'delete' => sprintf(__('<a href="%s">Delete</a>', 'give'), admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$item['id'])) |
|
| 145 | 145 | ); |
| 146 | 146 | |
| 147 | - return '<a href="' . esc_url( $view_url ) . '">' . $name . '</a>' . $this->row_actions( $actions ); |
|
| 147 | + return '<a href="'.esc_url($view_url).'">'.$name.'</a>'.$this->row_actions($actions); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -156,14 +156,14 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | public function get_columns() { |
| 158 | 158 | $columns = array( |
| 159 | - 'name' => __( 'Name', 'give' ), |
|
| 160 | - 'email' => __( 'Email', 'give' ), |
|
| 161 | - 'num_purchases' => __( 'Donations', 'give' ), |
|
| 162 | - 'amount_spent' => __( 'Total Donated', 'give' ), |
|
| 163 | - 'date_created' => __( 'Date Created', 'give' ) |
|
| 159 | + 'name' => __('Name', 'give'), |
|
| 160 | + 'email' => __('Email', 'give'), |
|
| 161 | + 'num_purchases' => __('Donations', 'give'), |
|
| 162 | + 'amount_spent' => __('Total Donated', 'give'), |
|
| 163 | + 'date_created' => __('Date Created', 'give') |
|
| 164 | 164 | ); |
| 165 | 165 | |
| 166 | - return apply_filters( 'give_report_customer_columns', $columns ); |
|
| 166 | + return apply_filters('give_report_customer_columns', $columns); |
|
| 167 | 167 | |
| 168 | 168 | } |
| 169 | 169 | |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | public function get_sortable_columns() { |
| 178 | 178 | return array( |
| 179 | - 'date_created' => array( 'date_created', true ), |
|
| 180 | - 'name' => array( 'name', true ), |
|
| 181 | - 'num_purchases' => array( 'purchase_count', false ), |
|
| 182 | - 'amount_spent' => array( 'purchase_value', false ), |
|
| 179 | + 'date_created' => array('date_created', true), |
|
| 180 | + 'name' => array('name', true), |
|
| 181 | + 'num_purchases' => array('purchase_count', false), |
|
| 182 | + 'amount_spent' => array('purchase_value', false), |
|
| 183 | 183 | ); |
| 184 | 184 | } |
| 185 | 185 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | * @since 1.0 |
| 191 | 191 | * @return void |
| 192 | 192 | */ |
| 193 | - public function bulk_actions( $which = '' ) { |
|
| 193 | + public function bulk_actions($which = '') { |
|
| 194 | 194 | // These aren't really bulk actions but this outputs the markup in the right place |
| 195 | 195 | } |
| 196 | 196 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | * @return int Current page number |
| 203 | 203 | */ |
| 204 | 204 | public function get_paged() { |
| 205 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 205 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | * @return mixed string If search is present, false otherwise |
| 214 | 214 | */ |
| 215 | 215 | public function get_search() { |
| 216 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
| 216 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | /** |
@@ -230,10 +230,10 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | $data = array(); |
| 232 | 232 | $paged = $this->get_paged(); |
| 233 | - $offset = $this->per_page * ( $paged - 1 ); |
|
| 233 | + $offset = $this->per_page * ($paged - 1); |
|
| 234 | 234 | $search = $this->get_search(); |
| 235 | - $order = isset( $_GET['order'] ) ? sanitize_text_field( $_GET['order'] ) : 'DESC'; |
|
| 236 | - $orderby = isset( $_GET['orderby'] ) ? sanitize_text_field( $_GET['orderby'] ) : 'id'; |
|
| 235 | + $order = isset($_GET['order']) ? sanitize_text_field($_GET['order']) : 'DESC'; |
|
| 236 | + $orderby = isset($_GET['orderby']) ? sanitize_text_field($_GET['orderby']) : 'id'; |
|
| 237 | 237 | |
| 238 | 238 | $args = array( |
| 239 | 239 | 'number' => $this->per_page, |
@@ -242,21 +242,21 @@ discard block |
||
| 242 | 242 | 'orderby' => $orderby |
| 243 | 243 | ); |
| 244 | 244 | |
| 245 | - if ( is_email( $search ) ) { |
|
| 245 | + if (is_email($search)) { |
|
| 246 | 246 | $args['email'] = $search; |
| 247 | - } elseif ( is_numeric( $search ) ) { |
|
| 247 | + } elseif (is_numeric($search)) { |
|
| 248 | 248 | $args['id'] = $search; |
| 249 | 249 | } else { |
| 250 | 250 | $args['name'] = $search; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - $customers = Give()->customers->get_customers( $args ); |
|
| 253 | + $customers = Give()->customers->get_customers($args); |
|
| 254 | 254 | |
| 255 | - if ( $customers ) { |
|
| 255 | + if ($customers) { |
|
| 256 | 256 | |
| 257 | - foreach ( $customers as $customer ) { |
|
| 257 | + foreach ($customers as $customer) { |
|
| 258 | 258 | |
| 259 | - $user_id = ! empty( $customer->user_id ) ? intval( $customer->user_id ) : 0; |
|
| 259 | + $user_id = ! empty($customer->user_id) ? intval($customer->user_id) : 0; |
|
| 260 | 260 | |
| 261 | 261 | $data[] = array( |
| 262 | 262 | 'id' => $customer->id, |
@@ -290,16 +290,16 @@ discard block |
||
| 290 | 290 | $hidden = array(); // No hidden columns |
| 291 | 291 | $sortable = $this->get_sortable_columns(); |
| 292 | 292 | |
| 293 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 293 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 294 | 294 | |
| 295 | 295 | $this->items = $this->reports_data(); |
| 296 | 296 | |
| 297 | 297 | $this->total = give_count_total_customers(); |
| 298 | 298 | |
| 299 | - $this->set_pagination_args( array( |
|
| 299 | + $this->set_pagination_args(array( |
|
| 300 | 300 | 'total_items' => $this->total, |
| 301 | 301 | 'per_page' => $this->per_page, |
| 302 | - 'total_pages' => ceil( $this->total / $this->per_page ) |
|
| 303 | - ) ); |
|
| 302 | + 'total_pages' => ceil($this->total / $this->per_page) |
|
| 303 | + )); |
|
| 304 | 304 | } |
| 305 | 305 | } |
| 306 | 306 | \ No newline at end of file |
@@ -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,14 +23,14 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return array $output Response messages |
| 25 | 25 | */ |
| 26 | -function give_edit_customer( $args ) { |
|
| 27 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
| 26 | +function give_edit_customer($args) { |
|
| 27 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
| 28 | 28 | |
| 29 | - if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) { |
|
| 30 | - wp_die( __( 'You do not have permission to edit this donor.', 'give' ) ); |
|
| 29 | + if ( ! is_admin() || ! current_user_can($customer_edit_role)) { |
|
| 30 | + wp_die(__('You do not have permission to edit this donor.', 'give')); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - if ( empty( $args ) ) { |
|
| 33 | + if (empty($args)) { |
|
| 34 | 34 | return; |
| 35 | 35 | } |
| 36 | 36 | |
@@ -38,12 +38,12 @@ discard block |
||
| 38 | 38 | $customer_id = (int) $args['customerinfo']['id']; |
| 39 | 39 | $nonce = $args['_wpnonce']; |
| 40 | 40 | |
| 41 | - if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) { |
|
| 42 | - wp_die( __( 'Cheatin\' eh?!', 'give' ) ); |
|
| 41 | + if ( ! wp_verify_nonce($nonce, 'edit-customer')) { |
|
| 42 | + wp_die(__('Cheatin\' eh?!', 'give')); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - $customer = new Give_Customer( $customer_id ); |
|
| 46 | - if ( empty( $customer->id ) ) { |
|
| 45 | + $customer = new Give_Customer($customer_id); |
|
| 46 | + if (empty($customer->id)) { |
|
| 47 | 47 | return false; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -53,23 +53,23 @@ discard block |
||
| 53 | 53 | 'user_id' => 0 |
| 54 | 54 | ); |
| 55 | 55 | |
| 56 | - $customer_info = wp_parse_args( $customer_info, $defaults ); |
|
| 56 | + $customer_info = wp_parse_args($customer_info, $defaults); |
|
| 57 | 57 | |
| 58 | - if ( ! is_email( $customer_info['email'] ) ) { |
|
| 59 | - give_set_error( 'give-invalid-email', __( 'Please enter a valid email address.', 'give' ) ); |
|
| 58 | + if ( ! is_email($customer_info['email'])) { |
|
| 59 | + give_set_error('give-invalid-email', __('Please enter a valid email address.', 'give')); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if ( (int) $customer_info['user_id'] != (int) $customer->user_id ) { |
|
| 62 | + if ((int) $customer_info['user_id'] != (int) $customer->user_id) { |
|
| 63 | 63 | |
| 64 | 64 | // Make sure we don't already have this user attached to a customer |
| 65 | - if ( ! empty( $customer_info['user_id'] ) && false !== Give()->customers->get_customer_by( 'user_id', $customer_info['user_id'] ) ) { |
|
| 66 | - give_set_error( 'give-invalid-customer-user_id', sprintf( __( 'The User ID %d is already associated with a different donor.', 'give' ), $customer_info['user_id'] ) ); |
|
| 65 | + if ( ! empty($customer_info['user_id']) && false !== Give()->customers->get_customer_by('user_id', $customer_info['user_id'])) { |
|
| 66 | + give_set_error('give-invalid-customer-user_id', sprintf(__('The User ID %d is already associated with a different donor.', 'give'), $customer_info['user_id'])); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | // Make sure it's actually a user |
| 70 | - $user = get_user_by( 'id', $customer_info['user_id'] ); |
|
| 71 | - if ( ! empty( $customer_info['user_id'] ) && false === $user ) { |
|
| 72 | - give_set_error( 'give-invalid-user_id', sprintf( __( 'The User ID %d does not exist. Please assign an existing user.', 'give' ), $customer_info['user_id'] ) ); |
|
| 70 | + $user = get_user_by('id', $customer_info['user_id']); |
|
| 71 | + if ( ! empty($customer_info['user_id']) && false === $user) { |
|
| 72 | + give_set_error('give-invalid-user_id', sprintf(__('The User ID %d does not exist. Please assign an existing user.', 'give'), $customer_info['user_id'])); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | } |
@@ -77,82 +77,82 @@ discard block |
||
| 77 | 77 | // Record this for later |
| 78 | 78 | $previous_user_id = $customer->user_id; |
| 79 | 79 | |
| 80 | - if ( give_get_errors() ) { |
|
| 80 | + if (give_get_errors()) { |
|
| 81 | 81 | return; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | // Setup the customer address, if present |
| 85 | 85 | $address = array(); |
| 86 | - if ( intval( $customer_info['user_id'] ) > 0 ) { |
|
| 86 | + if (intval($customer_info['user_id']) > 0) { |
|
| 87 | 87 | |
| 88 | - $current_address = get_user_meta( $customer_info['user_id'], '_give_user_address', true ); |
|
| 88 | + $current_address = get_user_meta($customer_info['user_id'], '_give_user_address', true); |
|
| 89 | 89 | |
| 90 | - if ( false === $current_address ) { |
|
| 91 | - $address['line1'] = isset( $customer_info['line1'] ) ? $customer_info['line1'] : ''; |
|
| 92 | - $address['line2'] = isset( $customer_info['line2'] ) ? $customer_info['line2'] : ''; |
|
| 93 | - $address['city'] = isset( $customer_info['city'] ) ? $customer_info['city'] : ''; |
|
| 94 | - $address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : ''; |
|
| 95 | - $address['zip'] = isset( $customer_info['zip'] ) ? $customer_info['zip'] : ''; |
|
| 96 | - $address['state'] = isset( $customer_info['state'] ) ? $customer_info['state'] : ''; |
|
| 90 | + if (false === $current_address) { |
|
| 91 | + $address['line1'] = isset($customer_info['line1']) ? $customer_info['line1'] : ''; |
|
| 92 | + $address['line2'] = isset($customer_info['line2']) ? $customer_info['line2'] : ''; |
|
| 93 | + $address['city'] = isset($customer_info['city']) ? $customer_info['city'] : ''; |
|
| 94 | + $address['country'] = isset($customer_info['country']) ? $customer_info['country'] : ''; |
|
| 95 | + $address['zip'] = isset($customer_info['zip']) ? $customer_info['zip'] : ''; |
|
| 96 | + $address['state'] = isset($customer_info['state']) ? $customer_info['state'] : ''; |
|
| 97 | 97 | } else { |
| 98 | - $current_address = wp_parse_args( $current_address, array( |
|
| 98 | + $current_address = wp_parse_args($current_address, array( |
|
| 99 | 99 | 'line1', |
| 100 | 100 | 'line2', |
| 101 | 101 | 'city', |
| 102 | 102 | 'zip', |
| 103 | 103 | 'state', |
| 104 | 104 | 'country' |
| 105 | - ) ); |
|
| 106 | - $address['line1'] = isset( $customer_info['line1'] ) ? $customer_info['line1'] : $current_address['line1']; |
|
| 107 | - $address['line2'] = isset( $customer_info['line2'] ) ? $customer_info['line2'] : $current_address['line2']; |
|
| 108 | - $address['city'] = isset( $customer_info['city'] ) ? $customer_info['city'] : $current_address['city']; |
|
| 109 | - $address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : $current_address['country']; |
|
| 110 | - $address['zip'] = isset( $customer_info['zip'] ) ? $customer_info['zip'] : $current_address['zip']; |
|
| 111 | - $address['state'] = isset( $customer_info['state'] ) ? $customer_info['state'] : $current_address['state']; |
|
| 105 | + )); |
|
| 106 | + $address['line1'] = isset($customer_info['line1']) ? $customer_info['line1'] : $current_address['line1']; |
|
| 107 | + $address['line2'] = isset($customer_info['line2']) ? $customer_info['line2'] : $current_address['line2']; |
|
| 108 | + $address['city'] = isset($customer_info['city']) ? $customer_info['city'] : $current_address['city']; |
|
| 109 | + $address['country'] = isset($customer_info['country']) ? $customer_info['country'] : $current_address['country']; |
|
| 110 | + $address['zip'] = isset($customer_info['zip']) ? $customer_info['zip'] : $current_address['zip']; |
|
| 111 | + $address['state'] = isset($customer_info['state']) ? $customer_info['state'] : $current_address['state']; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | // Sanitize the inputs |
| 117 | 117 | $customer_data = array(); |
| 118 | - $customer_data['name'] = strip_tags( stripslashes( $customer_info['name'] ) ); |
|
| 118 | + $customer_data['name'] = strip_tags(stripslashes($customer_info['name'])); |
|
| 119 | 119 | $customer_data['email'] = $customer_info['email']; |
| 120 | 120 | $customer_data['user_id'] = $customer_info['user_id']; |
| 121 | 121 | |
| 122 | - $customer_data = apply_filters( 'give_edit_customer_info', $customer_data, $customer_id ); |
|
| 123 | - $address = apply_filters( 'give_edit_customer_address', $address, $customer_id ); |
|
| 122 | + $customer_data = apply_filters('give_edit_customer_info', $customer_data, $customer_id); |
|
| 123 | + $address = apply_filters('give_edit_customer_address', $address, $customer_id); |
|
| 124 | 124 | |
| 125 | - $customer_data = array_map( 'sanitize_text_field', $customer_data ); |
|
| 126 | - $address = array_map( 'sanitize_text_field', $address ); |
|
| 125 | + $customer_data = array_map('sanitize_text_field', $customer_data); |
|
| 126 | + $address = array_map('sanitize_text_field', $address); |
|
| 127 | 127 | |
| 128 | - do_action( 'give_pre_edit_customer', $customer_id, $customer_data, $address ); |
|
| 128 | + do_action('give_pre_edit_customer', $customer_id, $customer_data, $address); |
|
| 129 | 129 | |
| 130 | 130 | $output = array(); |
| 131 | 131 | $previous_email = $customer->email; |
| 132 | 132 | |
| 133 | - if ( $customer->update( $customer_data ) ) { |
|
| 133 | + if ($customer->update($customer_data)) { |
|
| 134 | 134 | |
| 135 | - if ( ! empty( $customer->user_id ) && $customer->user_id > 0 ) { |
|
| 136 | - update_user_meta( $customer->user_id, '_give_user_address', $address ); |
|
| 135 | + if ( ! empty($customer->user_id) && $customer->user_id > 0) { |
|
| 136 | + update_user_meta($customer->user_id, '_give_user_address', $address); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | // Update some payment meta if we need to |
| 140 | - $payments_array = explode( ',', $customer->payment_ids ); |
|
| 140 | + $payments_array = explode(',', $customer->payment_ids); |
|
| 141 | 141 | |
| 142 | - if ( $customer->email != $previous_email ) { |
|
| 143 | - foreach ( $payments_array as $payment_id ) { |
|
| 144 | - give_update_payment_meta( $payment_id, 'email', $customer->email ); |
|
| 142 | + if ($customer->email != $previous_email) { |
|
| 143 | + foreach ($payments_array as $payment_id) { |
|
| 144 | + give_update_payment_meta($payment_id, 'email', $customer->email); |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - if ( $customer->user_id != $previous_user_id ) { |
|
| 149 | - foreach ( $payments_array as $payment_id ) { |
|
| 150 | - give_update_payment_meta( $payment_id, '_give_payment_user_id', $customer->user_id ); |
|
| 148 | + if ($customer->user_id != $previous_user_id) { |
|
| 149 | + foreach ($payments_array as $payment_id) { |
|
| 150 | + give_update_payment_meta($payment_id, '_give_payment_user_id', $customer->user_id); |
|
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | $output['success'] = true; |
| 155 | - $customer_data = array_merge( $customer_data, $address ); |
|
| 155 | + $customer_data = array_merge($customer_data, $address); |
|
| 156 | 156 | $output['customer_info'] = $customer_data; |
| 157 | 157 | |
| 158 | 158 | } else { |
@@ -161,11 +161,11 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - do_action( 'give_post_edit_customer', $customer_id, $customer_data ); |
|
| 164 | + do_action('give_post_edit_customer', $customer_id, $customer_data); |
|
| 165 | 165 | |
| 166 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
| 167 | - header( 'Content-Type: application/json' ); |
|
| 168 | - echo json_encode( $output ); |
|
| 166 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
| 167 | + header('Content-Type: application/json'); |
|
| 168 | + echo json_encode($output); |
|
| 169 | 169 | wp_die(); |
| 170 | 170 | } |
| 171 | 171 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | -add_action( 'give_edit-customer', 'give_edit_customer', 10, 1 ); |
|
| 176 | +add_action('give_edit-customer', 'give_edit_customer', 10, 1); |
|
| 177 | 177 | |
| 178 | 178 | /** |
| 179 | 179 | * Save a customer note being added |
@@ -184,53 +184,53 @@ discard block |
||
| 184 | 184 | * |
| 185 | 185 | * @return int The Note ID that was saved, or 0 if nothing was saved |
| 186 | 186 | */ |
| 187 | -function give_customer_save_note( $args ) { |
|
| 187 | +function give_customer_save_note($args) { |
|
| 188 | 188 | |
| 189 | - $customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' ); |
|
| 189 | + $customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports'); |
|
| 190 | 190 | |
| 191 | - if ( ! is_admin() || ! current_user_can( $customer_view_role ) ) { |
|
| 192 | - wp_die( __( 'You do not have permission to edit this donor.', 'give' ) ); |
|
| 191 | + if ( ! is_admin() || ! current_user_can($customer_view_role)) { |
|
| 192 | + wp_die(__('You do not have permission to edit this donor.', 'give')); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - if ( empty( $args ) ) { |
|
| 195 | + if (empty($args)) { |
|
| 196 | 196 | return; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | - $customer_note = trim( sanitize_text_field( $args['customer_note'] ) ); |
|
| 199 | + $customer_note = trim(sanitize_text_field($args['customer_note'])); |
|
| 200 | 200 | $customer_id = (int) $args['customer_id']; |
| 201 | 201 | $nonce = $args['add_customer_note_nonce']; |
| 202 | 202 | |
| 203 | - if ( ! wp_verify_nonce( $nonce, 'add-customer-note' ) ) { |
|
| 204 | - wp_die( __( 'Cheatin\' eh?!', 'give' ) ); |
|
| 203 | + if ( ! wp_verify_nonce($nonce, 'add-customer-note')) { |
|
| 204 | + wp_die(__('Cheatin\' eh?!', 'give')); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - if ( empty( $customer_note ) ) { |
|
| 208 | - give_set_error( 'empty-customer-note', __( 'A note is required', 'give' ) ); |
|
| 207 | + if (empty($customer_note)) { |
|
| 208 | + give_set_error('empty-customer-note', __('A note is required', 'give')); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - if ( give_get_errors() ) { |
|
| 211 | + if (give_get_errors()) { |
|
| 212 | 212 | return; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - $customer = new Give_Customer( $customer_id ); |
|
| 216 | - $new_note = $customer->add_note( $customer_note ); |
|
| 215 | + $customer = new Give_Customer($customer_id); |
|
| 216 | + $new_note = $customer->add_note($customer_note); |
|
| 217 | 217 | |
| 218 | - do_action( 'give_pre_insert_customer_note', $customer_id, $new_note ); |
|
| 218 | + do_action('give_pre_insert_customer_note', $customer_id, $new_note); |
|
| 219 | 219 | |
| 220 | - if ( ! empty( $new_note ) && ! empty( $customer->id ) ) { |
|
| 220 | + if ( ! empty($new_note) && ! empty($customer->id)) { |
|
| 221 | 221 | |
| 222 | 222 | ob_start(); |
| 223 | 223 | ?> |
| 224 | 224 | <div class="customer-note-wrapper dashboard-comment-wrap comment-item"> |
| 225 | 225 | <span class="note-content-wrap"> |
| 226 | - <?php echo stripslashes( $new_note ); ?> |
|
| 226 | + <?php echo stripslashes($new_note); ?> |
|
| 227 | 227 | </span> |
| 228 | 228 | </div> |
| 229 | 229 | <?php |
| 230 | 230 | $output = ob_get_contents(); |
| 231 | 231 | ob_end_clean(); |
| 232 | 232 | |
| 233 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
| 233 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
| 234 | 234 | echo $output; |
| 235 | 235 | exit; |
| 236 | 236 | } |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | -add_action( 'give_add-customer-note', 'give_customer_save_note', 10, 1 ); |
|
| 246 | +add_action('give_add-customer-note', 'give_customer_save_note', 10, 1); |
|
| 247 | 247 | |
| 248 | 248 | /** |
| 249 | 249 | * Delete a customer |
@@ -254,87 +254,87 @@ discard block |
||
| 254 | 254 | * |
| 255 | 255 | * @return int Whether it was a successful deletion |
| 256 | 256 | */ |
| 257 | -function give_customer_delete( $args ) { |
|
| 257 | +function give_customer_delete($args) { |
|
| 258 | 258 | |
| 259 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
| 259 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
| 260 | 260 | |
| 261 | - if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) { |
|
| 262 | - wp_die( __( 'You do not have permission to delete this donor.', 'give' ) ); |
|
| 261 | + if ( ! is_admin() || ! current_user_can($customer_edit_role)) { |
|
| 262 | + wp_die(__('You do not have permission to delete this donor.', 'give')); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | - if ( empty( $args ) ) { |
|
| 265 | + if (empty($args)) { |
|
| 266 | 266 | return; |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | $customer_id = (int) $args['customer_id']; |
| 270 | - $confirm = ! empty( $args['give-customer-delete-confirm'] ) ? true : false; |
|
| 271 | - $remove_data = ! empty( $args['give-customer-delete-records'] ) ? true : false; |
|
| 270 | + $confirm = ! empty($args['give-customer-delete-confirm']) ? true : false; |
|
| 271 | + $remove_data = ! empty($args['give-customer-delete-records']) ? true : false; |
|
| 272 | 272 | $nonce = $args['_wpnonce']; |
| 273 | 273 | |
| 274 | - if ( ! wp_verify_nonce( $nonce, 'delete-customer' ) ) { |
|
| 275 | - wp_die( __( 'Cheatin\' eh?!', 'give' ) ); |
|
| 274 | + if ( ! wp_verify_nonce($nonce, 'delete-customer')) { |
|
| 275 | + wp_die(__('Cheatin\' eh?!', 'give')); |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - if ( ! $confirm ) { |
|
| 279 | - give_set_error( 'customer-delete-no-confirm', __( 'Please confirm you want to delete this donor', 'give' ) ); |
|
| 278 | + if ( ! $confirm) { |
|
| 279 | + give_set_error('customer-delete-no-confirm', __('Please confirm you want to delete this donor', 'give')); |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - if ( give_get_errors() ) { |
|
| 283 | - wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id ) ); |
|
| 282 | + if (give_get_errors()) { |
|
| 283 | + wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id)); |
|
| 284 | 284 | exit; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | - $customer = new Give_Customer( $customer_id ); |
|
| 287 | + $customer = new Give_Customer($customer_id); |
|
| 288 | 288 | |
| 289 | - do_action( 'give_pre_delete_customer', $customer_id, $confirm, $remove_data ); |
|
| 289 | + do_action('give_pre_delete_customer', $customer_id, $confirm, $remove_data); |
|
| 290 | 290 | |
| 291 | 291 | $success = false; |
| 292 | 292 | |
| 293 | - if ( $customer->id > 0 ) { |
|
| 293 | + if ($customer->id > 0) { |
|
| 294 | 294 | |
| 295 | - $payments_array = explode( ',', $customer->payment_ids ); |
|
| 296 | - $success = Give()->customers->delete( $customer->id ); |
|
| 295 | + $payments_array = explode(',', $customer->payment_ids); |
|
| 296 | + $success = Give()->customers->delete($customer->id); |
|
| 297 | 297 | |
| 298 | - if ( $success ) { |
|
| 298 | + if ($success) { |
|
| 299 | 299 | |
| 300 | - if ( $remove_data ) { |
|
| 300 | + if ($remove_data) { |
|
| 301 | 301 | |
| 302 | 302 | // Remove all payments, logs, etc |
| 303 | - foreach ( $payments_array as $payment_id ) { |
|
| 304 | - give_delete_purchase( $payment_id ); |
|
| 303 | + foreach ($payments_array as $payment_id) { |
|
| 304 | + give_delete_purchase($payment_id); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | } else { |
| 308 | 308 | |
| 309 | 309 | // Just set the payments to customer_id of 0 |
| 310 | - foreach ( $payments_array as $payment_id ) { |
|
| 311 | - give_update_payment_meta( $payment_id, '_give_payment_customer_id', 0 ); |
|
| 310 | + foreach ($payments_array as $payment_id) { |
|
| 311 | + give_update_payment_meta($payment_id, '_give_payment_customer_id', 0); |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted' ); |
|
| 316 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted'); |
|
| 317 | 317 | |
| 318 | 318 | } else { |
| 319 | 319 | |
| 320 | - give_set_error( 'give-donor-delete-failed', __( 'Error deleting donor', 'give' ) ); |
|
| 321 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer_id ); |
|
| 320 | + give_set_error('give-donor-delete-failed', __('Error deleting donor', 'give')); |
|
| 321 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer_id); |
|
| 322 | 322 | |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | } else { |
| 326 | 326 | |
| 327 | - give_set_error( 'give-customer-delete-invalid-id', __( 'Invalid Donor ID', 'give' ) ); |
|
| 328 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); |
|
| 327 | + give_set_error('give-customer-delete-invalid-id', __('Invalid Donor ID', 'give')); |
|
| 328 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors'); |
|
| 329 | 329 | |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - wp_redirect( $redirect ); |
|
| 332 | + wp_redirect($redirect); |
|
| 333 | 333 | exit; |
| 334 | 334 | |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | -add_action( 'give_delete-customer', 'give_customer_delete', 10, 1 ); |
|
| 337 | +add_action('give_delete-customer', 'give_customer_delete', 10, 1); |
|
| 338 | 338 | |
| 339 | 339 | /** |
| 340 | 340 | * Disconnect a user ID from a donor |
@@ -345,39 +345,39 @@ discard block |
||
| 345 | 345 | * |
| 346 | 346 | * @return bool If the disconnect was sucessful |
| 347 | 347 | */ |
| 348 | -function give_disconnect_customer_user_id( $args ) { |
|
| 348 | +function give_disconnect_customer_user_id($args) { |
|
| 349 | 349 | |
| 350 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
| 350 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
| 351 | 351 | |
| 352 | - if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) { |
|
| 353 | - wp_die( __( 'You do not have permission to edit this donor.', 'give' ) ); |
|
| 352 | + if ( ! is_admin() || ! current_user_can($customer_edit_role)) { |
|
| 353 | + wp_die(__('You do not have permission to edit this donor.', 'give')); |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | - if ( empty( $args ) ) { |
|
| 356 | + if (empty($args)) { |
|
| 357 | 357 | return; |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | $customer_id = (int) $args['customer_id']; |
| 361 | 361 | $nonce = $args['_wpnonce']; |
| 362 | 362 | |
| 363 | - if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) { |
|
| 364 | - wp_die( __( 'Cheatin\' eh?!', 'give' ) ); |
|
| 363 | + if ( ! wp_verify_nonce($nonce, 'edit-customer')) { |
|
| 364 | + wp_die(__('Cheatin\' eh?!', 'give')); |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - $customer = new Give_Customer( $customer_id ); |
|
| 368 | - if ( empty( $customer->id ) ) { |
|
| 367 | + $customer = new Give_Customer($customer_id); |
|
| 368 | + if (empty($customer->id)) { |
|
| 369 | 369 | return false; |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - do_action( 'give_pre_customer_disconnect_user_id', $customer_id, $customer->user_id ); |
|
| 372 | + do_action('give_pre_customer_disconnect_user_id', $customer_id, $customer->user_id); |
|
| 373 | 373 | |
| 374 | - $customer_args = array( 'user_id' => 0 ); |
|
| 374 | + $customer_args = array('user_id' => 0); |
|
| 375 | 375 | |
| 376 | - if ( $customer->update( $customer_args ) ) { |
|
| 376 | + if ($customer->update($customer_args)) { |
|
| 377 | 377 | global $wpdb; |
| 378 | 378 | |
| 379 | - if ( ! empty( $customer->payment_ids ) ) { |
|
| 380 | - $wpdb->query( "UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )" ); |
|
| 379 | + if ( ! empty($customer->payment_ids)) { |
|
| 380 | + $wpdb->query("UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )"); |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | $output['success'] = true; |
@@ -385,14 +385,14 @@ discard block |
||
| 385 | 385 | } else { |
| 386 | 386 | |
| 387 | 387 | $output['success'] = false; |
| 388 | - give_set_error( 'give-disconnect-user-fail', __( 'Failed to disconnect user from donor', 'give' ) ); |
|
| 388 | + give_set_error('give-disconnect-user-fail', __('Failed to disconnect user from donor', 'give')); |
|
| 389 | 389 | } |
| 390 | 390 | |
| 391 | - do_action( 'give_post_customer_disconnect_user_id', $customer_id ); |
|
| 391 | + do_action('give_post_customer_disconnect_user_id', $customer_id); |
|
| 392 | 392 | |
| 393 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
| 394 | - header( 'Content-Type: application/json' ); |
|
| 395 | - echo json_encode( $output ); |
|
| 393 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
| 394 | + header('Content-Type: application/json'); |
|
| 395 | + echo json_encode($output); |
|
| 396 | 396 | wp_die(); |
| 397 | 397 | } |
| 398 | 398 | |
@@ -400,4 +400,4 @@ discard block |
||
| 400 | 400 | |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | -add_action( 'give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1 ); |
|
| 403 | +add_action('give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1); |
|