Completed
Pull Request — master (#1071)
by Gennady
22:39 queued 18:20
created
includes/class-gravityview-entry-notes.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@
 block discarded – undo
141 141
 		global $wpdb;
142 142
 
143 143
 		if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' )
144
-		     && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) {
144
+			 && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) {
145 145
 			$notes_table = GFFormsModel::get_entry_notes_table_name();
146 146
 		} else {
147 147
 			$notes_table = GFFormsModel::get_lead_notes_table_name();
Please login to merge, or discard this patch.
future/includes/class-gv-view.php 1 patch
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,6 @@
 block discarded – undo
62 62
 	 *
63 63
 	 * Internal static cache for gets, and whatnot.
64 64
 	 * This is not persistent, resets across requests.
65
-
66 65
 	 * @internal
67 66
 	 */
68 67
 	private static $cache = array();
Please login to merge, or discard this patch.
future/includes/class-gv-widget.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -163,14 +163,14 @@
 block discarded – undo
163 163
 		return $settings;
164 164
 	}
165 165
 
166
-    /**
166
+	/**
167 167
 	 * Get the Widget ID.
168 168
 	 *
169
-     * @return string The Widget ID.
170
-     */
171
-    public function get_widget_id() {
172
-        return $this->widget_id;
173
-    }
169
+	 * @return string The Widget ID.
170
+	 */
171
+	public function get_widget_id() {
172
+		return $this->widget_id;
173
+	}
174 174
 
175 175
 	/**
176 176
 	 * Get the widget settings
Please login to merge, or discard this patch.
future/includes/class-gv-extension.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -244,13 +244,13 @@
 block discarded – undo
244 244
 			$this->_remote_update_url,
245 245
 			$this->_path,
246 246
 			array(
247
-            	'version'	=> $this->_version, // current version number
248
-            	'license'	=> $license['license'],
249
-	            'item_id'   => $this->_item_id, // The ID of the download on _remote_update_url
250
-            	'item_name' => $this->_title,  // name of this plugin
251
-            	'author' 	=> strip_tags( $this->_author )  // author of this plugin
252
-          	)
253
-        );
247
+				'version'	=> $this->_version, // current version number
248
+				'license'	=> $license['license'],
249
+				'item_id'   => $this->_item_id, // The ID of the download on _remote_update_url
250
+				'item_name' => $this->_title,  // name of this plugin
251
+				'author' 	=> strip_tags( $this->_author )  // author of this plugin
252
+		  	)
253
+		);
254 254
 	}
255 255
 
256 256
 	/**
Please login to merge, or discard this patch.
future/includes/class-gv-request.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -112,10 +112,10 @@
 block discarded – undo
112 112
 	 */
113 113
 	public function is_edit_entry() {
114 114
 		/**
115
-		* @filter `gravityview_is_edit_entry` Whether we're currently on the Edit Entry screen \n
116
-		* The Edit Entry functionality overrides this value.
117
-		* @param boolean $is_edit_entry
118
-		*/
115
+		 * @filter `gravityview_is_edit_entry` Whether we're currently on the Edit Entry screen \n
116
+		 * The Edit Entry functionality overrides this value.
117
+		 * @param boolean $is_edit_entry
118
+		 */
119 119
 		if ( ( $entry = $this->is_entry() ) && apply_filters( 'gravityview_is_edit_entry', false ) ) {
120 120
 			return $entry;
121 121
 		}
Please login to merge, or discard this patch.
future/includes/class-gv-license-handler.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 			'author'    => self::author,
97 97
 			'language'  => get_locale(),
98 98
 			'url'       => home_url(),
99
-		    'beta'      => $this->settings->get( 'beta' ),
99
+			'beta'      => $this->settings->get( 'beta' ),
100 100
 		);
101 101
 
