@@ -21,7 +21,7 @@ |
||
| 21 | 21 | * @return string |
| 22 | 22 | */ |
| 23 | 23 | function get_field_desc() { |
| 24 | - return !empty( $this->field['desc'] ) ? $this->field['desc'] : ''; |
|
| 24 | + return ! empty( $this->field[ 'desc' ] ) ? $this->field[ 'desc' ] : ''; |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | function render_input( $override_input = null ) { |
| 25 | - if( isset( $override_input ) ) { |
|
| 25 | + if ( isset( $override_input ) ) { |
|
| 26 | 26 | echo $override_input; |
| 27 | 27 | return; |
| 28 | 28 | } |
@@ -30,18 +30,18 @@ discard block |
||
| 30 | 30 | ?> |
| 31 | 31 | <ul class="gv-setting-list"> |
| 32 | 32 | <?php |
| 33 | - foreach( $this->field['options'] as $value => $label ) { ?> |
|
| 34 | - <li <?php if( isset( $label['requires'] ) ) { printf( 'class="gv-sub-setting" data-requires="%s"', $label['requires'] ); } ?>> |
|
| 33 | + foreach ( $this->field[ 'options' ] as $value => $label ) { ?> |
|
| 34 | + <li <?php if ( isset( $label[ 'requires' ] ) ) { printf( 'class="gv-sub-setting" data-requires="%s"', $label[ 'requires' ] ); } ?>> |
|
| 35 | 35 | <label> |
| 36 | 36 | <input name="<?php printf( '%s[%s]', esc_attr( $this->name ), esc_attr( $value ) ); ?>" type="hidden" |
| 37 | 37 | value="0"/> |
| 38 | 38 | <input name="<?php printf( '%s[%s]', esc_attr( $this->name ), esc_attr( $value ) ); ?>" |
| 39 | 39 | id="<?php echo $this->get_field_id(); ?>" type="checkbox" |
| 40 | 40 | value="1" <?php checked( ! empty( $this->value[ $value ] ) ); ?> /> |
| 41 | - <?php echo esc_html( $label['label'] ); ?> |
|
| 41 | + <?php echo esc_html( $label[ 'label' ] ); ?> |
|
| 42 | 42 | </label> |
| 43 | - <?php if( ! empty( $label['desc'] ) ) { |
|
| 44 | - printf( '<span class="howto">%s</span>', $label['desc'] ); |
|
| 43 | + <?php if ( ! empty( $label[ 'desc' ] ) ) { |
|
| 44 | + printf( '<span class="howto">%s</span>', $label[ 'desc' ] ); |
|
| 45 | 45 | } |
| 46 | 46 | ?> |
| 47 | 47 | </li> |
@@ -9,9 +9,9 @@ discard block |
||
| 9 | 9 | $gravityview_view = GravityView_View::getInstance(); |
| 10 | 10 | |
| 11 | 11 | $visibility_settings = $gravityview_view->getCurrentFieldSetting( 'notes' ); |
| 12 | -$show_notes_logged_out = ( ! empty( $visibility_settings['view'] ) && ! empty( $visibility_settings['view_loggedout'] ) ); |
|
| 12 | +$show_notes_logged_out = ( ! empty( $visibility_settings[ 'view' ] ) && ! empty( $visibility_settings[ 'view_loggedout' ] ) ); |
|
| 13 | 13 | |
| 14 | -if( ! GVCommon::has_cap( array( 'gravityview_view_entry_notes', 'gravityview_add_entry_notes', 'gravityview_delete_entry_notes' ) ) && ! $show_notes_logged_out ) { |
|
| 14 | +if ( ! GVCommon::has_cap( array( 'gravityview_view_entry_notes', 'gravityview_add_entry_notes', 'gravityview_delete_entry_notes' ) ) && ! $show_notes_logged_out ) { |
|
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | 17 | |
@@ -25,20 +25,20 @@ discard block |
||
| 25 | 25 | do_action( 'gravityview/field/notes/scripts' ); |
| 26 | 26 | |
| 27 | 27 | $entry = $gravityview_view->getCurrentEntry(); |
| 28 | -$notes = GravityView_Entry_Notes::get_notes( $entry['id'] ); |
|
| 28 | +$notes = GravityView_Entry_Notes::get_notes( $entry[ 'id' ] ); |
|
| 29 | 29 | $strings = GravityView_Field_Notes::strings(); |
| 30 | -$entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
| 30 | +$entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
| 31 | 31 | |
| 32 | -$show_add = ! empty( $visibility_settings['add'] ); |
|
| 33 | -$show_delete = ( ! empty( $visibility_settings['delete'] ) && GVCommon::has_cap( 'gravityview_delete_entry_notes' ) ); |
|
| 34 | -$show_notes = $show_notes_logged_out || ( ! empty( $visibility_settings['view'] ) && GVCommon::has_cap( 'gravityview_view_entry_notes' ) ); |
|
| 32 | +$show_add = ! empty( $visibility_settings[ 'add' ] ); |
|
| 33 | +$show_delete = ( ! empty( $visibility_settings[ 'delete' ] ) && GVCommon::has_cap( 'gravityview_delete_entry_notes' ) ); |
|
| 34 | +$show_notes = $show_notes_logged_out || ( ! empty( $visibility_settings[ 'view' ] ) && GVCommon::has_cap( 'gravityview_view_entry_notes' ) ); |
|
| 35 | 35 | |
| 36 | 36 | $container_class = ( sizeof( $notes ) > 0 ? 'gv-has-notes' : 'gv-no-notes' ); |
| 37 | 37 | $container_class .= $show_notes ? ' gv-show-notes' : ' gv-hide-notes'; |
| 38 | 38 | ?> |
| 39 | 39 | <div class="gv-notes <?php echo $container_class; ?>"> |
| 40 | 40 | <?php |
| 41 | - if( $show_notes ) { |
|
| 41 | + if ( $show_notes ) { |
|
| 42 | 42 | ?> |
| 43 | 43 | <form method="post" class="gv-notes-list"> |
| 44 | 44 | <?php if ( $show_delete ) { wp_nonce_field( 'gv_delete_notes_' . $entry_slug, 'gv_delete_notes' ); } ?> |
@@ -46,21 +46,21 @@ discard block |
||
| 46 | 46 | <input type="hidden" name="action" value="gv_delete_notes" /> |
| 47 | 47 | <input type="hidden" name="entry-slug" value="<?php echo esc_attr( $entry_slug ); ?>" /> |
| 48 | 48 | <table> |
| 49 | - <caption><?php echo $strings['caption']; ?></caption> |
|
| 49 | + <caption><?php echo $strings[ 'caption' ]; ?></caption> |
|
| 50 | 50 | <?php |
| 51 | 51 | if ( $show_delete ) { |
| 52 | 52 | ?> |
| 53 | 53 | <thead> |
| 54 | 54 | <tr> |
| 55 | 55 | <th colspan="2"> |
| 56 | - <label><input type="checkbox" value="" class="gv-notes-toggle" title="<?php echo $strings['toggle-notes']; ?>"><span class="screen-reader-text"><?php echo $strings['toggle-notes']; ?></span></label> |
|
| 57 | - <button type="submit" class="button button-small gv-notes-delete"><?php echo $strings['delete']; ?></button> |
|
| 56 | + <label><input type="checkbox" value="" class="gv-notes-toggle" title="<?php echo $strings[ 'toggle-notes' ]; ?>"><span class="screen-reader-text"><?php echo $strings[ 'toggle-notes' ]; ?></span></label> |
|
| 57 | + <button type="submit" class="button button-small gv-notes-delete"><?php echo $strings[ 'delete' ]; ?></button> |
|
| 58 | 58 | </th> |
| 59 | 59 | </tr> |
| 60 | 60 | </thead> |
| 61 | 61 | <?php } ?> |
| 62 | 62 | <tbody> |
| 63 | - <tr class="gv-notes-no-notes"><td colspan="2"><?php echo $strings['no-notes']; ?></td></tr> |
|
| 63 | + <tr class="gv-notes-no-notes"><td colspan="2"><?php echo $strings[ 'no-notes' ]; ?></td></tr> |
|
| 64 | 64 | <?php |
| 65 | 65 | foreach ( $notes as $note ) { |
| 66 | 66 | echo GravityView_Field_Notes::display_note( $note, $show_delete ); |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | <?php |
| 74 | 74 | } // End if can view notes |
| 75 | 75 | |
| 76 | - if( $show_add ) { |
|
| 76 | + if ( $show_add ) { |
|
| 77 | 77 | echo do_shortcode( '[gv_note_add]' ); |
| 78 | 78 | } |
| 79 | 79 | ?> |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public static function get_instance() { |
| 87 | 87 | |
| 88 | - if( empty( self::$instance ) ) { |
|
| 88 | + if ( empty( self::$instance ) ) { |
|
| 89 | 89 | self::$instance = new self; |
| 90 | 90 | } |
| 91 | 91 | |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | $operators = array_merge( self::$SUPPORTED_ARRAY_OPERATORS, self::$SUPPORTED_NUMERIC_OPERATORS, self::$SUPPORTED_SCALAR_OPERATORS, self::$SUPPORTED_CUSTOM_OPERATORS ); |
| 120 | 120 | |
| 121 | - if( $with_values ) { |
|
| 121 | + if ( $with_values ) { |
|
| 122 | 122 | $operators_with_values = array(); |
| 123 | - foreach( $operators as $key ) { |
|
| 123 | + foreach ( $operators as $key ) { |
|
| 124 | 124 | $operators_with_values[ $key ] = ''; |
| 125 | 125 | } |
| 126 | 126 | return $operators_with_values; |
@@ -137,14 +137,14 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | function set_operation( $operation = '' ) { |
| 139 | 139 | |
| 140 | - if( empty( $operation ) ) { |
|
| 140 | + if ( empty( $operation ) ) { |
|
| 141 | 141 | return false; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | $operators = $this->get_operators( false ); |
| 145 | 145 | |
| 146 | - if( !in_array( $operation, $operators ) ) { |
|
| 147 | - do_action( 'gravityview_log_debug', __METHOD__ .' Attempted to add invalid operation type.', $operation ); |
|
| 146 | + if ( ! in_array( $operation, $operators ) ) { |
|
| 147 | + do_action( 'gravityview_log_debug', __METHOD__ . ' Attempted to add invalid operation type.', $operation ); |
|
| 148 | 148 | return false; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -164,11 +164,11 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | private function setup_operation_and_comparison() { |
| 166 | 166 | |
| 167 | - foreach( $this->atts as $key => $value ) { |
|
| 167 | + foreach ( $this->atts as $key => $value ) { |
|
| 168 | 168 | |
| 169 | 169 | $valid = $this->set_operation( $key ); |
| 170 | 170 | |
| 171 | - if( $valid ) { |
|
| 171 | + if ( $valid ) { |
|
| 172 | 172 | $this->comparison = $value; |
| 173 | 173 | return true; |
| 174 | 174 | } |
@@ -191,8 +191,8 @@ discard block |
||
| 191 | 191 | return null; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - if( empty( $atts ) ) { |
|
| 195 | - do_action( 'gravityview_log_error', __METHOD__.' $atts are empty.', $atts ); |
|
| 194 | + if ( empty( $atts ) ) { |
|
| 195 | + do_action( 'gravityview_log_error', __METHOD__ . ' $atts are empty.', $atts ); |
|
| 196 | 196 | return null; |
| 197 | 197 | } |
| 198 | 198 | |
@@ -203,16 +203,16 @@ discard block |
||
| 203 | 203 | $this->parse_atts(); |
| 204 | 204 | |
| 205 | 205 | // We need an "if" |
| 206 | - if( false === $this->if ) { |
|
| 207 | - do_action( 'gravityview_log_error', __METHOD__.' $atts->if is empty.', $this->passed_atts ); |
|
| 206 | + if ( false === $this->if ) { |
|
| 207 | + do_action( 'gravityview_log_error', __METHOD__ . ' $atts->if is empty.', $this->passed_atts ); |
|
| 208 | 208 | return null; |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | $setup = $this->setup_operation_and_comparison(); |
| 212 | 212 | |
| 213 | 213 | // We need an operation and comparison value |
| 214 | - if( ! $setup ) { |
|
| 215 | - do_action( 'gravityview_log_error', __METHOD__.' No valid operators were passed.', $this->atts ); |
|
| 214 | + if ( ! $setup ) { |
|
| 215 | + do_action( 'gravityview_log_error', __METHOD__ . ' No valid operators were passed.', $this->atts ); |
|
| 216 | 216 | return null; |
| 217 | 217 | } |
| 218 | 218 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | */ |
| 246 | 246 | private function get_output() { |
| 247 | 247 | |
| 248 | - if( $this->is_match ) { |
|
| 248 | + if ( $this->is_match ) { |
|
| 249 | 249 | $output = $this->content; |
| 250 | 250 | } else { |
| 251 | 251 | $output = $this->else_content; |
@@ -259,9 +259,9 @@ discard block |
||
| 259 | 259 | * @param string $output HTML/text output |
| 260 | 260 | * @param GVLogic_Shortcode $this This class |
| 261 | 261 | */ |
| 262 | - $output = apply_filters('gravityview/gvlogic/output', $output, $this ); |
|
| 262 | + $output = apply_filters( 'gravityview/gvlogic/output', $output, $this ); |
|
| 263 | 263 | |
| 264 | - do_action( 'gravityview_log_debug', __METHOD__ .' Output: ', $output ); |
|
| 264 | + do_action( 'gravityview_log_debug', __METHOD__ . ' Output: ', $output ); |
|
| 265 | 265 | |
| 266 | 266 | return $output; |
| 267 | 267 | } |
@@ -277,11 +277,11 @@ discard block |
||
| 277 | 277 | |
| 278 | 278 | $content = explode( '[else]', $this->passed_content ); |
| 279 | 279 | |
| 280 | - $this->content = $content[0]; |
|
| 280 | + $this->content = $content[ 0 ]; |
|
| 281 | 281 | |
| 282 | - $else_attr = isset( $this->atts['else'] ) ? $this->atts['else'] : NULL; |
|
| 282 | + $else_attr = isset( $this->atts[ 'else' ] ) ? $this->atts[ 'else' ] : NULL; |
|
| 283 | 283 | |
| 284 | - $this->else_content = isset( $content[1] ) ? $content[1] : $else_attr; |
|
| 284 | + $this->else_content = isset( $content[ 1 ] ) ? $content[ 1 ] : $else_attr; |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | /** |
@@ -304,10 +304,10 @@ discard block |
||
| 304 | 304 | $this->atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( $this->passed_atts, $this->atts ) : $this->atts; |
| 305 | 305 | |
| 306 | 306 | // Strip whitespace if it's not default false |
| 307 | - $this->if = is_string( $this->atts['if'] ) ? trim( $this->atts['if'] ) : false; |
|
| 307 | + $this->if = is_string( $this->atts[ 'if' ] ) ? trim( $this->atts[ 'if' ] ) : false; |
|
| 308 | 308 | |
| 309 | 309 | // Make sure the "if" isn't processed in self::setup_operation_and_comparison() |
| 310 | - unset( $this->atts['if'] ); |
|
| 310 | + unset( $this->atts[ 'if' ] ); |
|
| 311 | 311 | } |
| 312 | 312 | } |
| 313 | 313 | |
@@ -42,12 +42,12 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | add_action( 'wp', array( $this, 'process_delete' ), 10000 ); |
| 44 | 44 | |
| 45 | - add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field'), 10, 3 ); |
|
| 45 | + add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 ); |
|
| 46 | 46 | |
| 47 | 47 | add_action( 'gravityview_before', array( $this, 'display_message' ) ); |
| 48 | 48 | |
| 49 | 49 | // For the Delete Entry Link, you don't want visible to all users. |
| 50 | - add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps'), 10, 5 ); |
|
| 50 | + add_filter( 'gravityview_field_visibility_caps', array( $this, 'modify_visibility_caps' ), 10, 5 ); |
|
| 51 | 51 | |
| 52 | 52 | // Modify the field options based on the name of the field type |
| 53 | 53 | add_filter( 'gravityview_template_delete_link_options', array( $this, 'delete_link_field_options' ), 10, 5 ); |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | // add template path to check for field |
| 56 | 56 | add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) ); |
| 57 | 57 | |
| 58 | - add_action( 'gravityview/edit-entry/publishing-action/after', array( $this, 'add_delete_button'), 10, 3 ); |
|
| 58 | + add_action( 'gravityview/edit-entry/publishing-action/after', array( $this, 'add_delete_button' ), 10, 3 ); |
|
| 59 | 59 | |
| 60 | - add_action ( 'gravityview/delete-entry/deleted', array( $this, 'process_connected_posts' ), 10, 2 ); |
|
| 61 | - add_action ( 'gravityview/delete-entry/trashed', array( $this, 'process_connected_posts' ), 10, 2 ); |
|
| 60 | + add_action( 'gravityview/delete-entry/deleted', array( $this, 'process_connected_posts' ), 10, 2 ); |
|
| 61 | + add_action( 'gravityview/delete-entry/trashed', array( $this, 'process_connected_posts' ), 10, 2 ); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | static function getInstance() { |
| 71 | 71 | |
| 72 | - if( empty( self::$instance ) ) { |
|
| 72 | + if ( empty( self::$instance ) ) { |
|
| 73 | 73 | self::$instance = new self; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -105,20 +105,20 @@ discard block |
||
| 105 | 105 | function delete_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 106 | 106 | |
| 107 | 107 | // Always a link, never a filter |
| 108 | - unset( $field_options['show_as_link'], $field_options['search_filter'] ); |
|
| 108 | + unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ] ); |
|
| 109 | 109 | |
| 110 | 110 | // Delete Entry link should only appear to visitors capable of editing entries |
| 111 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
| 111 | + unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] ); |
|
| 112 | 112 | |
| 113 | - $add_option['delete_link'] = array( |
|
| 113 | + $add_option[ 'delete_link' ] = array( |
|
| 114 | 114 | 'type' => 'text', |
| 115 | 115 | 'label' => __( 'Delete Link Text', 'gravityview' ), |
| 116 | 116 | 'desc' => NULL, |
| 117 | - 'value' => __('Delete Entry', 'gravityview'), |
|
| 117 | + 'value' => __( 'Delete Entry', 'gravityview' ), |
|
| 118 | 118 | 'merge_tags' => true, |
| 119 | 119 | ); |
| 120 | 120 | |
| 121 | - $field_options['allow_edit_cap'] = array( |
|
| 121 | + $field_options[ 'allow_edit_cap' ] = array( |
|
| 122 | 122 | 'type' => 'select', |
| 123 | 123 | 'label' => __( 'Allow the following users to delete the entry:', 'gravityview' ), |
| 124 | 124 | 'choices' => GravityView_Render_Settings::get_cap_choices( $template_id, $field_id, $context, $input_type ), |
@@ -142,10 +142,10 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) { |
| 144 | 144 | |
| 145 | - $entry_default_fields['delete_link'] = array( |
|
| 146 | - 'label' => __('Delete Entry', 'gravityview'), |
|
| 145 | + $entry_default_fields[ 'delete_link' ] = array( |
|
| 146 | + 'label' => __( 'Delete Entry', 'gravityview' ), |
|
| 147 | 147 | 'type' => 'delete_link', |
| 148 | - 'desc' => __('A link to delete the entry. Respects the Delete Entry permissions.', 'gravityview'), |
|
| 148 | + 'desc' => __( 'A link to delete the entry. Respects the Delete Entry permissions.', 'gravityview' ), |
|
| 149 | 149 | ); |
| 150 | 150 | |
| 151 | 151 | return $entry_default_fields; |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | */ |
| 159 | 159 | function add_available_field( $available_fields = array() ) { |
| 160 | 160 | |
| 161 | - $available_fields['delete_link'] = array( |
|
| 161 | + $available_fields[ 'delete_link' ] = array( |
|
| 162 | 162 | 'label_text' => __( 'Delete Entry', 'gravityview' ), |
| 163 | 163 | 'field_id' => 'delete_link', |
| 164 | 164 | 'label_type' => 'field', |
@@ -186,12 +186,12 @@ discard block |
||
| 186 | 186 | $caps = $visibility_caps; |
| 187 | 187 | |
| 188 | 188 | // If we're configuring fields in the edit context, we want a limited selection |
| 189 | - if( $field_id === 'delete_link' ) { |
|
| 189 | + if ( $field_id === 'delete_link' ) { |
|
| 190 | 190 | |
| 191 | 191 | // Remove other built-in caps. |
| 192 | - unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] ); |
|
| 192 | + unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'delete_others_posts' ] ); |
|
| 193 | 193 | |
| 194 | - $caps['read'] = _x('Entry Creator', 'User capability', 'gravityview'); |
|
| 194 | + $caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' ); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | return $caps; |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * @param [type] $entry [description] |
| 205 | 205 | */ |
| 206 | 206 | function set_entry( $entry = null ) { |
| 207 | - $this->entry = empty( $entry ) ? GravityView_View::getInstance()->entries[0] : $entry; |
|
| 207 | + $this->entry = empty( $entry ) ? GravityView_View::getInstance()->entries[ 0 ] : $entry; |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | /** |
@@ -234,13 +234,13 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | $base = GravityView_API::directory_link( $post_id, true ); |
| 236 | 236 | |
| 237 | - if( empty( $base ) ) { |
|
| 238 | - do_action( 'gravityview_log_error', __METHOD__ . ' - Post ID does not exist: '.$post_id ); |
|
| 237 | + if ( empty( $base ) ) { |
|
| 238 | + do_action( 'gravityview_log_error', __METHOD__ . ' - Post ID does not exist: ' . $post_id ); |
|
| 239 | 239 | return NULL; |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | // Use the slug instead of the ID for consistent security |
| 243 | - $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
| 243 | + $entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
| 244 | 244 | |
| 245 | 245 | $view_id = empty( $view_id ) ? gravityview_get_view_id() : $view_id; |
| 246 | 246 | |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | 'view_id' => $view_id, |
| 252 | 252 | ), $base ); |
| 253 | 253 | |
| 254 | - $url = wp_nonce_url( $actionurl, 'delete_'.$entry_slug, 'delete' ); |
|
| 254 | + $url = wp_nonce_url( $actionurl, 'delete_' . $entry_slug, 'delete' ); |
|
| 255 | 255 | |
| 256 | 256 | return $url; |
| 257 | 257 | } |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | function add_delete_button( $form = array(), $entry = array(), $view_id = NULL ) { |
| 269 | 269 | |
| 270 | 270 | // Only show the link to those who are allowed to see it. |
| 271 | - if( !self::check_user_cap_delete_entry( $entry ) ) { |
|
| 271 | + if ( ! self::check_user_cap_delete_entry( $entry ) ) { |
|
| 272 | 272 | return; |
| 273 | 273 | } |
| 274 | 274 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | $show_delete_button = apply_filters( 'gravityview/delete-entry/show-delete-button', true ); |
| 280 | 280 | |
| 281 | 281 | // If the button is hidden by the filter, don't show. |
| 282 | - if( !$show_delete_button ) { |
|
| 282 | + if ( ! $show_delete_button ) { |
|
| 283 | 283 | return; |
| 284 | 284 | } |
| 285 | 285 | |
@@ -309,27 +309,27 @@ discard block |
||
| 309 | 309 | function process_delete() { |
| 310 | 310 | |
| 311 | 311 | // If the form is submitted |
| 312 | - if( isset( $_GET['action'] ) && 'delete' === $_GET['action'] && isset( $_GET['entry_id'] ) ) { |
|
| 312 | + if ( isset( $_GET[ 'action' ] ) && 'delete' === $_GET[ 'action' ] && isset( $_GET[ 'entry_id' ] ) ) { |
|
| 313 | 313 | |
| 314 | 314 | // Make sure it's a GravityView request |
| 315 | - $valid_nonce_key = wp_verify_nonce( $_GET['delete'], self::get_nonce_key( $_GET['entry_id'] ) ); |
|
| 315 | + $valid_nonce_key = wp_verify_nonce( $_GET[ 'delete' ], self::get_nonce_key( $_GET[ 'entry_id' ] ) ); |
|
| 316 | 316 | |
| 317 | - if( ! $valid_nonce_key ) { |
|
| 318 | - do_action('gravityview_log_debug', __METHOD__ . ' Delete entry not processed: nonce validation failed.' ); |
|
| 317 | + if ( ! $valid_nonce_key ) { |
|
| 318 | + do_action( 'gravityview_log_debug', __METHOD__ . ' Delete entry not processed: nonce validation failed.' ); |
|
| 319 | 319 | return; |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | // Get the entry slug |
| 323 | - $entry_slug = esc_attr( $_GET['entry_id'] ); |
|
| 323 | + $entry_slug = esc_attr( $_GET[ 'entry_id' ] ); |
|
| 324 | 324 | |
| 325 | 325 | // See if there's an entry there |
| 326 | 326 | $entry = gravityview_get_entry( $entry_slug ); |
| 327 | 327 | |
| 328 | - if( $entry ) { |
|
| 328 | + if ( $entry ) { |
|
| 329 | 329 | |
| 330 | 330 | $has_permission = $this->user_can_delete_entry( $entry ); |
| 331 | 331 | |
| 332 | - if( is_wp_error( $has_permission ) ) { |
|
| 332 | + if ( is_wp_error( $has_permission ) ) { |
|
| 333 | 333 | |
| 334 | 334 | $messages = array( |
| 335 | 335 | 'message' => urlencode( $has_permission->get_error_message() ), |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | // Delete the entry |
| 342 | 342 | $delete_response = $this->delete_or_trash_entry( $entry ); |
| 343 | 343 | |
| 344 | - if( is_wp_error( $delete_response ) ) { |
|
| 344 | + if ( is_wp_error( $delete_response ) ) { |
|
| 345 | 345 | |
| 346 | 346 | $messages = array( |
| 347 | 347 | 'message' => urlencode( $delete_response->get_error_message() ), |
@@ -360,10 +360,10 @@ discard block |
||
| 360 | 360 | |
| 361 | 361 | } else { |
| 362 | 362 | |
| 363 | - do_action('gravityview_log_debug', __METHOD__ . ' Delete entry failed: there was no entry with the entry slug '. $entry_slug ); |
|
| 363 | + do_action( 'gravityview_log_debug', __METHOD__ . ' Delete entry failed: there was no entry with the entry slug ' . $entry_slug ); |
|
| 364 | 364 | |
| 365 | 365 | $messages = array( |
| 366 | - 'message' => urlencode( __('The entry does not exist.', 'gravityview') ), |
|
| 366 | + 'message' => urlencode( __( 'The entry does not exist.', 'gravityview' ) ), |
|
| 367 | 367 | 'status' => 'error', |
| 368 | 368 | ); |
| 369 | 369 | } |
@@ -403,18 +403,18 @@ discard block |
||
| 403 | 403 | */ |
| 404 | 404 | private function delete_or_trash_entry( $entry ) { |
| 405 | 405 | |
| 406 | - $entry_id = $entry['id']; |
|
| 406 | + $entry_id = $entry[ 'id' ]; |
|
| 407 | 407 | |
| 408 | 408 | $mode = $this->get_delete_mode(); |
| 409 | 409 | |
| 410 | - if( 'delete' === $mode ) { |
|
| 410 | + if ( 'delete' === $mode ) { |
|
| 411 | 411 | |
| 412 | 412 | do_action( 'gravityview_log_debug', __METHOD__ . ' Starting delete entry: ', $entry_id ); |
| 413 | 413 | |
| 414 | 414 | // Delete the entry |
| 415 | 415 | $delete_response = GFAPI::delete_entry( $entry_id ); |
| 416 | 416 | |
| 417 | - if( ! is_wp_error( $delete_response ) ) { |
|
| 417 | + if ( ! is_wp_error( $delete_response ) ) { |
|
| 418 | 418 | $delete_response = 'deleted'; |
| 419 | 419 | |
| 420 | 420 | /** |
@@ -435,8 +435,8 @@ discard block |
||
| 435 | 435 | $trashed = GFAPI::update_entry_property( $entry_id, 'status', 'trash' ); |
| 436 | 436 | new GravityView_Cache; |
| 437 | 437 | |
| 438 | - if( ! $trashed ) { |
|
| 439 | - $delete_response = new WP_Error( 'trash_entry_failed', __('Moving the entry to the trash failed.', 'gravityview' ) ); |
|
| 438 | + if ( ! $trashed ) { |
|
| 439 | + $delete_response = new WP_Error( 'trash_entry_failed', __( 'Moving the entry to the trash failed.', 'gravityview' ) ); |
|
| 440 | 440 | } else { |
| 441 | 441 | |
| 442 | 442 | /** |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | public function process_connected_posts( $entry_id = 0, $entry = array() ) { |
| 468 | 468 | |
| 469 | 469 | // The entry had no connected post |
| 470 | - if( empty( $entry['post_id'] ) ) { |
|
| 470 | + if ( empty( $entry[ 'post_id' ] ) ) { |
|
| 471 | 471 | return; |
| 472 | 472 | } |
| 473 | 473 | |
@@ -478,22 +478,22 @@ discard block |
||
| 478 | 478 | */ |
| 479 | 479 | $delete_post = apply_filters( 'gravityview/delete-entry/delete-connected-post', true ); |
| 480 | 480 | |
| 481 | - if( false === $delete_post ) { |
|
| 481 | + if ( false === $delete_post ) { |
|
| 482 | 482 | return; |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | $action = current_action(); |
| 486 | 486 | |
| 487 | - if( 'gravityview/delete-entry/deleted' === $action ) { |
|
| 488 | - $result = wp_delete_post( $entry['post_id'], true ); |
|
| 487 | + if ( 'gravityview/delete-entry/deleted' === $action ) { |
|
| 488 | + $result = wp_delete_post( $entry[ 'post_id' ], true ); |
|
| 489 | 489 | } else { |
| 490 | - $result = wp_trash_post( $entry['post_id'] ); |
|
| 490 | + $result = wp_trash_post( $entry[ 'post_id' ] ); |
|
| 491 | 491 | } |
| 492 | 492 | |
| 493 | - if( false === $result ) { |
|
| 494 | - do_action( 'gravityview_log_error', __METHOD__ . ' (called by '.$action.'): Error processing the Post connected to the entry.', $entry ); |
|
| 493 | + if ( false === $result ) { |
|
| 494 | + do_action( 'gravityview_log_error', __METHOD__ . ' (called by ' . $action . '): Error processing the Post connected to the entry.', $entry ); |
|
| 495 | 495 | } else { |
| 496 | - do_action( 'gravityview_log_debug', __METHOD__ . ' (called by '.$action.'): Successfully processed Post connected to the entry.', $entry ); |
|
| 496 | + do_action( 'gravityview_log_debug', __METHOD__ . ' (called by ' . $action . '): Successfully processed Post connected to the entry.', $entry ); |
|
| 497 | 497 | } |
| 498 | 498 | } |
| 499 | 499 | |
@@ -506,13 +506,13 @@ discard block |
||
| 506 | 506 | public function verify_nonce() { |
| 507 | 507 | |
| 508 | 508 | // No delete entry request was made |
| 509 | - if( empty( $_GET['entry_id'] ) || empty( $_GET['delete'] ) ) { |
|
| 509 | + if ( empty( $_GET[ 'entry_id' ] ) || empty( $_GET[ 'delete' ] ) ) { |
|
| 510 | 510 | return false; |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | - $nonce_key = self::get_nonce_key( $_GET['entry_id'] ); |
|
| 513 | + $nonce_key = self::get_nonce_key( $_GET[ 'entry_id' ] ); |
|
| 514 | 514 | |
| 515 | - $valid = wp_verify_nonce( $_GET['delete'], $nonce_key ); |
|
| 515 | + $valid = wp_verify_nonce( $_GET[ 'delete' ], $nonce_key ); |
|
| 516 | 516 | |
| 517 | 517 | /** |
| 518 | 518 | * @filter `gravityview/delete-entry/verify_nonce` Override Delete Entry nonce validation. Return true to declare nonce valid. |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | */ |
| 535 | 535 | public static function get_confirm_dialog() { |
| 536 | 536 | |
| 537 | - $confirm = __('Are you sure you want to delete this entry? This cannot be undone.', 'gravityview'); |
|
| 537 | + $confirm = __( 'Are you sure you want to delete this entry? This cannot be undone.', 'gravityview' ); |
|
| 538 | 538 | |
| 539 | 539 | /** |
| 540 | 540 | * @filter `gravityview/delete-entry/confirm-text` Modify the Delete Entry Javascript confirmation text |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | */ |
| 543 | 543 | $confirm = apply_filters( 'gravityview/delete-entry/confirm-text', $confirm ); |
| 544 | 544 | |
| 545 | - return 'return window.confirm(\''. esc_js( $confirm ) .'\');'; |
|
| 545 | + return 'return window.confirm(\'' . esc_js( $confirm ) . '\');'; |
|
| 546 | 546 | } |
| 547 | 547 | |
| 548 | 548 | /** |
@@ -560,16 +560,16 @@ discard block |
||
| 560 | 560 | |
| 561 | 561 | $error = NULL; |
| 562 | 562 | |
| 563 | - if( ! $this->verify_nonce() ) { |
|
| 564 | - $error = __( 'The link to delete this entry is not valid; it may have expired.', 'gravityview'); |
|
| 563 | + if ( ! $this->verify_nonce() ) { |
|
| 564 | + $error = __( 'The link to delete this entry is not valid; it may have expired.', 'gravityview' ); |
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | - if( ! self::check_user_cap_delete_entry( $entry ) ) { |
|
| 568 | - $error = __( 'You do not have permission to delete this entry.', 'gravityview'); |
|
| 567 | + if ( ! self::check_user_cap_delete_entry( $entry ) ) { |
|
| 568 | + $error = __( 'You do not have permission to delete this entry.', 'gravityview' ); |
|
| 569 | 569 | } |
| 570 | 570 | |
| 571 | - if( $entry['status'] === 'trash' ) { |
|
| 572 | - if( 'trash' === $this->get_delete_mode() ) { |
|
| 571 | + if ( $entry[ 'status' ] === 'trash' ) { |
|
| 572 | + if ( 'trash' === $this->get_delete_mode() ) { |
|
| 573 | 573 | $error = __( 'The entry is already in the trash.', 'gravityview' ); |
| 574 | 574 | } else { |
| 575 | 575 | $error = __( 'You cannot delete the entry; it is already in the trash.', 'gravityview' ); |
@@ -577,11 +577,11 @@ discard block |
||
| 577 | 577 | } |
| 578 | 578 | |
| 579 | 579 | // No errors; everything's fine here! |
| 580 | - if( empty( $error ) ) { |
|
| 580 | + if ( empty( $error ) ) { |
|
| 581 | 581 | return true; |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | - do_action('gravityview_log_error', 'GravityView_Delete_Entry[user_can_delete_entry]' . $error ); |
|
| 584 | + do_action( 'gravityview_log_error', 'GravityView_Delete_Entry[user_can_delete_entry]' . $error ); |
|
| 585 | 585 | |
| 586 | 586 | return new WP_Error( 'gravityview-delete-entry-permissions', $error ); |
| 587 | 587 | } |
@@ -603,32 +603,32 @@ discard block |
||
| 603 | 603 | |
| 604 | 604 | $current_user = wp_get_current_user(); |
| 605 | 605 | |
| 606 | - $entry_id = isset( $entry['id'] ) ? $entry['id'] : NULL; |
|
| 606 | + $entry_id = isset( $entry[ 'id' ] ) ? $entry[ 'id' ] : NULL; |
|
| 607 | 607 | |
| 608 | 608 | // Or if they can delete any entries (as defined in Gravity Forms), we're good. |
| 609 | - if( GVCommon::has_cap( array( 'gravityforms_delete_entries', 'gravityview_delete_others_entries' ), $entry_id ) ) { |
|
| 609 | + if ( GVCommon::has_cap( array( 'gravityforms_delete_entries', 'gravityview_delete_others_entries' ), $entry_id ) ) { |
|
| 610 | 610 | |
| 611 | - do_action('gravityview_log_debug', 'GravityView_Delete_Entry[check_user_cap_delete_entry] Current user has `gravityforms_delete_entries` or `gravityview_delete_others_entries` capability.' ); |
|
| 611 | + do_action( 'gravityview_log_debug', 'GravityView_Delete_Entry[check_user_cap_delete_entry] Current user has `gravityforms_delete_entries` or `gravityview_delete_others_entries` capability.' ); |
|
| 612 | 612 | |
| 613 | 613 | return true; |
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | |
| 617 | 617 | // If field options are passed, check if current user can view the link |
| 618 | - if( !empty( $field ) ) { |
|
| 618 | + if ( ! empty( $field ) ) { |
|
| 619 | 619 | |
| 620 | 620 | // If capability is not defined, something is not right! |
| 621 | - if( empty( $field['allow_edit_cap'] ) ) { |
|
| 621 | + if ( empty( $field[ 'allow_edit_cap' ] ) ) { |
|
| 622 | 622 | |
| 623 | 623 | do_action( 'gravityview_log_error', 'GravityView_Delete_Entry[check_user_cap_delete_entry] Cannot read delete entry field caps', $field ); |
| 624 | 624 | |
| 625 | 625 | return false; |
| 626 | 626 | } |
| 627 | 627 | |
| 628 | - if( GVCommon::has_cap( $field['allow_edit_cap'] ) ) { |
|
| 628 | + if ( GVCommon::has_cap( $field[ 'allow_edit_cap' ] ) ) { |
|
| 629 | 629 | |
| 630 | 630 | // Do not return true if cap is read, as we need to check if the current user created the entry |
| 631 | - if( $field['allow_edit_cap'] !== 'read' ) { |
|
| 631 | + if ( $field[ 'allow_edit_cap' ] !== 'read' ) { |
|
| 632 | 632 | return true; |
| 633 | 633 | } |
| 634 | 634 | |
@@ -641,9 +641,9 @@ discard block |
||
| 641 | 641 | |
| 642 | 642 | } |
| 643 | 643 | |
| 644 | - if( !isset( $entry['created_by'] ) ) { |
|
| 644 | + if ( ! isset( $entry[ 'created_by' ] ) ) { |
|
| 645 | 645 | |
| 646 | - do_action('gravityview_log_error', 'GravityView_Delete_Entry[check_user_cap_delete_entry] Entry `created_by` doesn\'t exist.'); |
|
| 646 | + do_action( 'gravityview_log_error', 'GravityView_Delete_Entry[check_user_cap_delete_entry] Entry `created_by` doesn\'t exist.' ); |
|
| 647 | 647 | |
| 648 | 648 | return false; |
| 649 | 649 | } |
@@ -651,24 +651,24 @@ discard block |
||
| 651 | 651 | $view_id = empty( $view_id ) ? $gravityview_view->getViewId() : $view_id; |
| 652 | 652 | |
| 653 | 653 | // Only checks user_delete view option if view is already set |
| 654 | - if( $view_id ) { |
|
| 654 | + if ( $view_id ) { |
|
| 655 | 655 | |
| 656 | 656 | $current_view = gravityview_get_current_view_data( $view_id ); |
| 657 | 657 | |
| 658 | - $user_delete = isset( $current_view['atts']['user_delete'] ) ? $current_view['atts']['user_delete'] : false; |
|
| 658 | + $user_delete = isset( $current_view[ 'atts' ][ 'user_delete' ] ) ? $current_view[ 'atts' ][ 'user_delete' ] : false; |
|
| 659 | 659 | |
| 660 | - if( empty( $user_delete ) ) { |
|
| 660 | + if ( empty( $user_delete ) ) { |
|
| 661 | 661 | |
| 662 | - do_action('gravityview_log_debug', 'GravityView_Delete_Entry[check_user_cap_delete_entry] User Delete is disabled. Returning false.' ); |
|
| 662 | + do_action( 'gravityview_log_debug', 'GravityView_Delete_Entry[check_user_cap_delete_entry] User Delete is disabled. Returning false.' ); |
|
| 663 | 663 | |
| 664 | 664 | return false; |
| 665 | 665 | } |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | 668 | // If the logged-in user is the same as the user who created the entry, we're good. |
| 669 | - if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) { |
|
| 669 | + if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) { |
|
| 670 | 670 | |
| 671 | - do_action('gravityview_log_debug', sprintf( 'GravityView_Delete_Entry[check_user_cap_delete_entry] User %s created the entry.', $current_user->ID ) ); |
|
| 671 | + do_action( 'gravityview_log_debug', sprintf( 'GravityView_Delete_Entry[check_user_cap_delete_entry] User %s created the entry.', $current_user->ID ) ); |
|
| 672 | 672 | |
| 673 | 673 | return true; |
| 674 | 674 | } |
@@ -691,31 +691,31 @@ discard block |
||
| 691 | 691 | */ |
| 692 | 692 | public function display_message( $current_view_id = 0 ) { |
| 693 | 693 | |
| 694 | - if( empty( $_GET['status'] ) || ! self::verify_nonce() ) { |
|
| 694 | + if ( empty( $_GET[ 'status' ] ) || ! self::verify_nonce() ) { |
|
| 695 | 695 | return; |
| 696 | 696 | } |
| 697 | 697 | |
| 698 | 698 | // Entry wasn't deleted from current View |
| 699 | - if( intval( $_GET['gvid'] ) !== intval( $current_view_id ) ) { |
|
| 699 | + if ( intval( $_GET[ 'gvid' ] ) !== intval( $current_view_id ) ) { |
|
| 700 | 700 | return; |
| 701 | 701 | } |
| 702 | 702 | |
| 703 | - $status = esc_attr( $_GET['status'] ); |
|
| 704 | - $message_from_url = rgget('message'); |
|
| 703 | + $status = esc_attr( $_GET[ 'status' ] ); |
|
| 704 | + $message_from_url = rgget( 'message' ); |
|
| 705 | 705 | $message_from_url = urldecode( stripslashes_deep( $message_from_url ) ); |
| 706 | 706 | $class = ''; |
| 707 | 707 | |
| 708 | 708 | switch ( $status ) { |
| 709 | 709 | case 'error': |
| 710 | 710 | $class = ' gv-error error'; |
| 711 | - $error_message = __('There was an error deleting the entry: %s', 'gravityview'); |
|
| 711 | + $error_message = __( 'There was an error deleting the entry: %s', 'gravityview' ); |
|
| 712 | 712 | $message = sprintf( $error_message, $message_from_url ); |
| 713 | 713 | break; |
| 714 | 714 | case 'trashed': |
| 715 | - $message = __('The entry was successfully moved to the trash.', 'gravityview'); |
|
| 715 | + $message = __( 'The entry was successfully moved to the trash.', 'gravityview' ); |
|
| 716 | 716 | break; |
| 717 | 717 | default: |
| 718 | - $message = __('The entry was successfully deleted.', 'gravityview'); |
|
| 718 | + $message = __( 'The entry was successfully deleted.', 'gravityview' ); |
|
| 719 | 719 | break; |
| 720 | 720 | } |
| 721 | 721 | |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | $message = apply_filters( 'gravityview/delete-entry/message', esc_attr( $message ), $status, $message_from_url ); |
| 730 | 730 | |
| 731 | 731 | // DISPLAY ERROR/SUCCESS MESSAGE |
| 732 | - echo '<div class="gv-notice' . esc_attr( $class ) .'">'. $message .'</div>'; |
|
| 732 | + echo '<div class="gv-notice' . esc_attr( $class ) . '">' . $message . '</div>'; |
|
| 733 | 733 | } |
| 734 | 734 | |
| 735 | 735 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $signature_fields = GFAPI::get_fields_by_type( $form, 'signature' ); |
| 54 | 54 | |
| 55 | 55 | foreach ( $signature_fields as $field ) { |
| 56 | - unset( $_POST["input_{$field->id}"] ); |
|
| 56 | + unset( $_POST[ "input_{$field->id}" ] ); |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
@@ -72,19 +72,19 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | function edit_entry_field_input( $field_content = '', $field, $value = '', $lead_id = 0, $form_id = 0 ) { |
| 74 | 74 | |
| 75 | - $context = function_exists('gravityview_get_context') ? gravityview_get_context() : ''; |
|
| 75 | + $context = function_exists( 'gravityview_get_context' ) ? gravityview_get_context() : ''; |
|
| 76 | 76 | |
| 77 | - if( 'signature' !== $field->type || 'edit' !== $context ) { |
|
| 77 | + if ( 'signature' !== $field->type || 'edit' !== $context ) { |
|
| 78 | 78 | return $field_content; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | // We need to fetch a fresh version of the entry, since the saved entry hasn't refreshed in GV yet. |
| 82 | 82 | $entry = GravityView_View::getInstance()->getCurrentEntry(); |
| 83 | - $entry = GFAPI::get_entry( $entry['id'] ); |
|
| 83 | + $entry = GFAPI::get_entry( $entry[ 'id' ] ); |
|
| 84 | 84 | $entry_value = rgar( $entry, $field->id ); |
| 85 | 85 | |
| 86 | - $_POST["input_{$field->id}"] = $entry_value; // Used when Edit Entry form *is* submitted |
|
| 87 | - $_POST["input_{$form_id}_{$field->id}_signature_filename"] = $entry_value; // Used when Edit Entry form *is not* submitted |
|
| 86 | + $_POST[ "input_{$field->id}" ] = $entry_value; // Used when Edit Entry form *is* submitted |
|
| 87 | + $_POST[ "input_{$form_id}_{$field->id}_signature_filename" ] = $entry_value; // Used when Edit Entry form *is not* submitted |
|
| 88 | 88 | |
| 89 | 89 | return ''; // Return empty string to force using $_POST values instead |
| 90 | 90 | } |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | */ |
| 51 | 51 | public function if_gravityview_return_true( $has_content = false ) { |
| 52 | 52 | |
| 53 | - if( ! class_exists( 'GravityView_frontend' ) ) { |
|
| 53 | + if ( ! class_exists( 'GravityView_frontend' ) ) { |
|
| 54 | 54 | return $has_content; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if( ! class_exists('GFAddOn') ) { |
|
| 3 | +if ( ! class_exists( 'GFAddOn' ) ) { |
|
| 4 | 4 | return; |
| 5 | 5 | } |
| 6 | 6 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function __construct( $prevent_multiple_instances = '' ) { |
| 77 | 77 | |
| 78 | - if( $prevent_multiple_instances === 'get_instance' ) { |
|
| 78 | + if ( $prevent_multiple_instances === 'get_instance' ) { |
|
| 79 | 79 | return parent::__construct(); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public static function get_instance() { |
| 89 | 89 | |
| 90 | - if( empty( self::$instance ) ) { |
|
| 90 | + if ( empty( self::$instance ) ) { |
|
| 91 | 91 | self::$instance = new self( 'get_instance' ); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -110,11 +110,11 @@ discard block |
||
| 110 | 110 | * Prevent Gravity Forms from showing the uninstall tab on the settings page |
| 111 | 111 | * @hack |
| 112 | 112 | */ |
| 113 | - if( $caps === $this->_capabilities_uninstall ) { |
|
| 113 | + if ( $caps === $this->_capabilities_uninstall ) { |
|
| 114 | 114 | return false; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - if( empty( $caps ) ) { |
|
| 117 | + if ( empty( $caps ) ) { |
|
| 118 | 118 | $caps = array( 'gravityview_full_access' ); |
| 119 | 119 | } |
| 120 | 120 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | add_filter( 'gform_addon_app_settings_menu_gravityview', array( $this, 'modify_app_settings_menu_title' ) ); |
| 138 | 138 | |
| 139 | 139 | /** @since 1.7.6 */ |
| 140 | - add_action('network_admin_menu', array( $this, 'add_network_menu' ) ); |
|
| 140 | + add_action( 'network_admin_menu', array( $this, 'add_network_menu' ) ); |
|
| 141 | 141 | |
| 142 | 142 | parent::init_admin(); |
| 143 | 143 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | public function modify_app_settings_menu_title( $setting_tabs ) { |
| 153 | 153 | |
| 154 | - $setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview'); |
|
| 154 | + $setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' ); |
|
| 155 | 155 | |
| 156 | 156 | return $setting_tabs; |
| 157 | 157 | } |
@@ -168,11 +168,11 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | private function _load_license_handler() { |
| 170 | 170 | |
| 171 | - if( !empty( $this->License_Handler ) ) { |
|
| 171 | + if ( ! empty( $this->License_Handler ) ) { |
|
| 172 | 172 | return; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php'); |
|
| 175 | + require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php' ); |
|
| 176 | 176 | |
| 177 | 177 | $this->License_Handler = GV_License_Handler::get_instance( $this ); |
| 178 | 178 | } |
@@ -184,39 +184,39 @@ discard block |
||
| 184 | 184 | function license_key_notice() { |
| 185 | 185 | |
| 186 | 186 | // Only show on GravityView pages |
| 187 | - if( ! gravityview_is_admin_page() ) { |
|
| 187 | + if ( ! gravityview_is_admin_page() ) { |
|
| 188 | 188 | return; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - $license_status = self::getSetting('license_key_status'); |
|
| 192 | - $license_id = self::getSetting('license_key'); |
|
| 191 | + $license_status = self::getSetting( 'license_key_status' ); |
|
| 192 | + $license_id = self::getSetting( 'license_key' ); |
|
| 193 | 193 | $license_id = empty( $license_id ) ? 'license' : $license_id; |
| 194 | 194 | |
| 195 | - $message = esc_html__('Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview'); |
|
| 195 | + $message = esc_html__( 'Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
|
| 196 | 196 | |
| 197 | 197 | /** |
| 198 | 198 | * I wanted to remove the period from after the buttons in the string, |
| 199 | 199 | * but didn't want to mess up the translation strings for the translators. |
| 200 | 200 | */ |
| 201 | 201 | $message = mb_substr( $message, 0, mb_strlen( $message ) - 1 ); |
| 202 | - $title = __('Inactive License', 'gravityview'); |
|
| 202 | + $title = __( 'Inactive License', 'gravityview' ); |
|
| 203 | 203 | $status = ''; |
| 204 | 204 | $update_below = false; |
| 205 | 205 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
| 206 | 206 | switch ( $license_status ) { |
| 207 | 207 | /** @since 1.17 */ |
| 208 | 208 | case 'expired': |
| 209 | - $title = __('Expired License', 'gravityview'); |
|
| 209 | + $title = __( 'Expired License', 'gravityview' ); |
|
| 210 | 210 | $status = 'expired'; |
| 211 | - $message = $this->get_license_handler()->strings( 'expired', self::getSetting('license_key_response') ); |
|
| 211 | + $message = $this->get_license_handler()->strings( 'expired', self::getSetting( 'license_key_response' ) ); |
|
| 212 | 212 | break; |
| 213 | 213 | case 'invalid': |
| 214 | - $title = __('Invalid License', 'gravityview'); |
|
| 215 | - $status = __('is invalid', 'gravityview'); |
|
| 214 | + $title = __( 'Invalid License', 'gravityview' ); |
|
| 215 | + $status = __( 'is invalid', 'gravityview' ); |
|
| 216 | 216 | break; |
| 217 | 217 | case 'deactivated': |
| 218 | - $status = __('is inactive', 'gravityview'); |
|
| 219 | - $update_below = __('Activate your license key below.', 'gravityview'); |
|
| 218 | + $status = __( 'is inactive', 'gravityview' ); |
|
| 219 | + $update_below = __( 'Activate your license key below.', 'gravityview' ); |
|
| 220 | 220 | break; |
| 221 | 221 | /** @noinspection PhpMissingBreakStatementInspection */ |
| 222 | 222 | case '': |
@@ -224,27 +224,27 @@ discard block |
||
| 224 | 224 | // break intentionally left blank |
| 225 | 225 | case 'inactive': |
| 226 | 226 | case 'site_inactive': |
| 227 | - $status = __('has not been activated', 'gravityview'); |
|
| 228 | - $update_below = __('Activate your license key below.', 'gravityview'); |
|
| 227 | + $status = __( 'has not been activated', 'gravityview' ); |
|
| 228 | + $update_below = __( 'Activate your license key below.', 'gravityview' ); |
|
| 229 | 229 | break; |
| 230 | 230 | } |
| 231 | - $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice'; |
|
| 231 | + $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice'; |
|
| 232 | 232 | |
| 233 | 233 | // Show a different notice on settings page for inactive licenses (hide the buttons) |
| 234 | - if( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
|
| 234 | + if ( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
|
| 235 | 235 | $message = sprintf( $message, $status, '<div class="hidden">', '', '', '</div><a href="#" onclick="jQuery(\'#license_key\').focus(); return false;">' . $update_below . '</a>' ); |
| 236 | 236 | } else { |
| 237 | 237 | $message = sprintf( $message, $status, "\n\n" . '<a href="' . $primary_button_link . '" class="button button-primary">', '</a>', '<a href="' . esc_url( $url ) . '" class="button button-secondary">', '</a>' ); |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - if( !empty( $status ) ) { |
|
| 240 | + if ( ! empty( $status ) ) { |
|
| 241 | 241 | GravityView_Admin_Notices::add_notice( array( |
| 242 | 242 | 'message' => $message, |
| 243 | 243 | 'class' => 'updated', |
| 244 | 244 | 'title' => $title, |
| 245 | 245 | 'cap' => 'gravityview_edit_settings', |
| 246 | - 'dismiss' => sha1( $license_status.'_'.$license_id ), |
|
| 247 | - )); |
|
| 246 | + 'dismiss' => sha1( $license_status . '_' . $license_id ), |
|
| 247 | + ) ); |
|
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | |
| 257 | 257 | $styles = parent::styles(); |
| 258 | 258 | |
| 259 | - $styles[] = array( |
|
| 259 | + $styles[ ] = array( |
|
| 260 | 260 | 'handle' => 'gravityview_settings', |
| 261 | 261 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
| 262 | 262 | 'version' => GravityView_Plugin::version, |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | * @return void |
| 280 | 280 | */ |
| 281 | 281 | public function add_network_menu() { |
| 282 | - if( GravityView_Plugin::is_network_activated() ) { |
|
| 282 | + if ( GravityView_Plugin::is_network_activated() ) { |
|
| 283 | 283 | add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
| 284 | 284 | } |
| 285 | 285 | } |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | * If multisite and not network admin, we don't want the settings to show. |
| 297 | 297 | * @since 1.7.6 |
| 298 | 298 | */ |
| 299 | - $show_submenu = !is_multisite() || is_main_site() || !GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() ); |
|
| 299 | + $show_submenu = ! is_multisite() || is_main_site() || ! GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() ); |
|
| 300 | 300 | |
| 301 | 301 | /** |
| 302 | 302 | * Override whether to show the Settings menu on a per-blog basis. |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | */ |
| 306 | 306 | $show_submenu = apply_filters( 'gravityview/show-settings-menu', $show_submenu ); |
| 307 | 307 | |
| 308 | - if( $show_submenu ) { |
|
| 308 | + if ( $show_submenu ) { |
|
| 309 | 309 | add_submenu_page( 'edit.php?post_type=gravityview', __( 'Settings', 'gravityview' ), __( 'Settings', 'gravityview' ), $this->_capabilities_app_settings, $this->_slug . '_settings', array( $this, 'app_tab_page' ) ); |
| 310 | 310 | } |
| 311 | 311 | } |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | /** |
| 337 | 337 | * Backward compatibility with Redux |
| 338 | 338 | */ |
| 339 | - if( $setting_name === 'license' ) { |
|
| 339 | + if ( $setting_name === 'license' ) { |
|
| 340 | 340 | return array( |
| 341 | 341 | 'license' => parent::get_app_setting( 'license_key' ), |
| 342 | 342 | 'status' => parent::get_app_setting( 'license_key_status' ), |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | |
| 401 | 401 | $return = $text . $activation; |
| 402 | 402 | |
| 403 | - if( $echo ) { |
|
| 403 | + if ( $echo ) { |
|
| 404 | 404 | echo $return; |
| 405 | 405 | } |
| 406 | 406 | |
@@ -427,15 +427,15 @@ discard block |
||
| 427 | 427 | */ |
| 428 | 428 | public function settings_submit( $field, $echo = true ) { |
| 429 | 429 | |
| 430 | - $field['type'] = ( isset($field['type']) && in_array( $field['type'], array('submit','reset','button') ) ) ? $field['type'] : 'submit'; |
|
| 430 | + $field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit'; |
|
| 431 | 431 | |
| 432 | 432 | $attributes = $this->get_field_attributes( $field ); |
| 433 | 433 | $default_value = rgar( $field, 'value' ) ? rgar( $field, 'value' ) : rgar( $field, 'default_value' ); |
| 434 | - $value = $this->get_setting( $field['name'], $default_value ); |
|
| 434 | + $value = $this->get_setting( $field[ 'name' ], $default_value ); |
|
| 435 | 435 | |
| 436 | 436 | |
| 437 | - $attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton'; |
|
| 438 | - $name = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_'.$field['name']; |
|
| 437 | + $attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton'; |
|
| 438 | + $name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ]; |
|
| 439 | 439 | |
| 440 | 440 | if ( empty( $value ) ) { |
| 441 | 441 | $value = __( 'Update Settings', 'gravityview' ); |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | $attributes = $this->get_field_attributes( $field ); |
| 445 | 445 | |
| 446 | 446 | $html = '<input |
| 447 | - type="' . $field['type'] . '" |
|
| 447 | + type="' . $field[ 'type' ] . '" |
|
| 448 | 448 | name="' . esc_attr( $name ) . '" |
| 449 | 449 | value="' . $value . '" ' . |
| 450 | 450 | implode( ' ', $attributes ) . |
@@ -466,16 +466,16 @@ discard block |
||
| 466 | 466 | * @return string |
| 467 | 467 | */ |
| 468 | 468 | public function settings_save( $field, $echo = true ) { |
| 469 | - $field['type'] = 'submit'; |
|
| 470 | - $field['name'] = 'gform-settings-save'; |
|
| 471 | - $field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton'; |
|
| 469 | + $field[ 'type' ] = 'submit'; |
|
| 470 | + $field[ 'name' ] = 'gform-settings-save'; |
|
| 471 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton'; |
|
| 472 | 472 | |
| 473 | 473 | if ( ! rgar( $field, 'value' ) ) |
| 474 | - $field['value'] = __( 'Update Settings', 'gravityview' ); |
|
| 474 | + $field[ 'value' ] = __( 'Update Settings', 'gravityview' ); |
|
| 475 | 475 | |
| 476 | 476 | $output = $this->settings_submit( $field, false ); |
| 477 | 477 | |
| 478 | - if( $echo ) { |
|
| 478 | + if ( $echo ) { |
|
| 479 | 479 | echo $output; |
| 480 | 480 | } |
| 481 | 481 | |
@@ -492,8 +492,8 @@ discard block |
||
| 492 | 492 | parent::single_setting_label( $field ); |
| 493 | 493 | |
| 494 | 494 | // Added by GravityView |
| 495 | - if ( isset( $field['description'] ) ) { |
|
| 496 | - echo '<span class="description">'. $field['description'] .'</span>'; |
|
| 495 | + if ( isset( $field[ 'description' ] ) ) { |
|
| 496 | + echo '<span class="description">' . $field[ 'description' ] . '</span>'; |
|
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | } |
@@ -555,11 +555,11 @@ discard block |
||
| 555 | 555 | |
| 556 | 556 | // If the posted key doesn't match the activated/deactivated key (set using the Activate License button, AJAX response), |
| 557 | 557 | // then we assume it's changed. If it's changed, unset the status and the previous response. |
| 558 | - if( $local_key !== $response_key ) { |
|
| 558 | + if ( $local_key !== $response_key ) { |
|
| 559 | 559 | |
| 560 | - unset( $posted_settings['license_key_response'] ); |
|
| 561 | - unset( $posted_settings['license_key_status'] ); |
|
| 562 | - GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
| 560 | + unset( $posted_settings[ 'license_key_response' ] ); |
|
| 561 | + unset( $posted_settings[ 'license_key_status' ] ); |
|
| 562 | + GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | return $posted_settings; |
@@ -594,25 +594,25 @@ discard block |
||
| 594 | 594 | 'label' => __( 'License Key', 'gravityview' ), |
| 595 | 595 | 'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates & support.', 'gravityview' ), |
| 596 | 596 | 'type' => 'edd_license', |
| 597 | - 'data-pending-text' => __('Verifying license…', 'gravityview'), |
|
| 598 | - 'default_value' => $default_settings['license_key'], |
|
| 597 | + 'data-pending-text' => __( 'Verifying license…', 'gravityview' ), |
|
| 598 | + 'default_value' => $default_settings[ 'license_key' ], |
|
| 599 | 599 | 'class' => ( '' == $this->get_app_setting( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key', |
| 600 | 600 | ), |
| 601 | 601 | array( |
| 602 | 602 | 'name' => 'license_key_response', |
| 603 | - 'default_value' => $default_settings['license_key_response'], |
|
| 603 | + 'default_value' => $default_settings[ 'license_key_response' ], |
|
| 604 | 604 | 'type' => 'hidden', |
| 605 | 605 | ), |
| 606 | 606 | array( |
| 607 | 607 | 'name' => 'license_key_status', |
| 608 | - 'default_value' => $default_settings['license_key_status'], |
|
| 608 | + 'default_value' => $default_settings[ 'license_key_status' ], |
|
| 609 | 609 | 'type' => 'hidden', |
| 610 | 610 | ), |
| 611 | 611 | array( |
| 612 | 612 | 'name' => 'support-email', |
| 613 | 613 | 'type' => 'text', |
| 614 | 614 | 'validate' => 'email', |
| 615 | - 'default_value' => $default_settings['support-email'], |
|
| 615 | + 'default_value' => $default_settings[ 'support-email' ], |
|
| 616 | 616 | 'label' => __( 'Support Email', 'gravityview' ), |
| 617 | 617 | 'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ), |
| 618 | 618 | 'class' => 'code regular-text', |
@@ -624,44 +624,44 @@ discard block |
||
| 624 | 624 | 'name' => 'support_port', |
| 625 | 625 | 'type' => 'radio', |
| 626 | 626 | 'label' => __( 'Show Support Port?', 'gravityview' ), |
| 627 | - 'default_value' => $default_settings['support_port'], |
|
| 627 | + 'default_value' => $default_settings[ 'support_port' ], |
|
| 628 | 628 | 'horizontal' => 1, |
| 629 | 629 | 'choices' => array( |
| 630 | 630 | array( |
| 631 | - 'label' => _x('Show', 'Setting: Show or Hide', 'gravityview'), |
|
| 631 | + 'label' => _x( 'Show', 'Setting: Show or Hide', 'gravityview' ), |
|
| 632 | 632 | 'value' => '1', |
| 633 | 633 | ), |
| 634 | 634 | array( |
| 635 | - 'label' => _x('Hide', 'Setting: Show or Hide', 'gravityview'), |
|
| 635 | + 'label' => _x( 'Hide', 'Setting: Show or Hide', 'gravityview' ), |
|
| 636 | 636 | 'value' => '0', |
| 637 | 637 | ), |
| 638 | 638 | ), |
| 639 | - 'tooltip' => '<p><img src="' . esc_url_raw( plugins_url('assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE ) ) . '" alt="' . esc_attr__( 'The Support Port looks like this.', 'gravityview' ) . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__('The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview') . '</p>', |
|
| 639 | + 'tooltip' => '<p><img src="' . esc_url_raw( plugins_url( 'assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE ) ) . '" alt="' . esc_attr__( 'The Support Port looks like this.', 'gravityview' ) . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__( 'The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview' ) . '</p>', |
|
| 640 | 640 | 'description' => __( 'Show the Support Port on GravityView pages?', 'gravityview' ), |
| 641 | 641 | ), |
| 642 | 642 | array( |
| 643 | 643 | 'name' => 'no-conflict-mode', |
| 644 | 644 | 'type' => 'radio', |
| 645 | 645 | 'label' => __( 'No-Conflict Mode', 'gravityview' ), |
| 646 | - 'default_value' => $default_settings['no-conflict-mode'], |
|
| 646 | + 'default_value' => $default_settings[ 'no-conflict-mode' ], |
|
| 647 | 647 | 'horizontal' => 1, |
| 648 | 648 | 'choices' => array( |
| 649 | 649 | array( |
| 650 | - 'label' => _x('On', 'Setting: On or off', 'gravityview'), |
|
| 650 | + 'label' => _x( 'On', 'Setting: On or off', 'gravityview' ), |
|
| 651 | 651 | 'value' => '1', |
| 652 | 652 | ), |
| 653 | 653 | array( |
| 654 | - 'label' => _x('Off', 'Setting: On or off', 'gravityview'), |
|
| 654 | + 'label' => _x( 'Off', 'Setting: On or off', 'gravityview' ), |
|
| 655 | 655 | 'value' => '0', |
| 656 | 656 | ), |
| 657 | 657 | ), |
| 658 | - 'description' => __( 'Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview' ) . ' ' . __('If your Edit View tabs are ugly, enable this setting.', 'gravityview'), |
|
| 658 | + 'description' => __( 'Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview' ) . ' ' . __( 'If your Edit View tabs are ugly, enable this setting.', 'gravityview' ), |
|
| 659 | 659 | ), |
| 660 | 660 | array( |
| 661 | 661 | 'name' => 'delete-on-uninstall', |
| 662 | 662 | 'type' => 'radio', |
| 663 | 663 | 'label' => __( 'Remove Data on Delete?', 'gravityview' ), |
| 664 | - 'default_value' => $default_settings['delete-on-uninstall'], |
|
| 664 | + 'default_value' => $default_settings[ 'delete-on-uninstall' ], |
|
| 665 | 665 | 'horizontal' => 1, |
| 666 | 666 | 'choices' => array( |
| 667 | 667 | array( |
@@ -687,20 +687,20 @@ discard block |
||
| 687 | 687 | * @since 1.7.4 |
| 688 | 688 | */ |
| 689 | 689 | foreach ( $fields as &$field ) { |
| 690 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : rgget('id', $field ); |
|
| 691 | - $field['label'] = isset( $field['label'] ) ? $field['label'] : rgget('title', $field ); |
|
| 692 | - $field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : rgget('default', $field ); |
|
| 693 | - $field['description'] = isset( $field['description'] ) ? $field['description'] : rgget('subtitle', $field ); |
|
| 690 | + $field[ 'name' ] = isset( $field[ 'name' ] ) ? $field[ 'name' ] : rgget( 'id', $field ); |
|
| 691 | + $field[ 'label' ] = isset( $field[ 'label' ] ) ? $field[ 'label' ] : rgget( 'title', $field ); |
|
| 692 | + $field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : rgget( 'default', $field ); |
|
| 693 | + $field[ 'description' ] = isset( $field[ 'description' ] ) ? $field[ 'description' ] : rgget( 'subtitle', $field ); |
|
| 694 | 694 | |
| 695 | - if( $disabled_attribute ) { |
|
| 696 | - $field['disabled'] = $disabled_attribute; |
|
| 695 | + if ( $disabled_attribute ) { |
|
| 696 | + $field[ 'disabled' ] = $disabled_attribute; |
|
| 697 | 697 | } |
| 698 | 698 | } |
| 699 | 699 | |
| 700 | 700 | |
| 701 | 701 | $sections = array( |
| 702 | 702 | array( |
| 703 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ), |
|
| 703 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), GravityView_Plugin::version ) ), |
|
| 704 | 704 | 'fields' => $fields, |
| 705 | 705 | ) |
| 706 | 706 | ); |
@@ -711,8 +711,8 @@ discard block |
||
| 711 | 711 | 'type' => 'save', |
| 712 | 712 | ); |
| 713 | 713 | |
| 714 | - if( $disabled_attribute ) { |
|
| 715 | - $button['disabled'] = $disabled_attribute; |
|
| 714 | + if ( $disabled_attribute ) { |
|
| 715 | + $button[ 'disabled' ] = $disabled_attribute; |
|
| 716 | 716 | } |
| 717 | 717 | |
| 718 | 718 | |
@@ -732,20 +732,20 @@ discard block |
||
| 732 | 732 | // If there are extensions, add a section for them |
| 733 | 733 | if ( ! empty( $extension_sections ) ) { |
| 734 | 734 | |
| 735 | - if( $disabled_attribute ) { |
|
| 735 | + if ( $disabled_attribute ) { |
|
| 736 | 736 | foreach ( $extension_sections as &$section ) { |
| 737 | - foreach ( $section['fields'] as &$field ) { |
|
| 738 | - $field['disabled'] = $disabled_attribute; |
|
| 737 | + foreach ( $section[ 'fields' ] as &$field ) { |
|
| 738 | + $field[ 'disabled' ] = $disabled_attribute; |
|
| 739 | 739 | } |
| 740 | 740 | } |
| 741 | 741 | } |
| 742 | 742 | |
| 743 | - $k = count( $extension_sections ) - 1 ; |
|
| 744 | - $extension_sections[ $k ]['fields'][] = $button; |
|
| 743 | + $k = count( $extension_sections ) - 1; |
|
| 744 | + $extension_sections[ $k ][ 'fields' ][ ] = $button; |
|
| 745 | 745 | $sections = array_merge( $sections, $extension_sections ); |
| 746 | 746 | } else { |
| 747 | 747 | // add the 'update settings' button to the general section |
| 748 | - $sections[0]['fields'][] = $button; |
|
| 748 | + $sections[ 0 ][ 'fields' ][ ] = $button; |
|
| 749 | 749 | } |
| 750 | 750 | |
| 751 | 751 | return $sections; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | function modify_entry_value_workflow_final_status( $output, $entry, $field_settings, $field ) { |
| 56 | 56 | |
| 57 | - if( ! empty( $output ) ) { |
|
| 57 | + if ( ! empty( $output ) ) { |
|
| 58 | 58 | $output = gravity_flow()->translate_status_label( $output ); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -78,11 +78,11 @@ discard block |
||
| 78 | 78 | function modify_entry_value_workflow_step( $output, $entry, $field_settings, $field ) { |
| 79 | 79 | |
| 80 | 80 | // If not set, the entry hasn't started a workflow |
| 81 | - $has_workflow_step = isset( $entry['workflow_step'] ); |
|
| 81 | + $has_workflow_step = isset( $entry[ 'workflow_step' ] ); |
|
| 82 | 82 | |
| 83 | - if( $has_workflow_step ) { |
|
| 83 | + if ( $has_workflow_step ) { |
|
| 84 | 84 | |
| 85 | - $GFlow = new Gravity_Flow_API( $entry['form_id'] ); |
|
| 85 | + $GFlow = new Gravity_Flow_API( $entry[ 'form_id' ] ); |
|
| 86 | 86 | |
| 87 | 87 | if ( $current_step = $GFlow->get_current_step( $entry ) ) { |
| 88 | 88 | $output = esc_html( $current_step->get_name() ); |