@@ -10,14 +10,14 @@ discard block |
||
10 | 10 | * Describes log levels. |
11 | 11 | */ |
12 | 12 | class LogLevel { |
13 | - const EMERGENCY = 'emergency'; |
|
14 | - const ALERT = 'alert'; |
|
15 | - const CRITICAL = 'critical'; |
|
16 | - const ERROR = 'error'; |
|
17 | - const WARNING = 'warning'; |
|
18 | - const NOTICE = 'notice'; |
|
19 | - const INFO = 'info'; |
|
20 | - const DEBUG = 'debug'; |
|
13 | + const EMERGENCY = 'emergency'; |
|
14 | + const ALERT = 'alert'; |
|
15 | + const CRITICAL = 'critical'; |
|
16 | + const ERROR = 'error'; |
|
17 | + const WARNING = 'warning'; |
|
18 | + const NOTICE = 'notice'; |
|
19 | + const INFO = 'info'; |
|
20 | + const DEBUG = 'debug'; |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
@@ -28,127 +28,127 @@ discard block |
||
28 | 28 | * @see https://github.com/php-fig/log/blob/master/Psr/Log/AbstractLogger.php |
29 | 29 | */ |
30 | 30 | abstract class Logger /** @todo extends Psr\Log\AbstractLogger */ { |
31 | - /** |
|
32 | - * System is unusable. |
|
33 | - * |
|
34 | - * @param string $message |
|
35 | - * @param array $context |
|
36 | - * |
|
37 | - * @return void |
|
38 | - */ |
|
39 | - public function emergency($message, array $context = array()) |
|
40 | - { |
|
41 | - $this->log(LogLevel::EMERGENCY, $message, $context); |
|
42 | - } |
|
31 | + /** |
|
32 | + * System is unusable. |
|
33 | + * |
|
34 | + * @param string $message |
|
35 | + * @param array $context |
|
36 | + * |
|
37 | + * @return void |
|
38 | + */ |
|
39 | + public function emergency($message, array $context = array()) |
|
40 | + { |
|
41 | + $this->log(LogLevel::EMERGENCY, $message, $context); |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * Action must be taken immediately. |
|
46 | - * |
|
47 | - * Example: Entire website down, database unavailable, etc. This should |
|
48 | - * trigger the SMS alerts and wake you up. |
|
49 | - * |
|
50 | - * @param string $message |
|
51 | - * @param array $context |
|
52 | - * |
|
53 | - * @return void |
|
54 | - */ |
|
55 | - public function alert($message, array $context = array()) |
|
56 | - { |
|
57 | - $this->log(LogLevel::ALERT, $message, $context); |
|
58 | - } |
|
44 | + /** |
|
45 | + * Action must be taken immediately. |
|
46 | + * |
|
47 | + * Example: Entire website down, database unavailable, etc. This should |
|
48 | + * trigger the SMS alerts and wake you up. |
|
49 | + * |
|
50 | + * @param string $message |
|
51 | + * @param array $context |
|
52 | + * |
|
53 | + * @return void |
|
54 | + */ |
|
55 | + public function alert($message, array $context = array()) |
|
56 | + { |
|
57 | + $this->log(LogLevel::ALERT, $message, $context); |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * Critical conditions. |
|
62 | - * |
|
63 | - * Example: Application component unavailable, unexpected exception. |
|
64 | - * |
|
65 | - * @param string $message |
|
66 | - * @param array $context |
|
67 | - * |
|
68 | - * @return void |
|
69 | - */ |
|
70 | - public function critical($message, array $context = array()) |
|
71 | - { |
|
72 | - $this->log(LogLevel::CRITICAL, $message, $context); |
|
73 | - } |
|
60 | + /** |
|
61 | + * Critical conditions. |
|
62 | + * |
|
63 | + * Example: Application component unavailable, unexpected exception. |
|
64 | + * |
|
65 | + * @param string $message |
|
66 | + * @param array $context |
|
67 | + * |
|
68 | + * @return void |
|
69 | + */ |
|
70 | + public function critical($message, array $context = array()) |
|
71 | + { |
|
72 | + $this->log(LogLevel::CRITICAL, $message, $context); |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * Runtime errors that do not require immediate action but should typically |
|
77 | - * be logged and monitored. |
|
78 | - * |
|
79 | - * @param string $message |
|
80 | - * @param array $context |
|
81 | - * |
|
82 | - * @return void |
|
83 | - */ |
|
84 | - public function error($message, array $context = array()) |
|
85 | - { |
|
86 | - $this->log(LogLevel::ERROR, $message, $context); |
|
87 | - } |
|
75 | + /** |
|
76 | + * Runtime errors that do not require immediate action but should typically |
|
77 | + * be logged and monitored. |
|
78 | + * |
|
79 | + * @param string $message |
|
80 | + * @param array $context |
|
81 | + * |
|
82 | + * @return void |
|
83 | + */ |
|
84 | + public function error($message, array $context = array()) |
|
85 | + { |
|
86 | + $this->log(LogLevel::ERROR, $message, $context); |
|
87 | + } |
|
88 | 88 | |
89 | - /** |
|
90 | - * Exceptional occurrences that are not errors. |
|
91 | - * |
|
92 | - * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
93 | - * that are not necessarily wrong. |
|
94 | - * |
|
95 | - * @param string $message |
|
96 | - * @param array $context |
|
97 | - * |
|
98 | - * @return void |
|
99 | - */ |
|
100 | - public function warning($message, array $context = array()) |
|
101 | - { |
|
102 | - $this->log(LogLevel::WARNING, $message, $context); |
|
103 | - } |
|
89 | + /** |
|
90 | + * Exceptional occurrences that are not errors. |
|
91 | + * |
|
92 | + * Example: Use of deprecated APIs, poor use of an API, undesirable things |
|
93 | + * that are not necessarily wrong. |
|
94 | + * |
|
95 | + * @param string $message |
|
96 | + * @param array $context |
|
97 | + * |
|
98 | + * @return void |
|
99 | + */ |
|
100 | + public function warning($message, array $context = array()) |
|
101 | + { |
|
102 | + $this->log(LogLevel::WARNING, $message, $context); |
|
103 | + } |
|
104 | 104 | |
105 | - /** |
|
106 | - * Normal but significant events. |
|
107 | - * |
|
108 | - * @param string $message |
|
109 | - * @param array $context |
|
110 | - * |
|
111 | - * @return void |
|
112 | - */ |
|
113 | - public function notice($message, array $context = array()) |
|
114 | - { |
|
115 | - $this->log(LogLevel::NOTICE, $message, $context); |
|
116 | - } |
|
105 | + /** |
|
106 | + * Normal but significant events. |
|
107 | + * |
|
108 | + * @param string $message |
|
109 | + * @param array $context |
|
110 | + * |
|
111 | + * @return void |
|
112 | + */ |
|
113 | + public function notice($message, array $context = array()) |
|
114 | + { |
|
115 | + $this->log(LogLevel::NOTICE, $message, $context); |
|
116 | + } |
|
117 | 117 | |
118 | - /** |
|
119 | - * Interesting events. |
|
120 | - * |
|
121 | - * Example: User logs in, SQL logs. |
|
122 | - * |
|
123 | - * @param string $message |
|
124 | - * @param array $context |
|
125 | - * |
|
126 | - * @return void |
|
127 | - */ |
|
128 | - public function info($message, array $context = array()) |
|
129 | - { |
|
130 | - $this->log(LogLevel::INFO, $message, $context); |
|
131 | - } |
|
118 | + /** |
|
119 | + * Interesting events. |
|
120 | + * |
|
121 | + * Example: User logs in, SQL logs. |
|
122 | + * |
|
123 | + * @param string $message |
|
124 | + * @param array $context |
|
125 | + * |
|
126 | + * @return void |
|
127 | + */ |
|
128 | + public function info($message, array $context = array()) |
|
129 | + { |
|
130 | + $this->log(LogLevel::INFO, $message, $context); |
|
131 | + } |
|
132 | 132 | |
133 | - /** |
|
134 | - * Detailed debug information. |
|
135 | - * |
|
136 | - * @param string $message |
|
137 | - * @param array $context |
|
138 | - * |
|
139 | - * @return void |
|
140 | - */ |
|
141 | - public function debug($message, array $context = array()) |
|
142 | - { |
|
143 | - $this->log(LogLevel::DEBUG, $message, $context); |
|
144 | - } |
|
133 | + /** |
|
134 | + * Detailed debug information. |
|
135 | + * |
|
136 | + * @param string $message |
|
137 | + * @param array $context |
|
138 | + * |
|
139 | + * @return void |
|
140 | + */ |
|
141 | + public function debug($message, array $context = array()) |
|
142 | + { |
|
143 | + $this->log(LogLevel::DEBUG, $message, $context); |
|
144 | + } |
|
145 | 145 | |
146 | 146 | /** |
147 | 147 | * Bake the context into { } placeholders in the message. |
148 | - * @param string $message |
|
149 | - * @param array $context |
|
150 | - * |
|
151 | - * @return string The baked message; |
|
148 | + * @param string $message |
|
149 | + * @param array $context |
|
150 | + * |
|
151 | + * @return string The baked message; |
|
152 | 152 | */ |
153 | 153 | protected function interpolate( $message, $context ) { |
154 | 154 | foreach ( $context as $key => $val ) { |
@@ -23,7 +23,7 @@ |
||
23 | 23 | */ |
24 | 24 | protected $script_handles = array( |
25 | 25 | 'rcp-admin-scripts', |
26 | - 'bbq', |
|
26 | + 'bbq', |
|
27 | 27 | ); |
28 | 28 | |
29 | 29 | /** |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | add_action( 'gravityview_log_debug', array( $this, 'log_debug'), 10, 2 ); |
13 | 13 | |
14 | 14 | // Enable debug with Gravity Forms Logging Add-on |
15 | - add_filter( 'gform_logging_supported', array( $this, 'enable_gform_logging' ) ); |
|
15 | + add_filter( 'gform_logging_supported', array( $this, 'enable_gform_logging' ) ); |
|
16 | 16 | |
17 | - // Load Debug Bar integration |
|
18 | - add_filter( 'debug_bar_panels', array( $this, 'add_debug_bar' ) ); |
|
17 | + // Load Debug Bar integration |
|
18 | + add_filter( 'debug_bar_panels', array( $this, 'add_debug_bar' ) ); |
|
19 | 19 | |
20 | 20 | } |
21 | 21 | |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | * @param array $supported_plugins List of plugins |
45 | 45 | */ |
46 | 46 | public function enable_gform_logging( $supported_plugins ) { |
47 | - $supported_plugins['gravityview'] = 'GravityView'; |
|
48 | - return $supported_plugins; |
|
47 | + $supported_plugins['gravityview'] = 'GravityView'; |
|
48 | + return $supported_plugins; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | |
97 | 97 | if ( class_exists("GFLogging") ) { |
98 | 98 | GFLogging::include_logger(); |
99 | - GFLogging::log_message( 'gravityview', $function( $message, true ) . $function($data, true), KLogger::DEBUG ); |
|
100 | - } |
|
99 | + GFLogging::log_message( 'gravityview', $function( $message, true ) . $function($data, true), KLogger::DEBUG ); |
|
100 | + } |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | static function log_error( $message = '', $data = null ) { |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | if ( class_exists("GFLogging") ) { |
118 | - GFLogging::include_logger(); |
|
119 | - GFLogging::log_message( 'gravityview', $function ( $message, true ) . $function ( $error, true), KLogger::ERROR ); |
|
118 | + GFLogging::include_logger(); |
|
119 | + GFLogging::log_message( 'gravityview', $function ( $message, true ) . $function ( $error, true), KLogger::ERROR ); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 |
@@ -141,7 +141,7 @@ |
||
141 | 141 | global $wpdb; |
142 | 142 | |
143 | 143 | if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) |
144 | - && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { |
|
144 | + && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { |
|
145 | 145 | $notes_table = GFFormsModel::get_entry_notes_table_name(); |
146 | 146 | } else { |
147 | 147 | $notes_table = GFFormsModel::get_lead_notes_table_name(); |
@@ -62,7 +62,6 @@ |
||
62 | 62 | * |
63 | 63 | * Internal static cache for gets, and whatnot. |
64 | 64 | * This is not persistent, resets across requests. |
65 | - |
|
66 | 65 | * @internal |
67 | 66 | */ |
68 | 67 | private static $cache = array(); |
@@ -163,14 +163,14 @@ |
||
163 | 163 | return $settings; |
164 | 164 | } |
165 | 165 | |
166 | - /** |
|
166 | + /** |
|
167 | 167 | * Get the Widget ID. |
168 | 168 | * |
169 | - * @return string The Widget ID. |
|
170 | - */ |
|
171 | - public function get_widget_id() { |
|
172 | - return $this->widget_id; |
|
173 | - } |
|
169 | + * @return string The Widget ID. |
|
170 | + */ |
|
171 | + public function get_widget_id() { |
|
172 | + return $this->widget_id; |
|
173 | + } |
|
174 | 174 | |
175 | 175 | /** |
176 | 176 | * Get the widget settings |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | 'author' => self::author, |
97 | 97 | 'language' => get_locale(), |
98 | 98 | 'url' => home_url(), |
99 | - 'beta' => $this->settings->get( 'beta' ), |
|
99 | + 'beta' => $this->settings->get( 'beta' ), |
|
100 | 100 | ); |
101 | 101 | |
102 | 102 | if ( ! empty( $action ) ) { |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | private function license_call_update_settings( $license_data, $data ) { |
464 | 464 | $settings = array(); |
465 | 465 | |
466 | - $settings['license_key'] = $license_data->license_key = trim( $data['license'] ); |
|
466 | + $settings['license_key'] = $license_data->license_key = trim( $data['license'] ); |
|
467 | 467 | $settings['license_key_status'] = $license_data->license; |
468 | 468 | $settings['license_key_response'] = (array)$license_data; |
469 | 469 | |
@@ -597,14 +597,14 @@ discard block |
||
597 | 597 | // Call the custom API. |
598 | 598 | $response = wp_remote_post( self::url, array( |
599 | 599 | 'timeout' => 15, |
600 | - 'sslverify' => false, |
|
601 | - 'body' => array( |
|
602 | - 'edd_action' => 'check_license', |
|
603 | - 'license' => trim( $this->settings->get( 'license_key' ) ), |
|
604 | - 'item_name' => self::name, |
|
605 | - 'url' => home_url(), |
|
606 | - 'site_data' => $this->get_site_data(), |
|
607 | - ), |
|
600 | + 'sslverify' => false, |
|
601 | + 'body' => array( |
|
602 | + 'edd_action' => 'check_license', |
|
603 | + 'license' => trim( $this->settings->get( 'license_key' ) ), |
|
604 | + 'item_name' => self::name, |
|
605 | + 'url' => home_url(), |
|
606 | + 'site_data' => $this->get_site_data(), |
|
607 | + ), |
|
608 | 608 | )); |
609 | 609 | |
610 | 610 | // make sure the response came back okay |
@@ -237,26 +237,26 @@ |
||
237 | 237 | |
238 | 238 | /** DEBUG */ |
239 | 239 | |
240 | - /** |
|
241 | - * Logs messages using Gravity Forms logging add-on |
|
242 | - * @param string $message log message |
|
243 | - * @param mixed $data Additional data to display |
|
240 | + /** |
|
241 | + * Logs messages using Gravity Forms logging add-on |
|
242 | + * @param string $message log message |
|
243 | + * @param mixed $data Additional data to display |
|
244 | 244 | * @deprecated use gravityview()->log |
245 | - * @return void |
|
246 | - */ |
|
247 | - public static function log_debug( $message, $data = null ){ |
|
245 | + * @return void |
|
246 | + */ |
|
247 | + public static function log_debug( $message, $data = null ){ |
|
248 | 248 | gravityview()->log->notice( '\GravityView_Plugin is deprecated. Use \GV\Plugin instead.' ); |
249 | 249 | gravityview()->log->debug( $message, $data ); |
250 | - } |
|
250 | + } |
|
251 | 251 | |
252 | - /** |
|
253 | - * Logs messages using Gravity Forms logging add-on |
|
254 | - * @param string $message log message |
|
252 | + /** |
|
253 | + * Logs messages using Gravity Forms logging add-on |
|
254 | + * @param string $message log message |
|
255 | 255 | * @deprecated use gravityview()->log |
256 | - * @return void |
|
257 | - */ |
|
258 | - public static function log_error( $message, $data = null ){ |
|
256 | + * @return void |
|
257 | + */ |
|
258 | + public static function log_error( $message, $data = null ){ |
|
259 | 259 | gravityview()->log->notice( '\GravityView_Plugin is deprecated. Use \GV\Plugin instead.' ); |
260 | 260 | gravityview()->log->error( $message, $data ); |
261 | - } |
|
261 | + } |
|
262 | 262 | } // end class GravityView_Plugin |
@@ -161,20 +161,20 @@ discard block |
||
161 | 161 | |
162 | 162 | if( !empty( $field['custom_class'] ) ) { |
163 | 163 | |
164 | - $custom_class = $field['custom_class']; |
|
164 | + $custom_class = $field['custom_class']; |
|
165 | 165 | |
166 | - if( !empty( $entry ) ) { |
|
166 | + if( !empty( $entry ) ) { |
|
167 | 167 | |
168 | - // We want the merge tag to be formatted as a class. The merge tag may be |
|
169 | - // replaced by a multiple-word value that should be output as a single class. |
|
170 | - // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
|
171 | - add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
168 | + // We want the merge tag to be formatted as a class. The merge tag may be |
|
169 | + // replaced by a multiple-word value that should be output as a single class. |
|
170 | + // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager` |
|
171 | + add_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
172 | 172 | |
173 | - $custom_class = self::replace_variables( $custom_class, $form, $entry); |
|
173 | + $custom_class = self::replace_variables( $custom_class, $form, $entry); |
|
174 | 174 | |
175 | - // And then we want life to return to normal |
|
176 | - remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
177 | - } |
|
175 | + // And then we want life to return to normal |
|
176 | + remove_filter('gform_merge_tag_filter', 'sanitize_html_class'); |
|
177 | + } |
|
178 | 178 | |
179 | 179 | // And now we want the spaces to be handled nicely. |
180 | 180 | $classes[] = gravityview_sanitize_html_class( $custom_class ); |
@@ -531,32 +531,32 @@ discard block |
||
531 | 531 | return sanitize_title( $slug ); |
532 | 532 | } |
533 | 533 | |
534 | - /** |
|
535 | - * If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta |
|
536 | - * |
|
537 | - * Triggered by add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
538 | - * |
|
539 | - * @param $entry array Gravity Forms entry object |
|
540 | - * @param $form array Gravity Forms form object |
|
541 | - */ |
|
542 | - public static function entry_create_custom_slug( $entry, $form ) { |
|
543 | - /** |
|
544 | - * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta |
|
545 | - * @param boolean $custom Should we process the custom entry slug? |
|
546 | - */ |
|
547 | - $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
548 | - if( $custom ) { |
|
549 | - // create the gravityview_unique_id and save it |
|
534 | + /** |
|
535 | + * If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta |
|
536 | + * |
|
537 | + * Triggered by add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 ); |
|
538 | + * |
|
539 | + * @param $entry array Gravity Forms entry object |
|
540 | + * @param $form array Gravity Forms form object |
|
541 | + */ |
|
542 | + public static function entry_create_custom_slug( $entry, $form ) { |
|
543 | + /** |
|
544 | + * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta |
|
545 | + * @param boolean $custom Should we process the custom entry slug? |
|
546 | + */ |
|
547 | + $custom = apply_filters( 'gravityview_custom_entry_slug', false ); |
|
548 | + if( $custom ) { |
|
549 | + // create the gravityview_unique_id and save it |
|
550 | 550 | |
551 | - // Get the entry hash |
|
552 | - $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
551 | + // Get the entry hash |
|
552 | + $hash = self::get_custom_entry_slug( $entry['id'], $entry ); |
|
553 | 553 | |
554 | - gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) ); |
|
554 | + gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) ); |
|
555 | 555 | |
556 | - gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) ); |
|
556 | + gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) ); |
|
557 | 557 | |
558 | - } |
|
559 | - } |
|
558 | + } |
|
559 | + } |
|
560 | 560 | |
561 | 561 | |
562 | 562 | |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | |
900 | 900 | // If there was an error, continue to the next term. |
901 | 901 | if ( is_wp_error( $term_link ) ) { |
902 | - continue; |
|
902 | + continue; |
|
903 | 903 | } |
904 | 904 | |
905 | 905 | $output[] = gravityview_get_link( $term_link, esc_html( $term->name ) ); |