102 102
 		if ( ! empty( $action ) ) {
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 	private function license_call_update_settings( $license_data, $data ) {
464 464
 		$settings = array();
465 465
 
466
-        $settings['license_key'] = $license_data->license_key = trim( $data['license'] );
466
+		$settings['license_key'] = $license_data->license_key = trim( $data['license'] );
467 467
 		$settings['license_key_status'] = $license_data->license;
468 468
 		$settings['license_key_response'] = (array)$license_data;
469 469
 
@@ -597,14 +597,14 @@  discard block
 block discarded – undo
597 597
 			// Call the custom API.
598 598
 			$response = wp_remote_post( self::url, array(
599 599
 				'timeout'   => 15,
600
-			    'sslverify' => false,
601
-			    'body'      =>  array(
602
-				    'edd_action' => 'check_license',
603
-				    'license'    => trim( $this->settings->get( 'license_key' ) ),
604
-				    'item_name'  => self::name,
605
-				    'url'        => home_url(),
606
-				    'site_data'  => $this->get_site_data(),
607
-			    ),
600
+				'sslverify' => false,
601
+				'body'      =>  array(
602
+					'edd_action' => 'check_license',
603
+					'license'    => trim( $this->settings->get( 'license_key' ) ),
604
+					'item_name'  => self::name,
605
+					'url'        => home_url(),
606
+					'site_data'  => $this->get_site_data(),
607
+				),
608 608
 			));
609 609
 
610 610
 			// make sure the response came back okay
Please login to merge, or discard this patch.
gravityview.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -237,26 +237,26 @@
 block discarded – undo
237 237
 
238 238
 	/** DEBUG */
239 239
 
240
-    /**
241
-     * Logs messages using Gravity Forms logging add-on
242
-     * @param  string $message log message
243
-     * @param mixed $data Additional data to display
240
+	/**
241
+	 * Logs messages using Gravity Forms logging add-on
242
+	 * @param  string $message log message
243
+	 * @param mixed $data Additional data to display
244 244
 	 * @deprecated use gravityview()->log
245
-     * @return void
246
-     */
247
-    public static function log_debug( $message, $data = null ){
245
+	 * @return void
246
+	 */
247
+	public static function log_debug( $message, $data = null ){
248 248
 		gravityview()->log->notice( '\GravityView_Plugin is deprecated. Use \GV\Plugin instead.' );
249 249
 		gravityview()->log->debug( $message, $data );
250
-    }
250
+	}
251 251
 
252
-    /**
253
-     * Logs messages using Gravity Forms logging add-on
254
-     * @param  string $message log message
252
+	/**
253
+	 * Logs messages using Gravity Forms logging add-on
254
+	 * @param  string $message log message
255 255
 	 * @deprecated use gravityview()->log
256
-     * @return void
257
-     */
258
-    public static function log_error( $message, $data = null ){
256
+	 * @return void
257
+	 */
258
+	public static function log_error( $message, $data = null ){
259 259
 		gravityview()->log->notice( '\GravityView_Plugin is deprecated. Use \GV\Plugin instead.' );
260 260
 		gravityview()->log->error( $message, $data );
261
-    }
261
+	}
262 262
 } // end class GravityView_Plugin
Please login to merge, or discard this patch.
includes/class-api.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -161,20 +161,20 @@  discard block
 block discarded – undo
161 161
 
162 162
 		if( !empty( $field['custom_class'] ) ) {
163 163
 
164
-            $custom_class = $field['custom_class'];
164
+			$custom_class = $field['custom_class'];
165 165
 
166
-            if( !empty( $entry ) ) {
166
+			if( !empty( $entry ) ) {
167 167
 
168
-                // We want the merge tag to be formatted as a class. The merge tag may be
169
-                // replaced by a multiple-word value that should be output as a single class.
170
-                // "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager`
171
-                add_filter('gform_merge_tag_filter', 'sanitize_html_class');
168
+				// We want the merge tag to be formatted as a class. The merge tag may be
169
+				// replaced by a multiple-word value that should be output as a single class.
170
+				// "Office Manager" will be formatted as `.OfficeManager`, not `.Office` and `.Manager`
171
+				add_filter('gform_merge_tag_filter', 'sanitize_html_class');
172 172
 
173
-                $custom_class = self::replace_variables( $custom_class, $form, $entry);
173
+				$custom_class = self::replace_variables( $custom_class, $form, $entry);
174 174
 
175
-                // And then we want life to return to normal
176
-                remove_filter('gform_merge_tag_filter', 'sanitize_html_class');
177
-            }
175
+				// And then we want life to return to normal
176
+				remove_filter('gform_merge_tag_filter', 'sanitize_html_class');
177
+			}
178 178
 
179 179
 			// And now we want the spaces to be handled nicely.
180 180
 			$classes[] = gravityview_sanitize_html_class( $custom_class );
@@ -531,32 +531,32 @@  discard block
 block discarded – undo
531 531
 		return sanitize_title( $slug );
532 532
 	}
533 533
 
534
-    /**
535
-     * If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta
536
-     *
537
-     * Triggered by add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 );
538
-     *
539
-     * @param $entry array Gravity Forms entry object
540
-     * @param $form array Gravity Forms form object
541
-     */
542
-    public static function entry_create_custom_slug( $entry, $form ) {
543
-        /**
544
-         * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta
545
-         * @param boolean $custom Should we process the custom entry slug?
546
-         */
547
-        $custom = apply_filters( 'gravityview_custom_entry_slug', false );
548
-        if( $custom ) {
549
-            // create the gravityview_unique_id and save it
534
+	/**
535
+	 * If using the entry custom slug feature, make sure the new entries have the custom slug created and saved as meta
536
+	 *
537
+	 * Triggered by add_action( 'gform_entry_created', array( 'GravityView_API', 'entry_create_custom_slug' ), 10, 2 );
538
+	 *
539
+	 * @param $entry array Gravity Forms entry object
540
+	 * @param $form array Gravity Forms form object
541
+	 */
542
+	public static function entry_create_custom_slug( $entry, $form ) {
543
+		/**
544
+		 * @filter `gravityview_custom_entry_slug` On entry creation, check if we are using the custom entry slug feature and update the meta
545
+		 * @param boolean $custom Should we process the custom entry slug?
546
+		 */
547
+		$custom = apply_filters( 'gravityview_custom_entry_slug', false );
548
+		if( $custom ) {
549
+			// create the gravityview_unique_id and save it
550 550
 
551
-            // Get the entry hash
552
-            $hash = self::get_custom_entry_slug( $entry['id'], $entry );
551
+			// Get the entry hash
552
+			$hash = self::get_custom_entry_slug( $entry['id'], $entry );
553 553
 
554
-	        gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) );
554
+			gravityview()->log->debug( 'Setting hash for entry {entry_id}: {hash}', array( 'entry_id' => $entry['id'], 'hash' => $hash ) );
555 555
 
556
-            gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
556
+			gform_update_meta( $entry['id'], 'gravityview_unique_id', $hash, \GV\Utils::get( $entry, 'form_id' ) );
557 557
 
558
-        }
559
-    }
558
+		}
559
+	}
560 560
 
