Completed
Push — develop ( 811c34...15e798 )
by Zack
19:29
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
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) {
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' ) . ' ' . sprintf( _x( 'Set to %s for no maximum.', '%s replaced with a formatted 0', 'gravityview' ), '<code>0</code>' ),
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
 			'min'   => 0,
70 70
 		);
71 71
 
72
-		$new_options['no_entries_hide'] = array(
72
+		$new_options[ 'no_entries_hide' ] = array(
73 73
 			'type'  => 'checkbox',
74 74
 			'label' => __( 'Hide if no entries', 'gravityview' ),
75 75
 			'desc'  => __( 'Don\'t display this field if the entry creator has no other entries', 'gravityview' ),
76 76
 			'value' => false,
77 77
 		);
78 78
 
79
-		$new_options['no_entries_text'] = array(
79
+		$new_options[ 'no_entries_text' ] = array(
80 80
 			'type'  => 'text',
81 81
 			'label' => __( 'No Entries Text', 'gravityview' ),
82 82
 			'desc'  => __( 'The text that is shown if the entry creator has no other entries (and "Hide if no entries" is disabled).', 'gravityview' ),
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
 		foreach ( $filters as $filter ) {
111 111
 			foreach ( $wp_filter[ $filter ] as $priority => $callbacks ) {
112 112
 				foreach ( $callbacks as $id => $callback ) {
113
-					if ( ! is_array( $callback['function'] ) ) {
113
+					if ( ! is_array( $callback[ 'function' ] ) ) {
114 114
 						continue;
115 115
 					}
116
-					if ( $callback['function'][0] instanceof \GV\Widget ) {
117
-						$remove[] = array( $filter, $priority, $id );
116
+					if ( $callback[ 'function' ][ 0 ] instanceof \GV\Widget ) {
117
+						$remove[ ] = array( $filter, $priority, $id );
118 118
 					}
119 119
 				}
120 120
 			}
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
 		foreach ( $remove as $r ) {
124 124
 			list( $filter, $priority, $id ) = $r;
125
-			$removed[] = array( $filter, $priority, $id, $wp_filter[ $filter ]->callbacks[ $priority ][ $id ] );
125
+			$removed[ ] = array( $filter, $priority, $id, $wp_filter[ $filter ]->callbacks[ $priority ][ $id ] );
126 126
 			unset( $wp_filter[ $filter ]->callbacks[ $priority ][ $id ] );
127 127
 		}
128 128
 
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
 	public function filter_entries( $search_criteria, $form_id = null, $args = array(), $force_search_criteria = false ) {
147 147
 		$context = $this->context;
148 148
 
149
-		$created_by = $context->entry['created_by'];
149
+		$created_by = $context->entry[ 'created_by' ];
150 150
 
151 151
 		/** Filter entries by approved and created_by. */
152
-		$search_criteria['field_filters'][] = array(
152
+		$search_criteria[ 'field_filters' ][ ] = array(
153 153
 			'key' => 'created_by',
154 154
 			'value' => $created_by,
155 155
 			'operator' => 'is'
@@ -169,14 +169,14 @@  discard block
 block discarded – undo
169 169
 		$criteria = apply_filters( 'gravityview/field/other_entries/criteria', $search_criteria, $context->view->settings->as_atts(), $context->view->form->ID, $context );
170 170
 
171 171
 		/** Force mode all and filter out our own entry. */
172
-		$search_criteria['field_filters']['mode'] = 'all';
173
-		$search_criteria['field_filters'][] = array(
172
+		$search_criteria[ 'field_filters' ][ 'mode' ] = 'all';
173
+		$search_criteria[ 'field_filters' ][ ] = array(
174 174
 			'key' => 'id',
175 175
 			'value' => $context->entry->ID,
176 176
 			'operator' => 'isnot'
177 177
 		);
178 178
 
179
-		$search_criteria['paging']['page_size'] = $context->field->page_size ? : 10;
179
+		$search_criteria[ 'paging' ][ 'page_size' ] = $context->field->page_size ?: 10;
180 180
 
181 181
 		return $search_criteria;
182 182
 	}
Please login to merge, or discard this patch.