@@ -12,8 +12,8 @@ |
||
| 12 | 12 | ?> |
| 13 | 13 | |
| 14 | 14 | <div class="gv-search-box"> |
| 15 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" class="gv-check-radio"> |
|
| 16 | - <input type="checkbox" name="<?php echo esc_attr( $search_field['name'] ); ?>" value="1" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" <?php checked( '1', $search_field['value'], true ); ?>> |
|
| 17 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { echo esc_html( $search_field['label'] ); } ?> |
|
| 15 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" class="gv-check-radio"> |
|
| 16 | + <input type="checkbox" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="1" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" <?php checked( '1', $search_field[ 'value' ], true ); ?>> |
|
| 17 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { echo esc_html( $search_field[ 'label' ] ); } ?> |
|
| 18 | 18 | </label> |
| 19 | 19 | </div> |
| 20 | 20 | \ 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 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | function __construct() { |
| 19 | 19 | |
| 20 | - $this->widget_description = __('Insert custom text or HTML as a widget', 'gravityview' ); |
|
| 20 | + $this->widget_description = __( 'Insert custom text or HTML as a widget', 'gravityview' ); |
|
| 21 | 21 | |
| 22 | 22 | $default_values = array( |
| 23 | 23 | 'header' => 1, |
@@ -42,39 +42,39 @@ discard block |
||
| 42 | 42 | ), |
| 43 | 43 | ); |
| 44 | 44 | |
| 45 | - parent::__construct( __( 'Custom Content', 'gravityview' ) , 'custom_content', $default_values, $settings ); |
|
| 45 | + parent::__construct( __( 'Custom Content', 'gravityview' ), 'custom_content', $default_values, $settings ); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public function render_frontend( $widget_args, $content = '', $context = '') { |
|
| 48 | + public function render_frontend( $widget_args, $content = '', $context = '' ) { |
|
| 49 | 49 | |
| 50 | - if( !$this->pre_render_frontend() ) { |
|
| 50 | + if ( ! $this->pre_render_frontend() ) { |
|
| 51 | 51 | return; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - if( !empty( $widget_args['title'] ) ) { |
|
| 55 | - echo $widget_args['title']; |
|
| 54 | + if ( ! empty( $widget_args[ 'title' ] ) ) { |
|
| 55 | + echo $widget_args[ 'title' ]; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
| 59 | 59 | // Make sure the class is loaded in DataTables |
| 60 | - if( !class_exists( 'GFFormDisplay' ) ) { |
|
| 60 | + if ( ! class_exists( 'GFFormDisplay' ) ) { |
|
| 61 | 61 | include_once( GFCommon::get_base_path() . '/form_display.php' ); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - $widget_args['content'] = trim( rtrim( $widget_args['content'] ) ); |
|
| 64 | + $widget_args[ 'content' ] = trim( rtrim( $widget_args[ 'content' ] ) ); |
|
| 65 | 65 | |
| 66 | 66 | // No custom content |
| 67 | - if( empty( $widget_args['content'] ) ) { |
|
| 68 | - do_action('gravityview_log_debug', sprintf( '%s[render_frontend]: No content.', get_class($this)) ); |
|
| 67 | + if ( empty( $widget_args[ 'content' ] ) ) { |
|
| 68 | + do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend]: No content.', get_class( $this ) ) ); |
|
| 69 | 69 | return; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // Add paragraphs? |
| 73 | - if( !empty( $widget_args['wpautop'] ) ) { |
|
| 74 | - $widget_args['content'] = wpautop( $widget_args['content'] ); |
|
| 73 | + if ( ! empty( $widget_args[ 'wpautop' ] ) ) { |
|
| 74 | + $widget_args[ 'content' ] = wpautop( $widget_args[ 'content' ] ); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - $content = $widget_args['content']; |
|
| 77 | + $content = $widget_args[ 'content' ]; |
|
| 78 | 78 | |
| 79 | 79 | $content = GravityView_Merge_Tags::replace_variables( $content ); |
| 80 | 80 | |
@@ -84,10 +84,10 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | |
| 86 | 86 | // Add custom class |
| 87 | - $class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
| 87 | + $class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
| 88 | 88 | $class = gravityview_sanitize_html_class( $class ); |
| 89 | 89 | |
| 90 | - echo '<div class="gv-widget-custom-content '.$class.'">'. $content .'</div>'; |
|
| 90 | + echo '<div class="gv-widget-custom-content ' . $class . '">' . $content . '</div>'; |
|
| 91 | 91 | |
| 92 | 92 | } |
| 93 | 93 | |
@@ -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 | /** |
@@ -170,25 +170,25 @@ discard block |
||
| 170 | 170 | public function get_output() { |
| 171 | 171 | |
| 172 | 172 | // No Entries |
| 173 | - if( empty( $this->entries ) ) { |
|
| 174 | - return '<div class="gv-no-results">'.$this->empty_message.'</div>'; |
|
| 173 | + if ( empty( $this->entries ) ) { |
|
| 174 | + return '<div class="gv-no-results">' . $this->empty_message . '</div>'; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | $output = ''; |
| 178 | 178 | $current_entry = GravityView_View::getInstance()->getCurrentEntry(); |
| 179 | 179 | |
| 180 | - $output .= '<'. $this->wrapper_tag .'>'; |
|
| 180 | + $output .= '<' . $this->wrapper_tag . '>'; |
|
| 181 | 181 | |
| 182 | - foreach( $this->entries as $entry ) { |
|
| 182 | + foreach ( $this->entries as $entry ) { |
|
| 183 | 183 | |
| 184 | - if( $this->skip_entry( $entry, $current_entry ) ) { |
|
| 184 | + if ( $this->skip_entry( $entry, $current_entry ) ) { |
|
| 185 | 185 | continue; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | $output .= $this->get_item_output( $entry ); |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - $output .= '</'. $this->wrapper_tag .'>'; |
|
| 191 | + $output .= '</' . $this->wrapper_tag . '>'; |
|
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | 194 | * @filter `gravityview/widget/recent-entries/output` Modify the HTML of the Recent Entries widget output |
@@ -211,15 +211,15 @@ discard block |
||
| 211 | 211 | private function skip_entry( $entry, $current_entry ) { |
| 212 | 212 | |
| 213 | 213 | // If skip entry is off, or there's no current entry, return false |
| 214 | - if( empty( $this->skip_current_entry ) || empty( $current_entry ) ) { |
|
| 214 | + if ( empty( $this->skip_current_entry ) || empty( $current_entry ) ) { |
|
| 215 | 215 | return false; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | // If in Single or Edit mode, $current_entry will be an array. |
| 219 | - $current_entry_id = is_array( $current_entry ) ? $current_entry['id'] : $current_entry; |
|
| 219 | + $current_entry_id = is_array( $current_entry ) ? $current_entry[ 'id' ] : $current_entry; |
|
| 220 | 220 | |
| 221 | 221 | // If the entry ID matches the current entry, yes: skip |
| 222 | - if( $entry['id'] === $current_entry_id ) { |
|
| 222 | + if ( $entry[ 'id' ] === $current_entry_id ) { |
|
| 223 | 223 | return true; |
| 224 | 224 | } |
| 225 | 225 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | |
| 247 | 247 | $item_output = gravityview_get_link( $link, $this->link_format ); |
| 248 | 248 | |
| 249 | - if( !empty( $this->after_link ) ) { |
|
| 249 | + if ( ! empty( $this->after_link ) ) { |
|
| 250 | 250 | |
| 251 | 251 | /** |
| 252 | 252 | * @filter `gravityview/entry-list/after-link` Modify the content displayed after the entry link in an entry list |
@@ -255,14 +255,14 @@ discard block |
||
| 255 | 255 | * @param array $entry Gravity Forms entry array |
| 256 | 256 | * @param GravityView_Entry_List $this The current class instance |
| 257 | 257 | */ |
| 258 | - $after_link = apply_filters( 'gravityview/entry-list/after-link', '<div>'.$this->after_link.'</div>', $entry, $this ); |
|
| 258 | + $after_link = apply_filters( 'gravityview/entry-list/after-link', '<div>' . $this->after_link . '</div>', $entry, $this ); |
|
| 259 | 259 | |
| 260 | 260 | $item_output .= $after_link; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | $item_output = GravityView_API::replace_variables( $item_output, $this->form, $entry ); |
| 264 | 264 | |
| 265 | - $item_output = '<'. $this->item_tag .'>'. $item_output .'</'. $this->item_tag .'>'; |
|
| 265 | + $item_output = '<' . $this->item_tag . '>' . $item_output . '</' . $this->item_tag . '>'; |
|
| 266 | 266 | |
| 267 | 267 | /** |
| 268 | 268 | * @filter `gravityview/entry-list/item` Modify each item's output in an entry list |
@@ -49,8 +49,8 @@ discard block |
||
| 49 | 49 | do_action( 'gravityview_log_debug', __FUNCTION__ . ' $passed_atts: ', $passed_atts ); |
| 50 | 50 | |
| 51 | 51 | // Get details about the current View |
| 52 | - if( !empty( $passed_atts['detail'] ) ) { |
|
| 53 | - return $this->get_view_detail( $passed_atts['detail'] ); |
|
| 52 | + if ( ! empty( $passed_atts[ 'detail' ] ) ) { |
|
| 53 | + return $this->get_view_detail( $passed_atts[ 'detail' ] ); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | $atts = $this->parse_and_sanitize_atts( $passed_atts ); |
@@ -90,12 +90,12 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | $atts = array(); |
| 92 | 92 | |
| 93 | - foreach( $filtered_atts as $key => $passed_value ) { |
|
| 93 | + foreach ( $filtered_atts as $key => $passed_value ) { |
|
| 94 | 94 | |
| 95 | 95 | // Allow using {get} merge tags in shortcode attributes |
| 96 | 96 | $passed_value = GravityView_Merge_Tags::replace_get_variables( $passed_value ); |
| 97 | 97 | |
| 98 | - switch( $defaults[ $key ]['type'] ) { |
|
| 98 | + switch ( $defaults[ $key ][ 'type' ] ) { |
|
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * Make sure number fields are numeric. |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @see http://php.net/manual/en/function.is-numeric.php#107326 |
| 104 | 104 | */ |
| 105 | 105 | case 'number': |
| 106 | - if( is_numeric( $passed_value ) ) { |
|
| 106 | + if ( is_numeric( $passed_value ) ) { |
|
| 107 | 107 | $atts[ $key ] = ( $passed_value + 0 ); |
| 108 | 108 | } |
| 109 | 109 | break; |
@@ -118,8 +118,8 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | case 'select': |
| 120 | 120 | case 'radio': |
| 121 | - $options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options']; |
|
| 122 | - if( in_array( $passed_value, array_keys( $options ) ) ) { |
|
| 121 | + $options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ]; |
|
| 122 | + if ( in_array( $passed_value, array_keys( $options ) ) ) { |
|
| 123 | 123 | $atts[ $key ] = $passed_value; |
| 124 | 124 | } |
| 125 | 125 | break; |
@@ -148,21 +148,21 @@ discard block |
||
| 148 | 148 | $gravityview_view = GravityView_View::getInstance(); |
| 149 | 149 | $return = ''; |
| 150 | 150 | |
| 151 | - switch( $detail ) { |
|
| 151 | + switch ( $detail ) { |
|
| 152 | 152 | case 'total_entries': |
| 153 | 153 | $return = number_format_i18n( $gravityview_view->getTotalEntries() ); |
| 154 | 154 | break; |
| 155 | 155 | case 'first_entry': |
| 156 | 156 | $paging = $gravityview_view->getPaginationCounts(); |
| 157 | - $return = empty( $paging ) ? '' : number_format_i18n( $paging['first'] ); |
|
| 157 | + $return = empty( $paging ) ? '' : number_format_i18n( $paging[ 'first' ] ); |
|
| 158 | 158 | break; |
| 159 | 159 | case 'last_entry': |
| 160 | 160 | $paging = $gravityview_view->getPaginationCounts(); |
| 161 | - $return = empty( $paging ) ? '' : number_format_i18n( $paging['last'] ); |
|
| 161 | + $return = empty( $paging ) ? '' : number_format_i18n( $paging[ 'last' ] ); |
|
| 162 | 162 | break; |
| 163 | 163 | case 'page_size': |
| 164 | 164 | $paging = $gravityview_view->getPaging(); |
| 165 | - $return = number_format_i18n( $paging['page_size'] ); |
|
| 165 | + $return = number_format_i18n( $paging[ 'page_size' ] ); |
|
| 166 | 166 | break; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -7,9 +7,9 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | function __construct() { |
| 9 | 9 | |
| 10 | - add_action( 'gravityview_log_error', array( $this, 'log_error'), 10, 2 ); |
|
| 10 | + add_action( 'gravityview_log_error', array( $this, 'log_error' ), 10, 2 ); |
|
| 11 | 11 | |
| 12 | - add_action( 'gravityview_log_debug', array( $this, 'log_debug'), 10, 2 ); |
|
| 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 | 15 | add_filter( 'gform_logging_supported', array( $this, 'enable_gform_logging' ) ); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | include_once( GRAVITYVIEW_DIR . 'includes/class-debug-bar.php' ); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - $panels[] = new GravityView_Debug_Bar; |
|
| 37 | + $panels[ ] = new GravityView_Debug_Bar; |
|
| 38 | 38 | |
| 39 | 39 | return $panels; |
| 40 | 40 | } |
@@ -44,7 +44,7 @@ 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'; |
|
| 47 | + $supported_plugins[ 'gravityview' ] = 'GravityView'; |
|
| 48 | 48 | return $supported_plugins; |
| 49 | 49 | } |
| 50 | 50 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * @return string "print_r" or "var_export" |
| 73 | 73 | */ |
| 74 | 74 | static function get_print_function() { |
| 75 | - if( ob_get_level() > 0 ) { |
|
| 75 | + if ( ob_get_level() > 0 ) { |
|
| 76 | 76 | $function = 'var_export'; |
| 77 | 77 | } else { |
| 78 | 78 | $function = 'print_r'; |
@@ -88,36 +88,36 @@ discard block |
||
| 88 | 88 | $notice = array( |
| 89 | 89 | 'message' => $function( $message, true ), |
| 90 | 90 | 'data' => $data, |
| 91 | - 'backtrace' => function_exists('wp_debug_backtrace_summary') ? wp_debug_backtrace_summary( null, 3 ) : '', |
|
| 91 | + 'backtrace' => function_exists( 'wp_debug_backtrace_summary' ) ? wp_debug_backtrace_summary( null, 3 ) : '', |
|
| 92 | 92 | ); |
| 93 | 93 | |
| 94 | - if( !in_array( $notice, self::$notices ) ) { |
|
| 95 | - self::$notices[] = $notice; |
|
| 94 | + if ( ! in_array( $notice, self::$notices ) ) { |
|
| 95 | + self::$notices[ ] = $notice; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - if ( class_exists("GFLogging") ) { |
|
| 98 | + if ( class_exists( "GFLogging" ) ) { |
|
| 99 | 99 | GFLogging::include_logger(); |
| 100 | - GFLogging::log_message( 'gravityview', $function( $message, true ) . $function($data, true), KLogger::DEBUG ); |
|
| 100 | + GFLogging::log_message( 'gravityview', $function( $message, true ) . $function( $data, true ), KLogger::DEBUG ); |
|
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - static function log_error( $message = '', $data = null ) { |
|
| 104 | + static function log_error( $message = '', $data = null ) { |
|
| 105 | 105 | |
| 106 | 106 | $function = self::get_print_function(); |
| 107 | 107 | |
| 108 | 108 | $error = array( |
| 109 | 109 | 'message' => $message, |
| 110 | 110 | 'data' => $data, |
| 111 | - 'backtrace' => function_exists('wp_debug_backtrace_summary') ? wp_debug_backtrace_summary( null, 3 ) : '', |
|
| 111 | + 'backtrace' => function_exists( 'wp_debug_backtrace_summary' ) ? wp_debug_backtrace_summary( null, 3 ) : '', |
|
| 112 | 112 | ); |
| 113 | 113 | |
| 114 | - if( !in_array( $error, self::$errors ) ) { |
|
| 115 | - self::$errors[] = $error; |
|
| 114 | + if ( ! in_array( $error, self::$errors ) ) { |
|
| 115 | + self::$errors[ ] = $error; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - if ( class_exists("GFLogging") ) { |
|
| 118 | + if ( class_exists( "GFLogging" ) ) { |
|
| 119 | 119 | GFLogging::include_logger(); |
| 120 | - GFLogging::log_message( 'gravityview', $function ( $message, true ) . $function ($data, true), KLogger::ERROR ); |
|
| 120 | + GFLogging::log_message( 'gravityview', $function( $message, true ) . $function( $data, true ), KLogger::ERROR ); |
|
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | |
@@ -65,11 +65,11 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | $atts = wp_parse_args( $atts, $defaults ); |
| 67 | 67 | |
| 68 | - foreach( $atts as $key => $val ) { |
|
| 68 | + foreach ( $atts as $key => $val ) { |
|
| 69 | 69 | $this->{$key} = $val; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - $this->class = !empty( $this->class ) ? esc_attr( implode( ' ', (array)$this->class ) ) : $this->class; |
|
| 72 | + $this->class = ! empty( $this->class ) ? esc_attr( implode( ' ', (array)$this->class ) ) : $this->class; |
|
| 73 | 73 | |
| 74 | 74 | $this->set_image_size(); |
| 75 | 75 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | function validate_image_src() { |
| 87 | 87 | |
| 88 | - if ( !$this->validate_src ) { return true; } |
|
| 88 | + if ( ! $this->validate_src ) { return true; } |
|
| 89 | 89 | |
| 90 | 90 | $info = pathinfo( $this->src ); |
| 91 | 91 | |
@@ -93,9 +93,9 @@ discard block |
||
| 93 | 93 | * @filter `gravityview_image_extensions` Extensions that GravityView recognizes as valid images to be shown in an `img` tag |
| 94 | 94 | * @param array $image_exts Default: `['jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico']` |
| 95 | 95 | */ |
| 96 | - $image_exts = apply_filters( 'gravityview_image_extensions', array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico' )); |
|
| 96 | + $image_exts = apply_filters( 'gravityview_image_extensions', array( 'jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico' ) ); |
|
| 97 | 97 | |
| 98 | - return isset( $info['extension'] ) && in_array( strtolower( $info['extension'] ), $image_exts); |
|
| 98 | + return isset( $info[ 'extension' ] ) && in_array( strtolower( $info[ 'extension' ] ), $image_exts ); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -111,11 +111,11 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | // And there is no string size passed |
| 113 | 113 | // And we want to get the image size using PHP |
| 114 | - if ( empty( $string ) && !empty( $this->getimagesize ) ) { |
|
| 114 | + if ( empty( $string ) && ! empty( $this->getimagesize ) ) { |
|
| 115 | 115 | |
| 116 | 116 | $image_size = getimagesize( $this->src ); |
| 117 | 117 | |
| 118 | - if ( !empty( $image_size ) ) { |
|
| 118 | + if ( ! empty( $image_size ) ) { |
|
| 119 | 119 | list( $width, $height ) = $image_size; |
| 120 | 120 | } |
| 121 | 121 | |
@@ -128,33 +128,33 @@ discard block |
||
| 128 | 128 | * @param array $image_sizes Array of image sizes with the key being the size slug, and the value being an array with `width` and `height` defined, in pixels |
| 129 | 129 | */ |
| 130 | 130 | $image_sizes = apply_filters( 'gravityview_image_sizes', array( |
| 131 | - 'tiny' => array('width' => 40, 'height' => 30), |
|
| 132 | - 'small' => array('width' => 100, 'height' => 75), |
|
| 133 | - 'medium' => array('width' => 250, 'height' => 188), |
|
| 134 | - 'large' => array('width' => 448, 'height' => 336), |
|
| 131 | + 'tiny' => array( 'width' => 40, 'height' => 30 ), |
|
| 132 | + 'small' => array( 'width' => 100, 'height' => 75 ), |
|
| 133 | + 'medium' => array( 'width' => 250, 'height' => 188 ), |
|
| 134 | + 'large' => array( 'width' => 448, 'height' => 336 ), |
|
| 135 | 135 | ) ); |
| 136 | 136 | |
| 137 | - switch( $this->size ) { |
|
| 137 | + switch ( $this->size ) { |
|
| 138 | 138 | case 'tiny': |
| 139 | - extract($image_sizes['tiny']); |
|
| 139 | + extract( $image_sizes[ 'tiny' ] ); |
|
| 140 | 140 | break; |
| 141 | 141 | case 'small': |
| 142 | 142 | case 's': |
| 143 | 143 | case 'thumb': |
| 144 | - extract($image_sizes['small']); |
|
| 144 | + extract( $image_sizes[ 'small' ] ); |
|
| 145 | 145 | break; |
| 146 | 146 | case 'm': |
| 147 | 147 | case 'medium': |
| 148 | - extract($image_sizes['medium']); |
|
| 148 | + extract( $image_sizes[ 'medium' ] ); |
|
| 149 | 149 | break; |
| 150 | 150 | case 'large': |
| 151 | 151 | case 'l': |
| 152 | - extract($image_sizes['large']); |
|
| 152 | + extract( $image_sizes[ 'large' ] ); |
|
| 153 | 153 | break; |
| 154 | 154 | default: |
| 155 | 155 | // Verify that the passed sizes are integers. |
| 156 | - $width = !empty( $width ) ? intval( $width ) : intval( $this->width ); |
|
| 157 | - $height = !empty( $height ) ? intval( $height ) : intval( $this->height ); |
|
| 156 | + $width = ! empty( $width ) ? intval( $width ) : intval( $this->width ); |
|
| 157 | + $height = ! empty( $height ) ? intval( $height ) : intval( $this->height ); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | } |
@@ -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 | } |