Completed
Push — develop ( e28642...629057 )
by Zack
14:34
created
future/includes/class-gv-oembed.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 		wp_embed_register_handler( 'gravityview_entry', self::get_entry_regex(), array( __CLASS__, 'render' ), 20000 );
27 27
 		wp_oembed_add_provider( self::get_entry_regex(), self::$provider_url, true );
28 28
 
29
-		if ( ! empty( $_GET['gv_oembed_provider'] ) && ! empty( $_GET['url'] ) ) {
29
+		if ( ! empty( $_GET[ 'gv_oembed_provider' ] ) && ! empty( $_GET[ 'url' ] ) ) {
30 30
 			add_action( 'template_redirect', array( __CLASS__, 'render_provider_request' ) );
31 31
 		}
32 32
 
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	 * @return void
44 44
 	 */
45 45
 	public static function render_provider_request() {
46
-		if ( ! empty( $_GET['url'] ) ) {
47
-			$url = $_GET['url'];
46
+		if ( ! empty( $_GET[ 'url' ] ) ) {
47
+			$url = $_GET[ 'url' ];
48 48
 		} else {
49 49
 			header( 'HTTP/1.0 404 Not Found' );
50 50
 			exit;
@@ -111,18 +111,18 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	private static function parse_matches( $matches, $url ) {
113 113
 		// If not using permalinks, re-assign values for matching groups
114
-		if ( ! empty( $matches['entry_slug2'] ) ) {
115
-			$matches['is_cpt'] = $matches['is_cpt2'];
116
-			$matches['slug'] = $matches['slug2'];
117
-			$matches['entry_slug'] = $matches['entry_slug2'];
118
-			unset( $matches['is_cpt2'], $matches['slug2'], $matches['entry_slug2'] );
114
+		if ( ! empty( $matches[ 'entry_slug2' ] ) ) {
115
+			$matches[ 'is_cpt' ] = $matches[ 'is_cpt2' ];
116
+			$matches[ 'slug' ] = $matches[ 'slug2' ];
117
+			$matches[ 'entry_slug' ] = $matches[ 'entry_slug2' ];
118
+			unset( $matches[ 'is_cpt2' ], $matches[ 'slug2' ], $matches[ 'entry_slug2' ] );
119 119
 		}
120 120
 
121
-		if ( empty( $matches['entry_slug'] ) ) {
121
+		if ( empty( $matches[ 'entry_slug' ] ) ) {
122 122
 			gravityview()->log->error( 'Entry slug not parsed by regex.', array( 'data' => $matches ) );
123 123
 			return null;
124 124
 		} else {
125
-			$entry_id = $matches['entry_slug'];
125
+			$entry_id = $matches[ 'entry_slug' ];
126 126
 		}
127 127
 
128 128
 		if ( ! $entry = \GV\GF_Entry::by_id( $entry_id ) ) {
@@ -142,12 +142,12 @@  discard block
 block discarded – undo
142 142
 		if ( ! $view ) {
143 143
 
144 144
 			// If the slug doesn't work, maybe using Plain permalinks and not the slug, only ID
145
-			if( is_numeric( $matches['slug'] ) ) {
146
-				$view = \GV\View::by_id( $matches['slug'] );
145
+			if ( is_numeric( $matches[ 'slug' ] ) ) {
146
+				$view = \GV\View::by_id( $matches[ 'slug' ] );
147 147
 			}
148 148
 
149
-			if( ! $view ) {
150
-				$view = \GV\View::from_post( get_page_by_path( $matches['slug'], OBJECT, 'gravityview' ) );
149
+			if ( ! $view ) {
150
+				$view = \GV\View::from_post( get_page_by_path( $matches[ 'slug' ], OBJECT, 'gravityview' ) );
151 151
 			}
152 152
 		}
153 153
 
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 
179 179
 		return '
180 180
 		<div class="loading-placeholder" style="background-color:#e6f0f5;">
181
-			<h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image.$embed_heading.'</h3>
181
+			<h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image . $embed_heading . '</h3>
182 182
 			<p style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">
183
-				'.$embed_text.'
183
+				'.$embed_text . '
184 184
 			</p>
185 185
 			<br style="clear: both;">
186 186
 		</div>';
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 	private static function render_preview_notice() {
195 195
 		$floaty = \GravityView_Admin::get_floaty();
196 196
 		$title = esc_html__( 'This will look better when it is embedded.', 'gravityview' );
197
-		$message = esc_html__( 'Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview');
198
-		return '<div class="updated notice">'.$floaty.'<h3>'.$title.'</h3><p>'.$message.'</p><br style="clear:both;" /></div>';
197
+		$message = esc_html__( 'Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview' );
198
+		return '<div class="updated notice">' . $floaty . '<h3>' . $title . '</h3><p>' . $message . '</p><br style="clear:both;" /></div>';
199 199
 	}
200 200
 
201 201
 	/**
@@ -214,13 +214,13 @@  discard block
 block discarded – undo
214 214
 			return __( 'You are not allowed to view this content.', 'gravityview' );
215 215
 		}
216 216
 
217
-		if ( $entry && 'active' !== $entry['status'] ) {
217
+		if ( $entry && 'active' !== $entry[ 'status' ] ) {
218 218
 			gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) );
219 219
 			return __( 'You are not allowed to view this content.', 'gravityview' );
220 220
 		}
221 221
 
222 222
 		if ( $view->settings->get( 'show_only_approved' ) ) {
223
-			if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) )  ) {
223
+			if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) {
224 224
 				gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) );
225 225
 				return __( 'You are not allowed to view this content.', 'gravityview' );
226 226
 			}
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 		// Catch either
286 286
 		$match_regex = "(?:{$using_permalinks}|{$not_using_permalinks})";
287 287
 
288
-		return '#'.$match_regex.'#i';
288
+		return '#' . $match_regex . '#i';
289 289
 	}
290 290
 
291 291
 	/**
Please login to merge, or discard this patch.