@@ -26,16 +26,16 @@ discard block |
||
| 26 | 26 | function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) { |
| 27 | 27 | |
| 28 | 28 | // It makes no sense to use this as the link. |
| 29 | - unset( $field_options['show_as_link'] ); |
|
| 29 | + unset( $field_options[ 'show_as_link' ] ); |
|
| 30 | 30 | |
| 31 | - if( 'edit' === $context ) { |
|
| 31 | + if ( 'edit' === $context ) { |
|
| 32 | 32 | return $field_options; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * @since 1.8 |
| 37 | 37 | */ |
| 38 | - $field_options['anchor_text'] = array( |
|
| 38 | + $field_options[ 'anchor_text' ] = array( |
|
| 39 | 39 | 'type' => 'text', |
| 40 | 40 | 'label' => __( 'Link Text:', 'gravityview' ), |
| 41 | 41 | 'desc' => __( 'Define custom link text. Leave blank to display the URL', 'gravityview' ), |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | 'merge_tags' => 'force', |
| 44 | 44 | ); |
| 45 | 45 | |
| 46 | - $field_options['truncatelink'] = array( |
|
| 46 | + $field_options[ 'truncatelink' ] = array( |
|
| 47 | 47 | 'type' => 'checkbox', |
| 48 | 48 | 'value' => true, |
| 49 | 49 | 'label' => __( 'Shorten Link Display', 'gravityview' ), |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | 'desc' => __( 'Don’t show the full URL, only show the domain.', 'gravityview' ) |
| 52 | 52 | ); |
| 53 | 53 | |
| 54 | - $field_options['open_same_window'] = array( |
|
| 54 | + $field_options[ 'open_same_window' ] = array( |
|
| 55 | 55 | 'type' => 'checkbox', |
| 56 | 56 | 'value' => false, |
| 57 | 57 | 'label' => __( 'Open link in the same window?', 'gravityview' ), |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | |
| 10 | 10 | var $name = 'radio'; |
| 11 | 11 | |
| 12 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
| 12 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
| 13 | 13 | |
| 14 | 14 | var $_gf_field_class_name = 'GF_Field_Radio'; |
| 15 | 15 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 20 | 20 | |
| 21 | - if( 'edit' === $context ) { |
|
| 21 | + if ( 'edit' === $context ) { |
|
| 22 | 22 | return $field_options; |
| 23 | 23 | } |
| 24 | 24 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | 'quiz_use_max_score' => array( |
| 27 | 27 | 'type' => 'checkbox', |
| 28 | 28 | 'label' => __( 'Show Max Score?', 'gravityview' ), |
| 29 | - 'desc' => __('Display score as the a fraction: "[score]/[max score]". If unchecked, will display score.', 'gravityview'), |
|
| 29 | + 'desc' => __( 'Display score as the a fraction: "[score]/[max score]". If unchecked, will display score.', 'gravityview' ), |
|
| 30 | 30 | 'value' => true, |
| 31 | 31 | 'merge_tags' => false, |
| 32 | 32 | ), |
@@ -41,10 +41,10 @@ |
||
| 41 | 41 | |
| 42 | 42 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 43 | 43 | |
| 44 | - unset ( $field_options['search_filter'], $field_options['show_as_link'] ); |
|
| 44 | + unset ( $field_options[ 'search_filter' ], $field_options[ 'show_as_link' ] ); |
|
| 45 | 45 | |
| 46 | 46 | // Set the default CSS class to gv-section, which applies a border and top/bottom margin |
| 47 | - $field_options['custom_class']['value'] = 'gv-section'; |
|
| 47 | + $field_options[ 'custom_class' ][ 'value' ] = 'gv-section'; |
|
| 48 | 48 | |
| 49 | 49 | return $field_options; |
| 50 | 50 | } |
@@ -34,23 +34,23 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | $merge_tags = array( |
| 36 | 36 | array( |
| 37 | - 'label' => __('Entry Creator: Display Name', 'gravityview'), |
|
| 37 | + 'label' => __( 'Entry Creator: Display Name', 'gravityview' ), |
|
| 38 | 38 | 'tag' => '{created_by:display_name}' |
| 39 | 39 | ), |
| 40 | 40 | array( |
| 41 | - 'label' => __('Entry Creator: Email', 'gravityview'), |
|
| 41 | + 'label' => __( 'Entry Creator: Email', 'gravityview' ), |
|
| 42 | 42 | 'tag' => '{created_by:user_email}' |
| 43 | 43 | ), |
| 44 | 44 | array( |
| 45 | - 'label' => __('Entry Creator: Username', 'gravityview'), |
|
| 45 | + 'label' => __( 'Entry Creator: Username', 'gravityview' ), |
|
| 46 | 46 | 'tag' => '{created_by:user_login}' |
| 47 | 47 | ), |
| 48 | 48 | array( |
| 49 | - 'label' => __('Entry Creator: User ID', 'gravityview'), |
|
| 49 | + 'label' => __( 'Entry Creator: User ID', 'gravityview' ), |
|
| 50 | 50 | 'tag' => '{created_by:ID}' |
| 51 | 51 | ), |
| 52 | 52 | array( |
| 53 | - 'label' => __('Entry Creator: Roles', 'gravityview'), |
|
| 53 | + 'label' => __( 'Entry Creator: Roles', 'gravityview' ), |
|
| 54 | 54 | 'tag' => '{created_by:roles}' |
| 55 | 55 | ), |
| 56 | 56 | ); |
@@ -78,19 +78,19 @@ discard block |
||
| 78 | 78 | public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
| 79 | 79 | |
| 80 | 80 | // If there are no matches OR the Entry `created_by` isn't set or is 0 (no user) |
| 81 | - if( empty( $entry['created_by'] ) ) { |
|
| 81 | + if ( empty( $entry[ 'created_by' ] ) ) { |
|
| 82 | 82 | return $text; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // Get the creator of the entry |
| 86 | - $entry_creator = new WP_User( $entry['created_by'] ); |
|
| 86 | + $entry_creator = new WP_User( $entry[ 'created_by' ] ); |
|
| 87 | 87 | |
| 88 | 88 | foreach ( $matches as $match ) { |
| 89 | 89 | |
| 90 | - $full_tag = $match[0]; |
|
| 91 | - $property = $match[1]; |
|
| 90 | + $full_tag = $match[ 0 ]; |
|
| 91 | + $property = $match[ 1 ]; |
|
| 92 | 92 | |
| 93 | - switch( $property ) { |
|
| 93 | + switch ( $property ) { |
|
| 94 | 94 | /** @since 1.13.2 */ |
| 95 | 95 | case 'roles': |
| 96 | 96 | $value = implode( ', ', $entry_creator->roles ); |
@@ -113,18 +113,18 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 115 | 115 | |
| 116 | - if( 'edit' === $context ) { |
|
| 116 | + if ( 'edit' === $context ) { |
|
| 117 | 117 | return $field_options; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - $field_options['name_display'] = array( |
|
| 120 | + $field_options[ 'name_display' ] = array( |
|
| 121 | 121 | 'type' => 'select', |
| 122 | 122 | 'label' => __( 'User Format', 'gravityview' ), |
| 123 | - 'desc' => __( 'How should the User information be displayed?', 'gravityview'), |
|
| 123 | + 'desc' => __( 'How should the User information be displayed?', 'gravityview' ), |
|
| 124 | 124 | 'choices' => array( |
| 125 | - 'display_name' => __('Display Name (Example: "Ellen Ripley")', 'gravityview'), |
|
| 126 | - 'user_login' => __('Username (Example: "nostromo")', 'gravityview'), |
|
| 127 | - 'ID' => __('User ID # (Example: 426)', 'gravityview'), |
|
| 125 | + 'display_name' => __( 'Display Name (Example: "Ellen Ripley")', 'gravityview' ), |
|
| 126 | + 'user_login' => __( 'Username (Example: "nostromo")', 'gravityview' ), |
|
| 127 | + 'ID' => __( 'User ID # (Example: 426)', 'gravityview' ), |
|
| 128 | 128 | ), |
| 129 | 129 | 'value' => 'display_name' |
| 130 | 130 | ); |
@@ -36,9 +36,9 @@ |
||
| 36 | 36 | |
| 37 | 37 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 38 | 38 | |
| 39 | - unset ( $field_options['search_filter'], $field_options['show_as_link'] ); |
|
| 39 | + unset ( $field_options[ 'search_filter' ], $field_options[ 'show_as_link' ] ); |
|
| 40 | 40 | |
| 41 | - if( 'edit' === $context ) { |
|
| 41 | + if ( 'edit' === $context ) { |
|
| 42 | 42 | return $field_options; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -23,16 +23,16 @@ |
||
| 23 | 23 | |
| 24 | 24 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 25 | 25 | |
| 26 | - unset ( $field_options['search_filter'] ); |
|
| 26 | + unset ( $field_options[ 'search_filter' ] ); |
|
| 27 | 27 | |
| 28 | - if( 'edit' === $context ) { |
|
| 28 | + if ( 'edit' === $context ) { |
|
| 29 | 29 | return $field_options; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - $this->add_field_support('link_to_post', $field_options ); |
|
| 32 | + $this->add_field_support( 'link_to_post', $field_options ); |
|
| 33 | 33 | |
| 34 | 34 | // @since 1.5.4 |
| 35 | - $this->add_field_support('dynamic_data', $field_options ); |
|
| 35 | + $this->add_field_support( 'dynamic_data', $field_options ); |
|
| 36 | 36 | |
| 37 | 37 | return $field_options; |
| 38 | 38 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | $list_rows = maybe_unserialize( $field_value ); |
| 62 | 62 | |
| 63 | - if( ! is_array( $list_rows ) ) { |
|
| 63 | + if ( ! is_array( $list_rows ) ) { |
|
| 64 | 64 | do_action( 'gravityview_log_error', __METHOD__ . ' - $field_value did not unserialize', $field_value ); |
| 65 | 65 | return null; |
| 66 | 66 | } |
@@ -73,15 +73,15 @@ discard block |
||
| 73 | 73 | foreach ( $list_row as $column_key => $column_value ) { |
| 74 | 74 | |
| 75 | 75 | // If the label of the column matches $column_id, or the numeric key value matches, add the value |
| 76 | - if( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
| 77 | - $column_values[] = $column_value; |
|
| 76 | + if ( (string)$column_key === (string)$column_id || ( is_numeric( $column_id ) && (int)$column_id === $current_column ) ) { |
|
| 77 | + $column_values[ ] = $column_value; |
|
| 78 | 78 | } |
| 79 | 79 | $current_column++; |
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | // Return the array of values |
| 84 | - if( 'raw' === $format ) { |
|
| 84 | + if ( 'raw' === $format ) { |
|
| 85 | 85 | return $column_values; |
| 86 | 86 | } |
| 87 | 87 | // Return the Gravity Forms Field output |
@@ -104,26 +104,26 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function _filter_field_label( $label, $field, $form, $entry ) { |
| 106 | 106 | |
| 107 | - $field_object = RGFormsModel::get_field( $form, $field['id'] ); |
|
| 107 | + $field_object = RGFormsModel::get_field( $form, $field[ 'id' ] ); |
|
| 108 | 108 | |
| 109 | 109 | // Not a list field |
| 110 | - if( ! $field_object || 'list' !== $field_object->type ) { |
|
| 110 | + if ( ! $field_object || 'list' !== $field_object->type ) { |
|
| 111 | 111 | return $label; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | // Custom label is defined, so use it |
| 115 | - if( ! empty( $field['custom_label'] ) ) { |
|
| 115 | + if ( ! empty( $field[ 'custom_label' ] ) ) { |
|
| 116 | 116 | return $label; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - $field_id_array = explode( '.', $field['id'] ); |
|
| 119 | + $field_id_array = explode( '.', $field[ 'id' ] ); |
|
| 120 | 120 | |
| 121 | 121 | // Parent field, not column field |
| 122 | - if( ! isset( $field_id_array[1] ) ) { |
|
| 122 | + if ( ! isset( $field_id_array[ 1 ] ) ) { |
|
| 123 | 123 | return $label; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - $column_id = intval( $field_id_array[1] ); |
|
| 126 | + $column_id = intval( $field_id_array[ 1 ] ); |
|
| 127 | 127 | |
| 128 | 128 | return self::get_column_label( $field_object, $column_id, $label ); |
| 129 | 129 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | public static function get_column_label( GF_Field_List $field, $column_id, $backup_label = '' ) { |
| 143 | 143 | |
| 144 | 144 | // Doesn't have columns enabled |
| 145 | - if( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
| 145 | + if ( ! isset( $field->choices ) || ! $field->enableColumns ) { |
|
| 146 | 146 | return $backup_label; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | add_filter( 'gravityview/sorting/time', array( $this, 'modify_sort_id' ), 10, 2 ); |
| 61 | 61 | |
| 62 | - add_filter('gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
| 62 | + add_filter( 'gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 ); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -100,31 +100,31 @@ discard block |
||
| 100 | 100 | public function _maybe_filter_gravity_forms_query( $criteria, $form_ids, $view_id ) { |
| 101 | 101 | |
| 102 | 102 | // If the search is being sorted |
| 103 | - if( ! empty( $criteria['sorting']['key'] ) ) { |
|
| 103 | + if ( ! empty( $criteria[ 'sorting' ][ 'key' ] ) ) { |
|
| 104 | 104 | |
| 105 | - $pieces = explode( $this->_sort_divider, $criteria['sorting']['key'] ); |
|
| 105 | + $pieces = explode( $this->_sort_divider, $criteria[ 'sorting' ][ 'key' ] ); |
|
| 106 | 106 | |
| 107 | 107 | /** |
| 108 | 108 | * And the sort key matches the key set in modify_sort_id(), then modify the Gravity Forms query SQL |
| 109 | 109 | * @see modify_sort_id() |
| 110 | 110 | */ |
| 111 | - if( ! empty( $pieces[1] ) ) { |
|
| 111 | + if ( ! empty( $pieces[ 1 ] ) ) { |
|
| 112 | 112 | |
| 113 | 113 | // Pass these to the _modify_query_sort_by_time_hack() method |
| 114 | - $this->_time_format = $pieces[1]; |
|
| 115 | - $this->_date_format = $pieces[2]; |
|
| 114 | + $this->_time_format = $pieces[ 1 ]; |
|
| 115 | + $this->_date_format = $pieces[ 2 ]; |
|
| 116 | 116 | |
| 117 | 117 | // Remove fake input IDs (5.1 doesn't exist. Use 5) |
| 118 | - $criteria['sorting']['key'] = floor( $pieces[0] ); |
|
| 118 | + $criteria[ 'sorting' ][ 'key' ] = floor( $pieces[ 0 ] ); |
|
| 119 | 119 | |
| 120 | 120 | /** |
| 121 | 121 | * Make sure sorting is numeric (# of seconds). IMPORTANT. |
| 122 | 122 | * @see GVCommon::is_field_numeric() is_numeric should also be set here |
| 123 | 123 | */ |
| 124 | - $criteria['sorting']['is_numeric'] = true; |
|
| 124 | + $criteria[ 'sorting' ][ 'is_numeric' ] = true; |
|
| 125 | 125 | |
| 126 | 126 | // Modify the Gravity Forms WP Query |
| 127 | - add_filter('query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
| 127 | + add_filter( 'query', array( $this, '_modify_query_sort_by_time_hack' ) ); |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
@@ -147,9 +147,9 @@ discard block |
||
| 147 | 147 | * then we want to modify the query. |
| 148 | 148 | * @see GFFormsModel::sort_by_field_query() |
| 149 | 149 | */ |
| 150 | - if( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
| 150 | + if ( strpos( $query, self::GF_SORTING_SQL ) > 0 ) { |
|
| 151 | 151 | |
| 152 | - if( $this->_time_format === '24' ) { |
|
| 152 | + if ( $this->_time_format === '24' ) { |
|
| 153 | 153 | $sql_str_to_date = "STR_TO_DATE( `value`, '%H:%i' )"; |
| 154 | 154 | } else { |
| 155 | 155 | $sql_str_to_date = "STR_TO_DATE( `value`, '%h:%i %p' )"; |
@@ -195,18 +195,18 @@ discard block |
||
| 195 | 195 | // Set variables |
| 196 | 196 | parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
| 197 | 197 | |
| 198 | - if( 'edit' === $context ) { |
|
| 198 | + if ( 'edit' === $context ) { |
|
| 199 | 199 | return $field_options; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | /** |
| 203 | 203 | * Set default date format based on field ID and Form ID |
| 204 | 204 | */ |
| 205 | - add_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
| 205 | + add_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
| 206 | 206 | |
| 207 | - $this->add_field_support('date_display', $field_options ); |
|
| 207 | + $this->add_field_support( 'date_display', $field_options ); |
|
| 208 | 208 | |
| 209 | - remove_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
| 209 | + remove_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) ); |
|
| 210 | 210 | |
| 211 | 211 | return $field_options; |
| 212 | 212 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | private function _get_time_format() { |
| 222 | 222 | global $post; |
| 223 | 223 | |
| 224 | - $current_form = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : gravityview_get_form_id( $post->ID ); |
|
| 224 | + $current_form = isset( $_POST[ 'form_id' ] ) ? intval( $_POST[ 'form_id' ] ) : gravityview_get_form_id( $post->ID ); |
|
| 225 | 225 | |
| 226 | 226 | return self::_get_time_format_for_field( $this->_field_id, $current_form ); |
| 227 | 227 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | // GF defaults to 12, so should we. |
| 241 | 241 | $time_format = '12'; |
| 242 | 242 | |
| 243 | - if( $form_id ) { |
|
| 243 | + if ( $form_id ) { |
|
| 244 | 244 | $form = GFAPI::get_form( $form_id ); |
| 245 | 245 | |
| 246 | 246 | if ( $form ) { |
@@ -284,12 +284,12 @@ discard block |
||
| 284 | 284 | |
| 285 | 285 | $field_id_array = explode( '.', $field_id ); |
| 286 | 286 | |
| 287 | - $field_input_id = isset( $field_id_array[1] ) ? intval( $field_id_array[1] ) : 0; |
|
| 287 | + $field_input_id = isset( $field_id_array[ 1 ] ) ? intval( $field_id_array[ 1 ] ) : 0; |
|
| 288 | 288 | |
| 289 | 289 | $default = 'h:i A'; |
| 290 | 290 | |
| 291 | 291 | // This doesn't take into account 24-hour |
| 292 | - switch( $field_input_id ) { |
|
| 292 | + switch ( $field_input_id ) { |
|
| 293 | 293 | // Hours |
| 294 | 294 | case 1: |
| 295 | 295 | return ( $time_format === '12' ) ? 'h' : 'H'; |