@@ -65,7 +65,7 @@  | 
                                                    ||
| 65 | 65 | *  | 
                                                        
| 66 | 66 | * @since 1.0  | 
                                                        
| 67 | 67 | * @uses Give_Session::get()  | 
                                                        
| 68 | - * @return mixed array if errors are present, false if none found  | 
                                                        |
| 68 | + * @return string array if errors are present, false if none found  | 
                                                        |
| 69 | 69 | */  | 
                                                        
| 70 | 70 |  function give_get_errors() { | 
                                                        
| 71 | 71 | return Give()->session->get( 'give_errors' );  | 
                                                        
@@ -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 | |
@@ -25,7 +25,7 @@ discard block  | 
                                                    ||
| 25 | 25 | * @return mixed array if errors are present, false if none found  | 
                                                        
| 26 | 26 | */  | 
                                                        
| 27 | 27 |  function give_get_errors() { | 
                                                        
| 28 | - return Give()->session->get( 'give_errors' );  | 
                                                        |
| 28 | +	return Give()->session->get('give_errors'); | 
                                                        |
| 29 | 29 | }  | 
                                                        
| 30 | 30 | |
| 31 | 31 | /**  | 
                                                        
@@ -42,23 +42,23 @@ discard block  | 
                                                    ||
| 42 | 42 | *  | 
                                                        
| 43 | 43 | * @return void  | 
                                                        
| 44 | 44 | */  | 
                                                        
| 45 | -function give_set_error( $error_id, $error_message, $notice_args = array() ) { | 
                                                        |
| 45 | +function give_set_error($error_id, $error_message, $notice_args = array()) { | 
                                                        |
| 46 | 46 | $errors = give_get_errors();  | 
                                                        
| 47 | -	if ( ! $errors ) { | 
                                                        |
| 47 | +	if ( ! $errors) { | 
                                                        |
| 48 | 48 | $errors = array();  | 
                                                        
| 49 | 49 | }  | 
                                                        
| 50 | 50 | |
| 51 | -	if( is_array( $notice_args ) && ! empty( $notice_args ) ) { | 
                                                        |
| 52 | - $errors[ $error_id ] = array(  | 
                                                        |
| 51 | +	if (is_array($notice_args) && ! empty($notice_args)) { | 
                                                        |
| 52 | + $errors[$error_id] = array(  | 
                                                        |
| 53 | 53 | 'message' => $error_message,  | 
                                                        
| 54 | 54 | 'notice_args' => $notice_args,  | 
                                                        
| 55 | 55 | );  | 
                                                        
| 56 | 56 |  	} else { | 
                                                        
| 57 | 57 | // Backward compatibility v<1.8.11.  | 
                                                        
| 58 | - $errors[ $error_id ] = $error_message;  | 
                                                        |
| 58 | + $errors[$error_id] = $error_message;  | 
                                                        |
| 59 | 59 | }  | 
                                                        
| 60 | 60 | |
| 61 | - Give()->session->set( 'give_errors', $errors );  | 
                                                        |
| 61 | +	Give()->session->set('give_errors', $errors); | 
                                                        |
| 62 | 62 | }  | 
                                                        
| 63 | 63 | |
| 64 | 64 | /**  | 
                                                        
@@ -69,7 +69,7 @@ discard block  | 
                                                    ||
| 69 | 69 | * @return void  | 
                                                        
| 70 | 70 | */  | 
                                                        
| 71 | 71 |  function give_clear_errors() { | 
                                                        
| 72 | - Give()->session->set( 'give_errors', null );  | 
                                                        |
| 72 | +	Give()->session->set('give_errors', null); | 
                                                        |
| 73 | 73 | }  | 
                                                        
| 74 | 74 | |
| 75 | 75 | /**  | 
                                                        
@@ -82,11 +82,11 @@ discard block  | 
                                                    ||
| 82 | 82 | *  | 
                                                        
| 83 | 83 | * @return void  | 
                                                        
| 84 | 84 | */  | 
                                                        
| 85 | -function give_unset_error( $error_id ) { | 
                                                        |
| 85 | +function give_unset_error($error_id) { | 
                                                        |
| 86 | 86 | $errors = give_get_errors();  | 
                                                        
| 87 | -	if ( $errors ) { | 
                                                        |
| 88 | - unset( $errors[ $error_id ] );  | 
                                                        |
| 89 | - Give()->session->set( 'give_errors', $errors );  | 
                                                        |
| 87 | +	if ($errors) { | 
                                                        |
| 88 | + unset($errors[$error_id]);  | 
                                                        |
| 89 | +		Give()->session->set('give_errors', $errors); | 
                                                        |
| 90 | 90 | }  | 
                                                        
| 91 | 91 | }  | 
                                                        
| 92 | 92 | |
@@ -97,7 +97,7 @@ discard block  | 
                                                    ||
| 97 | 97 | * @return string  | 
                                                        
| 98 | 98 | */  | 
                                                        
| 99 | 99 |  function _give_die_handler() { | 
                                                        
| 100 | -	if ( defined( 'GIVE_UNIT_TESTS' ) ) { | 
                                                        |
| 100 | +	if (defined('GIVE_UNIT_TESTS')) { | 
                                                        |
| 101 | 101 | return '_give_die_handler';  | 
                                                        
| 102 | 102 |  	} else { | 
                                                        
| 103 | 103 | die();  | 
                                                        
@@ -117,8 +117,8 @@ discard block  | 
                                                    ||
| 117 | 117 | *  | 
                                                        
| 118 | 118 | * @return void  | 
                                                        
| 119 | 119 | */  | 
                                                        
| 120 | -function give_die( $message = '', $title = '', $status = 400 ) { | 
                                                        |
| 121 | - add_filter( 'wp_die_ajax_handler', '_give_die_handler', 10, 3 );  | 
                                                        |
| 122 | - add_filter( 'wp_die_handler', '_give_die_handler', 10, 3 );  | 
                                                        |
| 123 | - wp_die( $message, $title, array( 'response' => $status ) );  | 
                                                        |
| 120 | +function give_die($message = '', $title = '', $status = 400) { | 
                                                        |
| 121 | +	add_filter('wp_die_ajax_handler', '_give_die_handler', 10, 3); | 
                                                        |
| 122 | +	add_filter('wp_die_handler', '_give_die_handler', 10, 3); | 
                                                        |
| 123 | +	wp_die($message, $title, array('response' => $status)); | 
                                                        |
| 124 | 124 | }  | 
                                                        
@@ -42,16 +42,16 @@  | 
                                                    ||
| 42 | 42 | 'minWidth' => 320,  | 
                                                        
| 43 | 43 | 'tooltip' => esc_attr__( 'Enter an URL here to redirect to after login.', 'give' ),  | 
                                                        
| 44 | 44 | ),  | 
                                                        
| 45 | - array(  | 
                                                        |
| 46 | - 'type' => 'container',  | 
                                                        |
| 47 | - 'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Logout Redirect URL (optional):', 'give' ) ),  | 
                                                        |
| 48 | - ),  | 
                                                        |
| 49 | - array(  | 
                                                        |
| 50 | - 'type' => 'textbox',  | 
                                                        |
| 51 | - 'name' => 'logout-redirect',  | 
                                                        |
| 52 | - 'minWidth' => 320,  | 
                                                        |
| 53 | - 'tooltip' => esc_attr__( 'Enter an URL here to redirect to after logout.', 'give' ),  | 
                                                        |
| 54 | - ),  | 
                                                        |
| 45 | + array(  | 
                                                        |
| 46 | + 'type' => 'container',  | 
                                                        |
| 47 | + 'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Logout Redirect URL (optional):', 'give' ) ),  | 
                                                        |
| 48 | + ),  | 
                                                        |
| 49 | + array(  | 
                                                        |
| 50 | + 'type' => 'textbox',  | 
                                                        |
| 51 | + 'name' => 'logout-redirect',  | 
                                                        |
| 52 | + 'minWidth' => 320,  | 
                                                        |
| 53 | + 'tooltip' => esc_attr__( 'Enter an URL here to redirect to after logout.', 'give' ),  | 
                                                        |
| 54 | + ),  | 
                                                        |
| 55 | 55 | );  | 
                                                        
| 56 | 56 | }  | 
                                                        
| 57 | 57 | }  | 
                                                        
@@ -10,7 +10,7 @@ discard block  | 
                                                    ||
| 10 | 10 | */  | 
                                                        
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly.  | 
                                                        
| 13 | -if ( ! defined( 'ABSPATH' ) ) { | 
                                                        |
| 13 | +if ( ! defined('ABSPATH')) { | 
                                                        |
| 14 | 14 | exit;  | 
                                                        
| 15 | 15 | }  | 
                                                        
| 16 | 16 | |
@@ -21,10 +21,10 @@ discard block  | 
                                                    ||
| 21 | 21 | */  | 
                                                        
| 22 | 22 |  	public function __construct() { | 
                                                        
| 23 | 23 | |
| 24 | - $this->shortcode['title'] = esc_html__( 'Login', 'give' );  | 
                                                        |
| 25 | - $this->shortcode['label'] = esc_html__( 'Login', 'give' );  | 
                                                        |
| 24 | +		$this->shortcode['title'] = esc_html__('Login', 'give'); | 
                                                        |
| 25 | +		$this->shortcode['label'] = esc_html__('Login', 'give'); | 
                                                        |
| 26 | 26 | |
| 27 | - parent::__construct( 'give_login' );  | 
                                                        |
| 27 | +		parent::__construct('give_login'); | 
                                                        |
| 28 | 28 | }  | 
                                                        
| 29 | 29 | |
| 30 | 30 | /**  | 
                                                        
@@ -37,23 +37,23 @@ discard block  | 
                                                    ||
| 37 | 37 | return array(  | 
                                                        
| 38 | 38 | array(  | 
                                                        
| 39 | 39 | 'type' => 'container',  | 
                                                        
| 40 | - 'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Login Redirect URL (optional):', 'give' ) ),  | 
                                                        |
| 40 | +				'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Login Redirect URL (optional):', 'give')), | 
                                                        |
| 41 | 41 | ),  | 
                                                        
| 42 | 42 | array(  | 
                                                        
| 43 | 43 | 'type' => 'textbox',  | 
                                                        
| 44 | 44 | 'name' => 'login-redirect',  | 
                                                        
| 45 | 45 | 'minWidth' => 320,  | 
                                                        
| 46 | - 'tooltip' => esc_attr__( 'Enter an URL here to redirect to after login.', 'give' ),  | 
                                                        |
| 46 | +				'tooltip'  => esc_attr__('Enter an URL here to redirect to after login.', 'give'), | 
                                                        |
| 47 | 47 | ),  | 
                                                        
| 48 | 48 | array(  | 
                                                        
| 49 | 49 | 'type' => 'container',  | 
                                                        
| 50 | - 'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Logout Redirect URL (optional):', 'give' ) ),  | 
                                                        |
| 50 | +                'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Logout Redirect URL (optional):', 'give')), | 
                                                        |
| 51 | 51 | ),  | 
                                                        
| 52 | 52 | array(  | 
                                                        
| 53 | 53 | 'type' => 'textbox',  | 
                                                        
| 54 | 54 | 'name' => 'logout-redirect',  | 
                                                        
| 55 | 55 | 'minWidth' => 320,  | 
                                                        
| 56 | - 'tooltip' => esc_attr__( 'Enter an URL here to redirect to after logout.', 'give' ),  | 
                                                        |
| 56 | +                'tooltip'  => esc_attr__('Enter an URL here to redirect to after logout.', 'give'), | 
                                                        |
| 57 | 57 | ),  | 
                                                        
| 58 | 58 | );  | 
                                                        
| 59 | 59 | }  | 
                                                        
@@ -248,8 +248,8 @@  | 
                                                    ||
| 248 | 248 | |
| 249 | 249 | // do not reindex array!  | 
                                                        
| 250 | 250 | $field['options'] = array(  | 
                                                        
| 251 | - '' => ( $field['placeholder'] ? $field['placeholder'] : esc_attr__( '- Select -', 'give' ) ),  | 
                                                        |
| 252 | - ) + $field['options'];  | 
                                                        |
| 251 | + '' => ( $field['placeholder'] ? $field['placeholder'] : esc_attr__( '- Select -', 'give' ) ),  | 
                                                        |
| 252 | + ) + $field['options'];  | 
                                                        |
| 253 | 253 | |
| 254 | 254 |  			foreach ( $field['options'] as $value => $text ) { | 
                                                        
| 255 | 255 | $new_listbox['values'][] = array(  | 
                                                        
@@ -11,7 +11,7 @@ discard block  | 
                                                    ||
| 11 | 11 | */  | 
                                                        
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly.  | 
                                                        
| 14 | -if ( ! defined( 'ABSPATH' ) ) { | 
                                                        |
| 14 | +if ( ! defined('ABSPATH')) { | 
                                                        |
| 15 | 15 | exit;  | 
                                                        
| 16 | 16 | }  | 
                                                        
| 17 | 17 | |
@@ -62,11 +62,11 @@ discard block  | 
                                                    ||
| 62 | 62 | *  | 
                                                        
| 63 | 63 | * @since 1.0  | 
                                                        
| 64 | 64 | */  | 
                                                        
| 65 | -	public function __construct( $shortcode ) { | 
                                                        |
| 65 | +	public function __construct($shortcode) { | 
                                                        |
| 66 | 66 | |
| 67 | 67 | $this->shortcode_tag = $shortcode;  | 
                                                        
| 68 | 68 | |
| 69 | - add_action( 'admin_init', array( $this, 'init' ) );  | 
                                                        |
| 69 | +		add_action('admin_init', array($this, 'init')); | 
                                                        |
| 70 | 70 | |
| 71 | 71 | }  | 
                                                        
| 72 | 72 | |
@@ -77,9 +77,9 @@ discard block  | 
                                                    ||
| 77 | 77 | */  | 
                                                        
| 78 | 78 |  	public function init() { | 
                                                        
| 79 | 79 | |
| 80 | -		if ( $this->shortcode_tag ) { | 
                                                        |
| 80 | +		if ($this->shortcode_tag) { | 
                                                        |
| 81 | 81 | |
| 82 | - $this->self = get_class( $this );  | 
                                                        |
| 82 | + $this->self = get_class($this);  | 
                                                        |
| 83 | 83 | |
| 84 | 84 | $this->errors = array();  | 
                                                        
| 85 | 85 | $this->required = array();  | 
                                                        
@@ -88,18 +88,18 @@ discard block  | 
                                                    ||
| 88 | 88 | $fields = $this->get_fields();  | 
                                                        
| 89 | 89 | |
| 90 | 90 | $defaults = array(  | 
                                                        
| 91 | - 'btn_close' => esc_html__( 'Close', 'give' ),  | 
                                                        |
| 92 | - 'btn_okay' => esc_html__( 'Insert Shortcode', 'give' ),  | 
                                                        |
| 91 | +				'btn_close' => esc_html__('Close', 'give'), | 
                                                        |
| 92 | +				'btn_okay'  => esc_html__('Insert Shortcode', 'give'), | 
                                                        |
| 93 | 93 | 'errors' => $this->errors,  | 
                                                        
| 94 | 94 | 'fields' => $fields,  | 
                                                        
| 95 | - 'label' => '[' . $this->shortcode_tag . ']',  | 
                                                        |
| 95 | + 'label' => '['.$this->shortcode_tag.']',  | 
                                                        |
| 96 | 96 | 'required' => $this->required,  | 
                                                        
| 97 | - 'title' => esc_html__( 'Insert Shortcode', 'give' ),  | 
                                                        |
| 97 | +				'title'     => esc_html__('Insert Shortcode', 'give'), | 
                                                        |
| 98 | 98 | );  | 
                                                        
| 99 | 99 | |
| 100 | -			if ( user_can_richedit() ) { | 
                                                        |
| 100 | +			if (user_can_richedit()) { | 
                                                        |
| 101 | 101 | |
| 102 | - Give_Shortcode_Button::$shortcodes[ $this->shortcode_tag ] = wp_parse_args( $this->shortcode, $defaults );  | 
                                                        |
| 102 | + Give_Shortcode_Button::$shortcodes[$this->shortcode_tag] = wp_parse_args($this->shortcode, $defaults);  | 
                                                        |
| 103 | 103 | |
| 104 | 104 | }  | 
                                                        
| 105 | 105 | }  | 
                                                        
@@ -128,13 +128,13 @@ discard block  | 
                                                    ||
| 128 | 128 | *  | 
                                                        
| 129 | 129 | * @since 1.0  | 
                                                        
| 130 | 130 | */  | 
                                                        
| 131 | -	protected function generate_fields( $defined_fields ) { | 
                                                        |
| 131 | +	protected function generate_fields($defined_fields) { | 
                                                        |
| 132 | 132 | |
| 133 | 133 | $fields = array();  | 
                                                        
| 134 | 134 | |
| 135 | -		if ( is_array( $defined_fields ) ) { | 
                                                        |
| 135 | +		if (is_array($defined_fields)) { | 
                                                        |
| 136 | 136 | |
| 137 | -			foreach ( $defined_fields as $field ) { | 
                                                        |
| 137 | +			foreach ($defined_fields as $field) { | 
                                                        |
| 138 | 138 | |
| 139 | 139 | $defaults = array(  | 
                                                        
| 140 | 140 | 'label' => false,  | 
                                                        
@@ -145,14 +145,14 @@ discard block  | 
                                                    ||
| 145 | 145 | 'type' => '',  | 
                                                        
| 146 | 146 | );  | 
                                                        
| 147 | 147 | |
| 148 | - $field = wp_parse_args( (array) $field, $defaults );  | 
                                                        |
| 149 | - $method = 'generate_' . strtolower( $field['type'] );  | 
                                                        |
| 148 | + $field = wp_parse_args((array) $field, $defaults);  | 
                                                        |
| 149 | + $method = 'generate_'.strtolower($field['type']);  | 
                                                        |
| 150 | 150 | |
| 151 | -				if ( method_exists( $this, $method ) ) { | 
                                                        |
| 151 | +				if (method_exists($this, $method)) { | 
                                                        |
| 152 | 152 | |
| 153 | - $field = call_user_func( array( $this, $method ), $field );  | 
                                                        |
| 153 | + $field = call_user_func(array($this, $method), $field);  | 
                                                        |
| 154 | 154 | |
| 155 | -					if ( $field ) { | 
                                                        |
| 155 | +					if ($field) { | 
                                                        |
| 156 | 156 | $fields[] = $field;  | 
                                                        
| 157 | 157 | }  | 
                                                        
| 158 | 158 | }  | 
                                                        
@@ -172,22 +172,22 @@ discard block  | 
                                                    ||
| 172 | 172 |  	protected function get_fields() { | 
                                                        
| 173 | 173 | |
| 174 | 174 | $defined_fields = $this->define_fields();  | 
                                                        
| 175 | - $generated_fields = $this->generate_fields( $defined_fields );  | 
                                                        |
| 175 | + $generated_fields = $this->generate_fields($defined_fields);  | 
                                                        |
| 176 | 176 | |
| 177 | 177 | $errors = array();  | 
                                                        
| 178 | 178 | |
| 179 | -		if ( ! empty( $this->errors ) ) { | 
                                                        |
| 180 | -			foreach ( $this->required as $name => $alert ) { | 
                                                        |
| 181 | -				if ( false === array_search( $name, array_column( $generated_fields, 'name' ) ) ) { | 
                                                        |
| 179 | +		if ( ! empty($this->errors)) { | 
                                                        |
| 180 | +			foreach ($this->required as $name => $alert) { | 
                                                        |
| 181 | +				if (false === array_search($name, array_column($generated_fields, 'name'))) { | 
                                                        |
| 182 | 182 | |
| 183 | - $errors[] = $this->errors[ $name ];  | 
                                                        |
| 183 | + $errors[] = $this->errors[$name];  | 
                                                        |
| 184 | 184 | }  | 
                                                        
| 185 | 185 | }  | 
                                                        
| 186 | 186 | |
| 187 | 187 | $this->errors = $errors;  | 
                                                        
| 188 | 188 | }  | 
                                                        
| 189 | 189 | |
| 190 | -		if ( ! empty( $errors ) ) { | 
                                                        |
| 190 | +		if ( ! empty($errors)) { | 
                                                        |
| 191 | 191 | |
| 192 | 192 | return $errors;  | 
                                                        
| 193 | 193 | }  | 
                                                        
@@ -204,9 +204,9 @@ discard block  | 
                                                    ||
| 204 | 204 | *  | 
                                                        
| 205 | 205 | * @since 1.0  | 
                                                        
| 206 | 206 | */  | 
                                                        
| 207 | -	protected function generate_container( $field ) { | 
                                                        |
| 207 | +	protected function generate_container($field) { | 
                                                        |
| 208 | 208 | |
| 209 | -		if ( array_key_exists( 'html', $field ) ) { | 
                                                        |
| 209 | +		if (array_key_exists('html', $field)) { | 
                                                        |
| 210 | 210 | |
| 211 | 211 | return array(  | 
                                                        
| 212 | 212 | 'type' => $field['type'],  | 
                                                        
@@ -226,9 +226,9 @@ discard block  | 
                                                    ||
| 226 | 226 | *  | 
                                                        
| 227 | 227 | * @since 1.0  | 
                                                        
| 228 | 228 | */  | 
                                                        
| 229 | -	protected function generate_listbox( $field ) { | 
                                                        |
| 229 | +	protected function generate_listbox($field) { | 
                                                        |
| 230 | 230 | |
| 231 | - $listbox = shortcode_atts( array(  | 
                                                        |
| 231 | + $listbox = shortcode_atts(array(  | 
                                                        |
| 232 | 232 | 'label' => '',  | 
                                                        
| 233 | 233 | 'minWidth' => '',  | 
                                                        
| 234 | 234 | 'name' => false,  | 
                                                        
@@ -236,27 +236,27 @@ discard block  | 
                                                    ||
| 236 | 236 | 'type' => '',  | 
                                                        
| 237 | 237 | 'value' => '',  | 
                                                        
| 238 | 238 | 'classes' => ''  | 
                                                        
| 239 | - ), $field );  | 
                                                        |
| 239 | + ), $field);  | 
                                                        |
| 240 | 240 | |
| 241 | -		if ( $this->validate( $field ) ) { | 
                                                        |
| 241 | +		if ($this->validate($field)) { | 
                                                        |
| 242 | 242 | |
| 243 | 243 | $new_listbox = array();  | 
                                                        
| 244 | 244 | |
| 245 | -			foreach ( $listbox as $key => $value ) { | 
                                                        |
| 245 | +			foreach ($listbox as $key => $value) { | 
                                                        |
| 246 | 246 | |
| 247 | -				if ( $key == 'value' && empty( $value ) ) { | 
                                                        |
| 248 | - $new_listbox[ $key ] = $listbox['name'];  | 
                                                        |
| 249 | -				} else if ( $value ) { | 
                                                        |
| 250 | - $new_listbox[ $key ] = $value;  | 
                                                        |
| 247 | +				if ($key == 'value' && empty($value)) { | 
                                                        |
| 248 | + $new_listbox[$key] = $listbox['name'];  | 
                                                        |
| 249 | +				} else if ($value) { | 
                                                        |
| 250 | + $new_listbox[$key] = $value;  | 
                                                        |
| 251 | 251 | }  | 
                                                        
| 252 | 252 | }  | 
                                                        
| 253 | 253 | |
| 254 | 254 | // do not reindex array!  | 
                                                        
| 255 | 255 | $field['options'] = array(  | 
                                                        
| 256 | - '' => ( $field['placeholder'] ? $field['placeholder'] : esc_attr__( '- Select -', 'give' ) ),  | 
                                                        |
| 256 | +				                    '' => ($field['placeholder'] ? $field['placeholder'] : esc_attr__('- Select -', 'give')), | 
                                                        |
| 257 | 257 | ) + $field['options'];  | 
                                                        
| 258 | 258 | |
| 259 | -			foreach ( $field['options'] as $value => $text ) { | 
                                                        |
| 259 | +			foreach ($field['options'] as $value => $text) { | 
                                                        |
| 260 | 260 | $new_listbox['values'][] = array(  | 
                                                        
| 261 | 261 | 'text' => $text,  | 
                                                        
| 262 | 262 | 'value' => $value,  | 
                                                        
@@ -278,7 +278,7 @@ discard block  | 
                                                    ||
| 278 | 278 | *  | 
                                                        
| 279 | 279 | * @since 1.0  | 
                                                        
| 280 | 280 | */  | 
                                                        
| 281 | -	protected function generate_post( $field ) { | 
                                                        |
| 281 | +	protected function generate_post($field) { | 
                                                        |
| 282 | 282 | |
| 283 | 283 | $args = array(  | 
                                                        
| 284 | 284 | 'post_type' => 'post',  | 
                                                        
@@ -287,23 +287,23 @@ discard block  | 
                                                    ||
| 287 | 287 | 'posts_per_page' => 30,  | 
                                                        
| 288 | 288 | );  | 
                                                        
| 289 | 289 | |
| 290 | - $args = wp_parse_args( (array) $field['query_args'], $args );  | 
                                                        |
| 291 | - $posts = get_posts( $args );  | 
                                                        |
| 290 | + $args = wp_parse_args((array) $field['query_args'], $args);  | 
                                                        |
| 291 | + $posts = get_posts($args);  | 
                                                        |
| 292 | 292 | $options = array();  | 
                                                        
| 293 | 293 | |
| 294 | -		if ( $posts ) { | 
                                                        |
| 295 | -			foreach ( $posts as $post ) { | 
                                                        |
| 296 | - $options[ absint( $post->ID ) ] = ( empty( $post->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $post->ID ) : $post->post_title );  | 
                                                        |
| 294 | +		if ($posts) { | 
                                                        |
| 295 | +			foreach ($posts as $post) { | 
                                                        |
| 296 | +				$options[absint($post->ID)] = (empty($post->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $post->ID) : $post->post_title); | 
                                                        |
| 297 | 297 | }  | 
                                                        
| 298 | 298 | |
| 299 | 299 | $field['type'] = 'listbox';  | 
                                                        
| 300 | 300 | $field['options'] = $options;  | 
                                                        
| 301 | 301 | |
| 302 | - return $this->generate_listbox( $field );  | 
                                                        |
| 302 | + return $this->generate_listbox($field);  | 
                                                        |
| 303 | 303 | }  | 
                                                        
| 304 | 304 | |
| 305 | 305 | // perform validation here before returning false  | 
                                                        
| 306 | - $this->validate( $field );  | 
                                                        |
| 306 | + $this->validate($field);  | 
                                                        |
| 307 | 307 | |
| 308 | 308 | return false;  | 
                                                        
| 309 | 309 | }  | 
                                                        
@@ -317,9 +317,9 @@ discard block  | 
                                                    ||
| 317 | 317 | *  | 
                                                        
| 318 | 318 | * @since 1.0  | 
                                                        
| 319 | 319 | */  | 
                                                        
| 320 | -	protected function generate_textbox( $field ) { | 
                                                        |
| 320 | +	protected function generate_textbox($field) { | 
                                                        |
| 321 | 321 | |
| 322 | - $textbox = shortcode_atts( array(  | 
                                                        |
| 322 | + $textbox = shortcode_atts(array(  | 
                                                        |
| 323 | 323 | 'label' => '',  | 
                                                        
| 324 | 324 | 'maxLength' => '',  | 
                                                        
| 325 | 325 | 'minHeight' => '',  | 
                                                        
@@ -330,10 +330,10 @@ discard block  | 
                                                    ||
| 330 | 330 | 'type' => '',  | 
                                                        
| 331 | 331 | 'value' => '',  | 
                                                        
| 332 | 332 | 'classes' => ''  | 
                                                        
| 333 | - ), $field );  | 
                                                        |
| 333 | + ), $field);  | 
                                                        |
| 334 | 334 | |
| 335 | -		if ( $this->validate( $field ) ) { | 
                                                        |
| 336 | - return array_filter( $textbox, array( $this, 'return_textbox_value' ) );  | 
                                                        |
| 335 | +		if ($this->validate($field)) { | 
                                                        |
| 336 | + return array_filter($textbox, array($this, 'return_textbox_value'));  | 
                                                        |
| 337 | 337 | }  | 
                                                        
| 338 | 338 | |
| 339 | 339 | return false;  | 
                                                        
@@ -346,7 +346,7 @@ discard block  | 
                                                    ||
| 346 | 346 | *  | 
                                                        
| 347 | 347 | * @return bool  | 
                                                        
| 348 | 348 | */  | 
                                                        
| 349 | -	function return_textbox_value( $value ) { | 
                                                        |
| 349 | +	function return_textbox_value($value) { | 
                                                        |
| 350 | 350 | return $value !== '';  | 
                                                        
| 351 | 351 | }  | 
                                                        
| 352 | 352 | |
@@ -362,9 +362,9 @@ discard block  | 
                                                    ||
| 362 | 362 | *  | 
                                                        
| 363 | 363 | * @since 1.0  | 
                                                        
| 364 | 364 | */  | 
                                                        
| 365 | -	protected function validate( $field ) { | 
                                                        |
| 365 | +	protected function validate($field) { | 
                                                        |
| 366 | 366 | |
| 367 | - extract( shortcode_atts(  | 
                                                        |
| 367 | + extract(shortcode_atts(  | 
                                                        |
| 368 | 368 | array(  | 
                                                        
| 369 | 369 | 'name' => false,  | 
                                                        
| 370 | 370 | 'required' => false,  | 
                                                        
@@ -372,36 +372,36 @@ discard block  | 
                                                    ||
| 372 | 372 | ), $field )  | 
                                                        
| 373 | 373 | );  | 
                                                        
| 374 | 374 | |
| 375 | -		if ( $name ) { | 
                                                        |
| 375 | +		if ($name) { | 
                                                        |
| 376 | 376 | |
| 377 | -			if ( isset( $required['error'] ) ) { | 
                                                        |
| 377 | +			if (isset($required['error'])) { | 
                                                        |
| 378 | 378 | |
| 379 | 379 | $error = array(  | 
                                                        
| 380 | 380 | 'type' => 'container',  | 
                                                        
| 381 | 381 | 'html' => $required['error'],  | 
                                                        
| 382 | 382 | );  | 
                                                        
| 383 | 383 | |
| 384 | - $this->errors[ $name ] = $this->generate_container( $error );  | 
                                                        |
| 384 | + $this->errors[$name] = $this->generate_container($error);  | 
                                                        |
| 385 | 385 | }  | 
                                                        
| 386 | 386 | |
| 387 | -			if ( ! ! $required || is_array( $required ) ) { | 
                                                        |
| 387 | +			if ( ! ! $required || is_array($required)) { | 
                                                        |
| 388 | 388 | |
| 389 | - $alert = esc_html__( 'Some of the shortcode options are required.', 'give' );  | 
                                                        |
| 389 | +				$alert = esc_html__('Some of the shortcode options are required.', 'give'); | 
                                                        |
| 390 | 390 | |
| 391 | -				if ( isset( $required['alert'] ) ) { | 
                                                        |
| 391 | +				if (isset($required['alert'])) { | 
                                                        |
| 392 | 392 | |
| 393 | 393 | $alert = $required['alert'];  | 
                                                        
| 394 | 394 | |
| 395 | -				} else if ( ! empty( $label ) ) { | 
                                                        |
| 395 | +				} else if ( ! empty($label)) { | 
                                                        |
| 396 | 396 | |
| 397 | 397 | $alert = sprintf(  | 
                                                        
| 398 | 398 | /* translators: %s: option label */  | 
                                                        
| 399 | - esc_html__( 'The "%s" option is required.', 'give' ),  | 
                                                        |
| 400 | - str_replace( ':', '', $label )  | 
                                                        |
| 399 | +						esc_html__('The "%s" option is required.', 'give'), | 
                                                        |
| 400 | +						str_replace(':', '', $label) | 
                                                        |
| 401 | 401 | );  | 
                                                        
| 402 | 402 | }  | 
                                                        
| 403 | 403 | |
| 404 | - $this->required[ $name ] = $alert;  | 
                                                        |
| 404 | + $this->required[$name] = $alert;  | 
                                                        |
| 405 | 405 | }  | 
                                                        
| 406 | 406 | |
| 407 | 407 | return true;  | 
                                                        
@@ -337,7 +337,7 @@  | 
                                                    ||
| 337 | 337 | *  | 
                                                        
| 338 | 338 | * @since 1.0  | 
                                                        
| 339 | 339 | * @uses Give()->session->get()  | 
                                                        
| 340 | - * @return mixed array | false  | 
                                                        |
| 340 | + * @return string array | false  | 
                                                        |
| 341 | 341 | */  | 
                                                        
| 342 | 342 |  function give_get_purchase_session() { | 
                                                        
| 343 | 343 | return Give()->session->get( 'give_purchase' );  | 
                                                        
@@ -812,10 +812,10 @@ discard block  | 
                                                    ||
| 812 | 812 | }  | 
                                                        
| 813 | 813 | |
| 814 | 814 | if ( ! is_int( $params[1] )  | 
                                                        
| 815 | - && ! is_float( $params[1] )  | 
                                                        |
| 816 | - && ! is_string( $params[1] )  | 
                                                        |
| 817 | - && $params[1] !== null  | 
                                                        |
| 818 | - && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )  | 
                                                        |
| 815 | + && ! is_float( $params[1] )  | 
                                                        |
| 816 | + && ! is_string( $params[1] )  | 
                                                        |
| 817 | + && $params[1] !== null  | 
                                                        |
| 818 | + && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )  | 
                                                        |
| 819 | 819 |  		) { | 
                                                        
| 820 | 820 | trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING );  | 
                                                        
| 821 | 821 | |
@@ -823,10 +823,10 @@ discard block  | 
                                                    ||
| 823 | 823 | }  | 
                                                        
| 824 | 824 | |
| 825 | 825 | if ( isset( $params[2] )  | 
                                                        
| 826 | - && ! is_int( $params[2] )  | 
                                                        |
| 827 | - && ! is_float( $params[2] )  | 
                                                        |
| 828 | - && ! is_string( $params[2] )  | 
                                                        |
| 829 | - && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )  | 
                                                        |
| 826 | + && ! is_int( $params[2] )  | 
                                                        |
| 827 | + && ! is_float( $params[2] )  | 
                                                        |
| 828 | + && ! is_string( $params[2] )  | 
                                                        |
| 829 | + && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )  | 
                                                        |
| 830 | 830 |  		) { | 
                                                        
| 831 | 831 | trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING );  | 
                                                        
| 832 | 832 | |
@@ -10,7 +10,7 @@ discard block  | 
                                                    ||
| 10 | 10 | */  | 
                                                        
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly.  | 
                                                        
| 13 | -if ( ! defined( 'ABSPATH' ) ) { | 
                                                        |
| 13 | +if ( ! defined('ABSPATH')) { | 
                                                        |
| 14 | 14 | exit;  | 
                                                        
| 15 | 15 | }  | 
                                                        
| 16 | 16 | |
@@ -23,9 +23,9 @@ discard block  | 
                                                    ||
| 23 | 23 | */  | 
                                                        
| 24 | 24 |  function give_is_test_mode() { | 
                                                        
| 25 | 25 | |
| 26 | - $ret = give_is_setting_enabled( give_get_option( 'test_mode' ) );  | 
                                                        |
| 26 | +	$ret = give_is_setting_enabled(give_get_option('test_mode')); | 
                                                        |
| 27 | 27 | |
| 28 | - return (bool) apply_filters( 'give_is_test_mode', $ret );  | 
                                                        |
| 28 | +	return (bool) apply_filters('give_is_test_mode', $ret); | 
                                                        |
| 29 | 29 | |
| 30 | 30 | }  | 
                                                        
| 31 | 31 | |
@@ -37,9 +37,9 @@ discard block  | 
                                                    ||
| 37 | 37 | */  | 
                                                        
| 38 | 38 |  function give_get_currency() { | 
                                                        
| 39 | 39 | |
| 40 | - $currency = give_get_option( 'currency', 'USD' );  | 
                                                        |
| 40 | +	$currency = give_get_option('currency', 'USD'); | 
                                                        |
| 41 | 41 | |
| 42 | - return apply_filters( 'give_currency', $currency );  | 
                                                        |
| 42 | +	return apply_filters('give_currency', $currency); | 
                                                        |
| 43 | 43 | }  | 
                                                        
| 44 | 44 | |
| 45 | 45 | /**  | 
                                                        
@@ -51,9 +51,9 @@ discard block  | 
                                                    ||
| 51 | 51 | */  | 
                                                        
| 52 | 52 |  function give_get_currency_position() { | 
                                                        
| 53 | 53 | |
| 54 | - $currency_pos = give_get_option( 'currency_position', 'before' );  | 
                                                        |
| 54 | +	$currency_pos = give_get_option('currency_position', 'before'); | 
                                                        |
| 55 | 55 | |
| 56 | - return apply_filters( 'give_currency_position', $currency_pos );  | 
                                                        |
| 56 | +	return apply_filters('give_currency_position', $currency_pos); | 
                                                        |
| 57 | 57 | }  | 
                                                        
| 58 | 58 | |
| 59 | 59 | |
@@ -66,39 +66,39 @@ discard block  | 
                                                    ||
| 66 | 66 | |
| 67 | 67 |  function give_get_currencies() { | 
                                                        
| 68 | 68 | $currencies = array(  | 
                                                        
| 69 | - 'USD' => __( 'US Dollars ($)', 'give' ),  | 
                                                        |
| 70 | - 'EUR' => __( 'Euros (€)', 'give' ),  | 
                                                        |
| 71 | - 'GBP' => __( 'Pounds Sterling (£)', 'give' ),  | 
                                                        |
| 72 | - 'AUD' => __( 'Australian Dollars ($)', 'give' ),  | 
                                                        |
| 73 | - 'BRL' => __( 'Brazilian Real (R$)', 'give' ),  | 
                                                        |
| 74 | - 'CAD' => __( 'Canadian Dollars ($)', 'give' ),  | 
                                                        |
| 75 | - 'CZK' => __( 'Czech Koruna (Kč)', 'give' ),  | 
                                                        |
| 76 | - 'DKK' => __( 'Danish Krone (kr.)', 'give' ),  | 
                                                        |
| 77 | - 'HKD' => __( 'Hong Kong Dollar ($)', 'give' ),  | 
                                                        |
| 78 | - 'HUF' => __( 'Hungarian Forint (Ft)', 'give' ),  | 
                                                        |
| 79 | - 'ILS' => __( 'Israeli Shekel (₪)', 'give' ),  | 
                                                        |
| 80 | - 'JPY' => __( 'Japanese Yen (¥)', 'give' ),  | 
                                                        |
| 81 | - 'MYR' => __( 'Malaysian Ringgits (RM)', 'give' ),  | 
                                                        |
| 82 | - 'MXN' => __( 'Mexican Peso ($)', 'give' ),  | 
                                                        |
| 83 | - 'MAD' => __( 'Moroccan Dirham (.د.م)', 'give' ),  | 
                                                        |
| 84 | - 'NZD' => __( 'New Zealand Dollar ($)', 'give' ),  | 
                                                        |
| 85 | - 'NOK' => __( 'Norwegian Krone (Kr.)', 'give' ),  | 
                                                        |
| 86 | - 'PHP' => __( 'Philippine Pesos (₱)', 'give' ),  | 
                                                        |
| 87 | - 'PLN' => __( 'Polish Zloty (zł)', 'give' ),  | 
                                                        |
| 88 | - 'SGD' => __( 'Singapore Dollar ($)', 'give' ),  | 
                                                        |
| 89 | - 'KRW' => __( 'South Korean Won (₩)', 'give' ),  | 
                                                        |
| 90 | - 'ZAR' => __( 'South African Rand (R)', 'give' ),  | 
                                                        |
| 91 | - 'SEK' => __( 'Swedish Krona (kr)', 'give' ),  | 
                                                        |
| 92 | - 'CHF' => __( 'Swiss Franc (CHF)', 'give' ),  | 
                                                        |
| 93 | - 'TWD' => __( 'Taiwan New Dollars (NT$)', 'give' ),  | 
                                                        |
| 94 | - 'THB' => __( 'Thai Baht (฿)', 'give' ),  | 
                                                        |
| 95 | - 'INR' => __( 'Indian Rupee (₹)', 'give' ),  | 
                                                        |
| 96 | - 'TRY' => __( 'Turkish Lira (₺)', 'give' ),  | 
                                                        |
| 97 | - 'RIAL' => __( 'Iranian Rial (﷼)', 'give' ),  | 
                                                        |
| 98 | - 'RUB' => __( 'Russian Rubles (руб)', 'give' ),  | 
                                                        |
| 69 | +		'USD'  => __('US Dollars ($)', 'give'), | 
                                                        |
| 70 | +		'EUR'  => __('Euros (€)', 'give'), | 
                                                        |
| 71 | +		'GBP'  => __('Pounds Sterling (£)', 'give'), | 
                                                        |
| 72 | +		'AUD'  => __('Australian Dollars ($)', 'give'), | 
                                                        |
| 73 | +		'BRL'  => __('Brazilian Real (R$)', 'give'), | 
                                                        |
| 74 | +		'CAD'  => __('Canadian Dollars ($)', 'give'), | 
                                                        |
| 75 | +		'CZK'  => __('Czech Koruna (Kč)', 'give'), | 
                                                        |
| 76 | +		'DKK'  => __('Danish Krone (kr.)', 'give'), | 
                                                        |
| 77 | +		'HKD'  => __('Hong Kong Dollar ($)', 'give'), | 
                                                        |
| 78 | +		'HUF'  => __('Hungarian Forint (Ft)', 'give'), | 
                                                        |
| 79 | +		'ILS'  => __('Israeli Shekel (₪)', 'give'), | 
                                                        |
| 80 | +		'JPY'  => __('Japanese Yen (¥)', 'give'), | 
                                                        |
| 81 | +		'MYR'  => __('Malaysian Ringgits (RM)', 'give'), | 
                                                        |
| 82 | +		'MXN'  => __('Mexican Peso ($)', 'give'), | 
                                                        |
| 83 | +		'MAD'  => __('Moroccan Dirham (.د.م)', 'give'), | 
                                                        |
| 84 | +		'NZD'  => __('New Zealand Dollar ($)', 'give'), | 
                                                        |
| 85 | +		'NOK'  => __('Norwegian Krone (Kr.)', 'give'), | 
                                                        |
| 86 | +		'PHP'  => __('Philippine Pesos (₱)', 'give'), | 
                                                        |
| 87 | +		'PLN'  => __('Polish Zloty (zł)', 'give'), | 
                                                        |
| 88 | +		'SGD'  => __('Singapore Dollar ($)', 'give'), | 
                                                        |
| 89 | +		'KRW'  => __('South Korean Won (₩)', 'give'), | 
                                                        |
| 90 | +		'ZAR'  => __('South African Rand (R)', 'give'), | 
                                                        |
| 91 | +		'SEK'  => __('Swedish Krona (kr)', 'give'), | 
                                                        |
| 92 | +		'CHF'  => __('Swiss Franc (CHF)', 'give'), | 
                                                        |
| 93 | +		'TWD'  => __('Taiwan New Dollars (NT$)', 'give'), | 
                                                        |
| 94 | +		'THB'  => __('Thai Baht (฿)', 'give'), | 
                                                        |
| 95 | +		'INR'  => __('Indian Rupee (₹)', 'give'), | 
                                                        |
| 96 | +		'TRY'  => __('Turkish Lira (₺)', 'give'), | 
                                                        |
| 97 | +		'RIAL' => __('Iranian Rial (﷼)', 'give'), | 
                                                        |
| 98 | +		'RUB'  => __('Russian Rubles (руб)', 'give'), | 
                                                        |
| 99 | 99 | );  | 
                                                        
| 100 | 100 | |
| 101 | - return apply_filters( 'give_currencies', $currencies );  | 
                                                        |
| 101 | +	return apply_filters('give_currencies', $currencies); | 
                                                        |
| 102 | 102 | }  | 
                                                        
| 103 | 103 | |
| 104 | 104 | |
@@ -115,12 +115,12 @@ discard block  | 
                                                    ||
| 115 | 115 | *  | 
                                                        
| 116 | 116 | * @return string The symbol to use for the currency  | 
                                                        
| 117 | 117 | */  | 
                                                        
| 118 | -function give_currency_symbol( $currency = '', $decode_currency = false ) { | 
                                                        |
| 118 | +function give_currency_symbol($currency = '', $decode_currency = false) { | 
                                                        |
| 119 | 119 | |
| 120 | -	if ( empty( $currency ) ) { | 
                                                        |
| 120 | +	if (empty($currency)) { | 
                                                        |
| 121 | 121 | $currency = give_get_currency();  | 
                                                        
| 122 | 122 | }  | 
                                                        
| 123 | - switch ( $currency ) :  | 
                                                        |
| 123 | + switch ($currency) :  | 
                                                        |
| 124 | 124 | case 'GBP' :  | 
                                                        
| 125 | 125 | $symbol = '£';  | 
                                                        
| 126 | 126 | break;  | 
                                                        
@@ -198,9 +198,9 @@ discard block  | 
                                                    ||
| 198 | 198 | break;  | 
                                                        
| 199 | 199 | endswitch;  | 
                                                        
| 200 | 200 | |
| 201 | - $symbol = ( ! $decode_currency ? $symbol : html_entity_decode( $symbol ) );  | 
                                                        |
| 201 | + $symbol = ( ! $decode_currency ? $symbol : html_entity_decode($symbol));  | 
                                                        |
| 202 | 202 | |
| 203 | - return apply_filters( 'give_currency_symbol', $symbol, $currency );  | 
                                                        |
| 203 | +	return apply_filters('give_currency_symbol', $symbol, $currency); | 
                                                        |
| 204 | 204 | }  | 
                                                        
| 205 | 205 | |
| 206 | 206 | |
@@ -213,16 +213,16 @@ discard block  | 
                                                    ||
| 213 | 213 | *  | 
                                                        
| 214 | 214 | * @return string  | 
                                                        
| 215 | 215 | */  | 
                                                        
| 216 | -function give_get_currency_name( $currency_code ) { | 
                                                        |
| 216 | +function give_get_currency_name($currency_code) { | 
                                                        |
| 217 | 217 | $currency_name = '';  | 
                                                        
| 218 | 218 | $currency_names = give_get_currencies();  | 
                                                        
| 219 | 219 | |
| 220 | -	if ( $currency_code && array_key_exists( $currency_code, $currency_names ) ) { | 
                                                        |
| 221 | -		$currency_name = explode( '(', $currency_names[ $currency_code ] ); | 
                                                        |
| 222 | - $currency_name = trim( current( $currency_name ) );  | 
                                                        |
| 220 | +	if ($currency_code && array_key_exists($currency_code, $currency_names)) { | 
                                                        |
| 221 | +		$currency_name = explode('(', $currency_names[$currency_code]); | 
                                                        |
| 222 | + $currency_name = trim(current($currency_name));  | 
                                                        |
| 223 | 223 | }  | 
                                                        
| 224 | 224 | |
| 225 | - return apply_filters( 'give_currency_name', $currency_name, $currency_code );  | 
                                                        |
| 225 | +	return apply_filters('give_currency_name', $currency_name, $currency_code); | 
                                                        |
| 226 | 226 | }  | 
                                                        
| 227 | 227 | |
| 228 | 228 | |
@@ -236,21 +236,21 @@ discard block  | 
                                                    ||
| 236 | 236 | |
| 237 | 237 | global $wp;  | 
                                                        
| 238 | 238 | |
| 239 | -	if ( get_option( 'permalink_structure' ) ) { | 
                                                        |
| 240 | - $base = trailingslashit( home_url( $wp->request ) );  | 
                                                        |
| 239 | +	if (get_option('permalink_structure')) { | 
                                                        |
| 240 | + $base = trailingslashit(home_url($wp->request));  | 
                                                        |
| 241 | 241 |  	} else { | 
                                                        
| 242 | - $base = add_query_arg( $wp->query_string, '', trailingslashit( home_url( $wp->request ) ) );  | 
                                                        |
| 243 | - $base = remove_query_arg( array( 'post_type', 'name' ), $base );  | 
                                                        |
| 242 | + $base = add_query_arg($wp->query_string, '', trailingslashit(home_url($wp->request)));  | 
                                                        |
| 243 | +		$base = remove_query_arg(array('post_type', 'name'), $base); | 
                                                        |
| 244 | 244 | }  | 
                                                        
| 245 | 245 | |
| 246 | 246 | $scheme = is_ssl() ? 'https' : 'http';  | 
                                                        
| 247 | - $current_uri = set_url_scheme( $base, $scheme );  | 
                                                        |
| 247 | + $current_uri = set_url_scheme($base, $scheme);  | 
                                                        |
| 248 | 248 | |
| 249 | -	if ( is_front_page() ) { | 
                                                        |
| 250 | - $current_uri = home_url( '/' );  | 
                                                        |
| 249 | +	if (is_front_page()) { | 
                                                        |
| 250 | +		$current_uri = home_url('/'); | 
                                                        |
| 251 | 251 | }  | 
                                                        
| 252 | 252 | |
| 253 | - return apply_filters( 'give_get_current_page_url', $current_uri );  | 
                                                        |
| 253 | +	return apply_filters('give_get_current_page_url', $current_uri); | 
                                                        |
| 254 | 254 | |
| 255 | 255 | }  | 
                                                        
| 256 | 256 | |
@@ -272,15 +272,15 @@ discard block  | 
                                                    ||
| 272 | 272 | */  | 
                                                        
| 273 | 273 | $gateways = give_get_enabled_payment_gateways();  | 
                                                        
| 274 | 274 | |
| 275 | -	if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) { | 
                                                        |
| 275 | +	if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) { | 
                                                        |
| 276 | 276 | $ret = true;  | 
                                                        
| 277 | -	} elseif ( count( $gateways ) == 1 ) { | 
                                                        |
| 277 | +	} elseif (count($gateways) == 1) { | 
                                                        |
| 278 | 278 | $ret = false;  | 
                                                        
| 279 | -	} elseif ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) { | 
                                                        |
| 279 | +	} elseif (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) { | 
                                                        |
| 280 | 280 | $ret = false;  | 
                                                        
| 281 | 281 | }  | 
                                                        
| 282 | 282 | |
| 283 | - return (bool) apply_filters( 'give_verify_credit_cards', $ret );  | 
                                                        |
| 283 | +	return (bool) apply_filters('give_verify_credit_cards', $ret); | 
                                                        |
| 284 | 284 | }  | 
                                                        
| 285 | 285 | |
| 286 | 286 | /**  | 
                                                        
@@ -292,26 +292,26 @@ discard block  | 
                                                    ||
| 292 | 292 |  function give_get_timezone_id() { | 
                                                        
| 293 | 293 | |
| 294 | 294 | // if site timezone string exists, return it.  | 
                                                        
| 295 | -	if ( $timezone = get_option( 'timezone_string' ) ) { | 
                                                        |
| 295 | +	if ($timezone = get_option('timezone_string')) { | 
                                                        |
| 296 | 296 | return $timezone;  | 
                                                        
| 297 | 297 | }  | 
                                                        
| 298 | 298 | |
| 299 | 299 | // get UTC offset, if it isn't set return UTC.  | 
                                                        
| 300 | -	if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) { | 
                                                        |
| 300 | +	if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) { | 
                                                        |
| 301 | 301 | return 'UTC';  | 
                                                        
| 302 | 302 | }  | 
                                                        
| 303 | 303 | |
| 304 | 304 | // attempt to guess the timezone string from the UTC offset.  | 
                                                        
| 305 | - $timezone = timezone_name_from_abbr( '', $utc_offset );  | 
                                                        |
| 305 | +	$timezone = timezone_name_from_abbr('', $utc_offset); | 
                                                        |
| 306 | 306 | |
| 307 | 307 | // last try, guess timezone string manually.  | 
                                                        
| 308 | -	if ( $timezone === false ) { | 
                                                        |
| 308 | +	if ($timezone === false) { | 
                                                        |
| 309 | 309 | |
| 310 | - $is_dst = date( 'I' );  | 
                                                        |
| 310 | +		$is_dst = date('I'); | 
                                                        |
| 311 | 311 | |
| 312 | -		foreach ( timezone_abbreviations_list() as $abbr ) { | 
                                                        |
| 313 | -			foreach ( $abbr as $city ) { | 
                                                        |
| 314 | -				if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) { | 
                                                        |
| 312 | +		foreach (timezone_abbreviations_list() as $abbr) { | 
                                                        |
| 313 | +			foreach ($abbr as $city) { | 
                                                        |
| 314 | +				if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) { | 
                                                        |
| 315 | 315 | return $city['timezone_id'];  | 
                                                        
| 316 | 316 | }  | 
                                                        
| 317 | 317 | }  | 
                                                        
@@ -335,17 +335,17 @@ discard block  | 
                                                    ||
| 335 | 335 | |
| 336 | 336 | $ip = '127.0.0.1';  | 
                                                        
| 337 | 337 | |
| 338 | -	if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { | 
                                                        |
| 338 | +	if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) { | 
                                                        |
| 339 | 339 | // check ip from share internet  | 
                                                        
| 340 | 340 | $ip = $_SERVER['HTTP_CLIENT_IP'];  | 
                                                        
| 341 | -	} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { | 
                                                        |
| 341 | +	} elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { | 
                                                        |
| 342 | 342 | // to check ip is pass from proxy  | 
                                                        
| 343 | 343 | $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];  | 
                                                        
| 344 | -	} elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) { | 
                                                        |
| 344 | +	} elseif ( ! empty($_SERVER['REMOTE_ADDR'])) { | 
                                                        |
| 345 | 345 | $ip = $_SERVER['REMOTE_ADDR'];  | 
                                                        
| 346 | 346 | }  | 
                                                        
| 347 | 347 | |
| 348 | - return apply_filters( 'give_get_ip', $ip );  | 
                                                        |
| 348 | +	return apply_filters('give_get_ip', $ip); | 
                                                        |
| 349 | 349 | }  | 
                                                        
| 350 | 350 | |
| 351 | 351 | |
@@ -360,9 +360,9 @@ discard block  | 
                                                    ||
| 360 | 360 | *  | 
                                                        
| 361 | 361 | * @uses Give()->session->set()  | 
                                                        
| 362 | 362 | */  | 
                                                        
| 363 | -function give_set_purchase_session( $purchase_data = array() ) { | 
                                                        |
| 364 | - Give()->session->set( 'give_purchase', $purchase_data );  | 
                                                        |
| 365 | - Give()->session->set( 'give_email', $purchase_data['user_email'] );  | 
                                                        |
| 363 | +function give_set_purchase_session($purchase_data = array()) { | 
                                                        |
| 364 | +	Give()->session->set('give_purchase', $purchase_data); | 
                                                        |
| 365 | +	Give()->session->set('give_email', $purchase_data['user_email']); | 
                                                        |
| 366 | 366 | }  | 
                                                        
| 367 | 367 | |
| 368 | 368 | /**  | 
                                                        
@@ -376,7 +376,7 @@ discard block  | 
                                                    ||
| 376 | 376 | * @return mixed array | false  | 
                                                        
| 377 | 377 | */  | 
                                                        
| 378 | 378 |  function give_get_purchase_session() { | 
                                                        
| 379 | - return Give()->session->get( 'give_purchase' );  | 
                                                        |
| 379 | +	return Give()->session->get('give_purchase'); | 
                                                        |
| 380 | 380 | }  | 
                                                        
| 381 | 381 | |
| 382 | 382 | /**  | 
                                                        
@@ -392,40 +392,40 @@ discard block  | 
                                                    ||
| 392 | 392 | *  | 
                                                        
| 393 | 393 | * @return string  | 
                                                        
| 394 | 394 | */  | 
                                                        
| 395 | -function give_payment_gateway_donation_summary( $donation_data, $name_and_email = true, $length = 255 ) { | 
                                                        |
| 395 | +function give_payment_gateway_donation_summary($donation_data, $name_and_email = true, $length = 255) { | 
                                                        |
| 396 | 396 | |
| 397 | 397 | $summary = '';  | 
                                                        
| 398 | 398 | |
| 399 | - $form_id = isset( $donation_data['post_data']['give-form-id'] ) ? $donation_data['post_data']['give-form-id'] : '';  | 
                                                        |
| 399 | + $form_id = isset($donation_data['post_data']['give-form-id']) ? $donation_data['post_data']['give-form-id'] : '';  | 
                                                        |
| 400 | 400 | |
| 401 | 401 | // Form title.  | 
                                                        
| 402 | -	if ( isset( $donation_data['post_data']['give-form-title'] ) ) { | 
                                                        |
| 402 | +	if (isset($donation_data['post_data']['give-form-title'])) { | 
                                                        |
| 403 | 403 | $summary .= $donation_data['post_data']['give-form-title'];  | 
                                                        
| 404 | 404 | }  | 
                                                        
| 405 | 405 | // Form multilevel if applicable.  | 
                                                        
| 406 | -	if ( isset( $donation_data['post_data']['give-price-id'] ) ) { | 
                                                        |
| 407 | - $summary .= ': ' . give_get_price_option_name( $form_id, $donation_data['post_data']['give-price-id'] );  | 
                                                        |
| 406 | +	if (isset($donation_data['post_data']['give-price-id'])) { | 
                                                        |
| 407 | + $summary .= ': '.give_get_price_option_name($form_id, $donation_data['post_data']['give-price-id']);  | 
                                                        |
| 408 | 408 | }  | 
                                                        
| 409 | 409 | |
| 410 | 410 | // Add Donor's name + email if requested.  | 
                                                        
| 411 | -	if ( $name_and_email ) { | 
                                                        |
| 411 | +	if ($name_and_email) { | 
                                                        |
| 412 | 412 | |
| 413 | 413 | // First name  | 
                                                        
| 414 | -		if ( isset( $donation_data['user_info']['first_name'] ) && ! empty( $donation_data['user_info']['first_name'] ) ) { | 
                                                        |
| 415 | - $summary .= ' - ' . $donation_data['user_info']['first_name'];  | 
                                                        |
| 414 | +		if (isset($donation_data['user_info']['first_name']) && ! empty($donation_data['user_info']['first_name'])) { | 
                                                        |
| 415 | + $summary .= ' - '.$donation_data['user_info']['first_name'];  | 
                                                        |
| 416 | 416 | }  | 
                                                        
| 417 | 417 | |
| 418 | -		if ( isset( $donation_data['user_info']['last_name'] ) && ! empty( $donation_data['user_info']['last_name'] ) ) { | 
                                                        |
| 419 | - $summary .= ' ' . $donation_data['user_info']['last_name'];  | 
                                                        |
| 418 | +		if (isset($donation_data['user_info']['last_name']) && ! empty($donation_data['user_info']['last_name'])) { | 
                                                        |
| 419 | + $summary .= ' '.$donation_data['user_info']['last_name'];  | 
                                                        |
| 420 | 420 | }  | 
                                                        
| 421 | 421 | |
| 422 | -		$summary .= ' (' . $donation_data['user_email'] . ')'; | 
                                                        |
| 422 | +		$summary .= ' ('.$donation_data['user_email'].')'; | 
                                                        |
| 423 | 423 | }  | 
                                                        
| 424 | 424 | |
| 425 | 425 | // Cut the length  | 
                                                        
| 426 | - $summary = substr( $summary, 0, $length );  | 
                                                        |
| 426 | + $summary = substr($summary, 0, $length);  | 
                                                        |
| 427 | 427 | |
| 428 | - return apply_filters( 'give_payment_gateway_donation_summary', $summary );  | 
                                                        |
| 428 | +	return apply_filters('give_payment_gateway_donation_summary', $summary); | 
                                                        |
| 429 | 429 | }  | 
                                                        
| 430 | 430 | |
| 431 | 431 | |
@@ -440,31 +440,31 @@ discard block  | 
                                                    ||
| 440 | 440 |  function give_get_host() { | 
                                                        
| 441 | 441 | $host = false;  | 
                                                        
| 442 | 442 | |
| 443 | -	if ( defined( 'WPE_APIKEY' ) ) { | 
                                                        |
| 443 | +	if (defined('WPE_APIKEY')) { | 
                                                        |
| 444 | 444 | $host = 'WP Engine';  | 
                                                        
| 445 | -	} elseif ( defined( 'PAGELYBIN' ) ) { | 
                                                        |
| 445 | +	} elseif (defined('PAGELYBIN')) { | 
                                                        |
| 446 | 446 | $host = 'Pagely';  | 
                                                        
| 447 | -	} elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { | 
                                                        |
| 447 | +	} elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') { | 
                                                        |
| 448 | 448 | $host = 'ICDSoft';  | 
                                                        
| 449 | -	} elseif ( DB_HOST == 'mysqlv5' ) { | 
                                                        |
| 449 | +	} elseif (DB_HOST == 'mysqlv5') { | 
                                                        |
| 450 | 450 | $host = 'NetworkSolutions';  | 
                                                        
| 451 | -	} elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { | 
                                                        |
| 451 | +	} elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) { | 
                                                        |
| 452 | 452 | $host = 'iPage';  | 
                                                        
| 453 | -	} elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { | 
                                                        |
| 453 | +	} elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) { | 
                                                        |
| 454 | 454 | $host = 'IPower';  | 
                                                        
| 455 | -	} elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { | 
                                                        |
| 455 | +	} elseif (strpos(DB_HOST, '.gridserver.com') !== false) { | 
                                                        |
| 456 | 456 | $host = 'MediaTemple Grid';  | 
                                                        
| 457 | -	} elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) { | 
                                                        |
| 457 | +	} elseif (strpos(DB_HOST, '.pair.com') !== false) { | 
                                                        |
| 458 | 458 | $host = 'pair Networks';  | 
                                                        
| 459 | -	} elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { | 
                                                        |
| 459 | +	} elseif (strpos(DB_HOST, '.stabletransit.com') !== false) { | 
                                                        |
| 460 | 460 | $host = 'Rackspace Cloud';  | 
                                                        
| 461 | -	} elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { | 
                                                        |
| 461 | +	} elseif (strpos(DB_HOST, '.sysfix.eu') !== false) { | 
                                                        |
| 462 | 462 | $host = 'SysFix.eu Power Hosting';  | 
                                                        
| 463 | -	} elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { | 
                                                        |
| 463 | +	} elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { | 
                                                        |
| 464 | 464 | $host = 'Flywheel';  | 
                                                        
| 465 | 465 |  	} else { | 
                                                        
| 466 | 466 | // Adding a general fallback for data gathering  | 
                                                        
| 467 | - $host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME'];  | 
                                                        |
| 467 | + $host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME'];  | 
                                                        |
| 468 | 468 | }  | 
                                                        
| 469 | 469 | |
| 470 | 470 | return $host;  | 
                                                        
@@ -480,67 +480,67 @@ discard block  | 
                                                    ||
| 480 | 480 | *  | 
                                                        
| 481 | 481 | * @return bool true if host matches, false if not  | 
                                                        
| 482 | 482 | */  | 
                                                        
| 483 | -function give_is_host( $host = false ) { | 
                                                        |
| 483 | +function give_is_host($host = false) { | 
                                                        |
| 484 | 484 | |
| 485 | 485 | $return = false;  | 
                                                        
| 486 | 486 | |
| 487 | -	if ( $host ) { | 
                                                        |
| 488 | - $host = str_replace( ' ', '', strtolower( $host ) );  | 
                                                        |
| 487 | +	if ($host) { | 
                                                        |
| 488 | +		$host = str_replace(' ', '', strtolower($host)); | 
                                                        |
| 489 | 489 | |
| 490 | -		switch ( $host ) { | 
                                                        |
| 490 | +		switch ($host) { | 
                                                        |
| 491 | 491 | case 'wpengine':  | 
                                                        
| 492 | -				if ( defined( 'WPE_APIKEY' ) ) { | 
                                                        |
| 492 | +				if (defined('WPE_APIKEY')) { | 
                                                        |
| 493 | 493 | $return = true;  | 
                                                        
| 494 | 494 | }  | 
                                                        
| 495 | 495 | break;  | 
                                                        
| 496 | 496 | case 'pagely':  | 
                                                        
| 497 | -				if ( defined( 'PAGELYBIN' ) ) { | 
                                                        |
| 497 | +				if (defined('PAGELYBIN')) { | 
                                                        |
| 498 | 498 | $return = true;  | 
                                                        
| 499 | 499 | }  | 
                                                        
| 500 | 500 | break;  | 
                                                        
| 501 | 501 | case 'icdsoft':  | 
                                                        
| 502 | -				if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { | 
                                                        |
| 502 | +				if (DB_HOST == 'localhost:/tmp/mysql5.sock') { | 
                                                        |
| 503 | 503 | $return = true;  | 
                                                        
| 504 | 504 | }  | 
                                                        
| 505 | 505 | break;  | 
                                                        
| 506 | 506 | case 'networksolutions':  | 
                                                        
| 507 | -				if ( DB_HOST == 'mysqlv5' ) { | 
                                                        |
| 507 | +				if (DB_HOST == 'mysqlv5') { | 
                                                        |
| 508 | 508 | $return = true;  | 
                                                        
| 509 | 509 | }  | 
                                                        
| 510 | 510 | break;  | 
                                                        
| 511 | 511 | case 'ipage':  | 
                                                        
| 512 | -				if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { | 
                                                        |
| 512 | +				if (strpos(DB_HOST, 'ipagemysql.com') !== false) { | 
                                                        |
| 513 | 513 | $return = true;  | 
                                                        
| 514 | 514 | }  | 
                                                        
| 515 | 515 | break;  | 
                                                        
| 516 | 516 | case 'ipower':  | 
                                                        
| 517 | -				if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { | 
                                                        |
| 517 | +				if (strpos(DB_HOST, 'ipowermysql.com') !== false) { | 
                                                        |
| 518 | 518 | $return = true;  | 
                                                        
| 519 | 519 | }  | 
                                                        
| 520 | 520 | break;  | 
                                                        
| 521 | 521 | case 'mediatemplegrid':  | 
                                                        
| 522 | -				if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { | 
                                                        |
| 522 | +				if (strpos(DB_HOST, '.gridserver.com') !== false) { | 
                                                        |
| 523 | 523 | $return = true;  | 
                                                        
| 524 | 524 | }  | 
                                                        
| 525 | 525 | break;  | 
                                                        
| 526 | 526 | case 'pairnetworks':  | 
                                                        
| 527 | -				if ( strpos( DB_HOST, '.pair.com' ) !== false ) { | 
                                                        |
| 527 | +				if (strpos(DB_HOST, '.pair.com') !== false) { | 
                                                        |
| 528 | 528 | $return = true;  | 
                                                        
| 529 | 529 | }  | 
                                                        
| 530 | 530 | break;  | 
                                                        
| 531 | 531 | case 'rackspacecloud':  | 
                                                        
| 532 | -				if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { | 
                                                        |
| 532 | +				if (strpos(DB_HOST, '.stabletransit.com') !== false) { | 
                                                        |
| 533 | 533 | $return = true;  | 
                                                        
| 534 | 534 | }  | 
                                                        
| 535 | 535 | break;  | 
                                                        
| 536 | 536 | case 'sysfix.eu':  | 
                                                        
| 537 | 537 | case 'sysfix.eupowerhosting':  | 
                                                        
| 538 | -				if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { | 
                                                        |
| 538 | +				if (strpos(DB_HOST, '.sysfix.eu') !== false) { | 
                                                        |
| 539 | 539 | $return = true;  | 
                                                        
| 540 | 540 | }  | 
                                                        
| 541 | 541 | break;  | 
                                                        
| 542 | 542 | case 'flywheel':  | 
                                                        
| 543 | -				if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { | 
                                                        |
| 543 | +				if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { | 
                                                        |
| 544 | 544 | $return = true;  | 
                                                        
| 545 | 545 | }  | 
                                                        
| 546 | 546 | break;  | 
                                                        
@@ -573,7 +573,7 @@ discard block  | 
                                                    ||
| 573 | 573 | * @param string $replacement Optional. The function that should have been called.  | 
                                                        
| 574 | 574 | * @param array $backtrace Optional. Contains stack backtrace of deprecated function.  | 
                                                        
| 575 | 575 | */  | 
                                                        
| 576 | -function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) { | 
                                                        |
| 576 | +function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) { | 
                                                        |
| 577 | 577 | |
| 578 | 578 | /**  | 
                                                        
| 579 | 579 | * Fires while give deprecated function call occurs.  | 
                                                        
@@ -586,19 +586,19 @@ discard block  | 
                                                    ||
| 586 | 586 | * @param string $replacement Optional. The function that should have been called.  | 
                                                        
| 587 | 587 | * @param string $version The plugin version that deprecated the function.  | 
                                                        
| 588 | 588 | */  | 
                                                        
| 589 | - do_action( 'give_deprecated_function_run', $function, $replacement, $version );  | 
                                                        |
| 589 | +	do_action('give_deprecated_function_run', $function, $replacement, $version); | 
                                                        |
| 590 | 590 | |
| 591 | - $show_errors = current_user_can( 'manage_options' );  | 
                                                        |
| 591 | +	$show_errors = current_user_can('manage_options'); | 
                                                        |
| 592 | 592 | |
| 593 | 593 | // Allow plugin to filter the output error trigger.  | 
                                                        
| 594 | -	if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) { | 
                                                        |
| 595 | -		if ( ! is_null( $replacement ) ) { | 
                                                        |
| 596 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) );  | 
                                                        |
| 597 | - trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.  | 
                                                        |
| 594 | +	if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) { | 
                                                        |
| 595 | +		if ( ! is_null($replacement)) { | 
                                                        |
| 596 | +			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement)); | 
                                                        |
| 597 | + trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.  | 
                                                        |
| 598 | 598 | // Alternatively we could dump this to a file.  | 
                                                        
| 599 | 599 |  		} else { | 
                                                        
| 600 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) );  | 
                                                        |
| 601 | - trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.  | 
                                                        |
| 600 | +			trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version)); | 
                                                        |
| 601 | + trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.  | 
                                                        |
| 602 | 602 | // Alternatively we could dump this to a file.  | 
                                                        
| 603 | 603 | }  | 
                                                        
| 604 | 604 | }  | 
                                                        
@@ -612,8 +612,8 @@ discard block  | 
                                                    ||
| 612 | 612 | * @return string $post_id  | 
                                                        
| 613 | 613 | */  | 
                                                        
| 614 | 614 |  function give_get_admin_post_id() { | 
                                                        
| 615 | - $post_id = isset( $_GET['post'] ) ? $_GET['post'] : null;  | 
                                                        |
| 616 | -	if ( ! $post_id && isset( $_POST['post_id'] ) ) { | 
                                                        |
| 615 | + $post_id = isset($_GET['post']) ? $_GET['post'] : null;  | 
                                                        |
| 616 | +	if ( ! $post_id && isset($_POST['post_id'])) { | 
                                                        |
| 617 | 617 | $post_id = $_POST['post_id'];  | 
                                                        
| 618 | 618 | }  | 
                                                        
| 619 | 619 | |
@@ -627,7 +627,7 @@ discard block  | 
                                                    ||
| 627 | 627 | * @return string Arg separator output  | 
                                                        
| 628 | 628 | */  | 
                                                        
| 629 | 629 |  function give_get_php_arg_separator_output() { | 
                                                        
| 630 | - return ini_get( 'arg_separator.output' );  | 
                                                        |
| 630 | +	return ini_get('arg_separator.output'); | 
                                                        |
| 631 | 631 | }  | 
                                                        
| 632 | 632 | |
| 633 | 633 | |
@@ -642,10 +642,10 @@ discard block  | 
                                                    ||
| 642 | 642 | *  | 
                                                        
| 643 | 643 | * @return string Short month name  | 
                                                        
| 644 | 644 | */  | 
                                                        
| 645 | -function give_month_num_to_name( $n ) { | 
                                                        |
| 646 | - $timestamp = mktime( 0, 0, 0, $n, 1, 2005 );  | 
                                                        |
| 645 | +function give_month_num_to_name($n) { | 
                                                        |
| 646 | + $timestamp = mktime(0, 0, 0, $n, 1, 2005);  | 
                                                        |
| 647 | 647 | |
| 648 | - return date_i18n( 'M', $timestamp );  | 
                                                        |
| 648 | +	return date_i18n('M', $timestamp); | 
                                                        |
| 649 | 649 | }  | 
                                                        
| 650 | 650 | |
| 651 | 651 | |
@@ -658,10 +658,10 @@ discard block  | 
                                                    ||
| 658 | 658 | *  | 
                                                        
| 659 | 659 | * @return bool Whether or not function is disabled.  | 
                                                        
| 660 | 660 | */  | 
                                                        
| 661 | -function give_is_func_disabled( $function ) { | 
                                                        |
| 662 | - $disabled = explode( ',', ini_get( 'disable_functions' ) );  | 
                                                        |
| 661 | +function give_is_func_disabled($function) { | 
                                                        |
| 662 | +	$disabled = explode(',', ini_get('disable_functions')); | 
                                                        |
| 663 | 663 | |
| 664 | - return in_array( $function, $disabled );  | 
                                                        |
| 664 | + return in_array($function, $disabled);  | 
                                                        |
| 665 | 665 | }  | 
                                                        
| 666 | 666 | |
| 667 | 667 | |
@@ -673,7 +673,7 @@ discard block  | 
                                                    ||
| 673 | 673 |  function give_get_newsletter() { | 
                                                        
| 674 | 674 | ?>  | 
                                                        
| 675 | 675 | |
| 676 | - <p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p>  | 
                                                        |
| 676 | +	<p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p> | 
                                                        |
| 677 | 677 | |
| 678 | 678 | <div class="give-newsletter-form-wrap">  | 
                                                        
| 679 | 679 | |
@@ -681,33 +681,33 @@ discard block  | 
                                                    ||
| 681 | 681 | method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate"  | 
                                                        
| 682 | 682 | target="_blank" novalidate>  | 
                                                        
| 683 | 683 | <div class="give-newsletter-confirmation">  | 
                                                        
| 684 | - <p><?php esc_html_e( 'Thanks for Subscribing!', 'give' ); ?> :)</p>  | 
                                                        |
| 684 | +				<p><?php esc_html_e('Thanks for Subscribing!', 'give'); ?> :)</p> | 
                                                        |
| 685 | 685 | </div>  | 
                                                        
| 686 | 686 | |
| 687 | 687 | <table class="form-table give-newsletter-form">  | 
                                                        
| 688 | 688 | <tr valign="middle">  | 
                                                        
| 689 | 689 | <td>  | 
                                                        
| 690 | 690 | <label for="mce-EMAIL"  | 
                                                        
| 691 | - class="screen-reader-text"><?php esc_html_e( 'Email Address (required)', 'give' ); ?></label>  | 
                                                        |
| 691 | +						       class="screen-reader-text"><?php esc_html_e('Email Address (required)', 'give'); ?></label> | 
                                                        |
| 692 | 692 | <input type="email" name="EMAIL" id="mce-EMAIL"  | 
                                                        
| 693 | - placeholder="<?php esc_attr_e( 'Email Address (required)', 'give' ); ?>"  | 
                                                        |
| 693 | +						       placeholder="<?php esc_attr_e('Email Address (required)', 'give'); ?>" | 
                                                        |
| 694 | 694 | class="required email" value="">  | 
                                                        
| 695 | 695 | </td>  | 
                                                        
| 696 | 696 | <td>  | 
                                                        
| 697 | 697 | <label for="mce-FNAME"  | 
                                                        
| 698 | - class="screen-reader-text"><?php esc_html_e( 'First Name', 'give' ); ?></label>  | 
                                                        |
| 698 | +						       class="screen-reader-text"><?php esc_html_e('First Name', 'give'); ?></label> | 
                                                        |
| 699 | 699 | <input type="text" name="FNAME" id="mce-FNAME"  | 
                                                        
| 700 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" class="" value="">  | 
                                                        |
| 700 | +						       placeholder="<?php esc_attr_e('First Name', 'give'); ?>" class="" value=""> | 
                                                        |
| 701 | 701 | </td>  | 
                                                        
| 702 | 702 | <td>  | 
                                                        
| 703 | 703 | <label for="mce-LNAME"  | 
                                                        
| 704 | - class="screen-reader-text"><?php esc_html_e( 'Last Name', 'give' ); ?></label>  | 
                                                        |
| 704 | +						       class="screen-reader-text"><?php esc_html_e('Last Name', 'give'); ?></label> | 
                                                        |
| 705 | 705 | <input type="text" name="LNAME" id="mce-LNAME"  | 
                                                        
| 706 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" class="" value="">  | 
                                                        |
| 706 | +						       placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" class="" value=""> | 
                                                        |
| 707 | 707 | </td>  | 
                                                        
| 708 | 708 | <td>  | 
                                                        
| 709 | 709 | <input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button"  | 
                                                        
| 710 | - value="<?php esc_attr_e( 'Subscribe', 'give' ); ?>">  | 
                                                        |
| 710 | +						       value="<?php esc_attr_e('Subscribe', 'give'); ?>"> | 
                                                        |
| 711 | 711 | </td>  | 
                                                        
| 712 | 712 | </tr>  | 
                                                        
| 713 | 713 | </table>  | 
                                                        
@@ -759,7 +759,7 @@ discard block  | 
                                                    ||
| 759 | 759 | *  | 
                                                        
| 760 | 760 | * @return string  | 
                                                        
| 761 | 761 | */  | 
                                                        
| 762 | -function give_svg_icons( $icon ) { | 
                                                        |
| 762 | +function give_svg_icons($icon) { | 
                                                        |
| 763 | 763 | |
| 764 | 764 | // Store your SVGs in an associative array  | 
                                                        
| 765 | 765 | $svgs = array(  | 
                                                        
@@ -771,7 +771,7 @@ discard block  | 
                                                    ||
| 771 | 771 | );  | 
                                                        
| 772 | 772 | |
| 773 | 773 | // Return the chosen icon's SVG string  | 
                                                        
| 774 | - return $svgs[ $icon ];  | 
                                                        |
| 774 | + return $svgs[$icon];  | 
                                                        |
| 775 | 775 | }  | 
                                                        
| 776 | 776 | |
| 777 | 777 | /**  | 
                                                        
@@ -783,15 +783,15 @@ discard block  | 
                                                    ||
| 783 | 783 | *  | 
                                                        
| 784 | 784 | * @return mixed  | 
                                                        
| 785 | 785 | */  | 
                                                        
| 786 | -function modify_nav_menu_meta_box_object( $post_type ) { | 
                                                        |
| 787 | -	if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) { | 
                                                        |
| 788 | - $post_type->labels->name = esc_html__( 'Donation Forms', 'give' );  | 
                                                        |
| 786 | +function modify_nav_menu_meta_box_object($post_type) { | 
                                                        |
| 787 | +	if (isset($post_type->name) && $post_type->name == 'give_forms') { | 
                                                        |
| 788 | +		$post_type->labels->name = esc_html__('Donation Forms', 'give'); | 
                                                        |
| 789 | 789 | }  | 
                                                        
| 790 | 790 | |
| 791 | 791 | return $post_type;  | 
                                                        
| 792 | 792 | }  | 
                                                        
| 793 | 793 | |
| 794 | -add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' );  | 
                                                        |
| 794 | +add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object'); | 
                                                        |
| 795 | 795 | |
| 796 | 796 | /**  | 
                                                        
| 797 | 797 | * Enable 'Donation Form' meta enabled by default on Menu page.  | 
                                                        
@@ -801,22 +801,22 @@ discard block  | 
                                                    ||
| 801 | 801 |  function give_nav_donation_metabox_enabled() { | 
                                                        
| 802 | 802 | |
| 803 | 803 | // Return false, if it fails to retrieve hidden meta box list and is not admin.  | 
                                                        
| 804 | -	if ( ( ! $hidden_meta_boxes = get_user_option( 'metaboxhidden_nav-menus' ) ) || ! is_admin() ) { | 
                                                        |
| 804 | +	if (( ! $hidden_meta_boxes = get_user_option('metaboxhidden_nav-menus')) || ! is_admin()) { | 
                                                        |
| 805 | 805 | return false;  | 
                                                        
| 806 | 806 | }  | 
                                                        
| 807 | 807 | |
| 808 | 808 | // Return false, In case, we don't find 'Donation Form' in hidden meta box list.  | 
                                                        
| 809 | -	if ( ! in_array( 'add-post-type-give_forms', $hidden_meta_boxes, true ) ) { | 
                                                        |
| 809 | +	if ( ! in_array('add-post-type-give_forms', $hidden_meta_boxes, true)) { | 
                                                        |
| 810 | 810 | return false;  | 
                                                        
| 811 | 811 | }  | 
                                                        
| 812 | 812 | |
| 813 | 813 | // Exclude 'Donation Form' value from hidden meta box's list.  | 
                                                        
| 814 | - $hidden_meta_boxes = array_diff( $hidden_meta_boxes, array( 'add-post-type-give_forms' ) );  | 
                                                        |
| 814 | +	$hidden_meta_boxes = array_diff($hidden_meta_boxes, array('add-post-type-give_forms')); | 
                                                        |
| 815 | 815 | |
| 816 | 816 | // Get current user ID.  | 
                                                        
| 817 | 817 | $user = wp_get_current_user();  | 
                                                        
| 818 | 818 | |
| 819 | - update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );  | 
                                                        |
| 819 | + update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);  | 
                                                        |
| 820 | 820 | }  | 
                                                        
| 821 | 821 | |
| 822 | 822 | /**  | 
                                                        
@@ -830,7 +830,7 @@ discard block  | 
                                                    ||
| 830 | 830 | * @license https://opensource.org/licenses/MIT MIT  | 
                                                        
| 831 | 831 | */  | 
                                                        
| 832 | 832 | |
| 833 | -if ( ! function_exists( 'array_column' ) ) { | 
                                                        |
| 833 | +if ( ! function_exists('array_column')) { | 
                                                        |
| 834 | 834 | /**  | 
                                                        
| 835 | 835 | * Returns the values from a single column of the input array, identified by  | 
                                                        
| 836 | 836 | * the $columnKey.  | 
                                                        
@@ -849,53 +849,53 @@ discard block  | 
                                                    ||
| 849 | 849 | *  | 
                                                        
| 850 | 850 | * @return array  | 
                                                        
| 851 | 851 | */  | 
                                                        
| 852 | -	function array_column( $input = null, $columnKey = null, $indexKey = null ) { | 
                                                        |
| 852 | +	function array_column($input = null, $columnKey = null, $indexKey = null) { | 
                                                        |
| 853 | 853 | // Using func_get_args() in order to check for proper number of  | 
                                                        
| 854 | 854 | // parameters and trigger errors exactly as the built-in array_column()  | 
                                                        
| 855 | 855 | // does in PHP 5.5.  | 
                                                        
| 856 | 856 | $argc = func_num_args();  | 
                                                        
| 857 | 857 | $params = func_get_args();  | 
                                                        
| 858 | 858 | |
| 859 | -		if ( $argc < 2 ) { | 
                                                        |
| 860 | - trigger_error( sprintf( esc_html__( 'array_column() expects at least 2 parameters, %s given.', 'give' ), $argc ), E_USER_WARNING );  | 
                                                        |
| 859 | +		if ($argc < 2) { | 
                                                        |
| 860 | +			trigger_error(sprintf(esc_html__('array_column() expects at least 2 parameters, %s given.', 'give'), $argc), E_USER_WARNING); | 
                                                        |
| 861 | 861 | |
| 862 | 862 | return null;  | 
                                                        
| 863 | 863 | }  | 
                                                        
| 864 | 864 | |
| 865 | -		if ( ! is_array( $params[0] ) ) { | 
                                                        |
| 866 | - trigger_error( sprintf( esc_html__( 'array_column() expects parameter 1 to be array, %s given.', 'give' ), gettype( $params[0] ) ), E_USER_WARNING );  | 
                                                        |
| 865 | +		if ( ! is_array($params[0])) { | 
                                                        |
| 866 | +			trigger_error(sprintf(esc_html__('array_column() expects parameter 1 to be array, %s given.', 'give'), gettype($params[0])), E_USER_WARNING); | 
                                                        |
| 867 | 867 | |
| 868 | 868 | return null;  | 
                                                        
| 869 | 869 | }  | 
                                                        
| 870 | 870 | |
| 871 | - if ( ! is_int( $params[1] )  | 
                                                        |
| 872 | - && ! is_float( $params[1] )  | 
                                                        |
| 873 | - && ! is_string( $params[1] )  | 
                                                        |
| 871 | + if ( ! is_int($params[1])  | 
                                                        |
| 872 | + && ! is_float($params[1])  | 
                                                        |
| 873 | + && ! is_string($params[1])  | 
                                                        |
| 874 | 874 | && $params[1] !== null  | 
                                                        
| 875 | - && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) )  | 
                                                        |
| 875 | + && ! (is_object($params[1]) && method_exists($params[1], '__toString'))  | 
                                                        |
| 876 | 876 |  		) { | 
                                                        
| 877 | - trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING );  | 
                                                        |
| 877 | +			trigger_error(esc_html__('array_column(): The column key should be either a string or an integer.', 'give'), E_USER_WARNING); | 
                                                        |
| 878 | 878 | |
| 879 | 879 | return false;  | 
                                                        
| 880 | 880 | }  | 
                                                        
| 881 | 881 | |
| 882 | - if ( isset( $params[2] )  | 
                                                        |
| 883 | - && ! is_int( $params[2] )  | 
                                                        |
| 884 | - && ! is_float( $params[2] )  | 
                                                        |
| 885 | - && ! is_string( $params[2] )  | 
                                                        |
| 886 | - && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) )  | 
                                                        |
| 882 | + if (isset($params[2])  | 
                                                        |
| 883 | + && ! is_int($params[2])  | 
                                                        |
| 884 | + && ! is_float($params[2])  | 
                                                        |
| 885 | + && ! is_string($params[2])  | 
                                                        |
| 886 | + && ! (is_object($params[2]) && method_exists($params[2], '__toString'))  | 
                                                        |
| 887 | 887 |  		) { | 
                                                        
| 888 | - trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING );  | 
                                                        |
| 888 | +			trigger_error(esc_html__('array_column(): The index key should be either a string or an integer.', 'give'), E_USER_WARNING); | 
                                                        |
| 889 | 889 | |
| 890 | 890 | return false;  | 
                                                        
| 891 | 891 | }  | 
                                                        
| 892 | 892 | |
| 893 | 893 | $paramsInput = $params[0];  | 
                                                        
| 894 | - $paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null;  | 
                                                        |
| 894 | + $paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null;  | 
                                                        |
| 895 | 895 | |
| 896 | 896 | $paramsIndexKey = null;  | 
                                                        
| 897 | -		if ( isset( $params[2] ) ) { | 
                                                        |
| 898 | -			if ( is_float( $params[2] ) || is_int( $params[2] ) ) { | 
                                                        |
| 897 | +		if (isset($params[2])) { | 
                                                        |
| 898 | +			if (is_float($params[2]) || is_int($params[2])) { | 
                                                        |
| 899 | 899 | $paramsIndexKey = (int) $params[2];  | 
                                                        
| 900 | 900 |  			} else { | 
                                                        
| 901 | 901 | $paramsIndexKey = (string) $params[2];  | 
                                                        
@@ -904,26 +904,26 @@ discard block  | 
                                                    ||
| 904 | 904 | |
| 905 | 905 | $resultArray = array();  | 
                                                        
| 906 | 906 | |
| 907 | -		foreach ( $paramsInput as $row ) { | 
                                                        |
| 907 | +		foreach ($paramsInput as $row) { | 
                                                        |
| 908 | 908 | $key = $value = null;  | 
                                                        
| 909 | 909 | $keySet = $valueSet = false;  | 
                                                        
| 910 | 910 | |
| 911 | -			if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) { | 
                                                        |
| 911 | +			if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) { | 
                                                        |
| 912 | 912 | $keySet = true;  | 
                                                        
| 913 | - $key = (string) $row[ $paramsIndexKey ];  | 
                                                        |
| 913 | + $key = (string) $row[$paramsIndexKey];  | 
                                                        |
| 914 | 914 | }  | 
                                                        
| 915 | 915 | |
| 916 | -			if ( $paramsColumnKey === null ) { | 
                                                        |
| 916 | +			if ($paramsColumnKey === null) { | 
                                                        |
| 917 | 917 | $valueSet = true;  | 
                                                        
| 918 | 918 | $value = $row;  | 
                                                        
| 919 | -			} elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) { | 
                                                        |
| 919 | +			} elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) { | 
                                                        |
| 920 | 920 | $valueSet = true;  | 
                                                        
| 921 | - $value = $row[ $paramsColumnKey ];  | 
                                                        |
| 921 | + $value = $row[$paramsColumnKey];  | 
                                                        |
| 922 | 922 | }  | 
                                                        
| 923 | 923 | |
| 924 | -			if ( $valueSet ) { | 
                                                        |
| 925 | -				if ( $keySet ) { | 
                                                        |
| 926 | - $resultArray[ $key ] = $value;  | 
                                                        |
| 924 | +			if ($valueSet) { | 
                                                        |
| 925 | +				if ($keySet) { | 
                                                        |
| 926 | + $resultArray[$key] = $value;  | 
                                                        |
| 927 | 927 |  				} else { | 
                                                        
| 928 | 928 | $resultArray[] = $value;  | 
                                                        
| 929 | 929 | }  | 
                                                        
@@ -943,40 +943,40 @@ discard block  | 
                                                    ||
| 943 | 943 | *  | 
                                                        
| 944 | 944 | * @return bool Whether the receipt is visible or not.  | 
                                                        
| 945 | 945 | */  | 
                                                        
| 946 | -function give_can_view_receipt( $payment_key = '' ) { | 
                                                        |
| 946 | +function give_can_view_receipt($payment_key = '') { | 
                                                        |
| 947 | 947 | |
| 948 | 948 | $return = false;  | 
                                                        
| 949 | 949 | |
| 950 | -	if ( empty( $payment_key ) ) { | 
                                                        |
| 950 | +	if (empty($payment_key)) { | 
                                                        |
| 951 | 951 | return $return;  | 
                                                        
| 952 | 952 | }  | 
                                                        
| 953 | 953 | |
| 954 | 954 | global $give_receipt_args;  | 
                                                        
| 955 | 955 | |
| 956 | - $give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key );  | 
                                                        |
| 956 | + $give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key);  | 
                                                        |
| 957 | 957 | |
| 958 | - $user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] );  | 
                                                        |
| 958 | + $user_id = (int) give_get_payment_user_id($give_receipt_args['id']);  | 
                                                        |
| 959 | 959 | |
| 960 | - $payment_meta = give_get_payment_meta( $give_receipt_args['id'] );  | 
                                                        |
| 960 | + $payment_meta = give_get_payment_meta($give_receipt_args['id']);  | 
                                                        |
| 961 | 961 | |
| 962 | -	if ( is_user_logged_in() ) { | 
                                                        |
| 963 | -		if ( $user_id === (int) get_current_user_id() ) { | 
                                                        |
| 962 | +	if (is_user_logged_in()) { | 
                                                        |
| 963 | +		if ($user_id === (int) get_current_user_id()) { | 
                                                        |
| 964 | 964 | $return = true;  | 
                                                        
| 965 | -		} elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) { | 
                                                        |
| 965 | +		} elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) { | 
                                                        |
| 966 | 966 | $return = true;  | 
                                                        
| 967 | -		} elseif ( current_user_can( 'view_give_sensitive_data' ) ) { | 
                                                        |
| 967 | +		} elseif (current_user_can('view_give_sensitive_data')) { | 
                                                        |
| 968 | 968 | $return = true;  | 
                                                        
| 969 | 969 | }  | 
                                                        
| 970 | 970 | }  | 
                                                        
| 971 | 971 | |
| 972 | 972 | $session = give_get_purchase_session();  | 
                                                        
| 973 | -	if ( ! empty( $session ) && ! is_user_logged_in() ) { | 
                                                        |
| 974 | -		if ( $session['purchase_key'] === $payment_meta['key'] ) { | 
                                                        |
| 973 | +	if ( ! empty($session) && ! is_user_logged_in()) { | 
                                                        |
| 974 | +		if ($session['purchase_key'] === $payment_meta['key']) { | 
                                                        |
| 975 | 975 | $return = true;  | 
                                                        
| 976 | 976 | }  | 
                                                        
| 977 | 977 | }  | 
                                                        
| 978 | 978 | |
| 979 | - return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key );  | 
                                                        |
| 979 | +	return (bool) apply_filters('give_can_view_receipt', $return, $payment_key); | 
                                                        |
| 980 | 980 | |
| 981 | 981 | }  | 
                                                        
| 982 | 982 | |
@@ -985,7 +985,7 @@ discard block  | 
                                                    ||
| 985 | 985 | *  | 
                                                        
| 986 | 986 | * Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar  | 
                                                        
| 987 | 987 | */  | 
                                                        
| 988 | -if ( ! function_exists( 'cal_days_in_month' ) ) { | 
                                                        |
| 988 | +if ( ! function_exists('cal_days_in_month')) { | 
                                                        |
| 989 | 989 | /**  | 
                                                        
| 990 | 990 | * cal_days_in_month  | 
                                                        
| 991 | 991 | *  | 
                                                        
@@ -995,8 +995,8 @@ discard block  | 
                                                    ||
| 995 | 995 | *  | 
                                                        
| 996 | 996 | * @return bool|string  | 
                                                        
| 997 | 997 | */  | 
                                                        
| 998 | -	function cal_days_in_month( $calendar, $month, $year ) { | 
                                                        |
| 999 | - return date( 't', mktime( 0, 0, 0, $month, 1, $year ) );  | 
                                                        |
| 998 | +	function cal_days_in_month($calendar, $month, $year) { | 
                                                        |
| 999 | +		return date('t', mktime(0, 0, 0, $month, 1, $year)); | 
                                                        |
| 1000 | 1000 | }  | 
                                                        
| 1001 | 1001 | }  | 
                                                        
| 1002 | 1002 | |
@@ -1015,42 +1015,42 @@ discard block  | 
                                                    ||
| 1015 | 1015 | */  | 
                                                        
| 1016 | 1016 |  function give_get_plugins() { | 
                                                        
| 1017 | 1017 | $plugins = get_plugins();  | 
                                                        
| 1018 | - $active_plugin_paths = (array) get_option( 'active_plugins', array() );  | 
                                                        |
| 1018 | +	$active_plugin_paths = (array) get_option('active_plugins', array()); | 
                                                        |
| 1019 | 1019 | |
| 1020 | -	if ( is_multisite() ) { | 
                                                        |
| 1021 | - $network_activated_plugin_paths = array_keys( get_site_option( 'active_sitewide_plugins', array() ) );  | 
                                                        |
| 1022 | - $active_plugin_paths = array_merge( $active_plugin_paths, $network_activated_plugin_paths );  | 
                                                        |
| 1020 | +	if (is_multisite()) { | 
                                                        |
| 1021 | +		$network_activated_plugin_paths = array_keys(get_site_option('active_sitewide_plugins', array())); | 
                                                        |
| 1022 | + $active_plugin_paths = array_merge($active_plugin_paths, $network_activated_plugin_paths);  | 
                                                        |
| 1023 | 1023 | }  | 
                                                        
| 1024 | 1024 | |
| 1025 | -	foreach ( $plugins as $plugin_path => $plugin_data ) { | 
                                                        |
| 1025 | +	foreach ($plugins as $plugin_path => $plugin_data) { | 
                                                        |
| 1026 | 1026 | // Is plugin active?  | 
                                                        
| 1027 | -		if ( in_array( $plugin_path, $active_plugin_paths ) ) { | 
                                                        |
| 1028 | - $plugins[ $plugin_path ]['Status'] = 'active';  | 
                                                        |
| 1027 | +		if (in_array($plugin_path, $active_plugin_paths)) { | 
                                                        |
| 1028 | + $plugins[$plugin_path]['Status'] = 'active';  | 
                                                        |
| 1029 | 1029 |  		} else { | 
                                                        
| 1030 | - $plugins[ $plugin_path ]['Status'] = 'inactive';  | 
                                                        |
| 1030 | + $plugins[$plugin_path]['Status'] = 'inactive';  | 
                                                        |
| 1031 | 1031 | }  | 
                                                        
| 1032 | 1032 | |
| 1033 | - $dirname = strtolower( dirname( $plugin_path ) );  | 
                                                        |
| 1033 | + $dirname = strtolower(dirname($plugin_path));  | 
                                                        |
| 1034 | 1034 | |
| 1035 | 1035 | // Is plugin a Give add-on by WordImpress?  | 
                                                        
| 1036 | -		if ( strstr( $dirname, 'give-' ) && strstr( $plugin_data['AuthorURI'], 'wordimpress.com' ) ) { | 
                                                        |
| 1036 | +		if (strstr($dirname, 'give-') && strstr($plugin_data['AuthorURI'], 'wordimpress.com')) { | 
                                                        |
| 1037 | 1037 | // Plugin is a Give-addon.  | 
                                                        
| 1038 | - $plugins[ $plugin_path ]['Type'] = 'add-on';  | 
                                                        |
| 1038 | + $plugins[$plugin_path]['Type'] = 'add-on';  | 
                                                        |
| 1039 | 1039 | |
| 1040 | 1040 | // Get license info from database.  | 
                                                        
| 1041 | - $plugin_name = str_replace( 'Give - ', '', $plugin_data['Name'] );  | 
                                                        |
| 1042 | - $db_option = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $plugin_name ) ) ) . '_license_active';  | 
                                                        |
| 1043 | - $license_active = get_option( $db_option );  | 
                                                        |
| 1041 | +			$plugin_name    = str_replace('Give - ', '', $plugin_data['Name']); | 
                                                        |
| 1042 | +			$db_option      = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($plugin_name))).'_license_active'; | 
                                                        |
| 1043 | + $license_active = get_option($db_option);  | 
                                                        |
| 1044 | 1044 | |
| 1045 | 1045 | // Does a valid license exist?  | 
                                                        
| 1046 | -			if ( ! empty( $license_active ) && 'valid' === $license_active->license ) { | 
                                                        |
| 1047 | - $plugins[ $plugin_path ]['License'] = true;  | 
                                                        |
| 1046 | +			if ( ! empty($license_active) && 'valid' === $license_active->license) { | 
                                                        |
| 1047 | + $plugins[$plugin_path]['License'] = true;  | 
                                                        |
| 1048 | 1048 |  			} else { | 
                                                        
| 1049 | - $plugins[ $plugin_path ]['License'] = false;  | 
                                                        |
| 1049 | + $plugins[$plugin_path]['License'] = false;  | 
                                                        |
| 1050 | 1050 | }  | 
                                                        
| 1051 | 1051 |  		} else { | 
                                                        
| 1052 | 1052 | // Plugin is not a Give add-on.  | 
                                                        
| 1053 | - $plugins[ $plugin_path ]['Type'] = 'other';  | 
                                                        |
| 1053 | + $plugins[$plugin_path]['Type'] = 'other';  | 
                                                        |
| 1054 | 1054 | }  | 
                                                        
| 1055 | 1055 | }  | 
                                                        
| 1056 | 1056 | |
@@ -1067,16 +1067,16 @@ discard block  | 
                                                    ||
| 1067 | 1067 | *  | 
                                                        
| 1068 | 1068 | * @return bool  | 
                                                        
| 1069 | 1069 | */  | 
                                                        
| 1070 | -function give_is_terms_enabled( $form_id ) { | 
                                                        |
| 1071 | - $form_option = give_get_meta( $form_id, '_give_terms_option', true );  | 
                                                        |
| 1070 | +function give_is_terms_enabled($form_id) { | 
                                                        |
| 1071 | + $form_option = give_get_meta($form_id, '_give_terms_option', true);  | 
                                                        |
| 1072 | 1072 | |
| 1073 | 1073 | if (  | 
                                                        
| 1074 | - give_is_setting_enabled( $form_option, 'global' )  | 
                                                        |
| 1075 | - && give_is_setting_enabled( give_get_option( 'terms' ) )  | 
                                                        |
| 1074 | + give_is_setting_enabled($form_option, 'global')  | 
                                                        |
| 1075 | +		&& give_is_setting_enabled(give_get_option('terms')) | 
                                                        |
| 1076 | 1076 |  	) { | 
                                                        
| 1077 | 1077 | return true;  | 
                                                        
| 1078 | 1078 | |
| 1079 | -	} elseif ( give_is_setting_enabled( $form_option ) ) { | 
                                                        |
| 1079 | +	} elseif (give_is_setting_enabled($form_option)) { | 
                                                        |
| 1080 | 1080 | return true;  | 
                                                        
| 1081 | 1081 | |
| 1082 | 1082 |  	} else { | 
                                                        
@@ -1100,9 +1100,9 @@ discard block  | 
                                                    ||
| 1100 | 1100 | *  | 
                                                        
| 1101 | 1101 | * @return WP_Error|bool  | 
                                                        
| 1102 | 1102 | */  | 
                                                        
| 1103 | -function give_delete_donation_stats( $date_range = '', $args = array() ) { | 
                                                        |
| 1103 | +function give_delete_donation_stats($date_range = '', $args = array()) { | 
                                                        |
| 1104 | 1104 | // Delete all cache.  | 
                                                        
| 1105 | - $status = Give_Cache::delete( Give_Cache::get_options_like( 'give_stats' ) );  | 
                                                        |
| 1105 | +	$status = Give_Cache::delete(Give_Cache::get_options_like('give_stats')); | 
                                                        |
| 1106 | 1106 | |
| 1107 | 1107 | /**  | 
                                                        
| 1108 | 1108 | * Fire the action when donation stats delete.  | 
                                                        
@@ -1112,7 +1112,7 @@ discard block  | 
                                                    ||
| 1112 | 1112 | * @param string|array $date_range  | 
                                                        
| 1113 | 1113 | * @param array $args  | 
                                                        
| 1114 | 1114 | */  | 
                                                        
| 1115 | - do_action( 'give_delete_donation_stats', $status, $date_range, $args );  | 
                                                        |
| 1115 | +	do_action('give_delete_donation_stats', $status, $date_range, $args); | 
                                                        |
| 1116 | 1116 | |
| 1117 | 1117 | return $status;  | 
                                                        
| 1118 | 1118 | }  | 
                                                        
@@ -1130,7 +1130,7 @@ discard block  | 
                                                    ||
| 1130 | 1130 | *  | 
                                                        
| 1131 | 1131 | * @return mixed  | 
                                                        
| 1132 | 1132 | */  | 
                                                        
| 1133 | -function give_get_meta( $id, $meta_key, $single = false, $default = false ) { | 
                                                        |
| 1133 | +function give_get_meta($id, $meta_key, $single = false, $default = false) { | 
                                                        |
| 1134 | 1134 | /**  | 
                                                        
| 1135 | 1135 | * Filter the meta value  | 
                                                        
| 1136 | 1136 | *  | 
                                                        
@@ -1138,14 +1138,14 @@ discard block  | 
                                                    ||
| 1138 | 1138 | */  | 
                                                        
| 1139 | 1139 | $meta_value = apply_filters(  | 
                                                        
| 1140 | 1140 | 'give_get_meta',  | 
                                                        
| 1141 | - get_post_meta( $id, $meta_key, $single ),  | 
                                                        |
| 1141 | + get_post_meta($id, $meta_key, $single),  | 
                                                        |
| 1142 | 1142 | $id,  | 
                                                        
| 1143 | 1143 | $meta_key,  | 
                                                        
| 1144 | 1144 | $default  | 
                                                        
| 1145 | 1145 | );  | 
                                                        
| 1146 | 1146 | |
| 1147 | 1147 | if (  | 
                                                        
| 1148 | - ( empty( $meta_key ) || empty( $meta_value ) )  | 
                                                        |
| 1148 | + (empty($meta_key) || empty($meta_value))  | 
                                                        |
| 1149 | 1149 | && $default  | 
                                                        
| 1150 | 1150 |  	) { | 
                                                        
| 1151 | 1151 | $meta_value = $default;  | 
                                                        
@@ -1166,15 +1166,15 @@ discard block  | 
                                                    ||
| 1166 | 1166 | *  | 
                                                        
| 1167 | 1167 | * @return mixed  | 
                                                        
| 1168 | 1168 | */  | 
                                                        
| 1169 | -function give_update_meta( $id, $meta_key, $meta_value, $prev_value = '' ) { | 
                                                        |
| 1170 | - $status = update_post_meta( $id, $meta_key, $meta_value, $prev_value );  | 
                                                        |
| 1169 | +function give_update_meta($id, $meta_key, $meta_value, $prev_value = '') { | 
                                                        |
| 1170 | + $status = update_post_meta($id, $meta_key, $meta_value, $prev_value);  | 
                                                        |
| 1171 | 1171 | |
| 1172 | 1172 | /**  | 
                                                        
| 1173 | 1173 | * Filter the meta value update status  | 
                                                        
| 1174 | 1174 | *  | 
                                                        
| 1175 | 1175 | * @since 1.8.8  | 
                                                        
| 1176 | 1176 | */  | 
                                                        
| 1177 | - return apply_filters( 'give_update_meta', $status, $id, $meta_key, $meta_value );  | 
                                                        |
| 1177 | +	return apply_filters('give_update_meta', $status, $id, $meta_key, $meta_value); | 
                                                        |
| 1178 | 1178 | }  | 
                                                        
| 1179 | 1179 | |
| 1180 | 1180 | /**  | 
                                                        
@@ -1188,15 +1188,15 @@ discard block  | 
                                                    ||
| 1188 | 1188 | *  | 
                                                        
| 1189 | 1189 | * @return mixed  | 
                                                        
| 1190 | 1190 | */  | 
                                                        
| 1191 | -function give_delete_meta( $id, $meta_key, $meta_value = '' ) { | 
                                                        |
| 1192 | - $status = delete_post_meta( $id, $meta_key, $meta_value );  | 
                                                        |
| 1191 | +function give_delete_meta($id, $meta_key, $meta_value = '') { | 
                                                        |
| 1192 | + $status = delete_post_meta($id, $meta_key, $meta_value);  | 
                                                        |
| 1193 | 1193 | |
| 1194 | 1194 | /**  | 
                                                        
| 1195 | 1195 | * Filter the meta value delete status  | 
                                                        
| 1196 | 1196 | *  | 
                                                        
| 1197 | 1197 | * @since 1.8.8  | 
                                                        
| 1198 | 1198 | */  | 
                                                        
| 1199 | - return apply_filters( 'give_delete_meta', $status, $id, $meta_key, $meta_value );  | 
                                                        |
| 1199 | +	return apply_filters('give_delete_meta', $status, $id, $meta_key, $meta_value); | 
                                                        |
| 1200 | 1200 | }  | 
                                                        
| 1201 | 1201 | |
| 1202 | 1202 | /**  | 
                                                        
@@ -1208,15 +1208,15 @@ discard block  | 
                                                    ||
| 1208 | 1208 | *  | 
                                                        
| 1209 | 1209 | * @return bool If the action has been added to the completed actions array  | 
                                                        
| 1210 | 1210 | */  | 
                                                        
| 1211 | -function give_has_upgrade_completed( $upgrade_action = '' ) { | 
                                                        |
| 1211 | +function give_has_upgrade_completed($upgrade_action = '') { | 
                                                        |
| 1212 | 1212 | |
| 1213 | -	if ( empty( $upgrade_action ) ) { | 
                                                        |
| 1213 | +	if (empty($upgrade_action)) { | 
                                                        |
| 1214 | 1214 | return false;  | 
                                                        
| 1215 | 1215 | }  | 
                                                        
| 1216 | 1216 | |
| 1217 | 1217 | $completed_upgrades = give_get_completed_upgrades();  | 
                                                        
| 1218 | 1218 | |
| 1219 | - return in_array( $upgrade_action, $completed_upgrades );  | 
                                                        |
| 1219 | + return in_array($upgrade_action, $completed_upgrades);  | 
                                                        |
| 1220 | 1220 | |
| 1221 | 1221 | }  | 
                                                        
| 1222 | 1222 | |
@@ -1228,8 +1228,8 @@ discard block  | 
                                                    ||
| 1228 | 1228 | * @return mixed When nothing to resume returns false, otherwise starts the upgrade where it left off  | 
                                                        
| 1229 | 1229 | */  | 
                                                        
| 1230 | 1230 |  function give_maybe_resume_upgrade() { | 
                                                        
| 1231 | - $doing_upgrade = get_option( 'give_doing_upgrade', false );  | 
                                                        |
| 1232 | -	if ( empty( $doing_upgrade ) ) { | 
                                                        |
| 1231 | +	$doing_upgrade = get_option('give_doing_upgrade', false); | 
                                                        |
| 1232 | +	if (empty($doing_upgrade)) { | 
                                                        |
| 1233 | 1233 | return false;  | 
                                                        
| 1234 | 1234 | }  | 
                                                        
| 1235 | 1235 | |
@@ -1245,9 +1245,9 @@ discard block  | 
                                                    ||
| 1245 | 1245 | *  | 
                                                        
| 1246 | 1246 | * @return bool If the function was successfully added  | 
                                                        
| 1247 | 1247 | */  | 
                                                        
| 1248 | -function give_set_upgrade_complete( $upgrade_action = '' ) { | 
                                                        |
| 1248 | +function give_set_upgrade_complete($upgrade_action = '') { | 
                                                        |
| 1249 | 1249 | |
| 1250 | -	if ( empty( $upgrade_action ) ) { | 
                                                        |
| 1250 | +	if (empty($upgrade_action)) { | 
                                                        |
| 1251 | 1251 | return false;  | 
                                                        
| 1252 | 1252 | }  | 
                                                        
| 1253 | 1253 | |
@@ -1255,16 +1255,16 @@ discard block  | 
                                                    ||
| 1255 | 1255 | $completed_upgrades[] = $upgrade_action;  | 
                                                        
| 1256 | 1256 | |
| 1257 | 1257 | // Remove any blanks, and only show uniques.  | 
                                                        
| 1258 | - $completed_upgrades = array_unique( array_values( $completed_upgrades ) );  | 
                                                        |
| 1258 | + $completed_upgrades = array_unique(array_values($completed_upgrades));  | 
                                                        |
| 1259 | 1259 | |
| 1260 | 1260 | /**  | 
                                                        
| 1261 | 1261 | * Fire the action when any upgrade set to complete.  | 
                                                        
| 1262 | 1262 | *  | 
                                                        
| 1263 | 1263 | * @since 1.8.12  | 
                                                        
| 1264 | 1264 | */  | 
                                                        
| 1265 | - do_action( 'give_set_upgrade_completed', $upgrade_action, $completed_upgrades );  | 
                                                        |
| 1265 | +	do_action('give_set_upgrade_completed', $upgrade_action, $completed_upgrades); | 
                                                        |
| 1266 | 1266 | |
| 1267 | - return update_option( 'give_completed_upgrades', $completed_upgrades );  | 
                                                        |
| 1267 | +	return update_option('give_completed_upgrades', $completed_upgrades); | 
                                                        |
| 1268 | 1268 | }  | 
                                                        
| 1269 | 1269 | |
| 1270 | 1270 | /**  | 
                                                        
@@ -1275,7 +1275,7 @@ discard block  | 
                                                    ||
| 1275 | 1275 | */  | 
                                                        
| 1276 | 1276 |  function give_get_completed_upgrades() { | 
                                                        
| 1277 | 1277 | |
| 1278 | - return (array) get_option( 'give_completed_upgrades' );  | 
                                                        |
| 1278 | +	return (array) get_option('give_completed_upgrades'); | 
                                                        |
| 1279 | 1279 | |
| 1280 | 1280 | }  | 
                                                        
| 1281 | 1281 | |
@@ -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,17 +23,17 @@ discard block  | 
                                                    ||
| 23 | 23 | *  | 
                                                        
| 24 | 24 | * @return void  | 
                                                        
| 25 | 25 | */  | 
                                                        
| 26 | -function give_trigger_donation_receipt( $payment_id ) { | 
                                                        |
| 26 | +function give_trigger_donation_receipt($payment_id) { | 
                                                        |
| 27 | 27 | // Make sure we don't send a receipt while editing a donation.  | 
                                                        
| 28 | -	if ( isset( $_POST['give-action'] ) && 'edit_payment' == $_POST['give-action'] ) { | 
                                                        |
| 28 | +	if (isset($_POST['give-action']) && 'edit_payment' == $_POST['give-action']) { | 
                                                        |
| 29 | 29 | return;  | 
                                                        
| 30 | 30 | }  | 
                                                        
| 31 | 31 | |
| 32 | 32 | // Send email.  | 
                                                        
| 33 | - give_email_donation_receipt( $payment_id );  | 
                                                        |
| 33 | + give_email_donation_receipt($payment_id);  | 
                                                        |
| 34 | 34 | }  | 
                                                        
| 35 | 35 | |
| 36 | -add_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999, 1 );  | 
                                                        |
| 36 | +add_action('give_complete_donation', 'give_trigger_donation_receipt', 999, 1); | 
                                                        |
| 37 | 37 | |
| 38 | 38 | /**  | 
                                                        
| 39 | 39 | * Resend the Email Donation Receipt. (This can be done from the Donation History Page)  | 
                                                        
@@ -44,29 +44,29 @@ discard block  | 
                                                    ||
| 44 | 44 | *  | 
                                                        
| 45 | 45 | * @return void  | 
                                                        
| 46 | 46 | */  | 
                                                        
| 47 | -function give_resend_donation_receipt( $data ) { | 
                                                        |
| 47 | +function give_resend_donation_receipt($data) { | 
                                                        |
| 48 | 48 | |
| 49 | - $purchase_id = absint( $data['purchase_id'] );  | 
                                                        |
| 49 | + $purchase_id = absint($data['purchase_id']);  | 
                                                        |
| 50 | 50 | |
| 51 | -	if ( empty( $purchase_id ) ) { | 
                                                        |
| 51 | +	if (empty($purchase_id)) { | 
                                                        |
| 52 | 52 | return;  | 
                                                        
| 53 | 53 | }  | 
                                                        
| 54 | 54 | |
| 55 | -	if ( ! current_user_can( 'edit_give_payments', $purchase_id ) ) { | 
                                                        |
| 56 | - wp_die( esc_html__( 'You do not have permission to edit payments.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) );  | 
                                                        |
| 55 | +	if ( ! current_user_can('edit_give_payments', $purchase_id)) { | 
                                                        |
| 56 | +		wp_die(esc_html__('You do not have permission to edit payments.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); | 
                                                        |
| 57 | 57 | }  | 
                                                        
| 58 | 58 | |
| 59 | - give_email_donation_receipt( $purchase_id, false );  | 
                                                        |
| 59 | + give_email_donation_receipt($purchase_id, false);  | 
                                                        |
| 60 | 60 | |
| 61 | - wp_redirect( add_query_arg( array(  | 
                                                        |
| 61 | + wp_redirect(add_query_arg(array(  | 
                                                        |
| 62 | 62 | 'give-message' => 'email_sent',  | 
                                                        
| 63 | 63 | 'give-action' => false,  | 
                                                        
| 64 | 64 | 'purchase_id' => false  | 
                                                        
| 65 | - ) ) );  | 
                                                        |
| 65 | + )));  | 
                                                        |
| 66 | 66 | exit;  | 
                                                        
| 67 | 67 | }  | 
                                                        
| 68 | 68 | |
| 69 | -add_action( 'give_email_links', 'give_resend_donation_receipt' );  | 
                                                        |
| 69 | +add_action('give_email_links', 'give_resend_donation_receipt'); | 
                                                        |
| 70 | 70 | |
| 71 | 71 | /**  | 
                                                        
| 72 | 72 | * Trigger the sending of a Test Email  | 
                                                        
@@ -77,8 +77,8 @@ discard block  | 
                                                    ||
| 77 | 77 | *  | 
                                                        
| 78 | 78 | * @return void  | 
                                                        
| 79 | 79 | */  | 
                                                        
| 80 | -function give_send_test_email( $data ) { | 
                                                        |
| 81 | -	if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-test-email' ) ) { | 
                                                        |
| 80 | +function give_send_test_email($data) { | 
                                                        |
| 81 | +	if ( ! wp_verify_nonce($data['_wpnonce'], 'give-test-email')) { | 
                                                        |
| 82 | 82 | return;  | 
                                                        
| 83 | 83 | }  | 
                                                        
| 84 | 84 | |
@@ -86,8 +86,8 @@ discard block  | 
                                                    ||
| 86 | 86 | give_email_test_donation_receipt();  | 
                                                        
| 87 | 87 | |
| 88 | 88 | // Remove the test email query arg.  | 
                                                        
| 89 | - wp_redirect( remove_query_arg( 'give_action' ) );  | 
                                                        |
| 89 | +	wp_redirect(remove_query_arg('give_action')); | 
                                                        |
| 90 | 90 | exit;  | 
                                                        
| 91 | 91 | }  | 
                                                        
| 92 | 92 | |
| 93 | -add_action( 'give_send_test_email', 'give_send_test_email' );  | 
                                                        |
| 93 | +add_action('give_send_test_email', 'give_send_test_email'); | 
                                                        |
@@ -85,7 +85,7 @@  | 
                                                    ||
| 85 | 85 | *  | 
                                                        
| 86 | 86 | * @since 1.8  | 
                                                        
| 87 | 87 | *  | 
                                                        
| 88 | - * @param $setting_tab  | 
                                                        |
| 88 | + * @param string $setting_tab  | 
                                                        |
| 89 | 89 | *  | 
                                                        
| 90 | 90 | * @return string  | 
                                                        
| 91 | 91 | */  | 
                                                        
@@ -9,7 +9,7 @@ discard block  | 
                                                    ||
| 9 | 9 | * @since 1.8  | 
                                                        
| 10 | 10 | */  | 
                                                        
| 11 | 11 | |
| 12 | -if ( ! class_exists( 'Give_CMB2_Settings_Loader' ) ) :  | 
                                                        |
| 12 | +if ( ! class_exists('Give_CMB2_Settings_Loader')) : | 
                                                        |
| 13 | 13 | |
| 14 | 14 | /**  | 
                                                        
| 15 | 15 | * This class loads the cmb2 settings.  | 
                                                        
@@ -52,30 +52,30 @@ discard block  | 
                                                    ||
| 52 | 52 | |
| 53 | 53 | // Get current tab.  | 
                                                        
| 54 | 54 | $this->current_tab = give_get_current_setting_tab();  | 
                                                        
| 55 | - $this->current_section = empty( $_REQUEST['section'] ) ? ( current( array_keys( $this->get_sections() ) ) ) : sanitize_title( $_REQUEST['section'] );  | 
                                                        |
| 55 | + $this->current_section = empty($_REQUEST['section']) ? (current(array_keys($this->get_sections()))) : sanitize_title($_REQUEST['section']);  | 
                                                        |
| 56 | 56 | |
| 57 | 57 | // Tab ID.  | 
                                                        
| 58 | 58 | $this->id = $this->current_tab;  | 
                                                        
| 59 | 59 | |
| 60 | 60 | // Add addon tabs.  | 
                                                        
| 61 | - add_filter( 'give-settings_tabs_array', array( $this, 'add_addon_settings_page' ), 999999 );  | 
                                                        |
| 61 | +			add_filter('give-settings_tabs_array', array($this, 'add_addon_settings_page'), 999999); | 
                                                        |
| 62 | 62 | |
| 63 | 63 | // Add save hook to addons.  | 
                                                        
| 64 | - add_action( 'give-settings_get_settings_pages', array( $this, 'setup_addon_save_hook' ), 999999 );  | 
                                                        |
| 64 | +			add_action('give-settings_get_settings_pages', array($this, 'setup_addon_save_hook'), 999999); | 
                                                        |
| 65 | 65 | |
| 66 | 66 | // Add backward compatibility filters plugin settings.  | 
                                                        
| 67 | - $setting_tabs = array( 'general', 'gateways', 'display', 'emails', 'addons', 'licenses' );  | 
                                                        |
| 67 | +			$setting_tabs = array('general', 'gateways', 'display', 'emails', 'addons', 'licenses'); | 
                                                        |
| 68 | 68 | |
| 69 | 69 | // Filter Payment Gateways settings.  | 
                                                        
| 70 | -			if ( in_array( $this->current_tab, $setting_tabs ) ) { | 
                                                        |
| 71 | -				add_filter( "give_get_settings_{$this->current_tab}", array( | 
                                                        |
| 70 | +			if (in_array($this->current_tab, $setting_tabs)) { | 
                                                        |
| 71 | +				add_filter("give_get_settings_{$this->current_tab}", array( | 
                                                        |
| 72 | 72 | $this,  | 
                                                        
| 73 | 73 | 'get_filtered_addon_settings',  | 
                                                        
| 74 | - ), 999999, 1 );  | 
                                                        |
| 75 | -				add_filter( "give_get_sections_{$this->current_tab}", array( | 
                                                        |
| 74 | + ), 999999, 1);  | 
                                                        |
| 75 | +				add_filter("give_get_sections_{$this->current_tab}", array( | 
                                                        |
| 76 | 76 | $this,  | 
                                                        
| 77 | 77 | 'get_filtered_addon_sections',  | 
                                                        
| 78 | - ), 999999, 1 );  | 
                                                        |
| 78 | + ), 999999, 1);  | 
                                                        |
| 79 | 79 | }  | 
                                                        
| 80 | 80 | }  | 
                                                        
| 81 | 81 | |
@@ -88,12 +88,12 @@ discard block  | 
                                                    ||
| 88 | 88 | *  | 
                                                        
| 89 | 89 | * @return string  | 
                                                        
| 90 | 90 | */  | 
                                                        
| 91 | -		function set_default_setting_tab( $setting_tab ) { | 
                                                        |
| 91 | +		function set_default_setting_tab($setting_tab) { | 
                                                        |
| 92 | 92 | $default_tab = '';  | 
                                                        
| 93 | 93 | |
| 94 | 94 | // Set default tab to first setting tab.  | 
                                                        
| 95 | -			if ( $sections = array_keys( $this->get_sections() ) ) { | 
                                                        |
| 96 | - $default_tab = current( $sections );  | 
                                                        |
| 95 | +			if ($sections = array_keys($this->get_sections())) { | 
                                                        |
| 96 | + $default_tab = current($sections);  | 
                                                        |
| 97 | 97 | }  | 
                                                        
| 98 | 98 | |
| 99 | 99 | return $default_tab;  | 
                                                        
@@ -108,29 +108,29 @@ discard block  | 
                                                    ||
| 108 | 108 | *  | 
                                                        
| 109 | 109 | * @return mixed  | 
                                                        
| 110 | 110 | */  | 
                                                        
| 111 | -		function add_addon_settings_page( $pages ) { | 
                                                        |
| 111 | +		function add_addon_settings_page($pages) { | 
                                                        |
| 112 | 112 | // Previous setting page.  | 
                                                        
| 113 | 113 | $previous_pages = $this->prev_settings->give_get_settings_tabs();  | 
                                                        
| 114 | 114 | |
| 115 | 115 | // API and System Info setting tab merge to Tools setting tab, so remove them from tabs.  | 
                                                        
| 116 | - unset( $previous_pages['api'] );  | 
                                                        |
| 117 | - unset( $previous_pages['system_info'] );  | 
                                                        |
| 116 | + unset($previous_pages['api']);  | 
                                                        |
| 117 | + unset($previous_pages['system_info']);  | 
                                                        |
| 118 | 118 | |
| 119 | 119 | // Tab is not register.  | 
                                                        
| 120 | - $pages_diff = array_keys( array_diff( $previous_pages, $pages ) );  | 
                                                        |
| 120 | + $pages_diff = array_keys(array_diff($previous_pages, $pages));  | 
                                                        |
| 121 | 121 | |
| 122 | 122 | // Merge old settings with new settings.  | 
                                                        
| 123 | - $pages = array_merge( $pages, $previous_pages );  | 
                                                        |
| 123 | + $pages = array_merge($pages, $previous_pages);  | 
                                                        |
| 124 | 124 | |
| 125 | -			if ( in_array( $this->current_tab, $pages_diff ) ) { | 
                                                        |
| 125 | +			if (in_array($this->current_tab, $pages_diff)) { | 
                                                        |
| 126 | 126 | // Filter & actions.  | 
                                                        
| 127 | -				add_filter( "give_default_setting_tab_section_{$this->current_tab}", array( | 
                                                        |
| 127 | +				add_filter("give_default_setting_tab_section_{$this->current_tab}", array( | 
                                                        |
| 128 | 128 | $this,  | 
                                                        
| 129 | 129 | 'set_default_setting_tab',  | 
                                                        
| 130 | - ), 10 );  | 
                                                        |
| 131 | -				add_action( "give-settings_sections_{$this->current_tab}_page", array( $this, 'output_sections' ) ); | 
                                                        |
| 132 | -				add_action( "give-settings_settings_{$this->current_tab}_page", array( $this, 'output' ), 10 ); | 
                                                        |
| 133 | -				add_action( "give-settings_save_{$this->current_tab}", array( $this, 'save' ) ); | 
                                                        |
| 130 | + ), 10);  | 
                                                        |
| 131 | +				add_action("give-settings_sections_{$this->current_tab}_page", array($this, 'output_sections')); | 
                                                        |
| 132 | +				add_action("give-settings_settings_{$this->current_tab}_page", array($this, 'output'), 10); | 
                                                        |
| 133 | +				add_action("give-settings_save_{$this->current_tab}", array($this, 'save')); | 
                                                        |
| 134 | 134 | }  | 
                                                        
| 135 | 135 | |
| 136 | 136 | return $pages;  | 
                                                        
@@ -146,29 +146,29 @@ discard block  | 
                                                    ||
| 146 | 146 | *  | 
                                                        
| 147 | 147 | * @return mixed  | 
                                                        
| 148 | 148 | */  | 
                                                        
| 149 | -		function setup_addon_save_hook( $pages ) { | 
                                                        |
| 149 | +		function setup_addon_save_hook($pages) { | 
                                                        |
| 150 | 150 | $page_ids = array();  | 
                                                        
| 151 | 151 | |
| 152 | -			foreach ( $pages as $page ) { | 
                                                        |
| 153 | - $page_ids = $page->add_settings_page( $page_ids );  | 
                                                        |
| 152 | +			foreach ($pages as $page) { | 
                                                        |
| 153 | + $page_ids = $page->add_settings_page($page_ids);  | 
                                                        |
| 154 | 154 | }  | 
                                                        
| 155 | 155 | |
| 156 | 156 | // Previous setting page.  | 
                                                        
| 157 | 157 | $previous_pages = $this->prev_settings->give_get_settings_tabs();  | 
                                                        
| 158 | 158 | |
| 159 | 159 | // API and System Info setting tab merge to Tools setting tab, so remove them from tabs.  | 
                                                        
| 160 | - unset( $previous_pages['api'] );  | 
                                                        |
| 161 | - unset( $previous_pages['system_info'] );  | 
                                                        |
| 160 | + unset($previous_pages['api']);  | 
                                                        |
| 161 | + unset($previous_pages['system_info']);  | 
                                                        |
| 162 | 162 | |
| 163 | 163 | // Tab is not register.  | 
                                                        
| 164 | - $pages_diff = array_keys( array_diff( $previous_pages, $page_ids ) );  | 
                                                        |
| 164 | + $pages_diff = array_keys(array_diff($previous_pages, $page_ids));  | 
                                                        |
| 165 | 165 | |
| 166 | 166 | // Merge old settings with new settings.  | 
                                                        
| 167 | - $pages = array_merge( $page_ids, $previous_pages );  | 
                                                        |
| 167 | + $pages = array_merge($page_ids, $previous_pages);  | 
                                                        |
| 168 | 168 | |
| 169 | -			if ( in_array( $this->current_tab, $pages_diff ) ) { | 
                                                        |
| 169 | +			if (in_array($this->current_tab, $pages_diff)) { | 
                                                        |
| 170 | 170 | // Filter & actions.  | 
                                                        
| 171 | -				add_action( "give-settings_save_{$this->current_tab}", array( $this, 'save' ) ); | 
                                                        |
| 171 | +				add_action("give-settings_save_{$this->current_tab}", array($this, 'save')); | 
                                                        |
| 172 | 172 | }  | 
                                                        
| 173 | 173 | |
| 174 | 174 | return $pages;  | 
                                                        
@@ -183,16 +183,16 @@ discard block  | 
                                                    ||
| 183 | 183 | *  | 
                                                        
| 184 | 184 | * @return string  | 
                                                        
| 185 | 185 | */  | 
                                                        
| 186 | -		function get_section_name( $field_name ) { | 
                                                        |
| 186 | +		function get_section_name($field_name) { | 
                                                        |
| 187 | 187 | // Bailout.  | 
                                                        
| 188 | -			if ( empty( $field_name ) ) { | 
                                                        |
| 188 | +			if (empty($field_name)) { | 
                                                        |
| 189 | 189 | return $field_name;  | 
                                                        
| 190 | 190 | }  | 
                                                        
| 191 | 191 | |
| 192 | - $section_name = explode( ' ', $field_name );  | 
                                                        |
| 192 | +			$section_name = explode(' ', $field_name); | 
                                                        |
| 193 | 193 | |
| 194 | 194 | // Output.  | 
                                                        
| 195 | - return strip_tags( implode( ' ', $section_name ) );  | 
                                                        |
| 195 | +			return strip_tags(implode(' ', $section_name)); | 
                                                        |
| 196 | 196 | }  | 
                                                        
| 197 | 197 | |
| 198 | 198 | |
@@ -207,7 +207,7 @@ discard block  | 
                                                    ||
| 207 | 207 | *  | 
                                                        
| 208 | 208 | * @return mixed  | 
                                                        
| 209 | 209 | */  | 
                                                        
| 210 | -		public function en_translation( $translation, $text ) { | 
                                                        |
| 210 | +		public function en_translation($translation, $text) { | 
                                                        |
| 211 | 211 | return $text;  | 
                                                        
| 212 | 212 | }  | 
                                                        
| 213 | 213 | |
@@ -221,52 +221,52 @@ discard block  | 
                                                    ||
| 221 | 221 | *  | 
                                                        
| 222 | 222 | * @return mixed  | 
                                                        
| 223 | 223 | */  | 
                                                        
| 224 | -		function get_filtered_addon_sections( $sections = array() ) { | 
                                                        |
| 224 | +		function get_filtered_addon_sections($sections = array()) { | 
                                                        |
| 225 | 225 | // New sections.  | 
                                                        
| 226 | 226 | $new_sections = array();  | 
                                                        
| 227 | - $sections_ID = array_keys( $sections );  | 
                                                        |
| 228 | - $setting_fields = $this->prev_settings->give_settings( $this->current_tab );  | 
                                                        |
| 227 | + $sections_ID = array_keys($sections);  | 
                                                        |
| 228 | + $setting_fields = $this->prev_settings->give_settings($this->current_tab);  | 
                                                        |
| 229 | 229 | |
| 230 | 230 | // We need untranslated settings for backward compatibility.  | 
                                                        
| 231 | - add_filter( 'gettext', array( $this, 'en_translation' ), 10, 2 );  | 
                                                        |
| 232 | - $en_setting_fields = $this->prev_settings->give_settings( $this->current_tab );  | 
                                                        |
| 233 | - remove_filter( 'gettext', array( $this, 'en_translation' ), 10, 2 );  | 
                                                        |
| 231 | +			add_filter('gettext', array($this, 'en_translation'), 10, 2); | 
                                                        |
| 232 | + $en_setting_fields = $this->prev_settings->give_settings($this->current_tab);  | 
                                                        |
| 233 | +			remove_filter('gettext', array($this, 'en_translation'), 10, 2); | 
                                                        |
| 234 | 234 | |
| 235 | -			if ( ! empty( $setting_fields ) && ! empty( $setting_fields['fields'] ) ) { | 
                                                        |
| 235 | +			if ( ! empty($setting_fields) && ! empty($setting_fields['fields'])) { | 
                                                        |
| 236 | 236 | |
| 237 | -				foreach ( $setting_fields['fields'] as $index => $field ) { | 
                                                        |
| 237 | +				foreach ($setting_fields['fields'] as $index => $field) { | 
                                                        |
| 238 | 238 | // Collect new sections from addons.  | 
                                                        
| 239 | -					if ( 'give_title' !== $field['type'] ) { | 
                                                        |
| 239 | +					if ('give_title' !== $field['type']) { | 
                                                        |
| 240 | 240 | continue;  | 
                                                        
| 241 | 241 | }  | 
                                                        
| 242 | 242 | |
| 243 | 243 | // Untranslated setting name.  | 
                                                        
| 244 | - $en_setting_field_name = isset( $en_setting_fields['fields'][ $index ]['name'] ) ? $en_setting_fields['fields'][ $index ]['name'] : '';  | 
                                                        |
| 244 | + $en_setting_field_name = isset($en_setting_fields['fields'][$index]['name']) ? $en_setting_fields['fields'][$index]['name'] : '';  | 
                                                        |
| 245 | 245 | |
| 246 | 246 | // Section name.  | 
                                                        
| 247 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : '';  | 
                                                        |
| 248 | - $section_name = $this->get_section_name( $field['name'] );  | 
                                                        |
| 247 | + $field['name'] = isset($field['name']) ? $field['name'] : '';  | 
                                                        |
| 248 | + $section_name = $this->get_section_name($field['name']);  | 
                                                        |
| 249 | 249 | |
| 250 | 250 | // Check if section name exit and section title array is not empty.  | 
                                                        
| 251 | -					if ( ! empty( $sections ) && ! empty( $en_setting_field_name ) ) { | 
                                                        |
| 251 | +					if ( ! empty($sections) && ! empty($en_setting_field_name)) { | 
                                                        |
| 252 | 252 | |
| 253 | 253 | // Bailout: Do not load section if it is already exist.  | 
                                                        
| 254 | 254 | if (  | 
                                                        
| 255 | - in_array( sanitize_title( $en_setting_field_name ), $sections_ID ) // Check section id.  | 
                                                        |
| 256 | - || in_array( $section_name, $sections ) // Check section name.  | 
                                                        |
| 255 | + in_array(sanitize_title($en_setting_field_name), $sections_ID) // Check section id.  | 
                                                        |
| 256 | + || in_array($section_name, $sections) // Check section name.  | 
                                                        |
| 257 | 257 |  						) { | 
                                                        
| 258 | 258 | continue;  | 
                                                        
| 259 | 259 | }  | 
                                                        
| 260 | 260 | }  | 
                                                        
| 261 | 261 | |
| 262 | 262 | // Collect new sections from addons.  | 
                                                        
| 263 | - $new_sections[ sanitize_title( $field['name'] ) ] = $section_name;  | 
                                                        |
| 263 | + $new_sections[sanitize_title($field['name'])] = $section_name;  | 
                                                        |
| 264 | 264 | }  | 
                                                        
| 265 | 265 | }  | 
                                                        
| 266 | 266 | |
| 267 | 267 | // Add new section.  | 
                                                        
| 268 | -			if ( ! empty( $new_sections ) ) { | 
                                                        |
| 269 | - $sections = array_merge( $sections, $new_sections );  | 
                                                        |
| 268 | +			if ( ! empty($new_sections)) { | 
                                                        |
| 269 | + $sections = array_merge($sections, $new_sections);  | 
                                                        |
| 270 | 270 | }  | 
                                                        
| 271 | 271 | |
| 272 | 272 | // Output.  | 
                                                        
@@ -284,19 +284,19 @@ discard block  | 
                                                    ||
| 284 | 284 | *  | 
                                                        
| 285 | 285 | * @return array  | 
                                                        
| 286 | 286 | */  | 
                                                        
| 287 | -		function get_filtered_addon_settings( $settings, $setting_fields = array() ) { | 
                                                        |
| 287 | +		function get_filtered_addon_settings($settings, $setting_fields = array()) { | 
                                                        |
| 288 | 288 | global $wp_filter;  | 
                                                        
| 289 | 289 | |
| 290 | 290 | $new_setting_fields = array();  | 
                                                        
| 291 | 291 | |
| 292 | -			if ( ! empty( $settings ) ) { | 
                                                        |
| 292 | +			if ( ! empty($settings)) { | 
                                                        |
| 293 | 293 | // Bailout: If setting array contain first element of type title then it means it is already created with new setting api (skip this section ).  | 
                                                        
| 294 | -				if ( isset( $settings[0]['type'] ) && 'title' == $settings[0]['type'] ) { | 
                                                        |
| 295 | -					foreach ( $settings as $setting ) { | 
                                                        |
| 294 | +				if (isset($settings[0]['type']) && 'title' == $settings[0]['type']) { | 
                                                        |
| 295 | +					foreach ($settings as $setting) { | 
                                                        |
| 296 | 296 | $new_setting_fields[] = $setting;  | 
                                                        
| 297 | 297 | |
| 298 | 298 | // We need setting only till first section end.  | 
                                                        
| 299 | -						if ( 'sectionend' === $setting['type'] ) { | 
                                                        |
| 299 | +						if ('sectionend' === $setting['type']) { | 
                                                        |
| 300 | 300 | break;  | 
                                                        
| 301 | 301 | }  | 
                                                        
| 302 | 302 | }  | 
                                                        
@@ -308,24 +308,24 @@ discard block  | 
                                                    ||
| 308 | 308 | $prev_title_field_id = '';  | 
                                                        
| 309 | 309 | |
| 310 | 310 | // Create new setting fields.  | 
                                                        
| 311 | -				foreach ( $settings as $index => $field ) { | 
                                                        |
| 311 | +				foreach ($settings as $index => $field) { | 
                                                        |
| 312 | 312 | |
| 313 | 313 | // Bailout: Must need field type to process.  | 
                                                        
| 314 | -					if ( ! isset( $field['type'] ) ) { | 
                                                        |
| 314 | +					if ( ! isset($field['type'])) { | 
                                                        |
| 315 | 315 | continue;  | 
                                                        
| 316 | 316 | }  | 
                                                        
| 317 | 317 | |
| 318 | 318 | // Set wrapper class if any.  | 
                                                        
| 319 | -					if ( ! empty( $field['row_classes'] ) ) { | 
                                                        |
| 319 | +					if ( ! empty($field['row_classes'])) { | 
                                                        |
| 320 | 320 | $field['wrapper_class'] = $field['row_classes'];  | 
                                                        
| 321 | - unset( $field['row_classes'] );  | 
                                                        |
| 321 | + unset($field['row_classes']);  | 
                                                        |
| 322 | 322 | }  | 
                                                        
| 323 | 323 | |
| 324 | - $field['name'] = ! isset( $field['name'] ) ? '' : $field['name'];  | 
                                                        |
| 325 | - $field['desc'] = ! isset( $field['desc'] ) ? '' : $field['desc'];  | 
                                                        |
| 324 | + $field['name'] = ! isset($field['name']) ? '' : $field['name'];  | 
                                                        |
| 325 | + $field['desc'] = ! isset($field['desc']) ? '' : $field['desc'];  | 
                                                        |
| 326 | 326 | |
| 327 | 327 | // Modify cmb2 setting fields.  | 
                                                        
| 328 | -					switch ( $field['type'] ) { | 
                                                        |
| 328 | +					switch ($field['type']) { | 
                                                        |
| 329 | 329 | case 'text' :  | 
                                                        
| 330 | 330 | case 'file' :  | 
                                                        
| 331 | 331 | $field['css'] = 'width:25em;';  | 
                                                        
@@ -349,18 +349,18 @@ discard block  | 
                                                    ||
| 349 | 349 | $field['type'] = 'title';  | 
                                                        
| 350 | 350 | |
| 351 | 351 | // Since we are showing sections, so there now ned to show horizontal rules.  | 
                                                        
| 352 | -							if ( '<hr>' === $field['desc'] ) { | 
                                                        |
| 352 | +							if ('<hr>' === $field['desc']) { | 
                                                        |
| 353 | 353 | $field['desc'] = '';  | 
                                                        
| 354 | 354 | }  | 
                                                        
| 355 | 355 | |
| 356 | 356 | break;  | 
                                                        
| 357 | 357 | }  | 
                                                        
| 358 | 358 | |
| 359 | -					if ( 'title' === $field['type'] ) { | 
                                                        |
| 359 | +					if ('title' === $field['type']) { | 
                                                        |
| 360 | 360 | |
| 361 | 361 | // If we do not have first element as title then these field will be skip from frontend  | 
                                                        
| 362 | 362 | // because there are not belong to any section, so put all abandon fields under first section.  | 
                                                        
| 363 | -						if ( $index && empty( $prev_title_field_id ) ) { | 
                                                        |
| 363 | +						if ($index && empty($prev_title_field_id)) { | 
                                                        |
| 364 | 364 | array_unshift(  | 
                                                        
| 365 | 365 | $new_setting_fields,  | 
                                                        
| 366 | 366 | array(  | 
                                                        
@@ -374,7 +374,7 @@ discard block  | 
                                                    ||
| 374 | 374 | $prev_title_field_id = $field['id'];  | 
                                                        
| 375 | 375 | |
| 376 | 376 | continue;  | 
                                                        
| 377 | -						} elseif ( $index ) { | 
                                                        |
| 377 | +						} elseif ($index) { | 
                                                        |
| 378 | 378 | // Section end.  | 
                                                        
| 379 | 379 | $new_setting_fields[] = array(  | 
                                                        
| 380 | 380 | 'type' => 'sectionend',  | 
                                                        
@@ -406,52 +406,52 @@ discard block  | 
                                                    ||
| 406 | 406 | |
| 407 | 407 | // Check if setting page has title section or not.  | 
                                                        
| 408 | 408 | // If setting page does not have title section then add title section to it and fix section end array id.  | 
                                                        
| 409 | -				if ( 'title' !== $new_setting_fields[0]['type'] ) { | 
                                                        |
| 409 | +				if ('title' !== $new_setting_fields[0]['type']) { | 
                                                        |
| 410 | 410 | array_unshift(  | 
                                                        
| 411 | 411 | $new_setting_fields,  | 
                                                        
| 412 | 412 | array(  | 
                                                        
| 413 | - 'title' => ( isset( $settings['give_title'] ) ? $settings['give_title'] : '' ),  | 
                                                        |
| 413 | + 'title' => (isset($settings['give_title']) ? $settings['give_title'] : ''),  | 
                                                        |
| 414 | 414 | 'type' => 'title',  | 
                                                        
| 415 | - 'desc' => ! empty( $setting_fields['desc'] ) ? $setting_fields['desc'] : '',  | 
                                                        |
| 416 | - 'id' => ( isset( $settings['id'] ) ? $settings['id'] : '' ),  | 
                                                        |
| 415 | + 'desc' => ! empty($setting_fields['desc']) ? $setting_fields['desc'] : '',  | 
                                                        |
| 416 | + 'id' => (isset($settings['id']) ? $settings['id'] : ''),  | 
                                                        |
| 417 | 417 | )  | 
                                                        
| 418 | 418 | );  | 
                                                        
| 419 | 419 | |
| 420 | 420 | // Update id in section end array if does not contain.  | 
                                                        
| 421 | -					if ( empty( $new_setting_fields[ count( $new_setting_fields ) - 1 ]['id'] ) ) { | 
                                                        |
| 422 | - $new_setting_fields[ count( $new_setting_fields ) - 1 ]['id'] = ( isset( $settings['id'] ) ? $settings['id'] : '' );  | 
                                                        |
| 421 | +					if (empty($new_setting_fields[count($new_setting_fields) - 1]['id'])) { | 
                                                        |
| 422 | + $new_setting_fields[count($new_setting_fields) - 1]['id'] = (isset($settings['id']) ? $settings['id'] : '');  | 
                                                        |
| 423 | 423 | }  | 
                                                        
| 424 | 424 | }  | 
                                                        
| 425 | 425 | |
| 426 | 426 | // Return only section related settings.  | 
                                                        
| 427 | -				if ( $sections = $this->get_filtered_addon_sections() ) { | 
                                                        |
| 428 | - $new_setting_fields = $this->get_section_settings( $new_setting_fields );  | 
                                                        |
| 427 | +				if ($sections = $this->get_filtered_addon_sections()) { | 
                                                        |
| 428 | + $new_setting_fields = $this->get_section_settings($new_setting_fields);  | 
                                                        |
| 429 | 429 | }  | 
                                                        
| 430 | 430 | |
| 431 | 431 | // Third party plugin backward compatibility.  | 
                                                        
| 432 | - $wp_filter_keys = array_keys( $wp_filter );  | 
                                                        |
| 433 | -				foreach ( $new_setting_fields as $index => $field ) { | 
                                                        |
| 434 | -					if ( ! isset( $field['type'] ) || in_array( $field['type'], array( 'title', 'sectionend' ) ) ) { | 
                                                        |
| 432 | + $wp_filter_keys = array_keys($wp_filter);  | 
                                                        |
| 433 | +				foreach ($new_setting_fields as $index => $field) { | 
                                                        |
| 434 | +					if ( ! isset($field['type']) || in_array($field['type'], array('title', 'sectionend'))) { | 
                                                        |
| 435 | 435 | continue;  | 
                                                        
| 436 | 436 | }  | 
                                                        
| 437 | 437 | |
| 438 | 438 |  					$cmb2_filter_name = "cmb2_render_{$field['type']}"; | 
                                                        
| 439 | 439 | |
| 440 | -					if ( in_array( $cmb2_filter_name, $wp_filter_keys ) ) { | 
                                                        |
| 440 | +					if (in_array($cmb2_filter_name, $wp_filter_keys)) { | 
                                                        |
| 441 | 441 | |
| 442 | -						if ( 0 >= version_compare( 4.7, get_bloginfo( 'version' ) ) && ! empty( $wp_filter[ $cmb2_filter_name ]->callbacks ) ) { | 
                                                        |
| 443 | - $cmb2_filter_arr = current( $wp_filter[ $cmb2_filter_name ]->callbacks );  | 
                                                        |
| 442 | +						if (0 >= version_compare(4.7, get_bloginfo('version')) && ! empty($wp_filter[$cmb2_filter_name]->callbacks)) { | 
                                                        |
| 443 | + $cmb2_filter_arr = current($wp_filter[$cmb2_filter_name]->callbacks);  | 
                                                        |
| 444 | 444 |  						} else { | 
                                                        
| 445 | - $cmb2_filter_arr = current( $wp_filter[ $cmb2_filter_name ] );  | 
                                                        |
| 445 | + $cmb2_filter_arr = current($wp_filter[$cmb2_filter_name]);  | 
                                                        |
| 446 | 446 | }  | 
                                                        
| 447 | 447 | |
| 448 | -						if ( ! empty( $cmb2_filter_arr ) ) { | 
                                                        |
| 448 | +						if ( ! empty($cmb2_filter_arr)) { | 
                                                        |
| 449 | 449 | // Note: function can be called either globally or with class object, it depends on how developer invoke it.  | 
                                                        
| 450 | - $new_setting_fields[ $index ]['func'] = current( $cmb2_filter_arr );  | 
                                                        |
| 451 | -							add_action( "give_admin_field_{$field['type']}", array( | 
                                                        |
| 450 | + $new_setting_fields[$index]['func'] = current($cmb2_filter_arr);  | 
                                                        |
| 451 | +							add_action("give_admin_field_{$field['type']}", array( | 
                                                        |
| 452 | 452 | $this,  | 
                                                        
| 453 | 453 | 'addon_setting_field',  | 
                                                        
| 454 | - ), 10, 2 );  | 
                                                        |
| 454 | + ), 10, 2);  | 
                                                        |
| 455 | 455 | }  | 
                                                        
| 456 | 456 | }  | 
                                                        
| 457 | 457 | }  | 
                                                        
@@ -472,31 +472,31 @@ discard block  | 
                                                    ||
| 472 | 472 | *  | 
                                                        
| 473 | 473 | * @return array  | 
                                                        
| 474 | 474 | */  | 
                                                        
| 475 | -		function get_section_settings( $tab_settings ) { | 
                                                        |
| 475 | +		function get_section_settings($tab_settings) { | 
                                                        |
| 476 | 476 | $current_section = give_get_current_setting_section();  | 
                                                        
| 477 | 477 | |
| 478 | 478 | // Note: If we are opening default tab for addon setting then it is possible that we will get empty string as current section  | 
                                                        
| 479 | 479 | // because default section filter added after save hook fire, so we will always get problem to save first section [default] or if there are only on section  | 
                                                        
| 480 | 480 | // This is hack to fix this.  | 
                                                        
| 481 | -			if ( empty( $current_section ) ) { | 
                                                        |
| 482 | - $current_section = $this->set_default_setting_tab( $current_section );  | 
                                                        |
| 481 | +			if (empty($current_section)) { | 
                                                        |
| 482 | + $current_section = $this->set_default_setting_tab($current_section);  | 
                                                        |
| 483 | 483 | }  | 
                                                        
| 484 | 484 | |
| 485 | 485 | $section_start = false;  | 
                                                        
| 486 | 486 | $section_end = false;  | 
                                                        
| 487 | 487 | $section_only_setting_fields = array();  | 
                                                        
| 488 | 488 | |
| 489 | -			foreach ( $tab_settings as $field ) { | 
                                                        |
| 490 | -				if ( 'title' == $field['type'] && $current_section == sanitize_title( $field['title'] ) ) { | 
                                                        |
| 489 | +			foreach ($tab_settings as $field) { | 
                                                        |
| 490 | +				if ('title' == $field['type'] && $current_section == sanitize_title($field['title'])) { | 
                                                        |
| 491 | 491 | $section_start = true;  | 
                                                        
| 492 | 492 | }  | 
                                                        
| 493 | 493 | |
| 494 | -				if ( ! $section_start || $section_end ) { | 
                                                        |
| 494 | +				if ( ! $section_start || $section_end) { | 
                                                        |
| 495 | 495 | continue;  | 
                                                        
| 496 | 496 | }  | 
                                                        
| 497 | 497 | |
| 498 | -				if ( $section_start && ! $section_end ) { | 
                                                        |
| 499 | -					if ( 'sectionend' == $field['type'] ) { | 
                                                        |
| 498 | +				if ($section_start && ! $section_end) { | 
                                                        |
| 499 | +					if ('sectionend' == $field['type']) { | 
                                                        |
| 500 | 500 | $section_end = true;  | 
                                                        
| 501 | 501 | }  | 
                                                        
| 502 | 502 | $section_only_setting_fields[] = $field;  | 
                                                        
@@ -506,7 +506,7 @@ discard block  | 
                                                    ||
| 506 | 506 | // Remove title from setting, prevent it from render in setting tab.  | 
                                                        
| 507 | 507 | $section_only_setting_fields[0]['title'] = '';  | 
                                                        
| 508 | 508 | |
| 509 | -			return apply_filters( "give_get_settings_{$this->current_tab}_{$current_section}", $section_only_setting_fields, $tab_settings ); | 
                                                        |
| 509 | +			return apply_filters("give_get_settings_{$this->current_tab}_{$current_section}", $section_only_setting_fields, $tab_settings); | 
                                                        |
| 510 | 510 | }  | 
                                                        
| 511 | 511 | |
| 512 | 512 | |
@@ -520,17 +520,17 @@ discard block  | 
                                                    ||
| 520 | 520 | *  | 
                                                        
| 521 | 521 | * @return void  | 
                                                        
| 522 | 522 | */  | 
                                                        
| 523 | -		function addon_setting_field( $field, $saved_value ) { | 
                                                        |
| 523 | +		function addon_setting_field($field, $saved_value) { | 
                                                        |
| 524 | 524 | // Create object for cmb2 function callback backward compatibility.  | 
                                                        
| 525 | 525 | // Note: Do not call any cmb2 function on these objects  | 
                                                        
| 526 | - $field_obj = (object) array( 'args' => $field );  | 
                                                        |
| 527 | - $field_type_obj = (object) array( 'field' => $field_obj );  | 
                                                        |
| 526 | +			$field_obj      = (object) array('args' => $field); | 
                                                        |
| 527 | +			$field_type_obj = (object) array('field' => $field_obj); | 
                                                        |
| 528 | 528 | |
| 529 | - switch ( $this->current_tab ) :  | 
                                                        |
| 529 | + switch ($this->current_tab) :  | 
                                                        |
| 530 | 530 | case 'licenses':  | 
                                                        
| 531 | 531 | ?>  | 
                                                        
| 532 | 532 | <div class="give-settings-wrap give-settings-wrap-<?php echo $this->current_tab; ?>">  | 
                                                        
| 533 | - <?php $field['func']['function']( $field_obj, $saved_value, '', '', $field_type_obj ); ?>  | 
                                                        |
| 533 | + <?php $field['func']['function']($field_obj, $saved_value, '', '', $field_type_obj); ?>  | 
                                                        |
| 534 | 534 | </div>  | 
                                                        
| 535 | 535 | <?php break;  | 
                                                        
| 536 | 536 | |
@@ -538,22 +538,22 @@ discard block  | 
                                                    ||
| 538 | 538 | $colspan = 'colspan="2"';  | 
                                                        
| 539 | 539 | ?>  | 
                                                        
| 540 | 540 | <tr valign="top">  | 
                                                        
| 541 | - <?php if ( ! empty( $field['name'] ) && ! in_array( $field['name'], array( ' ' ) ) ) : ?>  | 
                                                        |
| 541 | +						<?php if ( ! empty($field['name']) && ! in_array($field['name'], array(' '))) : ?> | 
                                                        |
| 542 | 542 | <th scope="row" class="titledesc">  | 
                                                        
| 543 | 543 | <label  | 
                                                        
| 544 | - for="<?php echo esc_attr( $field['name'] ); ?>"><?php echo $field['title']; ?></label>  | 
                                                        |
| 544 | + for="<?php echo esc_attr($field['name']); ?>"><?php echo $field['title']; ?></label>  | 
                                                        |
| 545 | 545 | </th>  | 
                                                        
| 546 | 546 | <?php $colspan = ''; ?>  | 
                                                        
| 547 | 547 | <?php endif; ?>  | 
                                                        
| 548 | 548 | <td class="give-forminp" <?php echo $colspan; ?>>  | 
                                                        
| 549 | 549 | <?php  | 
                                                        
| 550 | -							if ( is_array( $field['func']['function'] ) ) { | 
                                                        |
| 550 | +							if (is_array($field['func']['function'])) { | 
                                                        |
| 551 | 551 | $classname = $field['func']['function'][0];  | 
                                                        
| 552 | 552 | $function_name = $field['func']['function'][1];  | 
                                                        
| 553 | - $classname->$function_name( $field_obj, $saved_value, '', '', $field_type_obj );  | 
                                                        |
| 553 | + $classname->$function_name($field_obj, $saved_value, '', '', $field_type_obj);  | 
                                                        |
| 554 | 554 |  							} else { | 
                                                        
| 555 | 555 | $function_name = $field['func']['function'];  | 
                                                        
| 556 | - $function_name( $field_obj, $saved_value, '', '', $field_type_obj );  | 
                                                        |
| 556 | + $function_name($field_obj, $saved_value, '', '', $field_type_obj);  | 
                                                        |
| 557 | 557 | }  | 
                                                        
| 558 | 558 | ?>  | 
                                                        
| 559 | 559 | </td>  | 
                                                        
@@ -571,10 +571,10 @@ discard block  | 
                                                    ||
| 571 | 571 |  		public function get_sections() { | 
                                                        
| 572 | 572 | $sections = array();  | 
                                                        
| 573 | 573 | |
| 574 | -			if ( ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) && ! empty( $setting_fields['fields'] ) ) { | 
                                                        |
| 575 | -				foreach ( $setting_fields['fields'] as $field ) { | 
                                                        |
| 576 | -					if ( 'give_title' == $field['type'] ) { | 
                                                        |
| 577 | - $sections[ sanitize_title( $field['name'] ) ] = $this->get_section_name( $field['name'] );  | 
                                                        |
| 574 | +			if (($setting_fields = $this->prev_settings->give_settings($this->current_tab)) && ! empty($setting_fields['fields'])) { | 
                                                        |
| 575 | +				foreach ($setting_fields['fields'] as $field) { | 
                                                        |
| 576 | +					if ('give_title' == $field['type']) { | 
                                                        |
| 577 | + $sections[sanitize_title($field['name'])] = $this->get_section_name($field['name']);  | 
                                                        |
| 578 | 578 | }  | 
                                                        
| 579 | 579 | }  | 
                                                        
| 580 | 580 | }  | 
                                                        
@@ -594,16 +594,16 @@ discard block  | 
                                                    ||
| 594 | 594 | |
| 595 | 595 | $new_setting_fields = array();  | 
                                                        
| 596 | 596 | |
| 597 | -			if ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) { | 
                                                        |
| 598 | -				if ( isset( $setting_fields['fields'] ) ) { | 
                                                        |
| 597 | +			if ($setting_fields = $this->prev_settings->give_settings($this->current_tab)) { | 
                                                        |
| 598 | +				if (isset($setting_fields['fields'])) { | 
                                                        |
| 599 | 599 | |
| 600 | 600 | $tab_data = array(  | 
                                                        
| 601 | 601 | 'id' => $setting_fields['id'],  | 
                                                        
| 602 | 602 | 'give_title' => $setting_fields['give_title'],  | 
                                                        
| 603 | - 'desc' => ( isset( $setting_fields['desc'] ) ? $setting_fields['desc'] : '' ),  | 
                                                        |
| 603 | + 'desc' => (isset($setting_fields['desc']) ? $setting_fields['desc'] : ''),  | 
                                                        |
| 604 | 604 | );  | 
                                                        
| 605 | 605 | |
| 606 | - $new_setting_fields = $this->get_filtered_addon_settings( $setting_fields['fields'], $tab_data );  | 
                                                        |
| 606 | + $new_setting_fields = $this->get_filtered_addon_settings($setting_fields['fields'], $tab_data);  | 
                                                        |
| 607 | 607 | }  | 
                                                        
| 608 | 608 | }  | 
                                                        
| 609 | 609 | |
@@ -620,24 +620,24 @@ discard block  | 
                                                    ||
| 620 | 620 | $sections = $this->get_sections();  | 
                                                        
| 621 | 621 | |
| 622 | 622 | // Show section settings only if setting section exist.  | 
                                                        
| 623 | -			if ( $this->current_section && ! in_array( $this->current_section, array_keys( $sections ) ) ) { | 
                                                        |
| 624 | - echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>';  | 
                                                        |
| 623 | +			if ($this->current_section && ! in_array($this->current_section, array_keys($sections))) { | 
                                                        |
| 624 | +				echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>'; | 
                                                        |
| 625 | 625 | $GLOBALS['give_hide_save_button'] = true;  | 
                                                        
| 626 | 626 | |
| 627 | 627 | return;  | 
                                                        
| 628 | 628 | }  | 
                                                        
| 629 | 629 | |
| 630 | 630 | // Bailout.  | 
                                                        
| 631 | -			if ( empty( $sections ) ) { | 
                                                        |
| 631 | +			if (empty($sections)) { | 
                                                        |
| 632 | 632 | return;  | 
                                                        
| 633 | 633 | }  | 
                                                        
| 634 | 634 | |
| 635 | 635 | echo '<ul class="subsubsub">';  | 
                                                        
| 636 | 636 | |
| 637 | - $array_keys = array_keys( $sections );  | 
                                                        |
| 637 | + $array_keys = array_keys($sections);  | 
                                                        |
| 638 | 638 | |
| 639 | -			foreach ( $sections as $id => $label ) { | 
                                                        |
| 640 | - echo '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=' . $this->current_tab . '§ion=' . sanitize_title( $id ) ) . '" class="' . ( $this->current_section == $id ? 'current' : '' ) . '">' . strip_tags( $label ) . '</a> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>';  | 
                                                        |
| 639 | +			foreach ($sections as $id => $label) { | 
                                                        |
| 640 | +				echo '<li><a href="'.admin_url('edit.php?post_type=give_forms&page=give-settings&tab='.$this->current_tab.'§ion='.sanitize_title($id)).'" class="'.($this->current_section == $id ? 'current' : '').'">'.strip_tags($label).'</a> '.(end($array_keys) == $id ? '' : '|').' </li>'; | 
                                                        |
| 641 | 641 | }  | 
                                                        
| 642 | 642 | |
| 643 | 643 | echo '</ul><br class="clear" /><hr>';  | 
                                                        
@@ -652,7 +652,7 @@ discard block  | 
                                                    ||
| 652 | 652 |  		public function output() { | 
                                                        
| 653 | 653 | $settings = $this->get_settings();  | 
                                                        
| 654 | 654 | |
| 655 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' );  | 
                                                        |
| 655 | + Give_Admin_Settings::output_fields($settings, 'give_settings');  | 
                                                        |
| 656 | 656 | }  | 
                                                        
| 657 | 657 | |
| 658 | 658 | /**  | 
                                                        
@@ -664,7 +664,7 @@ discard block  | 
                                                    ||
| 664 | 664 |  		public function save() { | 
                                                        
| 665 | 665 | $settings = $this->get_settings();  | 
                                                        
| 666 | 666 | |
| 667 | - Give_Admin_Settings::save_fields( $settings, 'give_settings' );  | 
                                                        |
| 667 | + Give_Admin_Settings::save_fields($settings, 'give_settings');  | 
                                                        |
| 668 | 668 | }  | 
                                                        
| 669 | 669 | }  | 
                                                        
| 670 | 670 | endif;  | 
                                                        
@@ -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 | |
@@ -36,29 +36,29 @@ discard block  | 
                                                    ||
| 36 | 36 | /**  | 
                                                        
| 37 | 37 | * Templates  | 
                                                        
| 38 | 38 | */  | 
                                                        
| 39 | - add_filter( 'template_include', array( __CLASS__, 'template_loader' ) );  | 
                                                        |
| 39 | +		add_filter('template_include', array(__CLASS__, 'template_loader'));
 | 
                                                        |
| 40 | 40 | |
| 41 | 41 | /**  | 
                                                        
| 42 | 42 | * Content Wrappers  | 
                                                        
| 43 | 43 | */  | 
                                                        
| 44 | - add_action( 'give_before_main_content', 'give_output_content_wrapper', 10 );  | 
                                                        |
| 45 | - add_action( 'give_after_main_content', 'give_output_content_wrapper_end', 10 );  | 
                                                        |
| 44 | +		add_action('give_before_main_content', 'give_output_content_wrapper', 10);
 | 
                                                        |
| 45 | +		add_action('give_after_main_content', 'give_output_content_wrapper_end', 10);
 | 
                                                        |
| 46 | 46 | |
| 47 | 47 | /**  | 
                                                        
| 48 | 48 | * Entry Summary Classes  | 
                                                        
| 49 | 49 | */  | 
                                                        
| 50 | - add_filter( 'give_forms_single_summary_classes', array( $this, 'give_set_single_summary_classes' ) );  | 
                                                        |
| 50 | +		add_filter('give_forms_single_summary_classes', array($this, 'give_set_single_summary_classes'));
 | 
                                                        |
| 51 | 51 | |
| 52 | 52 | /**  | 
                                                        
| 53 | 53 | * Sidebar  | 
                                                        
| 54 | 54 | */  | 
                                                        
| 55 | - add_action( 'give_before_single_form_summary', array( $this, 'give_output_sidebar_option' ), 1 );  | 
                                                        |
| 55 | +		add_action('give_before_single_form_summary', array($this, 'give_output_sidebar_option'), 1);
 | 
                                                        |
| 56 | 56 | |
| 57 | 57 | /**  | 
                                                        
| 58 | 58 | * Single Forms Summary Box  | 
                                                        
| 59 | 59 | */  | 
                                                        
| 60 | - add_action( 'give_single_form_summary', 'give_template_single_title', 5 );  | 
                                                        |
| 61 | - add_action( 'give_single_form_summary', 'give_get_donation_form', 10 );  | 
                                                        |
| 60 | +		add_action('give_single_form_summary', 'give_template_single_title', 5);
 | 
                                                        |
| 61 | +		add_action('give_single_form_summary', 'give_get_donation_form', 10);
 | 
                                                        |
| 62 | 62 | |
| 63 | 63 | }  | 
                                                        
| 64 | 64 | |
@@ -73,10 +73,10 @@ discard block  | 
                                                    ||
| 73 | 73 | *  | 
                                                        
| 74 | 74 | * @return string $classes List of space separated class names.  | 
                                                        
| 75 | 75 | */  | 
                                                        
| 76 | -	public function give_set_single_summary_classes( $classes ) {
 | 
                                                        |
| 76 | +	public function give_set_single_summary_classes($classes) {
 | 
                                                        |
| 77 | 77 | |
| 78 | 78 | //Add full width class when feature image is disabled AND no widgets are present  | 
                                                        
| 79 | -		if ( ! give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) ) {
 | 
                                                        |
| 79 | +		if ( ! give_is_setting_enabled(give_get_option('form_sidebar'))) {
 | 
                                                        |
| 80 | 80 | $classes .= ' give-full-width';  | 
                                                        
| 81 | 81 | }  | 
                                                        
| 82 | 82 | |
@@ -97,11 +97,11 @@ discard block  | 
                                                    ||
| 97 | 97 |  	public function give_output_sidebar_option() {
 | 
                                                        
| 98 | 98 | |
| 99 | 99 | //Add full width class when feature image is disabled AND no widgets are present  | 
                                                        
| 100 | -		if ( give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) ) {
 | 
                                                        |
| 101 | - add_action( 'give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5 );  | 
                                                        |
| 102 | - add_action( 'give_before_single_form_summary', 'give_show_form_images', 10 );  | 
                                                        |
| 103 | - add_action( 'give_before_single_form_summary', 'give_get_forms_sidebar', 20 );  | 
                                                        |
| 104 | - add_action( 'give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30 );  | 
                                                        |
| 100 | +		if (give_is_setting_enabled(give_get_option('form_sidebar'))) {
 | 
                                                        |
| 101 | +			add_action('give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5);
 | 
                                                        |
| 102 | +			add_action('give_before_single_form_summary', 'give_show_form_images', 10);
 | 
                                                        |
| 103 | +			add_action('give_before_single_form_summary', 'give_get_forms_sidebar', 20);
 | 
                                                        |
| 104 | +			add_action('give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30);
 | 
                                                        |
| 105 | 105 | }  | 
                                                        
| 106 | 106 | |
| 107 | 107 | }  | 
                                                        
@@ -123,20 +123,20 @@ discard block  | 
                                                    ||
| 123 | 123 | *  | 
                                                        
| 124 | 124 | * @return string $template  | 
                                                        
| 125 | 125 | */  | 
                                                        
| 126 | -	public static function template_loader( $template ) {
 | 
                                                        |
| 127 | - $find = array( 'give.php' );  | 
                                                        |
| 126 | +	public static function template_loader($template) {
 | 
                                                        |
| 127 | +		$find = array('give.php');
 | 
                                                        |
| 128 | 128 | $file = '';  | 
                                                        
| 129 | 129 | |
| 130 | -		if ( is_single() && get_post_type() == 'give_forms' ) {
 | 
                                                        |
| 130 | +		if (is_single() && get_post_type() == 'give_forms') {
 | 
                                                        |
| 131 | 131 | $file = 'single-give-form.php';  | 
                                                        
| 132 | 132 | $find[] = $file;  | 
                                                        
| 133 | - $find[] = apply_filters( 'give_template_path', 'give/' ) . $file;  | 
                                                        |
| 133 | +			$find[] = apply_filters('give_template_path', 'give/').$file;
 | 
                                                        |
| 134 | 134 | }  | 
                                                        
| 135 | 135 | |
| 136 | -		if ( $file ) {
 | 
                                                        |
| 137 | - $template = locate_template( array_unique( $find ) );  | 
                                                        |
| 138 | -			if ( ! $template ) {
 | 
                                                        |
| 139 | - $template = GIVE_PLUGIN_DIR . '/templates/' . $file;  | 
                                                        |
| 136 | +		if ($file) {
 | 
                                                        |
| 137 | + $template = locate_template(array_unique($find));  | 
                                                        |
| 138 | +			if ( ! $template) {
 | 
                                                        |
| 139 | + $template = GIVE_PLUGIN_DIR.'/templates/'.$file;  | 
                                                        |
| 140 | 140 | }  | 
                                                        
| 141 | 141 | }  | 
                                                        
| 142 | 142 | |
@@ -1283,7 +1283,7 @@  | 
                                                    ||
| 1283 | 1283 | *  | 
                                                        
| 1284 | 1284 | * @param $field  | 
                                                        
| 1285 | 1285 | *  | 
                                                        
| 1286 | - * @return string  | 
                                                        |
| 1286 | + * @return integer  | 
                                                        |
| 1287 | 1287 | */  | 
                                                        
| 1288 | 1288 |  function _give_set_field_give_id_default_value( $field ) { | 
                                                        
| 1289 | 1289 | return 0;  | 
                                                        
@@ -555,7 +555,7 @@ discard block  | 
                                                    ||
| 555 | 555 | type="radio"  | 
                                                        
| 556 | 556 | style="' . esc_attr( $field['style'] ) . '"  | 
                                                        
| 557 | 557 | ' . checked( esc_attr( $field['value'] ), esc_attr( $key ), false ) . ' '  | 
                                                        
| 558 | - . give_get_custom_attributes( $field ) . '  | 
                                                        |
| 558 | + . give_get_custom_attributes( $field ) . '  | 
                                                        |
| 559 | 559 | /> ' . esc_html( $value ) . '</label>  | 
                                                        
| 560 | 560 | </li>';  | 
                                                        
| 561 | 561 | }  | 
                                                        
@@ -704,9 +704,9 @@ discard block  | 
                                                    ||
| 704 | 704 | $field['title'] = isset( $field['title'] ) ? $field['title'] : 'Documentation';  | 
                                                        
| 705 | 705 | |
| 706 | 706 | echo '<p class="give-docs-link"><a href="' . esc_url( $field['url'] )  | 
                                                        
| 707 | - . '" target="_blank">'  | 
                                                        |
| 708 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $field['title'] )  | 
                                                        |
| 709 | - . '<span class="dashicons dashicons-editor-help"></span></a></p>';  | 
                                                        |
| 707 | + . '" target="_blank">'  | 
                                                        |
| 708 | + . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $field['title'] )  | 
                                                        |
| 709 | + . '<span class="dashicons dashicons-editor-help"></span></a></p>';  | 
                                                        |
| 710 | 710 | }  | 
                                                        
| 711 | 711 | |
| 712 | 712 | /**  | 
                                                        
@@ -8,7 +8,7 @@ discard block  | 
                                                    ||
| 8 | 8 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License  | 
                                                        
| 9 | 9 | * @since 1.8  | 
                                                        
| 10 | 10 | */  | 
                                                        
| 11 | -if ( ! defined( 'ABSPATH' ) ) { | 
                                                        |
| 11 | +if ( ! defined('ABSPATH')) { | 
                                                        |
| 12 | 12 | exit; // Exit if accessed directly  | 
                                                        
| 13 | 13 | }  | 
                                                        
| 14 | 14 | |
@@ -22,8 +22,8 @@ discard block  | 
                                                    ||
| 22 | 22 | *  | 
                                                        
| 23 | 23 | * @return bool|string  | 
                                                        
| 24 | 24 | */  | 
                                                        
| 25 | -function give_is_field_callback_exist( $field ) { | 
                                                        |
| 26 | - return ( give_get_field_callback( $field ) ? true : false );  | 
                                                        |
| 25 | +function give_is_field_callback_exist($field) { | 
                                                        |
| 26 | + return (give_get_field_callback($field) ? true : false);  | 
                                                        |
| 27 | 27 | }  | 
                                                        
| 28 | 28 | |
| 29 | 29 | /**  | 
                                                        
@@ -35,12 +35,12 @@ discard block  | 
                                                    ||
| 35 | 35 | *  | 
                                                        
| 36 | 36 | * @return bool|string  | 
                                                        
| 37 | 37 | */  | 
                                                        
| 38 | -function give_get_field_callback( $field ) { | 
                                                        |
| 38 | +function give_get_field_callback($field) { | 
                                                        |
| 39 | 39 | $func_name_prefix = 'give';  | 
                                                        
| 40 | 40 | $func_name = '';  | 
                                                        
| 41 | 41 | |
| 42 | 42 | // Set callback function on basis of cmb2 field name.  | 
                                                        
| 43 | -	switch ( $field['type'] ) { | 
                                                        |
| 43 | +	switch ($field['type']) { | 
                                                        |
| 44 | 44 | case 'radio_inline':  | 
                                                        
| 45 | 45 |  			$func_name = "{$func_name_prefix}_radio"; | 
                                                        
| 46 | 46 | break;  | 
                                                        
@@ -76,8 +76,8 @@ discard block  | 
                                                    ||
| 76 | 76 | default:  | 
                                                        
| 77 | 77 | |
| 78 | 78 | if (  | 
                                                        
| 79 | - array_key_exists( 'callback', $field )  | 
                                                        |
| 80 | - && ! empty( $field['callback'] )  | 
                                                        |
| 79 | +				array_key_exists('callback', $field) | 
                                                        |
| 80 | + && ! empty($field['callback'])  | 
                                                        |
| 81 | 81 |  			) { | 
                                                        
| 82 | 82 | $func_name = $field['callback'];  | 
                                                        
| 83 | 83 |  			} else { | 
                                                        
@@ -90,15 +90,15 @@ discard block  | 
                                                    ||
| 90 | 90 | *  | 
                                                        
| 91 | 91 | * @since 1.8  | 
                                                        
| 92 | 92 | */  | 
                                                        
| 93 | - $func_name = apply_filters( 'give_get_field_callback', $func_name, $field );  | 
                                                        |
| 93 | +	$func_name = apply_filters('give_get_field_callback', $func_name, $field); | 
                                                        |
| 94 | 94 | |
| 95 | 95 | // Exit if not any function exist.  | 
                                                        
| 96 | 96 | // Check if render callback exist or not.  | 
                                                        
| 97 | -	if ( empty( $func_name ) ) { | 
                                                        |
| 97 | +	if (empty($func_name)) { | 
                                                        |
| 98 | 98 | return false;  | 
                                                        
| 99 | -	} elseif ( is_string( $func_name ) && ! function_exists( "$func_name" ) ) { | 
                                                        |
| 99 | +	} elseif (is_string($func_name) && ! function_exists("$func_name")) { | 
                                                        |
| 100 | 100 | return false;  | 
                                                        
| 101 | -	} elseif ( is_array( $func_name ) && ! method_exists( $func_name[0], "$func_name[1]" ) ) { | 
                                                        |
| 101 | +	} elseif (is_array($func_name) && ! method_exists($func_name[0], "$func_name[1]")) { | 
                                                        |
| 102 | 102 | return false;  | 
                                                        
| 103 | 103 | }  | 
                                                        
| 104 | 104 | |
@@ -114,35 +114,35 @@ discard block  | 
                                                    ||
| 114 | 114 | *  | 
                                                        
| 115 | 115 | * @return bool  | 
                                                        
| 116 | 116 | */  | 
                                                        
| 117 | -function give_render_field( $field ) { | 
                                                        |
| 117 | +function give_render_field($field) { | 
                                                        |
| 118 | 118 | |
| 119 | 119 | // Check if render callback exist or not.  | 
                                                        
| 120 | -	if ( ! ( $func_name = give_get_field_callback( $field ) ) ) { | 
                                                        |
| 120 | +	if ( ! ($func_name = give_get_field_callback($field))) { | 
                                                        |
| 121 | 121 | return false;  | 
                                                        
| 122 | 122 | }  | 
                                                        
| 123 | 123 | |
| 124 | 124 | // CMB2 compatibility: Push all classes to attributes's class key  | 
                                                        
| 125 | -	if ( empty( $field['class'] ) ) { | 
                                                        |
| 125 | +	if (empty($field['class'])) { | 
                                                        |
| 126 | 126 | $field['class'] = '';  | 
                                                        
| 127 | 127 | }  | 
                                                        
| 128 | 128 | |
| 129 | -	if ( empty( $field['attributes']['class'] ) ) { | 
                                                        |
| 129 | +	if (empty($field['attributes']['class'])) { | 
                                                        |
| 130 | 130 | $field['attributes']['class'] = '';  | 
                                                        
| 131 | 131 | }  | 
                                                        
| 132 | 132 | |
| 133 | -	$field['attributes']['class'] = trim( "give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}" ); | 
                                                        |
| 134 | - unset( $field['class'] );  | 
                                                        |
| 133 | +	$field['attributes']['class'] = trim("give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}"); | 
                                                        |
| 134 | + unset($field['class']);  | 
                                                        |
| 135 | 135 | |
| 136 | 136 | // CMB2 compatibility: Set wrapper class if any.  | 
                                                        
| 137 | -	if ( ! empty( $field['row_classes'] ) ) { | 
                                                        |
| 137 | +	if ( ! empty($field['row_classes'])) { | 
                                                        |
| 138 | 138 | $field['wrapper_class'] = $field['row_classes'];  | 
                                                        
| 139 | - unset( $field['row_classes'] );  | 
                                                        |
| 139 | + unset($field['row_classes']);  | 
                                                        |
| 140 | 140 | }  | 
                                                        
| 141 | 141 | |
| 142 | 142 | // Set field params on basis of cmb2 field name.  | 
                                                        
| 143 | -	switch ( $field['type'] ) { | 
                                                        |
| 143 | +	switch ($field['type']) { | 
                                                        |
| 144 | 144 | case 'radio_inline':  | 
                                                        
| 145 | -			if ( empty( $field['wrapper_class'] ) ) { | 
                                                        |
| 145 | +			if (empty($field['wrapper_class'])) { | 
                                                        |
| 146 | 146 | $field['wrapper_class'] = '';  | 
                                                        
| 147 | 147 | }  | 
                                                        
| 148 | 148 | $field['wrapper_class'] .= ' give-inline-radio-fields';  | 
                                                        
@@ -155,15 +155,15 @@ discard block  | 
                                                    ||
| 155 | 155 | case 'text-small' :  | 
                                                        
| 156 | 156 | case 'text_small' :  | 
                                                        
| 157 | 157 | // CMB2 compatibility: Set field type to text.  | 
                                                        
| 158 | - $field['type'] = isset( $field['attributes']['type'] ) ? $field['attributes']['type'] : 'text';  | 
                                                        |
| 158 | + $field['type'] = isset($field['attributes']['type']) ? $field['attributes']['type'] : 'text';  | 
                                                        |
| 159 | 159 | |
| 160 | 160 | // CMB2 compatibility: Set data type to price.  | 
                                                        
| 161 | 161 | if (  | 
                                                        
| 162 | - empty( $field['data_type'] )  | 
                                                        |
| 163 | - && ! empty( $field['attributes']['class'] )  | 
                                                        |
| 162 | + empty($field['data_type'])  | 
                                                        |
| 163 | + && ! empty($field['attributes']['class'])  | 
                                                        |
| 164 | 164 | && (  | 
                                                        
| 165 | - false !== strpos( $field['attributes']['class'], 'money' )  | 
                                                        |
| 166 | - || false !== strpos( $field['attributes']['class'], 'amount' )  | 
                                                        |
| 165 | + false !== strpos($field['attributes']['class'], 'money')  | 
                                                        |
| 166 | + || false !== strpos($field['attributes']['class'], 'amount')  | 
                                                        |
| 167 | 167 | )  | 
                                                        
| 168 | 168 |  			) { | 
                                                        
| 169 | 169 | $field['data_type'] = 'decimal';  | 
                                                        
@@ -182,22 +182,22 @@ discard block  | 
                                                    ||
| 182 | 182 | case 'give_default_radio_inline':  | 
                                                        
| 183 | 183 | $field['type'] = 'radio';  | 
                                                        
| 184 | 184 | $field['options'] = array(  | 
                                                        
| 185 | - 'default' => __( 'Default' ),  | 
                                                        |
| 185 | +				'default' => __('Default'), | 
                                                        |
| 186 | 186 | );  | 
                                                        
| 187 | 187 | break;  | 
                                                        
| 188 | 188 | }  | 
                                                        
| 189 | 189 | |
| 190 | 190 | // CMB2 compatibility: Add support to define field description by desc & description param.  | 
                                                        
| 191 | 191 | // We encourage you to use description param.  | 
                                                        
| 192 | - $field['description'] = ( ! empty( $field['description'] )  | 
                                                        |
| 192 | + $field['description'] = ( ! empty($field['description'])  | 
                                                        |
| 193 | 193 | ? $field['description']  | 
                                                        
| 194 | - : ( ! empty( $field['desc'] ) ? $field['desc'] : '' ) );  | 
                                                        |
| 194 | + : ( ! empty($field['desc']) ? $field['desc'] : ''));  | 
                                                        |
| 195 | 195 | |
| 196 | 196 | // Call render function.  | 
                                                        
| 197 | -	if ( is_array( $func_name ) ) { | 
                                                        |
| 198 | -		$func_name[0]->{$func_name[1]}( $field ); | 
                                                        |
| 197 | +	if (is_array($func_name)) { | 
                                                        |
| 198 | +		$func_name[0]->{$func_name[1]}($field); | 
                                                        |
| 199 | 199 |  	} else { | 
                                                        
| 200 | - $func_name( $field );  | 
                                                        |
| 200 | + $func_name($field);  | 
                                                        |
| 201 | 201 | }  | 
                                                        
| 202 | 202 | |
| 203 | 203 | return true;  | 
                                                        
@@ -227,29 +227,29 @@ discard block  | 
                                                    ||
| 227 | 227 | * }  | 
                                                        
| 228 | 228 | * @return void  | 
                                                        
| 229 | 229 | */  | 
                                                        
| 230 | -function give_text_input( $field ) { | 
                                                        |
| 230 | +function give_text_input($field) { | 
                                                        |
| 231 | 231 | global $thepostid, $post;  | 
                                                        
| 232 | 232 | |
| 233 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid;  | 
                                                        |
| 234 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : '';  | 
                                                        |
| 235 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';  | 
                                                        |
| 236 | - $field['value'] = give_get_field_value( $field, $thepostid );  | 
                                                        |
| 237 | - $field['type'] = isset( $field['type'] ) ? $field['type'] : 'text';  | 
                                                        |
| 233 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid;  | 
                                                        |
| 234 | + $field['style'] = isset($field['style']) ? $field['style'] : '';  | 
                                                        |
| 235 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';  | 
                                                        |
| 236 | + $field['value'] = give_get_field_value($field, $thepostid);  | 
                                                        |
| 237 | + $field['type'] = isset($field['type']) ? $field['type'] : 'text';  | 
                                                        |
| 238 | 238 | $field['before_field'] = '';  | 
                                                        
| 239 | 239 | $field['after_field'] = '';  | 
                                                        
| 240 | - $data_type = empty( $field['data_type'] ) ? '' : $field['data_type'];  | 
                                                        |
| 240 | + $data_type = empty($field['data_type']) ? '' : $field['data_type'];  | 
                                                        |
| 241 | 241 | |
| 242 | -	switch ( $data_type ) { | 
                                                        |
| 242 | +	switch ($data_type) { | 
                                                        |
| 243 | 243 | case 'price' :  | 
                                                        
| 244 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_amount( give_maybe_sanitize_amount( $field['value'] ), array( 'sanitize' => false ) ) : $field['value'] );  | 
                                                        |
| 244 | +			$field['value'] = ( ! empty($field['value']) ? give_format_amount(give_maybe_sanitize_amount($field['value']), array('sanitize' => false)) : $field['value']); | 
                                                        |
| 245 | 245 | |
| 246 | - $field['before_field'] = ! empty( $field['before_field'] ) ? $field['before_field'] : ( give_get_option( 'currency_position', 'before' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '' );  | 
                                                        |
| 247 | - $field['after_field'] = ! empty( $field['after_field'] ) ? $field['after_field'] : ( give_get_option( 'currency_position', 'before' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '' );  | 
                                                        |
| 246 | +			$field['before_field'] = ! empty($field['before_field']) ? $field['before_field'] : (give_get_option('currency_position', 'before') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : ''); | 
                                                        |
| 247 | +			$field['after_field']  = ! empty($field['after_field']) ? $field['after_field'] : (give_get_option('currency_position', 'before') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : ''); | 
                                                        |
| 248 | 248 | break;  | 
                                                        
| 249 | 249 | |
| 250 | 250 | case 'decimal' :  | 
                                                        
| 251 | 251 | $field['attributes']['class'] .= ' give_input_decimal';  | 
                                                        
| 252 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_decimal( give_maybe_sanitize_amount( $field['value'] ), false, false ) : $field['value'] );  | 
                                                        |
| 252 | + $field['value'] = ( ! empty($field['value']) ? give_format_decimal(give_maybe_sanitize_amount($field['value']), false, false) : $field['value']);  | 
                                                        |
| 253 | 253 | break;  | 
                                                        
| 254 | 254 | |
| 255 | 255 | default :  | 
                                                        
@@ -257,20 +257,20 @@ discard block  | 
                                                    ||
| 257 | 257 | }  | 
                                                        
| 258 | 258 | |
| 259 | 259 | ?>  | 
                                                        
| 260 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>">  | 
                                                        |
| 261 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label>  | 
                                                        |
| 260 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>">  | 
                                                        |
| 261 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label>  | 
                                                        |
| 262 | 262 | <?php echo $field['before_field']; ?>  | 
                                                        
| 263 | 263 | <input  | 
                                                        
| 264 | - type="<?php echo esc_attr( $field['type'] ); ?>"  | 
                                                        |
| 265 | - style="<?php echo esc_attr( $field['style'] ); ?>"  | 
                                                        |
| 266 | - name="<?php echo give_get_field_name( $field ); ?>"  | 
                                                        |
| 267 | - id="<?php echo esc_attr( $field['id'] ); ?>"  | 
                                                        |
| 268 | - value="<?php echo esc_attr( $field['value'] ); ?>"  | 
                                                        |
| 269 | - <?php echo give_get_custom_attributes( $field ); ?>  | 
                                                        |
| 264 | + type="<?php echo esc_attr($field['type']); ?>"  | 
                                                        |
| 265 | + style="<?php echo esc_attr($field['style']); ?>"  | 
                                                        |
| 266 | + name="<?php echo give_get_field_name($field); ?>"  | 
                                                        |
| 267 | + id="<?php echo esc_attr($field['id']); ?>"  | 
                                                        |
| 268 | + value="<?php echo esc_attr($field['value']); ?>"  | 
                                                        |
| 269 | + <?php echo give_get_custom_attributes($field); ?>  | 
                                                        |
| 270 | 270 | />  | 
                                                        
| 271 | 271 | <?php echo $field['after_field']; ?>  | 
                                                        
| 272 | 272 | <?php  | 
                                                        
| 273 | - echo give_get_field_description( $field );  | 
                                                        |
| 273 | + echo give_get_field_description($field);  | 
                                                        |
| 274 | 274 | echo '</p>';  | 
                                                        
| 275 | 275 | }  | 
                                                        
| 276 | 276 | |
@@ -292,29 +292,29 @@ discard block  | 
                                                    ||
| 292 | 292 | * }  | 
                                                        
| 293 | 293 | * @return void  | 
                                                        
| 294 | 294 | */  | 
                                                        
| 295 | -function give_hidden_input( $field ) { | 
                                                        |
| 295 | +function give_hidden_input($field) { | 
                                                        |
| 296 | 296 | global $thepostid, $post;  | 
                                                        
| 297 | 297 | |
| 298 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid;  | 
                                                        |
| 299 | - $field['value'] = give_get_field_value( $field, $thepostid );  | 
                                                        |
| 298 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid;  | 
                                                        |
| 299 | + $field['value'] = give_get_field_value($field, $thepostid);  | 
                                                        |
| 300 | 300 | |
| 301 | 301 | // Custom attribute handling  | 
                                                        
| 302 | 302 | $custom_attributes = array();  | 
                                                        
| 303 | 303 | |
| 304 | -	if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { | 
                                                        |
| 304 | +	if ( ! empty($field['attributes']) && is_array($field['attributes'])) { | 
                                                        |
| 305 | 305 | |
| 306 | -		foreach ( $field['attributes'] as $attribute => $value ) { | 
                                                        |
| 307 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"';  | 
                                                        |
| 306 | +		foreach ($field['attributes'] as $attribute => $value) { | 
                                                        |
| 307 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"';  | 
                                                        |
| 308 | 308 | }  | 
                                                        
| 309 | 309 | }  | 
                                                        
| 310 | 310 | ?>  | 
                                                        
| 311 | 311 | |
| 312 | 312 | <input  | 
                                                        
| 313 | 313 | type="hidden"  | 
                                                        
| 314 | - name="<?php echo give_get_field_name( $field ); ?>"  | 
                                                        |
| 315 | - id="<?php echo esc_attr( $field['id'] ); ?>"  | 
                                                        |
| 316 | - value="<?php echo esc_attr( $field['value'] ); ?>"  | 
                                                        |
| 317 | - <?php echo give_get_custom_attributes( $field ); ?>  | 
                                                        |
| 314 | + name="<?php echo give_get_field_name($field); ?>"  | 
                                                        |
| 315 | + id="<?php echo esc_attr($field['id']); ?>"  | 
                                                        |
| 316 | + value="<?php echo esc_attr($field['value']); ?>"  | 
                                                        |
| 317 | + <?php echo give_get_custom_attributes($field); ?>  | 
                                                        |
| 318 | 318 | />  | 
                                                        
| 319 | 319 | <?php  | 
                                                        
| 320 | 320 | }  | 
                                                        
@@ -340,27 +340,27 @@ discard block  | 
                                                    ||
| 340 | 340 | * }  | 
                                                        
| 341 | 341 | * @return void  | 
                                                        
| 342 | 342 | */  | 
                                                        
| 343 | -function give_textarea_input( $field ) { | 
                                                        |
| 343 | +function give_textarea_input($field) { | 
                                                        |
| 344 | 344 | global $thepostid, $post;  | 
                                                        
| 345 | 345 | |
| 346 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid;  | 
                                                        |
| 347 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : '';  | 
                                                        |
| 348 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';  | 
                                                        |
| 349 | - $field['value'] = give_get_field_value( $field, $thepostid );  | 
                                                        |
| 346 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid;  | 
                                                        |
| 347 | + $field['style'] = isset($field['style']) ? $field['style'] : '';  | 
                                                        |
| 348 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';  | 
                                                        |
| 349 | + $field['value'] = give_get_field_value($field, $thepostid);  | 
                                                        |
| 350 | 350 | |
| 351 | 351 | ?>  | 
                                                        
| 352 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>">  | 
                                                        |
| 353 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label>  | 
                                                        |
| 352 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>">  | 
                                                        |
| 353 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label>  | 
                                                        |
| 354 | 354 | <textarea  | 
                                                        
| 355 | - style="<?php echo esc_attr( $field['style'] ); ?>"  | 
                                                        |
| 356 | - name="<?php echo give_get_field_name( $field ); ?>"  | 
                                                        |
| 357 | - id="<?php echo esc_attr( $field['id'] ); ?>"  | 
                                                        |
| 355 | + style="<?php echo esc_attr($field['style']); ?>"  | 
                                                        |
| 356 | + name="<?php echo give_get_field_name($field); ?>"  | 
                                                        |
| 357 | + id="<?php echo esc_attr($field['id']); ?>"  | 
                                                        |
| 358 | 358 | rows="10"  | 
                                                        
| 359 | 359 | cols="20"  | 
                                                        
| 360 | - <?php echo give_get_custom_attributes( $field ); ?>  | 
                                                        |
| 361 | - ><?php echo esc_textarea( $field['value'] ); ?></textarea>  | 
                                                        |
| 360 | + <?php echo give_get_custom_attributes($field); ?>  | 
                                                        |
| 361 | + ><?php echo esc_textarea($field['value']); ?></textarea>  | 
                                                        |
| 362 | 362 | <?php  | 
                                                        
| 363 | - echo give_get_field_description( $field );  | 
                                                        |
| 363 | + echo give_get_field_description($field);  | 
                                                        |
| 364 | 364 | echo '</p>';  | 
                                                        
| 365 | 365 | }  | 
                                                        
| 366 | 366 | |
@@ -384,29 +384,29 @@ discard block  | 
                                                    ||
| 384 | 384 | * }  | 
                                                        
| 385 | 385 | * @return void  | 
                                                        
| 386 | 386 | */  | 
                                                        
| 387 | -function give_wysiwyg( $field ) { | 
                                                        |
| 387 | +function give_wysiwyg($field) { | 
                                                        |
| 388 | 388 | global $thepostid, $post;  | 
                                                        
| 389 | 389 | |
| 390 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid;  | 
                                                        |
| 391 | - $field['value'] = give_get_field_value( $field, $thepostid );  | 
                                                        |
| 392 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : '';  | 
                                                        |
| 393 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';  | 
                                                        |
| 390 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid;  | 
                                                        |
| 391 | + $field['value'] = give_get_field_value($field, $thepostid);  | 
                                                        |
| 392 | + $field['style'] = isset($field['style']) ? $field['style'] : '';  | 
                                                        |
| 393 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';  | 
                                                        |
| 394 | 394 | |
| 395 | - $field['unique_field_id'] = give_get_field_name( $field );  | 
                                                        |
| 395 | + $field['unique_field_id'] = give_get_field_name($field);  | 
                                                        |
| 396 | 396 | $editor_attributes = array(  | 
                                                        
| 397 | - 'textarea_name' => isset( $field['repeatable_field_id'] ) ? $field['repeatable_field_id'] : $field['id'],  | 
                                                        |
| 397 | + 'textarea_name' => isset($field['repeatable_field_id']) ? $field['repeatable_field_id'] : $field['id'],  | 
                                                        |
| 398 | 398 | 'textarea_rows' => '10',  | 
                                                        
| 399 | - 'editor_css' => esc_attr( $field['style'] ),  | 
                                                        |
| 399 | + 'editor_css' => esc_attr($field['style']),  | 
                                                        |
| 400 | 400 | 'editor_class' => $field['attributes']['class'],  | 
                                                        
| 401 | 401 | );  | 
                                                        
| 402 | - $data_wp_editor = ' data-wp-editor="' . base64_encode( json_encode( array(  | 
                                                        |
| 402 | + $data_wp_editor = ' data-wp-editor="'.base64_encode(json_encode(array(  | 
                                                        |
| 403 | 403 | $field['value'],  | 
                                                        
| 404 | 404 | $field['unique_field_id'],  | 
                                                        
| 405 | 405 | $editor_attributes,  | 
                                                        
| 406 | - ) ) ) . '"';  | 
                                                        |
| 407 | - $data_wp_editor = isset( $field['repeatable_field_id'] ) ? $data_wp_editor : '';  | 
                                                        |
| 406 | + ))).'"';  | 
                                                        |
| 407 | + $data_wp_editor = isset($field['repeatable_field_id']) ? $data_wp_editor : '';  | 
                                                        |
| 408 | 408 | |
| 409 | - echo '<div class="give-field-wrap ' . $field['unique_field_id'] . '_field ' . esc_attr( $field['wrapper_class'] ) . '"' . $data_wp_editor . '><label for="' . $field['unique_field_id'] . '">' . wp_kses_post( $field['name'] ) . '</label>';  | 
                                                        |
| 409 | + echo '<div class="give-field-wrap '.$field['unique_field_id'].'_field '.esc_attr($field['wrapper_class']).'"'.$data_wp_editor.'><label for="'.$field['unique_field_id'].'">'.wp_kses_post($field['name']).'</label>';  | 
                                                        |
| 410 | 410 | |
| 411 | 411 | wp_editor(  | 
                                                        
| 412 | 412 | $field['value'],  | 
                                                        
@@ -414,7 +414,7 @@ discard block  | 
                                                    ||
| 414 | 414 | $editor_attributes  | 
                                                        
| 415 | 415 | );  | 
                                                        
| 416 | 416 | |
| 417 | - echo give_get_field_description( $field );  | 
                                                        |
| 417 | + echo give_get_field_description($field);  | 
                                                        |
| 418 | 418 | echo '</div>';  | 
                                                        
| 419 | 419 | }  | 
                                                        
| 420 | 420 | |
@@ -439,29 +439,29 @@ discard block  | 
                                                    ||
| 439 | 439 | * }  | 
                                                        
| 440 | 440 | * @return void  | 
                                                        
| 441 | 441 | */  | 
                                                        
| 442 | -function give_checkbox( $field ) { | 
                                                        |
| 442 | +function give_checkbox($field) { | 
                                                        |
| 443 | 443 | global $thepostid, $post;  | 
                                                        
| 444 | 444 | |
| 445 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid;  | 
                                                        |
| 446 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : '';  | 
                                                        |
| 447 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';  | 
                                                        |
| 448 | - $field['value'] = give_get_field_value( $field, $thepostid );  | 
                                                        |
| 449 | - $field['cbvalue'] = isset( $field['cbvalue'] ) ? $field['cbvalue'] : 'on';  | 
                                                        |
| 450 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id'];  | 
                                                        |
| 445 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid;  | 
                                                        |
| 446 | + $field['style'] = isset($field['style']) ? $field['style'] : '';  | 
                                                        |
| 447 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';  | 
                                                        |
| 448 | + $field['value'] = give_get_field_value($field, $thepostid);  | 
                                                        |
| 449 | + $field['cbvalue'] = isset($field['cbvalue']) ? $field['cbvalue'] : 'on';  | 
                                                        |
| 450 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id'];  | 
                                                        |
| 451 | 451 | ?>  | 
                                                        
| 452 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>">  | 
                                                        |
| 453 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label>  | 
                                                        |
| 452 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>">  | 
                                                        |
| 453 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label>  | 
                                                        |
| 454 | 454 | <input  | 
                                                        
| 455 | 455 | type="checkbox"  | 
                                                        
| 456 | - style="<?php echo esc_attr( $field['style'] ); ?>"  | 
                                                        |
| 457 | - name="<?php echo give_get_field_name( $field ); ?>"  | 
                                                        |
| 458 | - id="<?php echo esc_attr( $field['id'] ); ?>"  | 
                                                        |
| 459 | - value="<?php echo esc_attr( $field['cbvalue'] ); ?>"  | 
                                                        |
| 460 | - <?php echo checked( $field['value'], $field['cbvalue'], false ); ?>  | 
                                                        |
| 461 | - <?php echo give_get_custom_attributes( $field ); ?>  | 
                                                        |
| 456 | + style="<?php echo esc_attr($field['style']); ?>"  | 
                                                        |
| 457 | + name="<?php echo give_get_field_name($field); ?>"  | 
                                                        |
| 458 | + id="<?php echo esc_attr($field['id']); ?>"  | 
                                                        |
| 459 | + value="<?php echo esc_attr($field['cbvalue']); ?>"  | 
                                                        |
| 460 | + <?php echo checked($field['value'], $field['cbvalue'], false); ?>  | 
                                                        |
| 461 | + <?php echo give_get_custom_attributes($field); ?>  | 
                                                        |
| 462 | 462 | />  | 
                                                        
| 463 | 463 | <?php  | 
                                                        
| 464 | - echo give_get_field_description( $field );  | 
                                                        |
| 464 | + echo give_get_field_description($field);  | 
                                                        |
| 465 | 465 | echo '</p>';  | 
                                                        
| 466 | 466 | }  | 
                                                        
| 467 | 467 | |
@@ -487,29 +487,29 @@ discard block  | 
                                                    ||
| 487 | 487 | * }  | 
                                                        
| 488 | 488 | * @return void  | 
                                                        
| 489 | 489 | */  | 
                                                        
| 490 | -function give_select( $field ) { | 
                                                        |
| 490 | +function give_select($field) { | 
                                                        |
| 491 | 491 | global $thepostid, $post;  | 
                                                        
| 492 | 492 | |
| 493 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid;  | 
                                                        |
| 494 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : '';  | 
                                                        |
| 495 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';  | 
                                                        |
| 496 | - $field['value'] = give_get_field_value( $field, $thepostid );  | 
                                                        |
| 497 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id'];  | 
                                                        |
| 493 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid;  | 
                                                        |
| 494 | + $field['style'] = isset($field['style']) ? $field['style'] : '';  | 
                                                        |
| 495 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';  | 
                                                        |
| 496 | + $field['value'] = give_get_field_value($field, $thepostid);  | 
                                                        |
| 497 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id'];  | 
                                                        |
| 498 | 498 | ?>  | 
                                                        
| 499 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>">  | 
                                                        |
| 500 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label>  | 
                                                        |
| 499 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>">  | 
                                                        |
| 500 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label>  | 
                                                        |
| 501 | 501 | <select  | 
                                                        
| 502 | - id="<?php echo esc_attr( $field['id'] ); ?>"  | 
                                                        |
| 503 | - name="<?php echo give_get_field_name( $field ); ?>"  | 
                                                        |
| 504 | - style="<?php echo esc_attr( $field['style'] ) ?>"  | 
                                                        |
| 505 | - <?php echo give_get_custom_attributes( $field ); ?>  | 
                                                        |
| 502 | + id="<?php echo esc_attr($field['id']); ?>"  | 
                                                        |
| 503 | + name="<?php echo give_get_field_name($field); ?>"  | 
                                                        |
| 504 | + style="<?php echo esc_attr($field['style']) ?>"  | 
                                                        |
| 505 | + <?php echo give_get_custom_attributes($field); ?>  | 
                                                        |
| 506 | 506 | >  | 
                                                        
| 507 | 507 | <?php  | 
                                                        
| 508 | -	foreach ( $field['options'] as $key => $value ) { | 
                                                        |
| 509 | - echo '<option value="' . esc_attr( $key ) . '" ' . selected( esc_attr( $field['value'] ), esc_attr( $key ), false ) . '>' . esc_html( $value ) . '</option>';  | 
                                                        |
| 508 | +	foreach ($field['options'] as $key => $value) { | 
                                                        |
| 509 | + echo '<option value="'.esc_attr($key).'" '.selected(esc_attr($field['value']), esc_attr($key), false).'>'.esc_html($value).'</option>';  | 
                                                        |
| 510 | 510 | }  | 
                                                        
| 511 | 511 | echo '</select>';  | 
                                                        
| 512 | - echo give_get_field_description( $field );  | 
                                                        |
| 512 | + echo give_get_field_description($field);  | 
                                                        |
| 513 | 513 | echo '</p>';  | 
                                                        
| 514 | 514 | }  | 
                                                        
| 515 | 515 | |
@@ -536,32 +536,32 @@ discard block  | 
                                                    ||
| 536 | 536 | * }  | 
                                                        
| 537 | 537 | * @return void  | 
                                                        
| 538 | 538 | */  | 
                                                        
| 539 | -function give_radio( $field ) { | 
                                                        |
| 539 | +function give_radio($field) { | 
                                                        |
| 540 | 540 | global $thepostid, $post;  | 
                                                        
| 541 | 541 | |
| 542 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid;  | 
                                                        |
| 543 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : '';  | 
                                                        |
| 544 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';  | 
                                                        |
| 545 | - $field['value'] = give_get_field_value( $field, $thepostid );  | 
                                                        |
| 546 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id'];  | 
                                                        |
| 542 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid;  | 
                                                        |
| 543 | + $field['style'] = isset($field['style']) ? $field['style'] : '';  | 
                                                        |
| 544 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';  | 
                                                        |
| 545 | + $field['value'] = give_get_field_value($field, $thepostid);  | 
                                                        |
| 546 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id'];  | 
                                                        |
| 547 | 547 | |
| 548 | - echo '<fieldset class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><span class="give-field-label">' . wp_kses_post( $field['name'] ) . '</span><legend class="screen-reader-text">' . wp_kses_post( $field['name'] ) . '</legend><ul class="give-radios">';  | 
                                                        |
| 548 | + echo '<fieldset class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><span class="give-field-label">'.wp_kses_post($field['name']).'</span><legend class="screen-reader-text">'.wp_kses_post($field['name']).'</legend><ul class="give-radios">';  | 
                                                        |
| 549 | 549 | |
| 550 | -	foreach ( $field['options'] as $key => $value ) { | 
                                                        |
| 550 | +	foreach ($field['options'] as $key => $value) { | 
                                                        |
| 551 | 551 | |
| 552 | 552 | echo '<li><label><input  | 
                                                        
| 553 | - name="' . give_get_field_name( $field ) . '"  | 
                                                        |
| 554 | - value="' . esc_attr( $key ) . '"  | 
                                                        |
| 553 | + name="' . give_get_field_name($field).'"  | 
                                                        |
| 554 | + value="' . esc_attr($key).'"  | 
                                                        |
| 555 | 555 | type="radio"  | 
                                                        
| 556 | - style="' . esc_attr( $field['style'] ) . '"  | 
                                                        |
| 557 | - ' . checked( esc_attr( $field['value'] ), esc_attr( $key ), false ) . ' '  | 
                                                        |
| 558 | - . give_get_custom_attributes( $field ) . '  | 
                                                        |
| 559 | - /> ' . esc_html( $value ) . '</label>  | 
                                                        |
| 556 | + style="' . esc_attr($field['style']).'"  | 
                                                        |
| 557 | + ' . checked(esc_attr($field['value']), esc_attr($key), false).' '  | 
                                                        |
| 558 | + . give_get_custom_attributes($field).'  | 
                                                        |
| 559 | + /> ' . esc_html($value).'</label>  | 
                                                        |
| 560 | 560 | </li>';  | 
                                                        
| 561 | 561 | }  | 
                                                        
| 562 | 562 | echo '</ul>';  | 
                                                        
| 563 | 563 | |
| 564 | - echo give_get_field_description( $field );  | 
                                                        |
| 564 | + echo give_get_field_description($field);  | 
                                                        |
| 565 | 565 | echo '</fieldset>';  | 
                                                        
| 566 | 566 | }  | 
                                                        
| 567 | 567 | |
@@ -585,27 +585,27 @@ discard block  | 
                                                    ||
| 585 | 585 | * }  | 
                                                        
| 586 | 586 | * @return void  | 
                                                        
| 587 | 587 | */  | 
                                                        
| 588 | -function give_colorpicker( $field ) { | 
                                                        |
| 588 | +function give_colorpicker($field) { | 
                                                        |
| 589 | 589 | global $thepostid, $post;  | 
                                                        
| 590 | 590 | |
| 591 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid;  | 
                                                        |
| 592 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : '';  | 
                                                        |
| 593 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';  | 
                                                        |
| 594 | - $field['value'] = give_get_field_value( $field, $thepostid );  | 
                                                        |
| 595 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id'];  | 
                                                        |
| 591 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid;  | 
                                                        |
| 592 | + $field['style'] = isset($field['style']) ? $field['style'] : '';  | 
                                                        |
| 593 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';  | 
                                                        |
| 594 | + $field['value'] = give_get_field_value($field, $thepostid);  | 
                                                        |
| 595 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id'];  | 
                                                        |
| 596 | 596 | $field['type'] = 'text';  | 
                                                        
| 597 | 597 | ?>  | 
                                                        
| 598 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>">  | 
                                                        |
| 599 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label>  | 
                                                        |
| 598 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>">  | 
                                                        |
| 599 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label>  | 
                                                        |
| 600 | 600 | <input  | 
                                                        
| 601 | - type="<?php echo esc_attr( $field['type'] ); ?>"  | 
                                                        |
| 602 | - style="<?php echo esc_attr( $field['style'] ); ?>"  | 
                                                        |
| 603 | - name="<?php echo give_get_field_name( $field ); ?>"  | 
                                                        |
| 604 | - id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr( $field['value'] ); ?>"  | 
                                                        |
| 605 | - <?php echo give_get_custom_attributes( $field ); ?>  | 
                                                        |
| 601 | + type="<?php echo esc_attr($field['type']); ?>"  | 
                                                        |
| 602 | + style="<?php echo esc_attr($field['style']); ?>"  | 
                                                        |
| 603 | + name="<?php echo give_get_field_name($field); ?>"  | 
                                                        |
| 604 | + id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr($field['value']); ?>"  | 
                                                        |
| 605 | + <?php echo give_get_custom_attributes($field); ?>  | 
                                                        |
| 606 | 606 | />  | 
                                                        
| 607 | 607 | <?php  | 
                                                        
| 608 | - echo give_get_field_description( $field );  | 
                                                        |
| 608 | + echo give_get_field_description($field);  | 
                                                        |
| 609 | 609 | echo '</p>';  | 
                                                        
| 610 | 610 | }  | 
                                                        
| 611 | 611 | |
@@ -616,8 +616,8 @@ discard block  | 
                                                    ||
| 616 | 616 | *  | 
                                                        
| 617 | 617 | * @param array $field  | 
                                                        
| 618 | 618 | */  | 
                                                        
| 619 | -function give_file( $field ) { | 
                                                        |
| 620 | - give_media( $field );  | 
                                                        |
| 619 | +function give_file($field) { | 
                                                        |
| 620 | + give_media($field);  | 
                                                        |
| 621 | 621 | }  | 
                                                        
| 622 | 622 | |
| 623 | 623 | |
@@ -628,40 +628,40 @@ discard block  | 
                                                    ||
| 628 | 628 | *  | 
                                                        
| 629 | 629 | * @param array $field  | 
                                                        
| 630 | 630 | */  | 
                                                        
| 631 | -function give_media( $field ) { | 
                                                        |
| 631 | +function give_media($field) { | 
                                                        |
| 632 | 632 | global $thepostid, $post;  | 
                                                        
| 633 | 633 | |
| 634 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid;  | 
                                                        |
| 635 | - $button_label = esc_html__( sprintf( 'Add or Upload %s', ( 'file' === $field['type'] ? 'File' : 'Image' ) ), 'give' );  | 
                                                        |
| 634 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid;  | 
                                                        |
| 635 | +	$button_label = esc_html__(sprintf('Add or Upload %s', ('file' === $field['type'] ? 'File' : 'Image')), 'give'); | 
                                                        |
| 636 | 636 | |
| 637 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : '';  | 
                                                        |
| 638 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';  | 
                                                        |
| 639 | - $field['value'] = give_get_field_value( $field, $thepostid );  | 
                                                        |
| 640 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id'];  | 
                                                        |
| 637 | + $field['style'] = isset($field['style']) ? $field['style'] : '';  | 
                                                        |
| 638 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : '';  | 
                                                        |
| 639 | + $field['value'] = give_get_field_value($field, $thepostid);  | 
                                                        |
| 640 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id'];  | 
                                                        |
| 641 | 641 |  	$field['attributes']['class'] = "{$field['attributes']['class']} give-text-medium"; | 
                                                        
| 642 | 642 | |
| 643 | 643 | // Allow developer to save attachment ID or attachment url as metadata.  | 
                                                        
| 644 | - $field['fvalue'] = isset( $field['fvalue'] ) ? $field['fvalue'] : 'url';  | 
                                                        |
| 644 | + $field['fvalue'] = isset($field['fvalue']) ? $field['fvalue'] : 'url';  | 
                                                        |
| 645 | 645 | |
| 646 | - $allow_media_preview_tags = array( 'jpg', 'jpeg', 'png', 'gif', 'ico' );  | 
                                                        |
| 647 | - $preview_image_src = $field['value'] ? ( 'id' === $field['fvalue'] ? wp_get_attachment_url( $field['value'] ) : $field['value'] ) : '#';  | 
                                                        |
| 648 | - $preview_image_extension = $preview_image_src ? pathinfo( $preview_image_src, PATHINFO_EXTENSION ) : '';  | 
                                                        |
| 649 | - $is_show_preview = in_array( $preview_image_extension, $allow_media_preview_tags );  | 
                                                        |
| 646 | +	$allow_media_preview_tags = array('jpg', 'jpeg', 'png', 'gif', 'ico'); | 
                                                        |
| 647 | +	$preview_image_src        = $field['value'] ? ('id' === $field['fvalue'] ? wp_get_attachment_url($field['value']) : $field['value']) : '#'; | 
                                                        |
| 648 | + $preview_image_extension = $preview_image_src ? pathinfo($preview_image_src, PATHINFO_EXTENSION) : '';  | 
                                                        |
| 649 | + $is_show_preview = in_array($preview_image_extension, $allow_media_preview_tags);  | 
                                                        |
| 650 | 650 | ?>  | 
                                                        
| 651 | - <fieldset class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>">  | 
                                                        |
| 652 | - <label for="<?php echo give_get_field_name( $field ) ?>"><?php echo wp_kses_post( $field['name'] ); ?></label>  | 
                                                        |
| 651 | + <fieldset class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>">  | 
                                                        |
| 652 | + <label for="<?php echo give_get_field_name($field) ?>"><?php echo wp_kses_post($field['name']); ?></label>  | 
                                                        |
| 653 | 653 | <input  | 
                                                        
| 654 | - name="<?php echo give_get_field_name( $field ); ?>"  | 
                                                        |
| 655 | - id="<?php echo esc_attr( $field['id'] ); ?>"  | 
                                                        |
| 654 | + name="<?php echo give_get_field_name($field); ?>"  | 
                                                        |
| 655 | + id="<?php echo esc_attr($field['id']); ?>"  | 
                                                        |
| 656 | 656 | type="text"  | 
                                                        
| 657 | 657 | value="<?php echo $field['value']; ?>"  | 
                                                        
| 658 | - style="<?php echo esc_attr( $field['style'] ); ?>"  | 
                                                        |
| 659 | - <?php echo give_get_custom_attributes( $field ); ?>  | 
                                                        |
| 658 | + style="<?php echo esc_attr($field['style']); ?>"  | 
                                                        |
| 659 | + <?php echo give_get_custom_attributes($field); ?>  | 
                                                        |
| 660 | 660 | />    <input class="give-upload-button button" type="button" value="<?php echo $button_label; ?>" data-fvalue="<?php echo $field['fvalue']; ?>" data-field-type="<?php echo $field['type']; ?>">  | 
                                                        
| 661 | - <?php echo give_get_field_description( $field ); ?>  | 
                                                        |
| 661 | + <?php echo give_get_field_description($field); ?>  | 
                                                        |
| 662 | 662 | <div class="give-image-thumb<?php echo ! $field['value'] || ! $is_show_preview ? ' give-hidden' : ''; ?>">  | 
                                                        
| 663 | 663 | <span class="give-delete-image-thumb dashicons dashicons-no-alt"></span>  | 
                                                        
| 664 | - <img src="<?php echo $preview_image_src ; ?>" alt="">  | 
                                                        |
| 664 | + <img src="<?php echo $preview_image_src; ?>" alt="">  | 
                                                        |
| 665 | 665 | </div>  | 
                                                        
| 666 | 666 | </fieldset>  | 
                                                        
| 667 | 667 | <?php  | 
                                                        
@@ -676,27 +676,27 @@ discard block  | 
                                                    ||
| 676 | 676 | *  | 
                                                        
| 677 | 677 | * @return void  | 
                                                        
| 678 | 678 | */  | 
                                                        
| 679 | -function give_default_gateway( $field ) { | 
                                                        |
| 679 | +function give_default_gateway($field) { | 
                                                        |
| 680 | 680 | global $thepostid, $post;  | 
                                                        
| 681 | 681 | |
| 682 | 682 | // get all active payment gateways.  | 
                                                        
| 683 | - $gateways = give_get_enabled_payment_gateways( $thepostid );  | 
                                                        |
| 683 | + $gateways = give_get_enabled_payment_gateways($thepostid);  | 
                                                        |
| 684 | 684 | $field['options'] = array();  | 
                                                        
| 685 | 685 | |
| 686 | 686 | // Set field option value.  | 
                                                        
| 687 | -	if ( ! empty( $gateways ) ) { | 
                                                        |
| 688 | -		foreach ( $gateways as $key => $option ) { | 
                                                        |
| 689 | - $field['options'][ $key ] = $option['admin_label'];  | 
                                                        |
| 687 | +	if ( ! empty($gateways)) { | 
                                                        |
| 688 | +		foreach ($gateways as $key => $option) { | 
                                                        |
| 689 | + $field['options'][$key] = $option['admin_label'];  | 
                                                        |
| 690 | 690 | }  | 
                                                        
| 691 | 691 | }  | 
                                                        
| 692 | 692 | |
| 693 | 693 | // Add a field to the Give Form admin single post view of this field  | 
                                                        
| 694 | -	if ( is_object( $post ) && 'give_forms' === $post->post_type ) { | 
                                                        |
| 695 | - $field['options'] = array_merge( array( 'global' => esc_html__( 'Global Default', 'give' ) ), $field['options'] );  | 
                                                        |
| 694 | +	if (is_object($post) && 'give_forms' === $post->post_type) { | 
                                                        |
| 695 | +		$field['options'] = array_merge(array('global' => esc_html__('Global Default', 'give')), $field['options']); | 
                                                        |
| 696 | 696 | }  | 
                                                        
| 697 | 697 | |
| 698 | 698 | // Render select field.  | 
                                                        
| 699 | - give_select( $field );  | 
                                                        |
| 699 | + give_select($field);  | 
                                                        |
| 700 | 700 | }  | 
                                                        
| 701 | 701 | |
| 702 | 702 | /**  | 
                                                        
@@ -718,13 +718,13 @@ discard block  | 
                                                    ||
| 718 | 718 | * @return void  | 
                                                        
| 719 | 719 | */  | 
                                                        
| 720 | 720 | |
| 721 | -function give_docs_link( $field ) { | 
                                                        |
| 722 | - $field['url'] = isset( $field['url'] ) ? $field['url'] : 'https://givewp.com/documentation';  | 
                                                        |
| 723 | - $field['title'] = isset( $field['title'] ) ? $field['title'] : 'Documentation';  | 
                                                        |
| 721 | +function give_docs_link($field) { | 
                                                        |
| 722 | + $field['url'] = isset($field['url']) ? $field['url'] : 'https://givewp.com/documentation';  | 
                                                        |
| 723 | + $field['title'] = isset($field['title']) ? $field['title'] : 'Documentation';  | 
                                                        |
| 724 | 724 | |
| 725 | - echo '<p class="give-docs-link"><a href="' . esc_url( $field['url'] )  | 
                                                        |
| 725 | + echo '<p class="give-docs-link"><a href="'.esc_url($field['url'])  | 
                                                        |
| 726 | 726 | . '" target="_blank">'  | 
                                                        
| 727 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $field['title'] )  | 
                                                        |
| 727 | +	     . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $field['title']) | 
                                                        |
| 728 | 728 | . '<span class="dashicons dashicons-editor-help"></span></a></p>';  | 
                                                        
| 729 | 729 | }  | 
                                                        
| 730 | 730 | |
@@ -740,13 +740,13 @@ discard block  | 
                                                    ||
| 740 | 740 | *  | 
                                                        
| 741 | 741 | * @return mixed  | 
                                                        
| 742 | 742 | */  | 
                                                        
| 743 | -function give_get_field_value( $field, $postid ) { | 
                                                        |
| 744 | -	if ( isset( $field['attributes']['value'] ) ) { | 
                                                        |
| 743 | +function give_get_field_value($field, $postid) { | 
                                                        |
| 744 | +	if (isset($field['attributes']['value'])) { | 
                                                        |
| 745 | 745 | return $field['attributes']['value'];  | 
                                                        
| 746 | 746 | }  | 
                                                        
| 747 | 747 | |
| 748 | 748 | // Get value from db.  | 
                                                        
| 749 | - $field_value = give_get_meta( $postid, $field['id'], true );  | 
                                                        |
| 749 | + $field_value = give_get_meta($postid, $field['id'], true);  | 
                                                        |
| 750 | 750 | |
| 751 | 751 | /**  | 
                                                        
| 752 | 752 | * Filter the field value before apply default value.  | 
                                                        
@@ -755,10 +755,10 @@ discard block  | 
                                                    ||
| 755 | 755 | *  | 
                                                        
| 756 | 756 | * @param mixed $field_value Field value.  | 
                                                        
| 757 | 757 | */  | 
                                                        
| 758 | -	$field_value = apply_filters( "{$field['id']}_field_value", $field_value, $field, $postid ); | 
                                                        |
| 758 | +	$field_value = apply_filters("{$field['id']}_field_value", $field_value, $field, $postid); | 
                                                        |
| 759 | 759 | |
| 760 | 760 | // Set default value if no any data saved to db.  | 
                                                        
| 761 | -	if ( ! $field_value && isset( $field['default'] ) ) { | 
                                                        |
| 761 | +	if ( ! $field_value && isset($field['default'])) { | 
                                                        |
| 762 | 762 | $field_value = $field['default'];  | 
                                                        
| 763 | 763 | }  | 
                                                        
| 764 | 764 | |
@@ -775,20 +775,20 @@ discard block  | 
                                                    ||
| 775 | 775 | *  | 
                                                        
| 776 | 776 | * @return string  | 
                                                        
| 777 | 777 | */  | 
                                                        
| 778 | -function give_get_field_description( $field ) { | 
                                                        |
| 778 | +function give_get_field_description($field) { | 
                                                        |
| 779 | 779 | $field_desc_html = '';  | 
                                                        
| 780 | 780 | $description = '';  | 
                                                        
| 781 | 781 | |
| 782 | 782 | // Check for both `description` and `desc`.  | 
                                                        
| 783 | -	if ( isset( $field['description'] ) ) { | 
                                                        |
| 783 | +	if (isset($field['description'])) { | 
                                                        |
| 784 | 784 | $description = $field['description'];  | 
                                                        
| 785 | -	} elseif ( isset( $field['desc'] ) ) { | 
                                                        |
| 785 | +	} elseif (isset($field['desc'])) { | 
                                                        |
| 786 | 786 | $description = $field['desc'];  | 
                                                        
| 787 | 787 | }  | 
                                                        
| 788 | 788 | |
| 789 | 789 | // Set if there is a description.  | 
                                                        
| 790 | -	if ( ! empty( $description ) ) { | 
                                                        |
| 791 | - $field_desc_html = '<span class="give-field-description">' . wp_kses_post( $description ) . '</span>';  | 
                                                        |
| 790 | +	if ( ! empty($description)) { | 
                                                        |
| 791 | + $field_desc_html = '<span class="give-field-description">'.wp_kses_post($description).'</span>';  | 
                                                        |
| 792 | 792 | }  | 
                                                        
| 793 | 793 | |
| 794 | 794 | return $field_desc_html;  | 
                                                        
@@ -804,18 +804,18 @@ discard block  | 
                                                    ||
| 804 | 804 | *  | 
                                                        
| 805 | 805 | * @return string  | 
                                                        
| 806 | 806 | */  | 
                                                        
| 807 | -function give_get_custom_attributes( $field ) { | 
                                                        |
| 807 | +function give_get_custom_attributes($field) { | 
                                                        |
| 808 | 808 | // Custom attribute handling  | 
                                                        
| 809 | 809 | $custom_attributes = array();  | 
                                                        
| 810 | 810 | |
| 811 | -	if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { | 
                                                        |
| 811 | +	if ( ! empty($field['attributes']) && is_array($field['attributes'])) { | 
                                                        |
| 812 | 812 | |
| 813 | -		foreach ( $field['attributes'] as $attribute => $value ) { | 
                                                        |
| 814 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"';  | 
                                                        |
| 813 | +		foreach ($field['attributes'] as $attribute => $value) { | 
                                                        |
| 814 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"';  | 
                                                        |
| 815 | 815 | }  | 
                                                        
| 816 | 816 | }  | 
                                                        
| 817 | 817 | |
| 818 | - return implode( ' ', $custom_attributes );  | 
                                                        |
| 818 | +	return implode(' ', $custom_attributes); | 
                                                        |
| 819 | 819 | }  | 
                                                        
| 820 | 820 | |
| 821 | 821 | /**  | 
                                                        
@@ -831,8 +831,8 @@ discard block  | 
                                                    ||
| 831 | 831 | *  | 
                                                        
| 832 | 832 | * @return string  | 
                                                        
| 833 | 833 | */  | 
                                                        
| 834 | -function give_get_repeater_field_value( $field, $field_group, $fields ) { | 
                                                        |
| 835 | - $field_value = ( isset( $field_group[ $field['id'] ] ) ? $field_group[ $field['id'] ] : '' );  | 
                                                        |
| 834 | +function give_get_repeater_field_value($field, $field_group, $fields) { | 
                                                        |
| 835 | + $field_value = (isset($field_group[$field['id']]) ? $field_group[$field['id']] : '');  | 
                                                        |
| 836 | 836 | |
| 837 | 837 | /**  | 
                                                        
| 838 | 838 | * Filter the specific repeater field value  | 
                                                        
@@ -841,7 +841,7 @@ discard block  | 
                                                    ||
| 841 | 841 | *  | 
                                                        
| 842 | 842 | * @param string $field_id  | 
                                                        
| 843 | 843 | */  | 
                                                        
| 844 | -	$field_value = apply_filters( "give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields ); | 
                                                        |
| 844 | +	$field_value = apply_filters("give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields); | 
                                                        |
| 845 | 845 | |
| 846 | 846 | /**  | 
                                                        
| 847 | 847 | * Filter the repeater field value  | 
                                                        
@@ -850,7 +850,7 @@ discard block  | 
                                                    ||
| 850 | 850 | *  | 
                                                        
| 851 | 851 | * @param string $field_id  | 
                                                        
| 852 | 852 | */  | 
                                                        
| 853 | - $field_value = apply_filters( 'give_get_repeater_field_value', $field_value, $field, $field_group, $fields );  | 
                                                        |
| 853 | +	$field_value = apply_filters('give_get_repeater_field_value', $field_value, $field, $field_group, $fields); | 
                                                        |
| 854 | 854 | |
| 855 | 855 | return $field_value;  | 
                                                        
| 856 | 856 | }  | 
                                                        
@@ -868,7 +868,7 @@ discard block  | 
                                                    ||
| 868 | 868 | *  | 
                                                        
| 869 | 869 | * @return string  | 
                                                        
| 870 | 870 | */  | 
                                                        
| 871 | -function give_get_repeater_field_id( $field, $fields, $default = false ) { | 
                                                        |
| 871 | +function give_get_repeater_field_id($field, $fields, $default = false) { | 
                                                        |
| 872 | 872 |  	$row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; | 
                                                        
| 873 | 873 | |
| 874 | 874 | // Get field id.  | 
                                                        
@@ -881,7 +881,7 @@ discard block  | 
                                                    ||
| 881 | 881 | *  | 
                                                        
| 882 | 882 | * @param string $field_id  | 
                                                        
| 883 | 883 | */  | 
                                                        
| 884 | -	$field_id = apply_filters( "give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default ); | 
                                                        |
| 884 | +	$field_id = apply_filters("give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default); | 
                                                        |
| 885 | 885 | |
| 886 | 886 | /**  | 
                                                        
| 887 | 887 | * Filter the repeater field id  | 
                                                        
@@ -890,7 +890,7 @@ discard block  | 
                                                    ||
| 890 | 890 | *  | 
                                                        
| 891 | 891 | * @param string $field_id  | 
                                                        
| 892 | 892 | */  | 
                                                        
| 893 | - $field_id = apply_filters( 'give_get_repeater_field_id', $field_id, $field, $fields, $default );  | 
                                                        |
| 893 | +	$field_id = apply_filters('give_get_repeater_field_id', $field_id, $field, $fields, $default); | 
                                                        |
| 894 | 894 | |
| 895 | 895 | return $field_id;  | 
                                                        
| 896 | 896 | }  | 
                                                        
@@ -905,8 +905,8 @@ discard block  | 
                                                    ||
| 905 | 905 | *  | 
                                                        
| 906 | 906 | * @return string  | 
                                                        
| 907 | 907 | */  | 
                                                        
| 908 | -function give_get_field_name( $field ) { | 
                                                        |
| 909 | - $field_name = esc_attr( empty( $field['repeat'] ) ? $field['id'] : $field['repeatable_field_id'] );  | 
                                                        |
| 908 | +function give_get_field_name($field) { | 
                                                        |
| 909 | + $field_name = esc_attr(empty($field['repeat']) ? $field['id'] : $field['repeatable_field_id']);  | 
                                                        |
| 910 | 910 | |
| 911 | 911 | /**  | 
                                                        
| 912 | 912 | * Filter the field name.  | 
                                                        
@@ -915,7 +915,7 @@ discard block  | 
                                                    ||
| 915 | 915 | *  | 
                                                        
| 916 | 916 | * @param string $field_name  | 
                                                        
| 917 | 917 | */  | 
                                                        
| 918 | - $field_name = apply_filters( 'give_get_field_name', $field_name, $field );  | 
                                                        |
| 918 | +	$field_name = apply_filters('give_get_field_name', $field_name, $field); | 
                                                        |
| 919 | 919 | |
| 920 | 920 | return $field_name;  | 
                                                        
| 921 | 921 | }  | 
                                                        
@@ -932,39 +932,39 @@ discard block  | 
                                                    ||
| 932 | 932 | *  | 
                                                        
| 933 | 933 | * @return void  | 
                                                        
| 934 | 934 | */  | 
                                                        
| 935 | -function _give_metabox_form_data_repeater_fields( $fields ) { | 
                                                        |
| 935 | +function _give_metabox_form_data_repeater_fields($fields) { | 
                                                        |
| 936 | 936 | global $thepostid, $post;  | 
                                                        
| 937 | 937 | |
| 938 | 938 | // Bailout.  | 
                                                        
| 939 | -	if ( ! isset( $fields['fields'] ) || empty( $fields['fields'] ) ) { | 
                                                        |
| 939 | +	if ( ! isset($fields['fields']) || empty($fields['fields'])) { | 
                                                        |
| 940 | 940 | return;  | 
                                                        
| 941 | 941 | }  | 
                                                        
| 942 | 942 | |
| 943 | - $group_numbering = isset( $fields['options']['group_numbering'] ) ? (int) $fields['options']['group_numbering'] : 0;  | 
                                                        |
| 944 | - $close_tabs = isset( $fields['options']['close_tabs'] ) ? (int) $fields['options']['close_tabs'] : 0;  | 
                                                        |
| 943 | + $group_numbering = isset($fields['options']['group_numbering']) ? (int) $fields['options']['group_numbering'] : 0;  | 
                                                        |
| 944 | + $close_tabs = isset($fields['options']['close_tabs']) ? (int) $fields['options']['close_tabs'] : 0;  | 
                                                        |
| 945 | 945 | ?>  | 
                                                        
| 946 | 946 |  	<div class="give-repeatable-field-section" id="<?php echo "{$fields['id']}_field"; ?>" | 
                                                        
| 947 | 947 | data-group-numbering="<?php echo $group_numbering; ?>" data-close-tabs="<?php echo $close_tabs; ?>">  | 
                                                        
| 948 | - <?php if ( ! empty( $fields['name'] ) ) : ?>  | 
                                                        |
| 948 | + <?php if ( ! empty($fields['name'])) : ?>  | 
                                                        |
| 949 | 949 | <p class="give-repeater-field-name"><?php echo $fields['name']; ?></p>  | 
                                                        
| 950 | 950 | <?php endif; ?>  | 
                                                        
| 951 | 951 | |
| 952 | - <?php if ( ! empty( $fields['description'] ) ) : ?>  | 
                                                        |
| 952 | + <?php if ( ! empty($fields['description'])) : ?>  | 
                                                        |
| 953 | 953 | <p class="give-repeater-field-description"><?php echo $fields['description']; ?></p>  | 
                                                        
| 954 | 954 | <?php endif; ?>  | 
                                                        
| 955 | 955 | |
| 956 | 956 | <table class="give-repeatable-fields-section-wrapper" cellspacing="0">  | 
                                                        
| 957 | 957 | <?php  | 
                                                        
| 958 | - $repeater_field_values = give_get_meta( $thepostid, $fields['id'], true );  | 
                                                        |
| 959 | - $header_title = isset( $fields['options']['header_title'] )  | 
                                                        |
| 958 | + $repeater_field_values = give_get_meta($thepostid, $fields['id'], true);  | 
                                                        |
| 959 | + $header_title = isset($fields['options']['header_title'])  | 
                                                        |
| 960 | 960 | ? $fields['options']['header_title']  | 
                                                        
| 961 | - : esc_attr__( 'Group', 'give' );  | 
                                                        |
| 961 | +				: esc_attr__('Group', 'give'); | 
                                                        |
| 962 | 962 | |
| 963 | 963 | $add_default_donation_field = false;  | 
                                                        
| 964 | 964 | |
| 965 | 965 | // Check if level is not created or we have to add default level.  | 
                                                        
| 966 | -			if ( is_array( $repeater_field_values ) && ( $fields_count = count( $repeater_field_values ) ) ) { | 
                                                        |
| 967 | - $repeater_field_values = array_values( $repeater_field_values );  | 
                                                        |
| 966 | +			if (is_array($repeater_field_values) && ($fields_count = count($repeater_field_values))) { | 
                                                        |
| 967 | + $repeater_field_values = array_values($repeater_field_values);  | 
                                                        |
| 968 | 968 |  			} else { | 
                                                        
| 969 | 969 | $fields_count = 1;  | 
                                                        
| 970 | 970 | $add_default_donation_field = true;  | 
                                                        
@@ -977,59 +977,59 @@ discard block  | 
                                                    ||
| 977 | 977 | <div class="give-row-head give-move">  | 
                                                        
| 978 | 978 | <button type="button" class="handlediv button-link"><span class="toggle-indicator"></span>  | 
                                                        
| 979 | 979 | </button>  | 
                                                        
| 980 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">-</span>  | 
                                                        |
| 980 | +						<span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">-</span> | 
                                                        |
| 981 | 981 | <h2>  | 
                                                        
| 982 | 982 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span>  | 
                                                        
| 983 | 983 | </h2>  | 
                                                        
| 984 | 984 | </div>  | 
                                                        
| 985 | 985 | <div class="give-row-body">  | 
                                                        
| 986 | - <?php foreach ( $fields['fields'] as $field ) : ?>  | 
                                                        |
| 987 | -							<?php if ( ! give_is_field_callback_exist( $field ) ) { | 
                                                        |
| 986 | + <?php foreach ($fields['fields'] as $field) : ?>  | 
                                                        |
| 987 | +							<?php if ( ! give_is_field_callback_exist($field)) { | 
                                                        |
| 988 | 988 | continue;  | 
                                                        
| 989 | 989 | } ?>  | 
                                                        
| 990 | 990 | <?php  | 
                                                        
| 991 | 991 | $field['repeat'] = true;  | 
                                                        
| 992 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields );  | 
                                                        |
| 993 | - $field['id'] = str_replace( array( '[', ']' ), array(  | 
                                                        |
| 992 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields);  | 
                                                        |
| 993 | +							$field['id']                  = str_replace(array('[', ']'), array( | 
                                                        |
| 994 | 994 | '_',  | 
                                                        
| 995 | 995 | '',  | 
                                                        
| 996 | - ), $field['repeatable_field_id'] );  | 
                                                        |
| 996 | + ), $field['repeatable_field_id']);  | 
                                                        |
| 997 | 997 | ?>  | 
                                                        
| 998 | - <?php give_render_field( $field ); ?>  | 
                                                        |
| 998 | + <?php give_render_field($field); ?>  | 
                                                        |
| 999 | 999 | <?php endforeach; ?>  | 
                                                        
| 1000 | 1000 | </div>  | 
                                                        
| 1001 | 1001 | </td>  | 
                                                        
| 1002 | 1002 | </tr>  | 
                                                        
| 1003 | 1003 | |
| 1004 | - <?php if ( ! empty( $repeater_field_values ) ) : ?>  | 
                                                        |
| 1004 | + <?php if ( ! empty($repeater_field_values)) : ?>  | 
                                                        |
| 1005 | 1005 | <!--Stored repeater field group-->  | 
                                                        
| 1006 | - <?php foreach ( $repeater_field_values as $index => $field_group ) : ?>  | 
                                                        |
| 1006 | + <?php foreach ($repeater_field_values as $index => $field_group) : ?>  | 
                                                        |
| 1007 | 1007 | <tr class="give-row">  | 
                                                        
| 1008 | 1008 | <td class="give-repeater-field-wrap give-column" colspan="2">  | 
                                                        
| 1009 | 1009 | <div class="give-row-head give-move">  | 
                                                        
| 1010 | 1010 | <button type="button" class="handlediv button-link">  | 
                                                        
| 1011 | 1011 | <span class="toggle-indicator"></span></button>  | 
                                                        
| 1012 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">-  | 
                                                        |
| 1012 | +								<span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- | 
                                                        |
| 1013 | 1013 | </span>  | 
                                                        
| 1014 | 1014 | <h2>  | 
                                                        
| 1015 | 1015 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span>  | 
                                                        
| 1016 | 1016 | </h2>  | 
                                                        
| 1017 | 1017 | </div>  | 
                                                        
| 1018 | 1018 | <div class="give-row-body">  | 
                                                        
| 1019 | - <?php foreach ( $fields['fields'] as $field ) : ?>  | 
                                                        |
| 1020 | -									<?php if ( ! give_is_field_callback_exist( $field ) ) { | 
                                                        |
| 1019 | + <?php foreach ($fields['fields'] as $field) : ?>  | 
                                                        |
| 1020 | +									<?php if ( ! give_is_field_callback_exist($field)) { | 
                                                        |
| 1021 | 1021 | continue;  | 
                                                        
| 1022 | 1022 | } ?>  | 
                                                        
| 1023 | 1023 | <?php  | 
                                                        
| 1024 | 1024 | $field['repeat'] = true;  | 
                                                        
| 1025 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, $index );  | 
                                                        |
| 1026 | - $field['attributes']['value'] = give_get_repeater_field_value( $field, $field_group, $fields );  | 
                                                        |
| 1027 | - $field['id'] = str_replace( array( '[', ']' ), array(  | 
                                                        |
| 1025 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, $index);  | 
                                                        |
| 1026 | + $field['attributes']['value'] = give_get_repeater_field_value($field, $field_group, $fields);  | 
                                                        |
| 1027 | +									$field['id']                  = str_replace(array('[', ']'), array( | 
                                                        |
| 1028 | 1028 | '_',  | 
                                                        
| 1029 | 1029 | '',  | 
                                                        
| 1030 | - ), $field['repeatable_field_id'] );  | 
                                                        |
| 1030 | + ), $field['repeatable_field_id']);  | 
                                                        |
| 1031 | 1031 | ?>  | 
                                                        
| 1032 | - <?php give_render_field( $field ); ?>  | 
                                                        |
| 1032 | + <?php give_render_field($field); ?>  | 
                                                        |
| 1033 | 1033 | <?php endforeach; ?>  | 
                                                        
| 1034 | 1034 | </div>  | 
                                                        
| 1035 | 1035 | </td>  | 
                                                        
@@ -1037,14 +1037,14 @@ discard block  | 
                                                    ||
| 1037 | 1037 | <?php endforeach;  | 
                                                        
| 1038 | 1038 | ; ?>  | 
                                                        
| 1039 | 1039 | |
| 1040 | - <?php elseif ( $add_default_donation_field ) : ?>  | 
                                                        |
| 1040 | + <?php elseif ($add_default_donation_field) : ?>  | 
                                                        |
| 1041 | 1041 | <!--Default repeater field group-->  | 
                                                        
| 1042 | 1042 | <tr class="give-row">  | 
                                                        
| 1043 | 1043 | <td class="give-repeater-field-wrap give-column" colspan="2">  | 
                                                        
| 1044 | 1044 | <div class="give-row-head give-move">  | 
                                                        
| 1045 | 1045 | <button type="button" class="handlediv button-link">  | 
                                                        
| 1046 | 1046 | <span class="toggle-indicator"></span></button>  | 
                                                        
| 1047 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">-  | 
                                                        |
| 1047 | +							<span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- | 
                                                        |
| 1048 | 1048 | </span>  | 
                                                        
| 1049 | 1049 | <h2>  | 
                                                        
| 1050 | 1050 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span>  | 
                                                        
@@ -1052,19 +1052,19 @@ discard block  | 
                                                    ||
| 1052 | 1052 | </div>  | 
                                                        
| 1053 | 1053 | <div class="give-row-body">  | 
                                                        
| 1054 | 1054 | <?php  | 
                                                        
| 1055 | - foreach ( $fields['fields'] as $field ) :  | 
                                                        |
| 1056 | -								if ( ! give_is_field_callback_exist( $field ) ) { | 
                                                        |
| 1055 | + foreach ($fields['fields'] as $field) :  | 
                                                        |
| 1056 | +								if ( ! give_is_field_callback_exist($field)) { | 
                                                        |
| 1057 | 1057 | continue;  | 
                                                        
| 1058 | 1058 | }  | 
                                                        
| 1059 | 1059 | |
| 1060 | 1060 | $field['repeat'] = true;  | 
                                                        
| 1061 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, 0 );  | 
                                                        |
| 1062 | -								$field['attributes']['value'] = apply_filters( "give_default_field_group_field_{$field['id']}_value", ( ! empty( $field['default'] ) ? $field['default'] : '' ), $field ); | 
                                                        |
| 1063 | - $field['id'] = str_replace( array( '[', ']' ), array(  | 
                                                        |
| 1061 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, 0);  | 
                                                        |
| 1062 | +								$field['attributes']['value'] = apply_filters("give_default_field_group_field_{$field['id']}_value", ( ! empty($field['default']) ? $field['default'] : ''), $field); | 
                                                        |
| 1063 | +								$field['id']                  = str_replace(array('[', ']'), array( | 
                                                        |
| 1064 | 1064 | '_',  | 
                                                        
| 1065 | 1065 | '',  | 
                                                        
| 1066 | - ), $field['repeatable_field_id'] );  | 
                                                        |
| 1067 | - give_render_field( $field );  | 
                                                        |
| 1066 | + ), $field['repeatable_field_id']);  | 
                                                        |
| 1067 | + give_render_field($field);  | 
                                                        |
| 1068 | 1068 | endforeach;  | 
                                                        
| 1069 | 1069 | ?>  | 
                                                        
| 1070 | 1070 | </div>  | 
                                                        
@@ -1075,9 +1075,9 @@ discard block  | 
                                                    ||
| 1075 | 1075 | <tfoot>  | 
                                                        
| 1076 | 1076 | <tr>  | 
                                                        
| 1077 | 1077 | <?php  | 
                                                        
| 1078 | - $add_row_btn_title = isset( $fields['options']['add_button'] )  | 
                                                        |
| 1078 | + $add_row_btn_title = isset($fields['options']['add_button'])  | 
                                                        |
| 1079 | 1079 | ? $add_row_btn_title = $fields['options']['add_button']  | 
                                                        
| 1080 | - : esc_html__( 'Add Row', 'give' );  | 
                                                        |
| 1080 | +					: esc_html__('Add Row', 'give'); | 
                                                        |
| 1081 | 1081 | ?>  | 
                                                        
| 1082 | 1082 | <td colspan="2" class="give-add-repeater-field-section-row-wrap">  | 
                                                        
| 1083 | 1083 | <span class="button button-primary give-add-repeater-field-section-row"><?php echo $add_row_btn_title; ?></span>  | 
                                                        
@@ -1107,10 +1107,10 @@ discard block  | 
                                                    ||
| 1107 | 1107 | *  | 
                                                        
| 1108 | 1108 | * @param string  | 
                                                        
| 1109 | 1109 | */  | 
                                                        
| 1110 | -	$default_current_tab = apply_filters( "give_default_setting_tab_{$current_setting_page}", 'general' ); | 
                                                        |
| 1110 | +	$default_current_tab = apply_filters("give_default_setting_tab_{$current_setting_page}", 'general'); | 
                                                        |
| 1111 | 1111 | |
| 1112 | 1112 | // Get current tab.  | 
                                                        
| 1113 | - $current_tab = empty( $_GET['tab'] ) ? $default_current_tab : urldecode( $_GET['tab'] );  | 
                                                        |
| 1113 | + $current_tab = empty($_GET['tab']) ? $default_current_tab : urldecode($_GET['tab']);  | 
                                                        |
| 1114 | 1114 | |
| 1115 | 1115 | // Output.  | 
                                                        
| 1116 | 1116 | return $current_tab;  | 
                                                        
@@ -1134,10 +1134,10 @@ discard block  | 
                                                    ||
| 1134 | 1134 | *  | 
                                                        
| 1135 | 1135 | * @param string  | 
                                                        
| 1136 | 1136 | */  | 
                                                        
| 1137 | -	$default_current_section = apply_filters( "give_default_setting_tab_section_{$current_tab}", '' ); | 
                                                        |
| 1137 | +	$default_current_section = apply_filters("give_default_setting_tab_section_{$current_tab}", ''); | 
                                                        |
| 1138 | 1138 | |
| 1139 | 1139 | // Get current section.  | 
                                                        
| 1140 | - $current_section = empty( $_REQUEST['section'] ) ? $default_current_section : urldecode( $_REQUEST['section'] );  | 
                                                        |
| 1140 | + $current_section = empty($_REQUEST['section']) ? $default_current_section : urldecode($_REQUEST['section']);  | 
                                                        |
| 1141 | 1141 | |
| 1142 | 1142 | // Output.  | 
                                                        
| 1143 | 1143 | return $current_section;  | 
                                                        
@@ -1151,7 +1151,7 @@ discard block  | 
                                                    ||
| 1151 | 1151 | */  | 
                                                        
| 1152 | 1152 |  function give_get_current_setting_page() { | 
                                                        
| 1153 | 1153 | // Get current page.  | 
                                                        
| 1154 | - $setting_page = ! empty( $_GET['page'] ) ? urldecode( $_GET['page'] ) : '';  | 
                                                        |
| 1154 | + $setting_page = ! empty($_GET['page']) ? urldecode($_GET['page']) : '';  | 
                                                        |
| 1155 | 1155 | |
| 1156 | 1156 | // Output.  | 
                                                        
| 1157 | 1157 | return $setting_page;  | 
                                                        
@@ -1171,13 +1171,13 @@ discard block  | 
                                                    ||
| 1171 | 1171 | *  | 
                                                        
| 1172 | 1172 | * @return string  | 
                                                        
| 1173 | 1173 | */  | 
                                                        
| 1174 | -function _give_display_content_field_value( $field_value, $field, $postid ) { | 
                                                        |
| 1175 | - $show_content = give_get_meta( $postid, '_give_content_option', true );  | 
                                                        |
| 1174 | +function _give_display_content_field_value($field_value, $field, $postid) { | 
                                                        |
| 1175 | + $show_content = give_get_meta($postid, '_give_content_option', true);  | 
                                                        |
| 1176 | 1176 | |
| 1177 | 1177 | if (  | 
                                                        
| 1178 | - ! give_get_meta( $postid, '_give_display_content', true )  | 
                                                        |
| 1178 | + ! give_get_meta($postid, '_give_display_content', true)  | 
                                                        |
| 1179 | 1179 | && $show_content  | 
                                                        
| 1180 | - && ( 'none' !== $show_content )  | 
                                                        |
| 1180 | +		&& ('none' !== $show_content) | 
                                                        |
| 1181 | 1181 |  	) { | 
                                                        
| 1182 | 1182 | $field_value = 'enabled';  | 
                                                        
| 1183 | 1183 | }  | 
                                                        
@@ -1185,7 +1185,7 @@ discard block  | 
                                                    ||
| 1185 | 1185 | return $field_value;  | 
                                                        
| 1186 | 1186 | }  | 
                                                        
| 1187 | 1187 | |
| 1188 | -add_filter( '_give_display_content_field_value', '_give_display_content_field_value', 10, 3 );  | 
                                                        |
| 1188 | +add_filter('_give_display_content_field_value', '_give_display_content_field_value', 10, 3); | 
                                                        |
| 1189 | 1189 | |
| 1190 | 1190 | |
| 1191 | 1191 | /**  | 
                                                        
@@ -1202,12 +1202,12 @@ discard block  | 
                                                    ||
| 1202 | 1202 | *  | 
                                                        
| 1203 | 1203 | * @return string  | 
                                                        
| 1204 | 1204 | */  | 
                                                        
| 1205 | -function _give_content_placement_field_value( $field_value, $field, $postid ) { | 
                                                        |
| 1206 | - $show_content = give_get_meta( $postid, '_give_content_option', true );  | 
                                                        |
| 1205 | +function _give_content_placement_field_value($field_value, $field, $postid) { | 
                                                        |
| 1206 | + $show_content = give_get_meta($postid, '_give_content_option', true);  | 
                                                        |
| 1207 | 1207 | |
| 1208 | 1208 | if (  | 
                                                        
| 1209 | - ! give_get_meta( $postid, '_give_content_placement', true )  | 
                                                        |
| 1210 | - && ( 'none' !== $show_content )  | 
                                                        |
| 1209 | + ! give_get_meta($postid, '_give_content_placement', true)  | 
                                                        |
| 1210 | +		&& ('none' !== $show_content) | 
                                                        |
| 1211 | 1211 |  	) { | 
                                                        
| 1212 | 1212 | $field_value = $show_content;  | 
                                                        
| 1213 | 1213 | }  | 
                                                        
@@ -1215,7 +1215,7 @@ discard block  | 
                                                    ||
| 1215 | 1215 | return $field_value;  | 
                                                        
| 1216 | 1216 | }  | 
                                                        
| 1217 | 1217 | |
| 1218 | -add_filter( '_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3 );  | 
                                                        |
| 1218 | +add_filter('_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3); | 
                                                        |
| 1219 | 1219 | |
| 1220 | 1220 | |
| 1221 | 1221 | /**  | 
                                                        
@@ -1231,17 +1231,17 @@ discard block  | 
                                                    ||
| 1231 | 1231 | *  | 
                                                        
| 1232 | 1232 | * @return string  | 
                                                        
| 1233 | 1233 | */  | 
                                                        
| 1234 | -function _give_terms_option_field_value( $field_value, $field, $postid ) { | 
                                                        |
| 1235 | - $term_option = give_get_meta( $postid, '_give_terms_option', true );  | 
                                                        |
| 1234 | +function _give_terms_option_field_value($field_value, $field, $postid) { | 
                                                        |
| 1235 | + $term_option = give_get_meta($postid, '_give_terms_option', true);  | 
                                                        |
| 1236 | 1236 | |
| 1237 | -	if ( in_array( $term_option, array( 'none', 'yes' ) ) ) { | 
                                                        |
| 1238 | - $field_value = ( 'yes' === $term_option ? 'enabled' : 'disabled' );  | 
                                                        |
| 1237 | +	if (in_array($term_option, array('none', 'yes'))) { | 
                                                        |
| 1238 | +		$field_value = ('yes' === $term_option ? 'enabled' : 'disabled'); | 
                                                        |
| 1239 | 1239 | }  | 
                                                        
| 1240 | 1240 | |
| 1241 | 1241 | return $field_value;  | 
                                                        
| 1242 | 1242 | }  | 
                                                        
| 1243 | 1243 | |
| 1244 | -add_filter( '_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3 );  | 
                                                        |
| 1244 | +add_filter('_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3); | 
                                                        |
| 1245 | 1245 | |
| 1246 | 1246 | |
| 1247 | 1247 | /**  | 
                                                        
@@ -1258,17 +1258,17 @@ discard block  | 
                                                    ||
| 1258 | 1258 | *  | 
                                                        
| 1259 | 1259 | * @return string  | 
                                                        
| 1260 | 1260 | */  | 
                                                        
| 1261 | -function _give_offline_donation_enable_billing_fields_single_field_value( $field_value, $field, $postid ) { | 
                                                        |
| 1262 | - $offline_donation = give_get_meta( $postid, '_give_offline_donation_enable_billing_fields_single', true );  | 
                                                        |
| 1261 | +function _give_offline_donation_enable_billing_fields_single_field_value($field_value, $field, $postid) { | 
                                                        |
| 1262 | + $offline_donation = give_get_meta($postid, '_give_offline_donation_enable_billing_fields_single', true);  | 
                                                        |
| 1263 | 1263 | |
| 1264 | -	if ( 'on' === $offline_donation ) { | 
                                                        |
| 1264 | +	if ('on' === $offline_donation) { | 
                                                        |
| 1265 | 1265 | $field_value = 'enabled';  | 
                                                        
| 1266 | 1266 | }  | 
                                                        
| 1267 | 1267 | |
| 1268 | 1268 | return $field_value;  | 
                                                        
| 1269 | 1269 | }  | 
                                                        
| 1270 | 1270 | |
| 1271 | -add_filter( '_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3 );  | 
                                                        |
| 1271 | +add_filter('_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3); | 
                                                        |
| 1272 | 1272 | |
| 1273 | 1273 | |
| 1274 | 1274 | /**  | 
                                                        
@@ -1284,17 +1284,17 @@ discard block  | 
                                                    ||
| 1284 | 1284 | *  | 
                                                        
| 1285 | 1285 | * @return string  | 
                                                        
| 1286 | 1286 | */  | 
                                                        
| 1287 | -function _give_custom_amount_field_value( $field_value, $field, $postid ) { | 
                                                        |
| 1288 | - $custom_amount = give_get_meta( $postid, '_give_custom_amount', true );  | 
                                                        |
| 1287 | +function _give_custom_amount_field_value($field_value, $field, $postid) { | 
                                                        |
| 1288 | + $custom_amount = give_get_meta($postid, '_give_custom_amount', true);  | 
                                                        |
| 1289 | 1289 | |
| 1290 | -	if ( in_array( $custom_amount, array( 'yes', 'no' ) ) ) { | 
                                                        |
| 1291 | - $field_value = ( 'yes' === $custom_amount ? 'enabled' : 'disabled' );  | 
                                                        |
| 1290 | +	if (in_array($custom_amount, array('yes', 'no'))) { | 
                                                        |
| 1291 | +		$field_value = ('yes' === $custom_amount ? 'enabled' : 'disabled'); | 
                                                        |
| 1292 | 1292 | }  | 
                                                        
| 1293 | 1293 | |
| 1294 | 1294 | return $field_value;  | 
                                                        
| 1295 | 1295 | }  | 
                                                        
| 1296 | 1296 | |
| 1297 | -add_filter( '_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3 );  | 
                                                        |
| 1297 | +add_filter('_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3); | 
                                                        |
| 1298 | 1298 | |
| 1299 | 1299 | |
| 1300 | 1300 | /**  | 
                                                        
@@ -1310,17 +1310,17 @@ discard block  | 
                                                    ||
| 1310 | 1310 | *  | 
                                                        
| 1311 | 1311 | * @return string  | 
                                                        
| 1312 | 1312 | */  | 
                                                        
| 1313 | -function _give_goal_option_field_value( $field_value, $field, $postid ) { | 
                                                        |
| 1314 | - $goal_option = give_get_meta( $postid, '_give_goal_option', true );  | 
                                                        |
| 1313 | +function _give_goal_option_field_value($field_value, $field, $postid) { | 
                                                        |
| 1314 | + $goal_option = give_get_meta($postid, '_give_goal_option', true);  | 
                                                        |
| 1315 | 1315 | |
| 1316 | -	if ( in_array( $goal_option, array( 'yes', 'no' ) ) ) { | 
                                                        |
| 1317 | - $field_value = ( 'yes' === $goal_option ? 'enabled' : 'disabled' );  | 
                                                        |
| 1316 | +	if (in_array($goal_option, array('yes', 'no'))) { | 
                                                        |
| 1317 | +		$field_value = ('yes' === $goal_option ? 'enabled' : 'disabled'); | 
                                                        |
| 1318 | 1318 | }  | 
                                                        
| 1319 | 1319 | |
| 1320 | 1320 | return $field_value;  | 
                                                        
| 1321 | 1321 | }  | 
                                                        
| 1322 | 1322 | |
| 1323 | -add_filter( '_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3 );  | 
                                                        |
| 1323 | +add_filter('_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3); | 
                                                        |
| 1324 | 1324 | |
| 1325 | 1325 | /**  | 
                                                        
| 1326 | 1326 | * Set value for Donation Goal --> close Form.  | 
                                                        
@@ -1336,17 +1336,17 @@ discard block  | 
                                                    ||
| 1336 | 1336 | *  | 
                                                        
| 1337 | 1337 | * @return string  | 
                                                        
| 1338 | 1338 | */  | 
                                                        
| 1339 | -function _give_close_form_when_goal_achieved_value( $field_value, $field, $postid ) { | 
                                                        |
| 1340 | - $close_form = give_get_meta( $postid, '_give_close_form_when_goal_achieved', true );  | 
                                                        |
| 1339 | +function _give_close_form_when_goal_achieved_value($field_value, $field, $postid) { | 
                                                        |
| 1340 | + $close_form = give_get_meta($postid, '_give_close_form_when_goal_achieved', true);  | 
                                                        |
| 1341 | 1341 | |
| 1342 | -	if ( in_array( $close_form, array( 'yes', 'no' ) ) ) { | 
                                                        |
| 1343 | - $field_value = ( 'yes' === $close_form ? 'enabled' : 'disabled' );  | 
                                                        |
| 1342 | +	if (in_array($close_form, array('yes', 'no'))) { | 
                                                        |
| 1343 | +		$field_value = ('yes' === $close_form ? 'enabled' : 'disabled'); | 
                                                        |
| 1344 | 1344 | }  | 
                                                        
| 1345 | 1345 | |
| 1346 | 1346 | return $field_value;  | 
                                                        
| 1347 | 1347 | }  | 
                                                        
| 1348 | 1348 | |
| 1349 | -add_filter( '_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3 );  | 
                                                        |
| 1349 | +add_filter('_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3); | 
                                                        |
| 1350 | 1350 | |
| 1351 | 1351 | |
| 1352 | 1352 | /**  | 
                                                        
@@ -1362,17 +1362,17 @@ discard block  | 
                                                    ||
| 1362 | 1362 | *  | 
                                                        
| 1363 | 1363 | * @return string  | 
                                                        
| 1364 | 1364 | */  | 
                                                        
| 1365 | -function _give_logged_in_only_value( $field_value, $field, $postid ) { | 
                                                        |
| 1366 | - $guest_donation = give_get_meta( $postid, '_give_logged_in_only', true );  | 
                                                        |
| 1365 | +function _give_logged_in_only_value($field_value, $field, $postid) { | 
                                                        |
| 1366 | + $guest_donation = give_get_meta($postid, '_give_logged_in_only', true);  | 
                                                        |
| 1367 | 1367 | |
| 1368 | -	if ( in_array( $guest_donation, array( 'yes', 'no' ) ) ) { | 
                                                        |
| 1369 | - $field_value = ( 'yes' === $guest_donation ? 'enabled' : 'disabled' );  | 
                                                        |
| 1368 | +	if (in_array($guest_donation, array('yes', 'no'))) { | 
                                                        |
| 1369 | +		$field_value = ('yes' === $guest_donation ? 'enabled' : 'disabled'); | 
                                                        |
| 1370 | 1370 | }  | 
                                                        
| 1371 | 1371 | |
| 1372 | 1372 | return $field_value;  | 
                                                        
| 1373 | 1373 | }  | 
                                                        
| 1374 | 1374 | |
| 1375 | -add_filter( '_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3 );  | 
                                                        |
| 1375 | +add_filter('_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3); | 
                                                        |
| 1376 | 1376 | |
| 1377 | 1377 | /**  | 
                                                        
| 1378 | 1378 | * Set value for Offline Donations --> Offline Donations.  | 
                                                        
@@ -1388,17 +1388,17 @@ discard block  | 
                                                    ||
| 1388 | 1388 | *  | 
                                                        
| 1389 | 1389 | * @return string  | 
                                                        
| 1390 | 1390 | */  | 
                                                        
| 1391 | -function _give_customize_offline_donations_value( $field_value, $field, $postid ) { | 
                                                        |
| 1392 | - $customize_offline_text = give_get_meta( $postid, '_give_customize_offline_donations', true );  | 
                                                        |
| 1391 | +function _give_customize_offline_donations_value($field_value, $field, $postid) { | 
                                                        |
| 1392 | + $customize_offline_text = give_get_meta($postid, '_give_customize_offline_donations', true);  | 
                                                        |
| 1393 | 1393 | |
| 1394 | -	if ( in_array( $customize_offline_text, array( 'yes', 'no' ) ) ) { | 
                                                        |
| 1395 | - $field_value = ( 'yes' === $customize_offline_text ? 'enabled' : 'disabled' );  | 
                                                        |
| 1394 | +	if (in_array($customize_offline_text, array('yes', 'no'))) { | 
                                                        |
| 1395 | +		$field_value = ('yes' === $customize_offline_text ? 'enabled' : 'disabled'); | 
                                                        |
| 1396 | 1396 | }  | 
                                                        
| 1397 | 1397 | |
| 1398 | 1398 | return $field_value;  | 
                                                        
| 1399 | 1399 | }  | 
                                                        
| 1400 | 1400 | |
| 1401 | -add_filter( '_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3 );  | 
                                                        |
| 1401 | +add_filter('_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3); | 
                                                        |
| 1402 | 1402 | |
| 1403 | 1403 | |
| 1404 | 1404 | /**  | 
                                                        
@@ -1413,14 +1413,14 @@ discard block  | 
                                                    ||
| 1413 | 1413 | *  | 
                                                        
| 1414 | 1414 | * @return mixed  | 
                                                        
| 1415 | 1415 | */  | 
                                                        
| 1416 | -function _give_set_multi_level_repeater_field_id( $field_id, $field, $fields, $default ) { | 
                                                        |
| 1416 | +function _give_set_multi_level_repeater_field_id($field_id, $field, $fields, $default) { | 
                                                        |
| 1417 | 1417 |  	$row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; | 
                                                        
| 1418 | 1418 |  	$field_id        = "{$fields['id']}[{$row_placeholder}][{$field['id']}][level_id]"; | 
                                                        
| 1419 | 1419 | |
| 1420 | 1420 | return $field_id;  | 
                                                        
| 1421 | 1421 | }  | 
                                                        
| 1422 | 1422 | |
| 1423 | -add_filter( 'give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4 );  | 
                                                        |
| 1423 | +add_filter('give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4); | 
                                                        |
| 1424 | 1424 | |
| 1425 | 1425 | /**  | 
                                                        
| 1426 | 1426 | * Set repeater field value for multi donation form.  | 
                                                        
@@ -1434,13 +1434,13 @@ discard block  | 
                                                    ||
| 1434 | 1434 | *  | 
                                                        
| 1435 | 1435 | * @return mixed  | 
                                                        
| 1436 | 1436 | */  | 
                                                        
| 1437 | -function _give_set_multi_level_repeater_field_value( $field_value, $field, $field_group, $fields ) { | 
                                                        |
| 1438 | - $field_value = $field_group[ $field['id'] ]['level_id'];  | 
                                                        |
| 1437 | +function _give_set_multi_level_repeater_field_value($field_value, $field, $field_group, $fields) { | 
                                                        |
| 1438 | + $field_value = $field_group[$field['id']]['level_id'];  | 
                                                        |
| 1439 | 1439 | |
| 1440 | 1440 | return $field_value;  | 
                                                        
| 1441 | 1441 | }  | 
                                                        
| 1442 | 1442 | |
| 1443 | -add_filter( 'give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4 );  | 
                                                        |
| 1443 | +add_filter('give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4); | 
                                                        |
| 1444 | 1444 | |
| 1445 | 1445 | /**  | 
                                                        
| 1446 | 1446 | * Set default value for _give_id field.  | 
                                                        
@@ -1451,11 +1451,11 @@ discard block  | 
                                                    ||
| 1451 | 1451 | *  | 
                                                        
| 1452 | 1452 | * @return string  | 
                                                        
| 1453 | 1453 | */  | 
                                                        
| 1454 | -function _give_set_field_give_id_default_value( $field ) { | 
                                                        |
| 1454 | +function _give_set_field_give_id_default_value($field) { | 
                                                        |
| 1455 | 1455 | return 0;  | 
                                                        
| 1456 | 1456 | }  | 
                                                        
| 1457 | 1457 | |
| 1458 | -add_filter( 'give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value' );  | 
                                                        |
| 1458 | +add_filter('give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value'); | 
                                                        |
| 1459 | 1459 | |
| 1460 | 1460 | /**  | 
                                                        
| 1461 | 1461 | * Set default value for _give_default field.  | 
                                                        
@@ -1466,11 +1466,11 @@ discard block  | 
                                                    ||
| 1466 | 1466 | *  | 
                                                        
| 1467 | 1467 | * @return string  | 
                                                        
| 1468 | 1468 | */  | 
                                                        
| 1469 | -function _give_set_field_give_default_default_value( $field ) { | 
                                                        |
| 1469 | +function _give_set_field_give_default_default_value($field) { | 
                                                        |
| 1470 | 1470 | return 'default';  | 
                                                        
| 1471 | 1471 | }  | 
                                                        
| 1472 | 1472 | |
| 1473 | -add_filter( 'give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value' );  | 
                                                        |
| 1473 | +add_filter('give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value'); | 
                                                        |
| 1474 | 1474 | |
| 1475 | 1475 | /**  | 
                                                        
| 1476 | 1476 | * Set repeater field editor id for field type wysiwyg.  | 
                                                        
@@ -1482,12 +1482,12 @@ discard block  | 
                                                    ||
| 1482 | 1482 | *  | 
                                                        
| 1483 | 1483 | * @return string  | 
                                                        
| 1484 | 1484 | */  | 
                                                        
| 1485 | -function give_repeater_field_set_editor_id( $field_name, $field ) { | 
                                                        |
| 1486 | -	if ( isset( $field['repeatable_field_id'] ) && 'wysiwyg' == $field['type'] ) { | 
                                                        |
| 1487 | - $field_name = '_give_repeater_' . uniqid() . '_wysiwyg';  | 
                                                        |
| 1485 | +function give_repeater_field_set_editor_id($field_name, $field) { | 
                                                        |
| 1486 | +	if (isset($field['repeatable_field_id']) && 'wysiwyg' == $field['type']) { | 
                                                        |
| 1487 | + $field_name = '_give_repeater_'.uniqid().'_wysiwyg';  | 
                                                        |
| 1488 | 1488 | }  | 
                                                        
| 1489 | 1489 | |
| 1490 | 1490 | return $field_name;  | 
                                                        
| 1491 | 1491 | }  | 
                                                        
| 1492 | 1492 | |
| 1493 | -add_filter( 'give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2 );  | 
                                                        |
| 1493 | +add_filter('give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2); | 
                                                        |
@@ -113,7 +113,7 @@  | 
                                                    ||
| 113 | 113 | /**  | 
                                                        
| 114 | 114 | * Adds the "Donation Form" button above the TinyMCE Editor on add/edit screens.  | 
                                                        
| 115 | 115 | *  | 
                                                        
| 116 | - * @return string|bool  | 
                                                        |
| 116 | + * @return false|null  | 
                                                        |
| 117 | 117 | *  | 
                                                        
| 118 | 118 | * @since 1.0  | 
                                                        
| 119 | 119 | */  | 
                                                        
@@ -138,8 +138,8 @@  | 
                                                    ||
| 138 | 138 | |
| 139 | 139 | // Only run in admin post/page creation and edit screens  | 
                                                        
| 140 | 140 | if ( in_array( $screen->parent_file, $shortcode_button_pages )  | 
                                                        
| 141 | - && apply_filters( 'give_shortcode_button_condition', true )  | 
                                                        |
| 142 | - && ! empty( self::$shortcodes )  | 
                                                        |
| 141 | + && apply_filters( 'give_shortcode_button_condition', true )  | 
                                                        |
| 142 | + && ! empty( self::$shortcodes )  | 
                                                        |
| 143 | 143 |  		) { | 
                                                        
| 144 | 144 | |
| 145 | 145 | $shortcodes = array();  | 
                                                        
@@ -12,7 +12,7 @@ discard block  | 
                                                    ||
| 12 | 12 | */  | 
                                                        
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly.  | 
                                                        
| 15 | -if ( ! defined( 'ABSPATH' ) ) { | 
                                                        |
| 15 | +if ( ! defined('ABSPATH')) { | 
                                                        |
| 16 | 16 | exit;  | 
                                                        
| 17 | 17 | }  | 
                                                        
| 18 | 18 | |
@@ -33,16 +33,16 @@ discard block  | 
                                                    ||
| 33 | 33 | */  | 
                                                        
| 34 | 34 |  	public function __construct() { | 
                                                        
| 35 | 35 | |
| 36 | -		if ( is_admin() ) { | 
                                                        |
| 37 | - add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 15 );  | 
                                                        |
| 36 | +		if (is_admin()) { | 
                                                        |
| 37 | +			add_filter('mce_external_plugins', array($this, 'mce_external_plugins'), 15); | 
                                                        |
| 38 | 38 | |
| 39 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) );  | 
                                                        |
| 40 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_localize_scripts' ), 13 );  | 
                                                        |
| 41 | - add_action( 'media_buttons', array( $this, 'shortcode_button' ) );  | 
                                                        |
| 39 | +			add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_assets')); | 
                                                        |
| 40 | +			add_action('admin_enqueue_scripts', array($this, 'admin_localize_scripts'), 13); | 
                                                        |
| 41 | +			add_action('media_buttons', array($this, 'shortcode_button')); | 
                                                        |
| 42 | 42 | }  | 
                                                        
| 43 | 43 | |
| 44 | - add_action( "wp_ajax_give_shortcode", array( $this, 'shortcode_ajax' ) );  | 
                                                        |
| 45 | - add_action( "wp_ajax_nopriv_give_shortcode", array( $this, 'shortcode_ajax' ) );  | 
                                                        |
| 44 | +		add_action("wp_ajax_give_shortcode", array($this, 'shortcode_ajax')); | 
                                                        |
| 45 | +		add_action("wp_ajax_nopriv_give_shortcode", array($this, 'shortcode_ajax')); | 
                                                        |
| 46 | 46 | }  | 
                                                        
| 47 | 47 | |
| 48 | 48 | /**  | 
                                                        
@@ -54,15 +54,15 @@ discard block  | 
                                                    ||
| 54 | 54 | *  | 
                                                        
| 55 | 55 | * @since 1.0  | 
                                                        
| 56 | 56 | */  | 
                                                        
| 57 | -	public function mce_external_plugins( $plugin_array ) { | 
                                                        |
| 57 | +	public function mce_external_plugins($plugin_array) { | 
                                                        |
| 58 | 58 | |
| 59 | -		if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) { | 
                                                        |
| 59 | +		if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages')) { | 
                                                        |
| 60 | 60 | return false;  | 
                                                        
| 61 | 61 | }  | 
                                                        
| 62 | 62 | |
| 63 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';  | 
                                                        |
| 63 | +		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; | 
                                                        |
| 64 | 64 | |
| 65 | - $plugin_array['give_shortcode'] = GIVE_PLUGIN_URL . 'assets/js/admin/tinymce/mce-plugin' . $suffix . '.js';  | 
                                                        |
| 65 | + $plugin_array['give_shortcode'] = GIVE_PLUGIN_URL.'assets/js/admin/tinymce/mce-plugin'.$suffix.'.js';  | 
                                                        |
| 66 | 66 | |
| 67 | 67 | return $plugin_array;  | 
                                                        
| 68 | 68 | }  | 
                                                        
@@ -76,12 +76,12 @@ discard block  | 
                                                    ||
| 76 | 76 | */  | 
                                                        
| 77 | 77 |  	public function admin_enqueue_assets() { | 
                                                        
| 78 | 78 | |
| 79 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';  | 
                                                        |
| 79 | +		$suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; | 
                                                        |
| 80 | 80 | |
| 81 | 81 | wp_enqueue_script(  | 
                                                        
| 82 | 82 | 'give_shortcode',  | 
                                                        
| 83 | - GIVE_PLUGIN_URL . 'assets/js/admin/admin-shortcodes' . $suffix . '.js',  | 
                                                        |
| 84 | - array( 'jquery' ),  | 
                                                        |
| 83 | + GIVE_PLUGIN_URL.'assets/js/admin/admin-shortcodes'.$suffix.'.js',  | 
                                                        |
| 84 | +			array('jquery'), | 
                                                        |
| 85 | 85 | GIVE_VERSION,  | 
                                                        
| 86 | 86 | true  | 
                                                        
| 87 | 87 | );  | 
                                                        
@@ -96,17 +96,17 @@ discard block  | 
                                                    ||
| 96 | 96 | */  | 
                                                        
| 97 | 97 |  	public function admin_localize_scripts() { | 
                                                        
| 98 | 98 | |
| 99 | -		if ( ! empty( self::$shortcodes ) ) { | 
                                                        |
| 99 | +		if ( ! empty(self::$shortcodes)) { | 
                                                        |
| 100 | 100 | |
| 101 | 101 | $variables = array();  | 
                                                        
| 102 | 102 | |
| 103 | -			foreach ( self::$shortcodes as $shortcode => $values ) { | 
                                                        |
| 104 | -				if ( ! empty( $values['required'] ) ) { | 
                                                        |
| 105 | - $variables[ $shortcode ] = $values['required'];  | 
                                                        |
| 103 | +			foreach (self::$shortcodes as $shortcode => $values) { | 
                                                        |
| 104 | +				if ( ! empty($values['required'])) { | 
                                                        |
| 105 | + $variables[$shortcode] = $values['required'];  | 
                                                        |
| 106 | 106 | }  | 
                                                        
| 107 | 107 | }  | 
                                                        
| 108 | 108 | |
| 109 | - wp_localize_script( 'give_shortcode', 'scShortcodes', $variables );  | 
                                                        |
| 109 | +			wp_localize_script('give_shortcode', 'scShortcodes', $variables); | 
                                                        |
| 110 | 110 | }  | 
                                                        
| 111 | 111 | }  | 
                                                        
| 112 | 112 | |
@@ -123,37 +123,37 @@ discard block  | 
                                                    ||
| 123 | 123 | |
| 124 | 124 | // If we load wp editor by ajax then $screen will be empty which generate notice if we treat $screen as WP_Screen object.  | 
                                                        
| 125 | 125 | // For example we are loading wp editor by ajax in repeater field.  | 
                                                        
| 126 | -		if ( ! ( $screen instanceof WP_Screen ) ) { | 
                                                        |
| 126 | +		if ( ! ($screen instanceof WP_Screen)) { | 
                                                        |
| 127 | 127 | return false;  | 
                                                        
| 128 | 128 | }  | 
                                                        
| 129 | 129 | |
| 130 | - $shortcode_button_pages = apply_filters( 'give_shortcode_button_pages', array(  | 
                                                        |
| 130 | +		$shortcode_button_pages = apply_filters('give_shortcode_button_pages', array( | 
                                                        |
| 131 | 131 | 'post.php',  | 
                                                        
| 132 | 132 | 'page.php',  | 
                                                        
| 133 | 133 | 'post-new.php',  | 
                                                        
| 134 | 134 | 'post-edit.php',  | 
                                                        
| 135 | 135 | 'edit.php',  | 
                                                        
| 136 | 136 | 'edit.php?post_type=page',  | 
                                                        
| 137 | - ) );  | 
                                                        |
| 137 | + ));  | 
                                                        |
| 138 | 138 | |
| 139 | 139 | // Only run in admin post/page creation and edit screens  | 
                                                        
| 140 | - if ( in_array( $screen->parent_file, $shortcode_button_pages )  | 
                                                        |
| 141 | - && apply_filters( 'give_shortcode_button_condition', true )  | 
                                                        |
| 142 | - && ! empty( self::$shortcodes )  | 
                                                        |
| 140 | + if (in_array($screen->parent_file, $shortcode_button_pages)  | 
                                                        |
| 141 | +		     && apply_filters('give_shortcode_button_condition', true) | 
                                                        |
| 142 | + && ! empty(self::$shortcodes)  | 
                                                        |
| 143 | 143 |  		) { | 
                                                        
| 144 | 144 | |
| 145 | 145 | $shortcodes = array();  | 
                                                        
| 146 | 146 | |
| 147 | -			foreach ( self::$shortcodes as $shortcode => $values ) { | 
                                                        |
| 147 | +			foreach (self::$shortcodes as $shortcode => $values) { | 
                                                        |
| 148 | 148 | |
| 149 | 149 | /**  | 
                                                        
| 150 | 150 | * Filters the condition for including the current shortcode  | 
                                                        
| 151 | 151 | *  | 
                                                        
| 152 | 152 | * @since 1.0  | 
                                                        
| 153 | 153 | */  | 
                                                        
| 154 | -				if ( apply_filters( sanitize_title( $shortcode ) . '_condition', true ) ) { | 
                                                        |
| 154 | +				if (apply_filters(sanitize_title($shortcode).'_condition', true)) { | 
                                                        |
| 155 | 155 | |
| 156 | - $shortcodes[ $shortcode ] = sprintf(  | 
                                                        |
| 156 | + $shortcodes[$shortcode] = sprintf(  | 
                                                        |
| 157 | 157 | '<div class="sc-shortcode mce-menu-item give-shortcode-item-%1$s" data-shortcode="%2$s">%3$s</div>',  | 
                                                        
| 158 | 158 | $shortcode,  | 
                                                        
| 159 | 159 | $shortcode,  | 
                                                        
@@ -162,37 +162,37 @@ discard block  | 
                                                    ||
| 162 | 162 | }  | 
                                                        
| 163 | 163 | }  | 
                                                        
| 164 | 164 | |
| 165 | -			if ( ! empty( $shortcodes ) ) { | 
                                                        |
| 165 | +			if ( ! empty($shortcodes)) { | 
                                                        |
| 166 | 166 | |
| 167 | 167 | // check current WP version  | 
                                                        
| 168 | - $img = ( version_compare( get_bloginfo( 'version' ), '3.5', '<' ) )  | 
                                                        |
| 169 | - ? '<img src="' . GIVE_PLUGIN_URL . 'assets/images/give-media.png" />'  | 
                                                        |
| 170 | -					: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url(' . give_svg_icons( 'give_grey' ) . ');"></span>'; | 
                                                        |
| 168 | +				$img = (version_compare(get_bloginfo('version'), '3.5', '<')) | 
                                                        |
| 169 | + ? '<img src="'.GIVE_PLUGIN_URL.'assets/images/give-media.png" />'  | 
                                                        |
| 170 | +					: '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url('.give_svg_icons('give_grey').');"></span>'; | 
                                                        |
| 171 | 171 | |
| 172 | - reset( $shortcodes );  | 
                                                        |
| 172 | + reset($shortcodes);  | 
                                                        |
| 173 | 173 | |
| 174 | -				if ( count( $shortcodes ) == 1 ) { | 
                                                        |
| 174 | +				if (count($shortcodes) == 1) { | 
                                                        |
| 175 | 175 | |
| 176 | - $shortcode = key( $shortcodes );  | 
                                                        |
| 176 | + $shortcode = key($shortcodes);  | 
                                                        |
| 177 | 177 | |
| 178 | 178 | printf(  | 
                                                        
| 179 | 179 | '<button class="button sc-shortcode" data-shortcode="%s">%s</button>',  | 
                                                        
| 180 | 180 | $shortcode,  | 
                                                        
| 181 | - sprintf( '%s %s %s',  | 
                                                        |
| 181 | +						sprintf('%s %s %s', | 
                                                        |
| 182 | 182 | $img,  | 
                                                        
| 183 | - esc_html__( 'Insert', 'give' ),  | 
                                                        |
| 184 | - self::$shortcodes[ $shortcode ]['label']  | 
                                                        |
| 183 | +							esc_html__('Insert', 'give'), | 
                                                        |
| 184 | + self::$shortcodes[$shortcode]['label']  | 
                                                        |
| 185 | 185 | )  | 
                                                        
| 186 | 186 | );  | 
                                                        
| 187 | 187 |  				} else { | 
                                                        
| 188 | 188 | printf(  | 
                                                        
| 189 | - '<div class="sc-wrap">' .  | 
                                                        |
| 190 | - '<button class="button sc-button">%s %s</button>' .  | 
                                                        |
| 191 | - '<div class="sc-menu mce-menu">%s</div>' .  | 
                                                        |
| 189 | + '<div class="sc-wrap">'.  | 
                                                        |
| 190 | + '<button class="button sc-button">%s %s</button>'.  | 
                                                        |
| 191 | + '<div class="sc-menu mce-menu">%s</div>'.  | 
                                                        |
| 192 | 192 | '</div>',  | 
                                                        
| 193 | 193 | $img,  | 
                                                        
| 194 | - esc_html__( 'Give Shortcodes', 'give' ),  | 
                                                        |
| 195 | - implode( '', array_values( $shortcodes ) )  | 
                                                        |
| 194 | +						esc_html__('Give Shortcodes', 'give'), | 
                                                        |
| 195 | +						implode('', array_values($shortcodes)) | 
                                                        |
| 196 | 196 | );  | 
                                                        
| 197 | 197 | }  | 
                                                        
| 198 | 198 | }  | 
                                                        
@@ -208,15 +208,15 @@ discard block  | 
                                                    ||
| 208 | 208 | */  | 
                                                        
| 209 | 209 |  	public function shortcode_ajax() { | 
                                                        
| 210 | 210 | |
| 211 | - $shortcode = isset( $_POST['shortcode'] ) ? $_POST['shortcode'] : false;  | 
                                                        |
| 211 | + $shortcode = isset($_POST['shortcode']) ? $_POST['shortcode'] : false;  | 
                                                        |
| 212 | 212 | $response = false;  | 
                                                        
| 213 | 213 | |
| 214 | -		if ( $shortcode && array_key_exists( $shortcode, self::$shortcodes ) ) { | 
                                                        |
| 214 | +		if ($shortcode && array_key_exists($shortcode, self::$shortcodes)) { | 
                                                        |
| 215 | 215 | |
| 216 | - $data = self::$shortcodes[ $shortcode ];  | 
                                                        |
| 216 | + $data = self::$shortcodes[$shortcode];  | 
                                                        |
| 217 | 217 | |
| 218 | -			if ( ! empty( $data['errors'] ) ) { | 
                                                        |
| 219 | - $data['btn_okay'] = array( esc_html__( 'Okay', 'give' ) );  | 
                                                        |
| 218 | +			if ( ! empty($data['errors'])) { | 
                                                        |
| 219 | +				$data['btn_okay'] = array(esc_html__('Okay', 'give')); | 
                                                        |
| 220 | 220 | }  | 
                                                        
| 221 | 221 | |
| 222 | 222 | $response = array(  | 
                                                        
@@ -228,10 +228,10 @@ discard block  | 
                                                    ||
| 228 | 228 | );  | 
                                                        
| 229 | 229 |  		} else { | 
                                                        
| 230 | 230 | // todo: handle error  | 
                                                        
| 231 | - error_log( print_r( 'AJAX error!', 1 ) );  | 
                                                        |
| 231 | +			error_log(print_r('AJAX error!', 1)); | 
                                                        |
| 232 | 232 | }  | 
                                                        
| 233 | 233 | |
| 234 | - wp_send_json( $response );  | 
                                                        |
| 234 | + wp_send_json($response);  | 
                                                        |
| 235 | 235 | }  | 
                                                        
| 236 | 236 | }  | 
                                                        
| 237 | 237 | |