561 561
 
562 562
 
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
 
900 900
 			// If there was an error, continue to the next term.
901 901
 			if ( is_wp_error( $term_link ) ) {
902
-			    continue;
902
+				continue;
903 903
 			}
904 904
 
905 905
 			$output[] = gravityview_get_link( $term_link, esc_html( $term->name ) );
Please login to merge, or discard this patch.
includes/class-gravityview-gfformsmodel.php 1 patch
Indentation   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -48,132 +48,132 @@
 block discarded – undo
48 48
 	}
49 49
 
50 50
 	/**
51
-     * Given information provided in an entry, get array of media IDs
52
-     *
53
-     * This is necessary because GF doesn't expect to need to update post images, only to create them.
54
-     *
55
-     * @see GFFormsModel::create_post()
56
-     *
57
-     * @since 1.17
58
-     *
59
-     * @param array $form Gravity Forms form array
60
-     * @param array $entry Gravity Forms entry array
61
-     *
62
-     * @return array Array of "Field ID" => "Media IDs"
63
-     */
64
-    public static function get_post_field_images( $form, $entry ) {
65
-
66
-        $post_data = self::get_post_fields( $form, $entry );
67
-
68
-        $media = get_attached_media( 'image', $entry['post_id'] );
69
-
70
-        $post_images = array();
71
-
72
-        foreach ( $media as $media_item ) {
73
-            foreach( (array) $post_data['images'] as $post_data_item ) {
74
-                if(
75
-                    \GV\Utils::get( $post_data_item, 'title' ) === $media_item->post_title &&
76
-                    \GV\Utils::get( $post_data_item, 'description' ) === $media_item->post_content &&
77
-                    \GV\Utils::get( $post_data_item, 'caption' ) === $media_item->post_excerpt
78
-                ) {
79
-                    $post_images["{$post_data_item['field_id']}"] = $media_item->ID;
80
-                }
81
-            }
82
-        }
83
-
84
-        return $post_images;
85
-    }
86
-
87
-    /**
88
-     * Alias of GFFormsModel::get_post_fields(); just making it public
89
-     *
90
-     * @see GFFormsModel::get_post_fields()
91
-     *
92
-     * @since 1.17
93
-     *
94
-     * @param array $form Gravity Forms form array
95
-     * @param array $entry Gravity Forms entry array
96
-     *
97
-     * @return array
98
-     */
99
-    public static function get_post_fields( $form, $entry ) {
100
-
101
-        $reflection = new ReflectionMethod( 'GFFormsModel', 'get_post_fields' );
102
-
103
-        /**
104
-         * If the method changes to public, use Gravity Forms' method
105
-         * @todo: If/when the method is public, remove the unneeded copied code.
106
-         */
107
-        if( $reflection->isPublic() ) {
108
-            return parent::get_post_fields( $form, $entry );
109
-        }
110
-
111
-        // It was private; let's make it public
112
-        $reflection->setAccessible( true );
113
-
114
-        return $reflection->invoke( new GFFormsModel, $form, $entry );
115
-    }
116
-
117
-    /**
118
-     * Copied function from Gravity Forms plugin \GFFormsModel::copy_post_image since the method is private.
119
-     *
120
-     * @since 1.16.2
121
-     *
122
-     * @param string $url URL of the post image to update
123
-     * @param int $post_id ID of the post image to update
124
-     * @return array|bool Array with `file`, `url` and `type` keys. False: failed to copy file to final directory path.
125
-     */
126
-    public static function copy_post_image( $url, $post_id ) {
127
-
128
-        $reflection = new ReflectionMethod( 'GFFormsModel', 'copy_post_image' );
129
-
130
-        /**
131
-         * If the method changes to public, use Gravity Forms' method
132
-         * @todo: If/when the method is public, remove the unneeded copied code.
133
-         */
134
-        if( $reflection->isPublic() ) {
135
-            return parent::copy_post_image( $url, $post_id );
136
-        }
137
-
138
-        // It was private; let's make it public
139
-        $reflection->setAccessible( true );
140
-
141
-        return $reflection->invoke( new GFFormsModel, $url, $post_id );
142
-    }
143
-
144
-    /**
145
-     * Copied function from Gravity Forms plugin \GFFormsModel::media_handle_upload since the method is private.
146
-     *
147
-     * Note: The method became public in GF 1.9.17.7
148
-     *
149
-     * @see GFFormsModel::media_handle_upload
150
-     * @see GravityView_Edit_Entry_Render::maybe_update_post_fields
151
-     *
152
-     * @uses copy_post_image
153
-     * @uses wp_insert_attachment
154
-     * @uses wp_update_attachment_metadata
155
-     *
156
-     * @param string $url URL of the post image to update
157
-     * @param int $post_id ID of the post image to update
158
-     * @param array $post_data Array of data for the eventual attachment post type that is created using {@see wp_insert_attachment}. Supports `post_mime_type`, `guid`, `post_parent`, `post_title`, `post_content` keys.
159
-     * @return bool|int ID of attachment Post created. Returns false if file not created by copy_post_image
160
-     */
161
-    public static function media_handle_upload( $url, $post_id, $post_data = array() ) {
162
-
163
-        $reflection = new ReflectionMethod( 'GFFormsModel', 'media_handle_upload' );
164
-
165
-        /**
166
-         * If the method changes to public, use Gravity Forms' method
167
-         * @todo: If/when the method is public, remove the unneeded copied code.
168
-         */
169
-        if( $reflection->isPublic() ) {
170
-            return parent::media_handle_upload( $url, $post_id, $post_data );
171
-        }
172
-
173
-        // It was private; let's make it public
174
-        $reflection->setAccessible( true );
175
-
176
-        return $reflection->invoke( new GFFormsModel, $url, $post_id, $post_data );
177
-    }
51
+	 * Given information provided in an entry, get array of media IDs
52
+	 *
53
+	 * This is necessary because GF doesn't expect to need to update post images, only to create them.
54
+	 *
55
+	 * @see GFFormsModel::create_post()
56
+	 *
57
+	 * @since 1.17
58
+	 *
59
+	 * @param array $form Gravity Forms form array
60
+	 * @param array $entry Gravity Forms entry array
61
+	 *
62
+	 * @return array Array of "Field ID" => "Media IDs"
63
+	 */
64
+	public static function get_post_field_images( $form, $entry ) {
65
+
66
+		$post_data = self::get_post_fields( $form, $entry );
67
+
68
+		$media = get_attached_media( 'image', $entry['post_id'] );
69
+
70
+		$post_images = array();
71
+
72
+		foreach ( $media as $media_item ) {
73
+			foreach( (array) $post_data['images'] as $post_data_item ) {
74
+				if(
75
+					\GV\Utils::get( $post_data_item, 'title' ) === $media_item->post_title &&
76
+					\GV\Utils::get( $post_data_item, 'description' ) === $media_item->post_content &&
77
+					\GV\Utils::get( $post_data_item, 'caption' ) === $media_item->post_excerpt
78
+				) {
79
+					$post_images["{$post_data_item['field_id']}"] = $media_item->ID;
80
+				}
81
+			}
82
+		}
83
+
84
+		return $post_images;
85
+	}
86
+
87
+	/**
88
+	 * Alias of GFFormsModel::get_post_fields(); just making it public
89
+	 *
90
+	 * @see GFFormsModel::get_post_fields()
91
+	 *
92
+	 * @since 1.17
93
+	 *
94
+	 * @param array $form Gravity Forms form array
95
+	 * @param array $entry Gravity Forms entry array
96
+	 *
97
+	 * @return array
98
+	 */
99
+	public static function get_post_fields( $form, $entry ) {
100
+
101
+		$reflection = new ReflectionMethod( 'GFFormsModel', 'get_post_fields' );
102
+
103
+		/**
104
+		 * If the method changes to public, use Gravity Forms' method
105
+		 * @todo: If/when the method is public, remove the unneeded copied code.
106
+		 */
107
+		if( $reflection->isPublic() ) {
108
+			return parent::get_post_fields( $form, $entry );
109
+		}
110
+
111
+		// It was private; let's make it public
112
+		$reflection->setAccessible( true );
113
+
114
+		return $reflection->invoke( new GFFormsModel, $form, $entry );
115
+	}
116
+
117
+	/**
118
+	 * Copied function from Gravity Forms plugin \GFFormsModel::copy_post_image since the method is private.
119
+	 *
120
+	 * @since 1.16.2
121
+	 *
122
+	 * @param string $url URL of the post image to update
123
+	 * @param int $post_id ID of the post image to update
124
+	 * @return array|bool Array with `file`, `url` and `type` keys. False: failed to copy file to final directory path.
125
+	 */
126
+	public static function copy_post_image( $url, $post_id ) {
127
+
128
+		$reflection = new ReflectionMethod( 'GFFormsModel', 'copy_post_image' );
129
+
130
+		/**
131
+		 * If the method changes to public, use Gravity Forms' method
132
+		 * @todo: If/when the method is public, remove the unneeded copied code.
133
+		 */
134
+		if( $reflection->isPublic() ) {
135
+			return parent::copy_post_image( $url, $post_id );
136
+		}
137
+
138
+		// It was private; let's make it public
139
+		$reflection->setAccessible( true );
140
+
141
+		return $reflection->invoke( new GFFormsModel, $url, $post_id );
142
+	}
143
+
144
+	/**
145
+	 * Copied function from Gravity Forms plugin \GFFormsModel::media_handle_upload since the method is private.
146
+	 *
147
+	 * Note: The method became public in GF 1.9.17.7
148
+	 *
149
+	 * @see GFFormsModel::media_handle_upload
150
+	 * @see GravityView_Edit_Entry_Render::maybe_update_post_fields
151
+	 *
152
+	 * @uses copy_post_image
153
+	 * @uses wp_insert_attachment
154
+	 * @uses wp_update_attachment_metadata
155
+	 *
156
+	 * @param string $url URL of the post image to update
157
+	 * @param int $post_id ID of the post image to update
158
+	 * @param array $post_data Array of data for the eventual attachment post type that is created using {@see wp_insert_attachment}. Supports `post_mime_type`, `guid`, `post_parent`, `post_title`, `post_content` keys.
159
+	 * @return bool|int ID of attachment Post created. Returns false if file not created by copy_post_image
160
+	 */
161
+	public static function media_handle_upload( $url, $post_id, $post_data = array() ) {
162
+
163
+		$reflection = new ReflectionMethod( 'GFFormsModel', 'media_handle_upload' );
164
+
165
+		/**
166
+		 * If the method changes to public, use Gravity Forms' method
167
+		 * @todo: If/when the method is public, remove the unneeded copied code.
168
+		 */
169
+		if( $reflection->isPublic() ) {
170
+			return parent::media_handle_upload( $url, $post_id, $post_data );
171
+		}
172
+
173
+		// It was private; let's make it public
174
+		$reflection->setAccessible( true );
175
+
176
+		return $reflection->invoke( new GFFormsModel, $url, $post_id, $post_data );
177
+	}
178 178
 
179 179
 }
180 180
\ No newline at end of file
Please login to merge, or discard this patch.