@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | */ |
22 | 22 | function __construct() { |
23 | 23 | |
24 | - $this->widget_description = __('Displays the results of Poll Fields that exist in the form.', 'gravityview' ); |
|
24 | + $this->widget_description = __( 'Displays the results of Poll Fields that exist in the form.', 'gravityview' ); |
|
25 | 25 | |
26 | - $this->widget_subtitle = sprintf( _x('Note: this will display poll results for %sall form entries%s, not only the entries displayed in the View.', 'The string placeholders are for emphasis HTML', 'gravityview' ), '<em>', '</em>' ); |
|
26 | + $this->widget_subtitle = sprintf( _x( 'Note: this will display poll results for %sall form entries%s, not only the entries displayed in the View.', 'The string placeholders are for emphasis HTML', 'gravityview' ), '<em>', '</em>' ); |
|
27 | 27 | |
28 | 28 | $default_values = array( |
29 | 29 | 'header' => 1, |
@@ -32,32 +32,32 @@ discard block |
||
32 | 32 | |
33 | 33 | $settings = array( |
34 | 34 | 'percentages' => array( |
35 | - 'label' => __('Display Percentages', 'gravityview'), |
|
35 | + 'label' => __( 'Display Percentages', 'gravityview' ), |
|
36 | 36 | 'type' => 'checkbox', |
37 | 37 | 'value' => true, |
38 | 38 | 'tooltip' => __( 'Display results percentages as part of results? Supported values are: true, false. Defaults to "true".', 'gravityview' ), |
39 | 39 | ), |
40 | 40 | 'counts' => array( |
41 | - 'label' => __('Display Counts', 'gravityview'), |
|
41 | + 'label' => __( 'Display Counts', 'gravityview' ), |
|
42 | 42 | 'type' => 'checkbox', |
43 | 43 | 'value' => true, |
44 | 44 | 'tooltip' => __( 'Display number of times each choice has been selected when displaying results? Supported values are: true, false. Defaults to "true".', 'gravityview' ), |
45 | 45 | ), |
46 | 46 | 'style' => array( |
47 | 47 | 'type' => 'select', |
48 | - 'label' => __('Style', 'gravityview'), |
|
48 | + 'label' => __( 'Style', 'gravityview' ), |
|
49 | 49 | 'tooltip' => __( 'The Polls Add-On currently supports 4 built in styles: red, green, orange, blue. Defaults to "green".', 'gravityview' ), |
50 | 50 | 'value' => 'green', |
51 | 51 | 'choices' => array( |
52 | - 'green' => __('Green', 'gravityview'), |
|
53 | - 'blue' => __('Blue', 'gravityview'), |
|
54 | - 'red' => __('Red', 'gravityview'), |
|
55 | - 'orange' => __('Orange', 'gravityview'), |
|
52 | + 'green' => __( 'Green', 'gravityview' ), |
|
53 | + 'blue' => __( 'Blue', 'gravityview' ), |
|
54 | + 'red' => __( 'Red', 'gravityview' ), |
|
55 | + 'orange' => __( 'Orange', 'gravityview' ), |
|
56 | 56 | ) |
57 | 57 | ) |
58 | 58 | ); |
59 | 59 | |
60 | - parent::__construct( __( 'Poll Results', 'gravityview' ) , 'poll', $default_values, $settings ); |
|
60 | + parent::__construct( __( 'Poll Results', 'gravityview' ), 'poll', $default_values, $settings ); |
|
61 | 61 | |
62 | 62 | // frontend - add template path |
63 | 63 | add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) ); |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | |
89 | 89 | $GFPolls = GFPolls::get_instance(); |
90 | 90 | |
91 | - wp_enqueue_script('gpoll_js', $GFPolls->get_base_url() . '/js/gpoll.js', array('jquery'), $GFPolls->_version); |
|
91 | + wp_enqueue_script( 'gpoll_js', $GFPolls->get_base_url() . '/js/gpoll.js', array( 'jquery' ), $GFPolls->_version ); |
|
92 | 92 | |
93 | 93 | $GFPolls->localize_scripts(); |
94 | 94 | |
95 | - wp_enqueue_style('gpoll_css', $GFPolls->get_base_url() . '/css/gpoll.css', null, $GFPolls->_version); |
|
95 | + wp_enqueue_style( 'gpoll_css', $GFPolls->get_base_url() . '/css/gpoll.css', null, $GFPolls->_version ); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function pre_render_frontend() { |
104 | 104 | |
105 | - if( !class_exists('GFPolls') ) { |
|
105 | + if ( ! class_exists( 'GFPolls' ) ) { |
|
106 | 106 | |
107 | 107 | $return = false; |
108 | 108 | |
@@ -158,14 +158,14 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @since 1.8 |
160 | 160 | */ |
161 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
161 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
162 | 162 | |
163 | - if( !$this->pre_render_frontend() ) { |
|
163 | + if ( ! $this->pre_render_frontend() ) { |
|
164 | 164 | return; |
165 | 165 | } |
166 | 166 | |
167 | 167 | // Make sure the class is loaded in DataTables |
168 | - if( !class_exists( 'GFFormDisplay' ) ) { |
|
168 | + if ( ! class_exists( 'GFFormDisplay' ) ) { |
|
169 | 169 | include_once( GFCommon::get_base_path() . '/form_display.php' ); |
170 | 170 | } |
171 | 171 | |
@@ -173,14 +173,14 @@ discard block |
||
173 | 173 | |
174 | 174 | $settings = $this->get_frontend_settings( $widget_args ); |
175 | 175 | |
176 | - $percentages = empty( $settings['percentages'] ) ? 'false' : 'true'; |
|
176 | + $percentages = empty( $settings[ 'percentages' ] ) ? 'false' : 'true'; |
|
177 | 177 | |
178 | - $counts = empty( $settings['counts'] ) ? 'false' : 'true'; |
|
178 | + $counts = empty( $settings[ 'counts' ] ) ? 'false' : 'true'; |
|
179 | 179 | |
180 | - if( !empty( $settings['field'] ) ) { |
|
181 | - $merge_tag = sprintf( '{gpoll: field="%d" style="%s" percentages="%s" counts="%s"}', $settings['field'], $settings['style'], $percentages, $counts ); |
|
180 | + if ( ! empty( $settings[ 'field' ] ) ) { |
|
181 | + $merge_tag = sprintf( '{gpoll: field="%d" style="%s" percentages="%s" counts="%s"}', $settings[ 'field' ], $settings[ 'style' ], $percentages, $counts ); |
|
182 | 182 | } else { |
183 | - $merge_tag = sprintf( '{all_poll_results: style="%s" percentages="%s" counts="%s"}', $settings['style'], $percentages, $counts ); |
|
183 | + $merge_tag = sprintf( '{all_poll_results: style="%s" percentages="%s" counts="%s"}', $settings[ 'style' ], $percentages, $counts ); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | $gravityview_view = GravityView_View::getInstance(); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | $gravityview_view->poll_settings = $settings; |
191 | 191 | |
192 | - $gravityview_view->render('widget', 'poll', false ); |
|
192 | + $gravityview_view->render( 'widget', 'poll', false ); |
|
193 | 193 | |
194 | 194 | } |
195 | 195 |
@@ -7,4 +7,4 @@ |
||
7 | 7 | |
8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
9 | 9 | $search_field = $gravityview_view->search_field; |
10 | -?><div><input type="hidden" name="<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>"></div> |
|
11 | 10 | \ No newline at end of file |
11 | +?><div><input type="hidden" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $search_field[ 'value' ] ); ?>"></div> |
|
12 | 12 | \ No newline at end of file |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | */ |
24 | 24 | do_action( 'gravityview_search_widget_fields_before', $this ); |
25 | 25 | |
26 | - foreach( $this->search_fields as $search_field ) { |
|
26 | + foreach ( $this->search_fields as $search_field ) { |
|
27 | 27 | $gravityview_view->search_field = $search_field; |
28 | - $this->render( 'search-field', $search_field['input'], false ); |
|
28 | + $this->render( 'search-field', $search_field[ 'input' ], false ); |
|
29 | 29 | |
30 | 30 | // show/hide the search button if there are input type fields |
31 | - if( !$has_inputs && $search_field['input'] != 'link' ) { |
|
31 | + if ( ! $has_inputs && $search_field[ 'input' ] != 'link' ) { |
|
32 | 32 | $has_inputs = true; |
33 | 33 | } |
34 | 34 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | do_action( 'gravityview_search_widget_fields_after', $this ); |
41 | 41 | |
42 | - if( $has_inputs ) { ?> |
|
42 | + if ( $has_inputs ) { ?> |
|
43 | 43 | <div class="gv-search-box gv-search-box-submit"> |
44 | 44 | <?php |
45 | 45 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | function __construct() { |
18 | 18 | |
19 | - $this->widget_description = __('Summary of the number of visible entries out of the total results.', 'gravityview' ); |
|
19 | + $this->widget_description = __( 'Summary of the number of visible entries out of the total results.', 'gravityview' ); |
|
20 | 20 | |
21 | 21 | $default_values = array( |
22 | 22 | 'header' => 1, |
@@ -25,18 +25,18 @@ discard block |
||
25 | 25 | |
26 | 26 | $settings = array(); |
27 | 27 | |
28 | - parent::__construct( __( 'Show Pagination Info', 'gravityview' ) , 'page_info', $default_values, $settings ); |
|
28 | + parent::__construct( __( 'Show Pagination Info', 'gravityview' ), 'page_info', $default_values, $settings ); |
|
29 | 29 | } |
30 | 30 | |
31 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
31 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
32 | 32 | $gravityview_view = GravityView_View::getInstance(); |
33 | 33 | |
34 | - if( !$this->pre_render_frontend() ) { |
|
34 | + if ( ! $this->pre_render_frontend() ) { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
38 | - if( !empty( $widget_args['title'] ) ) { |
|
39 | - echo $widget_args['title']; |
|
38 | + if ( ! empty( $widget_args[ 'title' ] ) ) { |
|
39 | + echo $widget_args[ 'title' ]; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $pagination_counts = $gravityview_view->getPaginationCounts(); |
@@ -45,16 +45,16 @@ discard block |
||
45 | 45 | |
46 | 46 | $output = ''; |
47 | 47 | |
48 | - if( ! empty( $pagination_counts ) ) { |
|
48 | + if ( ! empty( $pagination_counts ) ) { |
|
49 | 49 | |
50 | - $first = $pagination_counts['first']; |
|
51 | - $last = $pagination_counts['last']; |
|
52 | - $total = $pagination_counts['total']; |
|
50 | + $first = $pagination_counts[ 'first' ]; |
|
51 | + $last = $pagination_counts[ 'last' ]; |
|
52 | + $total = $pagination_counts[ 'total' ]; |
|
53 | 53 | |
54 | - $class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
54 | + $class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
55 | 55 | $class = gravityview_sanitize_html_class( $class ); |
56 | 56 | |
57 | - $output = '<div class="gv-widget-pagination '.$class.'"><p>'. sprintf(__( 'Displaying %1$s - %2$s of %3$s', 'gravityview' ), number_format_i18n( $first ), number_format_i18n( $last ), number_format_i18n( $total ) ) . '</p></div>'; |
|
57 | + $output = '<div class="gv-widget-pagination ' . $class . '"><p>' . sprintf( __( 'Displaying %1$s - %2$s of %3$s', 'gravityview' ), number_format_i18n( $first ), number_format_i18n( $last ), number_format_i18n( $total ) ) . '</p></div>'; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -71,13 +71,13 @@ discard block |
||
71 | 71 | |
72 | 72 | add_action( 'init', array( $this, 'load_plugin_textdomain' ) ); |
73 | 73 | |
74 | - add_action( 'admin_init', array( $this, 'settings') ); |
|
74 | + add_action( 'admin_init', array( $this, 'settings' ) ); |
|
75 | 75 | |
76 | 76 | add_action( 'admin_notices', array( $this, 'admin_notice' ), 100 ); |
77 | 77 | |
78 | 78 | add_action( 'gravityview/metaboxes/before_render', array( $this, 'add_metabox_tab' ) ); |
79 | 79 | |
80 | - if( false === $this->is_extension_supported() ) { |
|
80 | + if ( false === $this->is_extension_supported() ) { |
|
81 | 81 | return; |
82 | 82 | } |
83 | 83 | |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $tab_settings = $this->tab_settings(); |
117 | 117 | |
118 | 118 | // Don't add a tab if it's empty. |
119 | - if( empty( $tab_settings ) ) { |
|
119 | + if ( empty( $tab_settings ) ) { |
|
120 | 120 | return; |
121 | 121 | } |
122 | 122 | |
@@ -134,17 +134,17 @@ discard block |
||
134 | 134 | $tab = wp_parse_args( $tab_settings, $tab_defaults ); |
135 | 135 | |
136 | 136 | // Force the screen to be GravityView |
137 | - $tab['screen'] = 'gravityview'; |
|
137 | + $tab[ 'screen' ] = 'gravityview'; |
|
138 | 138 | |
139 | - if( class_exists('GravityView_Metabox_Tab') ) { |
|
139 | + if ( class_exists( 'GravityView_Metabox_Tab' ) ) { |
|
140 | 140 | |
141 | - $metabox = new GravityView_Metabox_Tab( $tab['id'], $tab['title'], $tab['file'], $tab['icon-class'], $tab['callback'], $tab['callback_args'] ); |
|
141 | + $metabox = new GravityView_Metabox_Tab( $tab[ 'id' ], $tab[ 'title' ], $tab[ 'file' ], $tab[ 'icon-class' ], $tab[ 'callback' ], $tab[ 'callback_args' ] ); |
|
142 | 142 | |
143 | 143 | GravityView_Metabox_Tabs::add( $metabox ); |
144 | 144 | |
145 | 145 | } else { |
146 | 146 | |
147 | - add_meta_box( 'gravityview_'.$tab['id'], $tab['title'], $tab['callback'], $tab['screen'], $tab['context'], $tab['priority'] ); |
|
147 | + add_meta_box( 'gravityview_' . $tab[ 'id' ], $tab[ 'title' ], $tab[ 'callback' ], $tab[ 'screen' ], $tab[ 'context' ], $tab[ 'priority' ] ); |
|
148 | 148 | |
149 | 149 | } |
150 | 150 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function load_plugin_textdomain() { |
162 | 162 | |
163 | - if( empty( $this->_text_domain ) ) { |
|
163 | + if ( empty( $this->_text_domain ) ) { |
|
164 | 164 | do_action( 'gravityview_log_debug', __METHOD__ . ': Extension translation cannot be loaded; the `_text_domain` variable is not defined', $this ); |
165 | 165 | return; |
166 | 166 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $lang_dir = dirname( plugin_basename( $path ) ) . '/languages/'; |
173 | 173 | |
174 | 174 | // Traditional WordPress plugin locale filter |
175 | - $locale = apply_filters( 'plugin_locale', get_locale(), $this->_text_domain ); |
|
175 | + $locale = apply_filters( 'plugin_locale', get_locale(), $this->_text_domain ); |
|
176 | 176 | |
177 | 177 | $mofile = sprintf( '%1$s-%2$s.mo', $this->_text_domain, $locale ); |
178 | 178 | |
@@ -202,11 +202,11 @@ discard block |
||
202 | 202 | */ |
203 | 203 | protected function get_license() { |
204 | 204 | |
205 | - if( !class_exists( 'GravityView_Settings' ) ) { |
|
205 | + if ( ! class_exists( 'GravityView_Settings' ) ) { |
|
206 | 206 | return false; |
207 | 207 | } |
208 | 208 | |
209 | - $license = GravityView_Settings::getSetting('license'); |
|
209 | + $license = GravityView_Settings::getSetting( 'license' ); |
|
210 | 210 | |
211 | 211 | return $license; |
212 | 212 | } |
@@ -219,16 +219,16 @@ discard block |
||
219 | 219 | public function settings() { |
220 | 220 | |
221 | 221 | // If doing ajax, get outta here |
222 | - if( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { |
|
222 | + if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { |
|
223 | 223 | return; |
224 | 224 | } |
225 | 225 | |
226 | - if( !class_exists( 'EDD_SL_Plugin_Updater' ) ) { |
|
226 | + if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) { |
|
227 | 227 | |
228 | 228 | $file_path = plugin_dir_path( __FILE__ ) . 'lib/EDD_SL_Plugin_Updater.php'; |
229 | 229 | |
230 | 230 | // This file may be in the lib/ directory already |
231 | - if( ! file_exists( $file_path ) ) { |
|
231 | + if ( ! file_exists( $file_path ) ) { |
|
232 | 232 | $file_path = plugin_dir_path( __FILE__ ) . '/EDD_SL_Plugin_Updater.php'; |
233 | 233 | } |
234 | 234 | |
@@ -238,16 +238,16 @@ discard block |
||
238 | 238 | $license = $this->get_license(); |
239 | 239 | |
240 | 240 | // Don't update if invalid license. |
241 | - if( false === $license || empty( $license['status'] ) || strtolower( $license['status'] ) !== 'valid' ) { return; } |
|
241 | + if ( false === $license || empty( $license[ 'status' ] ) || strtolower( $license[ 'status' ] ) !== 'valid' ) { return; } |
|
242 | 242 | |
243 | 243 | new EDD_SL_Plugin_Updater( |
244 | 244 | $this->_remote_update_url, |
245 | 245 | $this->_path, |
246 | 246 | array( |
247 | 247 | 'version' => $this->_version, // current version number |
248 | - 'license' => $license['license'], |
|
248 | + 'license' => $license[ 'license' ], |
|
249 | 249 | 'item_id' => $this->_item_id, // The ID of the download on _remote_update_url |
250 | - 'item_name' => $this->_title, // name of this plugin |
|
250 | + 'item_name' => $this->_title, // name of this plugin |
|
251 | 251 | 'author' => strip_tags( $this->_author ) // author of this plugin |
252 | 252 | ) |
253 | 253 | ); |
@@ -260,14 +260,14 @@ discard block |
||
260 | 260 | */ |
261 | 261 | public function admin_notice() { |
262 | 262 | |
263 | - if( empty( self::$admin_notices ) ) { |
|
263 | + if ( empty( self::$admin_notices ) ) { |
|
264 | 264 | return; |
265 | 265 | } |
266 | 266 | |
267 | - foreach( self::$admin_notices as $key => $notice ) { |
|
267 | + foreach ( self::$admin_notices as $key => $notice ) { |
|
268 | 268 | |
269 | - echo '<div id="message" class="'. esc_attr( $notice['class'] ).'">'; |
|
270 | - echo wpautop( $notice['message'] ); |
|
269 | + echo '<div id="message" class="' . esc_attr( $notice[ 'class' ] ) . '">'; |
|
270 | + echo wpautop( $notice[ 'message' ] ); |
|
271 | 271 | echo '<div class="clear"></div>'; |
272 | 272 | echo '</div>'; |
273 | 273 | } |
@@ -282,16 +282,16 @@ discard block |
||
282 | 282 | */ |
283 | 283 | public static function add_notice( $notice = array() ) { |
284 | 284 | |
285 | - if( is_array( $notice ) && !isset( $notice['message'] ) ) { |
|
286 | - do_action( 'gravityview_log_error', __CLASS__.'[add_notice] Notice not set', $notice ); |
|
285 | + if ( is_array( $notice ) && ! isset( $notice[ 'message' ] ) ) { |
|
286 | + do_action( 'gravityview_log_error', __CLASS__ . '[add_notice] Notice not set', $notice ); |
|
287 | 287 | return; |
288 | - } else if( is_string( $notice ) ) { |
|
288 | + } else if ( is_string( $notice ) ) { |
|
289 | 289 | $notice = array( 'message' => $notice ); |
290 | 290 | } |
291 | 291 | |
292 | - $notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class']; |
|
292 | + $notice[ 'class' ] = empty( $notice[ 'class' ] ) ? 'error' : $notice[ 'class' ]; |
|
293 | 293 | |
294 | - self::$admin_notices[] = $notice; |
|
294 | + self::$admin_notices[ ] = $notice; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
@@ -346,17 +346,17 @@ discard block |
||
346 | 346 | |
347 | 347 | $message = ''; |
348 | 348 | |
349 | - if( !class_exists( 'GravityView_Plugin' ) ) { |
|
349 | + if ( ! class_exists( 'GravityView_Plugin' ) ) { |
|
350 | 350 | |
351 | - $message = sprintf( __('Could not activate the %s Extension; GravityView is not active.', 'gravityview'), $this->_title ); |
|
351 | + $message = sprintf( __( 'Could not activate the %s Extension; GravityView is not active.', 'gravityview' ), $this->_title ); |
|
352 | 352 | |
353 | - } else if( false === version_compare(GravityView_Plugin::version, $this->_min_gravityview_version , ">=") ) { |
|
353 | + } else if ( false === version_compare( GravityView_Plugin::version, $this->_min_gravityview_version, ">=" ) ) { |
|
354 | 354 | |
355 | - $message = sprintf( __('The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), $this->_title, '<tt>'.$this->_min_gravityview_version.'</tt>' ); |
|
355 | + $message = sprintf( __( 'The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), $this->_title, '<tt>' . $this->_min_gravityview_version . '</tt>' ); |
|
356 | 356 | |
357 | - } else if( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version , ">=") ) { |
|
357 | + } else if ( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version, ">=" ) ) { |
|
358 | 358 | |
359 | - $message = sprintf( __('The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), $this->_title, '<tt>'.$this->_min_php_version.'</tt>' ); |
|
359 | + $message = sprintf( __( 'The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), $this->_title, '<tt>' . $this->_min_php_version . '</tt>' ); |
|
360 | 360 | |
361 | 361 | } else { |
362 | 362 | |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | |
369 | 369 | self::add_notice( $message ); |
370 | 370 | |
371 | - do_action( 'gravityview_log_error', __METHOD__. ' ' . $message ); |
|
371 | + do_action( 'gravityview_log_error', __METHOD__ . ' ' . $message ); |
|
372 | 372 | |
373 | 373 | self::$is_compatible = false; |
374 | 374 | } |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | |
23 | 23 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
24 | 24 | |
25 | - unset( $field_options['show_as_link'] ); |
|
25 | + unset( $field_options[ 'show_as_link' ] ); |
|
26 | 26 | |
27 | - if( 'edit' === $context ) { |
|
27 | + if ( 'edit' === $context ) { |
|
28 | 28 | return $field_options; |
29 | 29 | } |
30 | 30 | |
31 | - $this->add_field_support('dynamic_data', $field_options ); |
|
31 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
32 | 32 | |
33 | 33 | return $field_options; |
34 | 34 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function get_field_input( $form, $value = '', $entry = null, GF_Field_Post_Content $field ) { |
46 | 46 | |
47 | - $id = (int) $field->id; |
|
47 | + $id = (int)$field->id; |
|
48 | 48 | $input_name = "input_{$id}"; |
49 | 49 | $class = esc_attr( $field->size ); |
50 | 50 | $tabindex = $field->get_tabindex(); |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @return GravityView_Field | bool |
43 | 43 | */ |
44 | 44 | public static function create( $properties ) { |
45 | - $type = isset( $properties['type'] ) ? $properties['type'] : ''; |
|
46 | - $type = empty( $properties['inputType'] ) ? $type : $properties['inputType']; |
|
45 | + $type = isset( $properties[ 'type' ] ) ? $properties[ 'type' ] : ''; |
|
46 | + $type = empty( $properties[ 'inputType' ] ) ? $type : $properties[ 'inputType' ]; |
|
47 | 47 | if ( empty( $type ) || ! isset( self::$_fields[ $type ] ) ) { |
48 | 48 | return new GravityView_Field( $properties ); |
49 | 49 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @return bool True: yes, it exists; False: nope |
63 | 63 | */ |
64 | 64 | public static function exists( $field_name ) { |
65 | - return isset( self::$_fields["{$field_name}"] ); |
|
65 | + return isset( self::$_fields[ "{$field_name}" ] ); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | |
97 | 97 | $field_type = is_a( $gf_field, 'GF_Field' ) ? get_class( $gf_field ) : $gf_field; |
98 | 98 | |
99 | - foreach( self::$_fields as $field ) { |
|
100 | - if( $field_type === $field->_gf_field_class_name ) { |
|
99 | + foreach ( self::$_fields as $field ) { |
|
100 | + if ( $field_type === $field->_gf_field_class_name ) { |
|
101 | 101 | return $field; |
102 | 102 | } |
103 | 103 | } |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public static function get_all( $group = '' ) { |
118 | 118 | |
119 | - if( '' !== $group ) { |
|
119 | + if ( '' !== $group ) { |
|
120 | 120 | $return_fields = self::$_fields; |
121 | 121 | foreach ( $return_fields as $key => $field ) { |
122 | - if( $group !== $field->group ) { |
|
122 | + if ( $group !== $field->group ) { |
|
123 | 123 | unset( $return_fields[ $key ] ); |
124 | 124 | } |
125 | 125 | } |
@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | |
24 | 24 | function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
25 | 25 | |
26 | - if( 'edit' === $context ) { |
|
26 | + if ( 'edit' === $context ) { |
|
27 | 27 | return $field_options; |
28 | 28 | } |
29 | 29 | |
30 | - $this->add_field_support('date_display', $field_options ); |
|
30 | + $this->add_field_support( 'date_display', $field_options ); |
|
31 | 31 | |
32 | 32 | return $field_options; |
33 | 33 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $field_input_id = gravityview_get_input_id_from_id( $field_id ); |
52 | 52 | |
53 | 53 | $date_field_output = ''; |
54 | - switch( $field_input_id ) { |
|
54 | + switch ( $field_input_id ) { |
|
55 | 55 | case 1: |
56 | 56 | $date_field_output = rgar( $parsed_date, 'day' ); |
57 | 57 | break; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | add_filter( 'gravityview/sorting/time', array( $this, 'modify_sort_id' ), 10, 2 ); |
61 | 61 | |
62 | - add_filter('gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
62 | + add_filter( 'gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -100,31 +100,31 @@ discard block |
||
100 | 100 | public function _maybe_filter_gravity_forms_query( $criteria, $form_ids, $view_id ) { |
101 | 101 | |
102 | 102 | // If the search is being sorted |
103 | - if( ! empty( $criteria['sorting']['key'] ) ) { |
|
103 | + if ( ! empty( $criteria[ 'sorting' ][ 'key' ] ) ) { |
|
104 | 104 | |
105 | - $pieces = explode( $this->_sort_divider, $criteria['sorting']['key'] ); |
|
105 | + $pieces = explode( $this->_sort_divider, $criteria[ 'sorting' ][ 'key' ] ); |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * And the sort key matches the key set in modify_sort_id(), then modify the Gravity Forms query SQL |
109 | 109 | * @see modify_sort_id() |
110 | 110 | */ |
111 | - if( ! empty( $pieces[1] ) ) { |
|
111 | + if ( ! empty( $pieces[ 1 ] ) ) { |
|
112 | 112 | |
113 | 113 | // Pass these to the _modify_query_sort_by_time_hack() method |
114 | - $this->_time_format = $pieces[1]; |
|
115 | - $this->_date_format = $pieces[2]; |
|
114 | + $this->_time_format = $pieces[ 1 ]; |
|
115 | + $this->_date_format = $pieces[ 2 ]; |
|
116 | 116 | |
117 | 117 | // Remove fake input IDs (5.1 doesn't exist. Use 5) |
118 | - $criteria['sorting']['key'] = floor( $pieces[0] ); |
|
118 | + $criteria[ 'sorting' ][ 'key' ] = floor( $pieces[ 0 ] ); |
|
119 | 119 | |
120 | 120 | /** |
121 | 121 | * Make sure sorting is numeric (# of seconds). IMPORTANT. |
122 | 122 | * @see GVCommon::is_field_numeric() is_numeric should also be set here |
123 | 123 | */ |
124 | - $criteria['sorting']['is_numeric'] = true; |
|
124 | + $criteria[ 'sorting' ][ 'is_numeric' ] = true; |
|
125 | 125 | |
126 | 126 | // Modify the Gravity Forms WP Query |
127 | - add_filter('query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
127 | + add_filter( 'query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | * then we want to modify the query. |
148 | 148 | * @see GFFormsModel::sort_by_field_query() |
149 | 149 | */ |
150 | - if( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
150 | + if ( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
151 | 151 | |
152 | - if( $this->_time_format === '24' ) { |
|
152 | + if ( $this->_time_format === '24' ) { |
|
153 | 153 | $sql_str_to_date = "STR_TO_DATE( `value`, '%H:%i' )"; |
154 | 154 | } else { |
155 | 155 | $sql_str_to_date = "STR_TO_DATE( `value`, '%h:%i %p' )"; |
@@ -195,18 +195,18 @@ discard block |
||
195 | 195 | // Set variables |
196 | 196 | parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
197 | 197 | |
198 | - if( 'edit' === $context ) { |
|
198 | + if ( 'edit' === $context ) { |
|
199 | 199 | return $field_options; |
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
203 | 203 | * Set default date format based on field ID and Form ID |
204 | 204 | */ |
205 | - add_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
205 | + add_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
206 | 206 | |
207 | - $this->add_field_support('date_display', $field_options ); |
|
207 | + $this->add_field_support( 'date_display', $field_options ); |
|
208 | 208 | |
209 | - remove_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
209 | + remove_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
210 | 210 | |
211 | 211 | return $field_options; |
212 | 212 | } |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | private function _get_time_format() { |
222 | 222 | global $post; |
223 | 223 | |
224 | - $current_form = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : gravityview_get_form_id( $post->ID ); |
|
224 | + $current_form = isset( $_POST[ 'form_id' ] ) ? intval( $_POST[ 'form_id' ] ) : gravityview_get_form_id( $post->ID ); |
|
225 | 225 | |
226 | 226 | return self::_get_time_format_for_field( $this->_field_id, $current_form ); |
227 | 227 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | // GF defaults to 12, so should we. |
241 | 241 | $time_format = '12'; |
242 | 242 | |
243 | - if( $form_id ) { |
|
243 | + if ( $form_id ) { |
|
244 | 244 | $form = GFAPI::get_form( $form_id ); |
245 | 245 | |
246 | 246 | if ( $form ) { |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | $default = 'h:i A'; |
288 | 288 | |
289 | 289 | // This doesn't take into account 24-hour |
290 | - switch( $field_input_id ) { |
|
290 | + switch ( $field_input_id ) { |
|
291 | 291 | // Hours |
292 | 292 | case 1: |
293 | 293 | return ( $time_format === '12' ) ? 'h' : 'H'; |