Completed
Push — develop ( 636298...36bdeb )
by Gennady
16:37
created
includes/fields/class-gravityview-field-other-entries.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 	public function __construct() {
27 27
 		$this->label = esc_html__( 'Other Entries', 'gravityview' );
28
-		$this->description = esc_html__('Display other entries created by the entry creator.', 'gravityview');
28
+		$this->description = esc_html__( 'Display other entries created by the entry creator.', 'gravityview' );
29 29
 		parent::__construct();
30 30
 	}
31 31
 
@@ -35,32 +35,32 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
37 37
 
38
-		if( 'edit' === $context ) {
38
+		if ( 'edit' === $context ) {
39 39
 			return $field_options;
40 40
 		}
41 41
 
42 42
 		// No "Link to single entry"; all the items will be links to entries!
43
-		unset( $field_options['show_as_link'] );
43
+		unset( $field_options[ 'show_as_link' ] );
44 44
 
45 45
 		$new_options = array();
46 46
 
47
-		$new_options['link_format'] = array(
47
+		$new_options[ 'link_format' ] = array(
48 48
 			'type'  => 'text',
49 49
 			'label' => __( 'Entry link text (required)', 'gravityview' ),
50
-			'value' => __('Entry #{entry_id}', 'gravityview'),
50
+			'value' => __( 'Entry #{entry_id}', 'gravityview' ),
51 51
 			'merge_tags' => 'force',
52 52
 		);
53 53
 
54
-		$new_options['after_link'] = array(
54
+		$new_options[ 'after_link' ] = array(
55 55
 			'type'  => 'textarea',
56 56
 			'label' => __( 'Text or HTML to display after the link (optional)', 'gravityview' ),
57
-			'desc'  => __('This content will be displayed below each entry link.', 'gravityview'),
57
+			'desc'  => __( 'This content will be displayed below each entry link.', 'gravityview' ),
58 58
 			'value' => '',
59 59
 			'merge_tags' => 'force',
60 60
 			'class' => 'widefat code',
61 61
 		);
62 62
 
63
-		$new_options['page_size'] = array(
63
+		$new_options[ 'page_size' ] = array(
64 64
 			'type'  => 'number',
65 65
 			'label' => __( 'Entries to Display', 'gravityview' ),
66 66
 			'desc'  => __( 'What is the maximum number of entries that should be shown?', 'gravityview' ),
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
 			'merge_tags' => false,
69 69
 		);
70 70
 
71
-		$new_options['no_entries_hide'] = array(
71
+		$new_options[ 'no_entries_hide' ] = array(
72 72
 			'type'  => 'checkbox',
73 73
 			'label' => __( 'Hide if no entries', 'gravityview' ),
74 74
 			'desc'  => __( 'Don\'t display this field if the entry creator has no other entries', 'gravityview' ),
75 75
 			'value' => false,
76 76
 		);
77 77
 
78
-		$new_options['no_entries_text'] = array(
78
+		$new_options[ 'no_entries_text' ] = array(
79 79
 			'type'  => 'text',
80 80
 			'label' => __( 'No Entries Text', 'gravityview' ),
81 81
 			'desc'  => __( 'The text that is shown if the entry creator has no other entries (and "Hide if no entries" is disabled).', 'gravityview' ),
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
 		foreach ( $filters as $filter ) {
108 108
 			foreach ( $wp_filter[ $filter ] as $priority => $callbacks ) {
109 109
 				foreach ( $callbacks as $id => $callback ) {
110
-					if ( ! is_array( $callback['function'] ) ) {
110
+					if ( ! is_array( $callback[ 'function' ] ) ) {
111 111
 						continue;
112 112
 					}
113
-					if ( $callback['function'][0] instanceof \GV\Widget ) {
114
-						$remove[] = array( $filter, $priority, $id );
113
+					if ( $callback[ 'function' ][ 0 ] instanceof \GV\Widget ) {
114
+						$remove[ ] = array( $filter, $priority, $id );
115 115
 					}
116 116
 				}
117 117
 			}
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
 		foreach ( $remove as $r ) {
121 121
 			list( $filter, $priority, $id ) = $r;
122
-			$removed[] = array( $filter, $priority, $id, $wp_filter[ $filter ]->callbacks[ $priority ][ $id ] );
122
+			$removed[ ] = array( $filter, $priority, $id, $wp_filter[ $filter ]->callbacks[ $priority ][ $id ] );
123 123
 			unset( $wp_filter[ $filter ]->callbacks[ $priority ][ $id ] );
124 124
 		}
125 125
 
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
 	public function filter_entries( $search_criteria, $form_id = null, $args = array(), $force_search_criteria = false ) {
144 144
 		$context = $this->context;
145 145
 
146
-		$created_by = $context->entry['created_by'];
146
+		$created_by = $context->entry[ 'created_by' ];
147 147
 
148 148
 		/** Filter entries by approved and created_by. */
149
-		$search_criteria['field_filters'][] = array(
149
+		$search_criteria[ 'field_filters' ][ ] = array(
150 150
 			'key' => 'created_by',
151 151
 			'value' => $created_by,
152 152
 			'operator' => 'is'
@@ -166,14 +166,14 @@  discard block
 block discarded – undo
166 166
 		$criteria = apply_filters( 'gravityview/field/other_entries/criteria', $search_criteria, $context->view->settings->as_atts(), $context->view->form->ID, $context );
167 167
 
168 168
 		/** Force mode all and filter out our own entry. */
169
-		$search_criteria['field_filters']['mode'] = 'all';
170
-		$search_criteria['field_filters'][] = array(
169
+		$search_criteria[ 'field_filters' ][ 'mode' ] = 'all';
170
+		$search_criteria[ 'field_filters' ][ ] = array(
171 171
 			'key' => 'id',
172 172
 			'value' => $context->entry->ID,
173 173
 			'operator' => 'isnot'
174 174
 		);
175 175
 
176
-		$search_criteria['paging']['page_size'] = $context->field->page_size ? : 10;
176
+		$search_criteria[ 'paging' ][ 'page_size' ] = $context->field->page_size ?: 10;
177 177
 
178 178
 		return $search_criteria;
179 179
 	}
Please login to merge, or discard this patch.