@@ -2,8 +2,9 @@ |
||
2 | 2 | namespace GV; |
3 | 3 | |
4 | 4 | /** If this file is called directly, abort. */ |
5 | -if ( ! defined( 'GRAVITYVIEW_DIR' ) ) |
|
5 | +if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { |
|
6 | 6 | die(); |
7 | +} |
|
7 | 8 | |
8 | 9 | /** |
9 | 10 | * The base \GV\Shortcode class. |
@@ -50,7 +50,6 @@ |
||
50 | 50 | * |
51 | 51 | * @throws \ErrorException if shortcode with this name has already been registered elsewhere. |
52 | 52 | * @internal |
53 | - |
|
54 | 53 | * @return \GV\Shortcode The only internally registered instance of this shortcode. |
55 | 54 | */ |
56 | 55 | public static function add() { |
@@ -56,15 +56,15 @@ discard block |
||
56 | 56 | public static function add() { |
57 | 57 | $shortcode = new static(); |
58 | 58 | if ( shortcode_exists( $shortcode->name ) ) { |
59 | - if ( empty( self::$shortcodes[$shortcode->name] ) ) { |
|
59 | + if ( empty( self::$shortcodes[ $shortcode->name ] ) ) { |
|
60 | 60 | throw new \ErrorException( sprintf( 'Shortcode [%s] has already been registered elsewhere.', $shortcode->name ) ); |
61 | 61 | } |
62 | 62 | } else { |
63 | 63 | add_shortcode( $shortcode->name, array( get_class( $shortcode ), 'callback' ) ); |
64 | - self::$shortcodes[$shortcode->name] = $shortcode; |
|
64 | + self::$shortcodes[ $shortcode->name ] = $shortcode; |
|
65 | 65 | } |
66 | 66 | |
67 | - return self::$shortcodes[$shortcode->name]; |
|
67 | + return self::$shortcodes[ $shortcode->name ]; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public static function remove() { |
78 | 78 | $shortcode = new static(); |
79 | - unset( self::$shortcodes[$shortcode->name] ); |
|
79 | + unset( self::$shortcodes[ $shortcode->name ] ); |
|
80 | 80 | remove_shortcode( $shortcode->name ); |
81 | 81 | } |
82 | 82 | |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | preg_match_all( '/' . get_shortcode_regex() . '/', $content, $matches, PREG_SET_ORDER ); |
109 | 109 | |
110 | 110 | foreach ( $matches as $shortcode ) { |
111 | - $shortcode_name = $shortcode[2]; |
|
111 | + $shortcode_name = $shortcode[ 2 ]; |
|
112 | 112 | |
113 | - $shortcode_atts = shortcode_parse_atts( $shortcode[3] ); |
|
114 | - $shortcode_content = $shortcode[5]; |
|
113 | + $shortcode_atts = shortcode_parse_atts( $shortcode[ 3 ] ); |
|
114 | + $shortcode_content = $shortcode[ 5 ]; |
|
115 | 115 | |
116 | 116 | /** This is a registered GravityView shortcode. */ |
117 | - if ( !empty( self::$shortcodes[$shortcode_name] ) ) { |
|
118 | - $shortcode = clone( self::$shortcodes[$shortcode_name] ); |
|
117 | + if ( ! empty( self::$shortcodes[ $shortcode_name ] ) ) { |
|
118 | + $shortcode = clone( self::$shortcodes[ $shortcode_name ] ); |
|
119 | 119 | } else { |
120 | 120 | /** This is some generic shortcode. */ |
121 | 121 | $shortcode = new self; |
@@ -2,8 +2,9 @@ |
||
2 | 2 | namespace GV\Shortcodes; |
3 | 3 | |
4 | 4 | /** If this file is called directly, abort. */ |
5 | -if ( ! defined( 'GRAVITYVIEW_DIR' ) ) |
|
5 | +if ( ! defined( 'GRAVITYVIEW_DIR' ) ) { |
|
6 | 6 | die(); |
7 | +} |
|
7 | 8 | |
8 | 9 | /** |
9 | 10 | * The base \GV\Shortcode class. |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | // hold widget View options |
52 | 52 | private $widget_options; |
53 | 53 | |
54 | - function __construct( $widget_label , $widget_id , $defaults = array(), $settings = array() ) { |
|
54 | + function __construct( $widget_label, $widget_id, $defaults = array(), $settings = array() ) { |
|
55 | 55 | |
56 | 56 | |
57 | 57 | /** |
58 | 58 | * The shortcode name is set to the lowercase name of the widget class, unless overridden by the class specifying a different value for $shortcode_name |
59 | 59 | * @var string |
60 | 60 | */ |
61 | - $this->shortcode_name = !isset( $this->shortcode_name ) ? strtolower( get_class($this) ) : $this->shortcode_name; |
|
61 | + $this->shortcode_name = ! isset( $this->shortcode_name ) ? strtolower( get_class( $this ) ) : $this->shortcode_name; |
|
62 | 62 | |
63 | 63 | $this->widget_label = $widget_label; |
64 | 64 | $this->widget_id = $widget_id; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $this->settings = wp_parse_args( $settings, $this->settings ); |
70 | 70 | |
71 | 71 | // register widgets to be listed in the View Configuration |
72 | - add_filter( 'gravityview_register_directory_widgets', array( $this, 'register_widget') ); |
|
72 | + add_filter( 'gravityview_register_directory_widgets', array( $this, 'register_widget' ) ); |
|
73 | 73 | |
74 | 74 | // widget options |
75 | 75 | add_filter( 'gravityview_template_widget_options', array( $this, 'assign_widget_options' ), 10, 3 ); |
@@ -78,10 +78,10 @@ discard block |
||
78 | 78 | add_action( "gravityview_render_widget_{$widget_id}", array( $this, 'render_frontend' ), 10, 1 ); |
79 | 79 | |
80 | 80 | // register shortcodes |
81 | - add_action( 'wp', array( $this, 'add_shortcode') ); |
|
81 | + add_action( 'wp', array( $this, 'add_shortcode' ) ); |
|
82 | 82 | |
83 | 83 | // Use shortcodes in text widgets. |
84 | - add_filter('widget_text', array( $this, 'maybe_do_shortcode' ) ); |
|
84 | + add_filter( 'widget_text', array( $this, 'maybe_do_shortcode' ) ); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | |
@@ -99,14 +99,14 @@ discard block |
||
99 | 99 | * @param boolean $enable_custom_class False by default. Return true if you want to enable. |
100 | 100 | * @param GravityView_Widget $this Current instance of GravityView_Widget |
101 | 101 | */ |
102 | - $enable_custom_class = apply_filters('gravityview/widget/enable_custom_class', false, $this ); |
|
102 | + $enable_custom_class = apply_filters( 'gravityview/widget/enable_custom_class', false, $this ); |
|
103 | 103 | |
104 | - if( $enable_custom_class ) { |
|
104 | + if ( $enable_custom_class ) { |
|
105 | 105 | |
106 | - $settings['custom_class'] = array( |
|
106 | + $settings[ 'custom_class' ] = array( |
|
107 | 107 | 'type' => 'text', |
108 | 108 | 'label' => __( 'Custom CSS Class:', 'gravityview' ), |
109 | - 'desc' => __( 'This class will be added to the widget container', 'gravityview'), |
|
109 | + 'desc' => __( 'This class will be added to the widget container', 'gravityview' ), |
|
110 | 110 | 'value' => '', |
111 | 111 | 'merge_tags' => true, |
112 | 112 | ); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @return array|null Settings array; NULL if not set |
129 | 129 | */ |
130 | 130 | public function get_settings() { |
131 | - return !empty( $this->settings ) ? $this->settings : NULL; |
|
131 | + return ! empty( $this->settings ) ? $this->settings : NULL; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | public function get_setting( $key ) { |
140 | 140 | $setting = NULL; |
141 | 141 | |
142 | - if( isset( $this->settings ) && is_array( $this->settings ) ) { |
|
142 | + if ( isset( $this->settings ) && is_array( $this->settings ) ) { |
|
143 | 143 | $setting = isset( $this->settings[ $key ] ) ? $this->settings[ $key ] : NULL; |
144 | 144 | } |
145 | 145 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | function maybe_do_shortcode( $text, $widget = NULL ) { |
156 | 156 | |
157 | - if( !empty( $this->shortcode_name ) && has_shortcode( $text, $this->shortcode_name ) ) { |
|
157 | + if ( ! empty( $this->shortcode_name ) && has_shortcode( $text, $this->shortcode_name ) ) { |
|
158 | 158 | return do_shortcode( $text ); |
159 | 159 | } |
160 | 160 | |
@@ -183,26 +183,26 @@ discard block |
||
183 | 183 | return; |
184 | 184 | } |
185 | 185 | |
186 | - if( empty( $this->shortcode_name ) ) { return; } |
|
186 | + if ( empty( $this->shortcode_name ) ) { return; } |
|
187 | 187 | |
188 | 188 | // If the widget shouldn't output on single entries, don't show it |
189 | - if( empty( $this->show_on_single ) && class_exists('GravityView_frontend') && GravityView_frontend::is_single_entry() ) { |
|
190 | - do_action('gravityview_log_debug', sprintf( '%s[add_shortcode]: Skipping; set to not run on single entry.', get_class($this)) ); |
|
189 | + if ( empty( $this->show_on_single ) && class_exists( 'GravityView_frontend' ) && GravityView_frontend::is_single_entry() ) { |
|
190 | + do_action( 'gravityview_log_debug', sprintf( '%s[add_shortcode]: Skipping; set to not run on single entry.', get_class( $this ) ) ); |
|
191 | 191 | |
192 | 192 | add_shortcode( $this->shortcode_name, '__return_null' ); |
193 | 193 | return; |
194 | 194 | } |
195 | 195 | |
196 | 196 | |
197 | - if( !has_gravityview_shortcode( $post ) ) { |
|
197 | + if ( ! has_gravityview_shortcode( $post ) ) { |
|
198 | 198 | |
199 | - do_action('gravityview_log_debug', sprintf( '%s[add_shortcode]: No shortcode present; not adding render_frontend shortcode.', get_class($this)) ); |
|
199 | + do_action( 'gravityview_log_debug', sprintf( '%s[add_shortcode]: No shortcode present; not adding render_frontend shortcode.', get_class( $this ) ) ); |
|
200 | 200 | |
201 | 201 | add_shortcode( $this->shortcode_name, '__return_null' ); |
202 | 202 | return; |
203 | 203 | } |
204 | 204 | |
205 | - add_shortcode( $this->shortcode_name, array( $this, 'render_shortcode') ); |
|
205 | + add_shortcode( $this->shortcode_name, array( $this, 'render_shortcode' ) ); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | */ |
213 | 213 | function register_widget( $widgets ) { |
214 | 214 | $widgets[ $this->widget_id ] = array( |
215 | - 'label' => $this->widget_label , |
|
215 | + 'label' => $this->widget_label, |
|
216 | 216 | 'description' => $this->widget_description, |
217 | 217 | 'subtitle' => $this->widget_subtitle, |
218 | 218 | ); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | */ |
230 | 230 | public function assign_widget_options( $options = array(), $template = '', $widget = '' ) { |
231 | 231 | |
232 | - if( $this->widget_id === $widget ) { |
|
232 | + if ( $this->widget_id === $widget ) { |
|
233 | 233 | $options = array_merge( $options, $this->settings ); |
234 | 234 | } |
235 | 235 | |
@@ -242,9 +242,9 @@ discard block |
||
242 | 242 | * |
243 | 243 | * @return void |
244 | 244 | */ |
245 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
245 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
246 | 246 | // to be defined by child class |
247 | - if( !$this->pre_render_frontend() ) { |
|
247 | + if ( ! $this->pre_render_frontend() ) { |
|
248 | 248 | return; |
249 | 249 | } |
250 | 250 | } |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | public function pre_render_frontend() { |
257 | 257 | $gravityview_view = GravityView_View::getInstance(); |
258 | 258 | |
259 | - if( empty( $gravityview_view ) ) { |
|
260 | - do_action('gravityview_log_debug', sprintf( '%s[render_frontend]: $gravityview_view not instantiated yet.', get_class($this)) ); |
|
259 | + if ( empty( $gravityview_view ) ) { |
|
260 | + do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend]: $gravityview_view not instantiated yet.', get_class( $this ) ) ); |
|
261 | 261 | return false; |
262 | 262 | } |
263 | 263 | |
@@ -268,8 +268,8 @@ discard block |
||
268 | 268 | */ |
269 | 269 | $hide_until_search = apply_filters( 'gravityview/widget/hide_until_searched', $gravityview_view->hide_until_searched, $this ); |
270 | 270 | |
271 | - if( $hide_until_search ) { |
|
272 | - do_action('gravityview_log_debug', sprintf( '%s[render_frontend]: Hide View data until search is performed', get_class($this)) ); |
|
271 | + if ( $hide_until_search ) { |
|
272 | + do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend]: Hide View data until search is performed', get_class( $this ) ) ); |
|
273 | 273 | return false; |
274 | 274 | } |
275 | 275 |
@@ -312,8 +312,9 @@ discard block |
||
312 | 312 | */ |
313 | 313 | public static function is_admin() { |
314 | 314 | |
315 | - if ( function_exists( 'gravityview' ) ) |
|
316 | - return gravityview()->request->is_admin(); |
|
315 | + if ( function_exists( 'gravityview' ) ) { |
|
316 | + return gravityview()->request->is_admin(); |
|
317 | + } |
|
317 | 318 | |
318 | 319 | $doing_ajax = defined( 'DOING_AJAX' ) ? DOING_AJAX : false; |
319 | 320 | |
@@ -382,7 +383,7 @@ discard block |
||
382 | 383 | * @param mixed $data Additional data to display |
383 | 384 | * @return void |
384 | 385 | */ |
385 | - public static function log_debug( $message, $data = null ){ |
|
386 | + public static function log_debug( $message, $data = null ) { |
|
386 | 387 | /** |
387 | 388 | * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
388 | 389 | * @param string $message Message to display |
@@ -396,7 +397,7 @@ discard block |
||
396 | 397 | * @param string $message log message |
397 | 398 | * @return void |
398 | 399 | */ |
399 | - public static function log_error( $message, $data = null ){ |
|
400 | + public static function log_error( $message, $data = null ) { |
|
400 | 401 | /** |
401 | 402 | * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output |
402 | 403 | * @param string $message Error message to display |
@@ -232,7 +232,7 @@ |
||
232 | 232 | * Does the if and the comparison match? |
233 | 233 | * @uses GVCommon::matches_operation |
234 | 234 | * |
235 | - * @return boolean True: yep; false: nope |
|
235 | + * @return boolean|null True: yep; false: nope |
|
236 | 236 | */ |
237 | 237 | private function set_is_match() { |
238 | 238 | $this->is_match = GVCommon::matches_operation( $this->if, $this->comparison, $this->operation ); |
@@ -77,7 +77,7 @@ |
||
77 | 77 | /** |
78 | 78 | * Alias for get_instance() |
79 | 79 | * |
80 | - * @param $field_name |
|
80 | + * @param string $field_name |
|
81 | 81 | * |
82 | 82 | * @return GravityView_Field|false |
83 | 83 | */ |
@@ -40,7 +40,6 @@ |
||
40 | 40 | * Get the default date format for a field based on the field ID and the time format setting |
41 | 41 | * |
42 | 42 | * @since 1.16.4 |
43 | - |
|
44 | 43 | * @param string $date_format The Gravity Forms date format for the field. Default: "mdy" |
45 | 44 | * @param int $field_id The ID of the field. Used to figure out full date/day/month/year |
46 | 45 | * |
@@ -13,7 +13,7 @@ |
||
13 | 13 | * @see GFCommon::get_field_filter_settings Gravity Forms suggests checkboxes should just be "contains" |
14 | 14 | * @var array |
15 | 15 | */ |
16 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
16 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
17 | 17 | |
18 | 18 | var $is_searchable = true; |
19 | 19 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | var $is_searchable = true; |
13 | 13 | |
14 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
14 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
15 | 15 | |
16 | 16 | var $_gf_field_class_name = 'GF_Field_Radio'; |
17 | 17 | |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | // Set the $_field_id var |
41 | 41 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
42 | 42 | |
43 | - if( $this->is_choice_value_enabled() ) { |
|
44 | - $field_options['choice_display'] = array( |
|
43 | + if ( $this->is_choice_value_enabled() ) { |
|
44 | + $field_options[ 'choice_display' ] = array( |
|
45 | 45 | 'type' => 'radio', |
46 | 46 | 'value' => 'value', |
47 | 47 | 'label' => __( 'What should be displayed:', 'gravityview' ), |