Completed
Push — master ( 885fbd...5a8fbc )
by Mike
02:40
created
types/term.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -166,20 +166,20 @@
 block discarded – undo
166 166
 
167 167
 		// Query for our terms
168 168
 		$args = array(
169
-		    'hide_empty' => false,
170
-		    'meta_query' => array(
169
+			'hide_empty' => false,
170
+			'meta_query' => array(
171 171
 				'relation'		=> 'OR',
172
-		        array(
173
-		           'key'       => 'dummypress_test_data',
174
-		           'value'     => '__test__',
175
-		           'compare'   => '='
172
+				array(
173
+				   'key'       => 'dummypress_test_data',
174
+				   'value'     => '__test__',
175
+				   'compare'   => '='
176 176
 			   ),
177 177
 			   array(
178 178
 				  'key'       => 'evans_test_content',
179 179
 				  'value'     => '__test__',
180 180
 				  'compare'   => '='
181 181
 			  ),
182
-		    )
182
+			)
183 183
 		);
184 184
 
185 185
 		$terms = get_terms( $slug, $args );
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  * @subpackage Evans
13 13
  * @author     Old Town Media
14 14
  */
15
-class Term extends Abs\Type{
15
+class Term extends Abs\Type {
16 16
 
17 17
 	/**
18 18
 	 * type
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
 	 * @param string $slug a custom post type ID.
38 38
 	 * @param int $num Optional. Number of posts to create.
39 39
 	 */
40
-	public function create_objects( $slug, $connection, $num = '' ){
40
+	public function create_objects($slug, $connection, $num = '') {
41 41
 
42 42
 		// If we're missing a custom post type id - don't do anything
43
-		if ( empty( $slug ) ){
43
+		if (empty($slug)) {
44 44
 			return;
45 45
 		}
46 46
 
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
 		$this->connected = $connection;
49 49
 
50 50
 		// If we forgot to put in a quantity, make one for us
51
-		if ( empty( $num ) ){
52
-			$num = rand( 5, 30 );
51
+		if (empty($num)) {
52
+			$num = rand(5, 30);
53 53
 		}
54 54
 
55 55
 		// Create test terms
56
-		for( $i = 0; $i < $num; $i++ ){
56
+		for ($i = 0; $i < $num; $i++) {
57 57
 
58
-			$return = $this->create_test_object( $slug );
58
+			$return = $this->create_test_object($slug);
59 59
 
60 60
 			return $return;
61 61
 
@@ -77,27 +77,27 @@  discard block
 block discarded – undo
77 77
 	 *
78 78
 	 * @param string $slug a custom post type ID.
79 79
 	 */
80
-	private function create_test_object( $slug ){
80
+	private function create_test_object($slug) {
81 81
 
82 82
 		// Get a random title
83
-		$title = apply_filters( "tc_{$slug}_term_title", TestContent::title() );
83
+		$title = apply_filters("tc_{$slug}_term_title", TestContent::title());
84 84
 
85 85
 		$return = wp_insert_term(
86 86
 			$title,
87 87
 			$slug,
88
-			apply_filters( "tc_{$slug}_term_arguments", array(
88
+			apply_filters("tc_{$slug}_term_arguments", array(
89 89
 					'description'=> TestContent::title(),
90
-					'slug' => sanitize_title( $title ),
90
+					'slug' => sanitize_title($title),
91 91
 				)
92 92
 			)
93 93
 		);
94 94
 
95 95
 		// Then, set a test content flag on the new post for later deletion
96
-		add_term_meta( $return['term_id'], 'dummypress_test_data', '__test__', true );
96
+		add_term_meta($return['term_id'], 'dummypress_test_data', '__test__', true);
97 97
 
98 98
 		// Check if we have errors and return them or created message
99
-		if ( is_wp_error( $return ) ){
100
-			error_log( $return->get_error_message() );
99
+		if (is_wp_error($return)) {
100
+			error_log($return->get_error_message());
101 101
 			return $return;
102 102
 		} else {
103 103
 			return array(
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 				'object'	=> 'term',
106 106
 				'oid'		=> $return['term_id'],
107 107
 				'type'		=> $slug,
108
-				'link_edit'	=> admin_url( '/edit-tags.php?action=edit&taxonomy='.$slug.'&tag_ID='.$return['term_id'] ),
109
-				'link_view'	=> get_term_link( $return['term_id'] )
108
+				'link_edit'	=> admin_url('/edit-tags.php?action=edit&taxonomy=' . $slug . '&tag_ID=' . $return['term_id']),
109
+				'link_view'	=> get_term_link($return['term_id'])
110 110
 			);
111 111
 		}
112 112
 
@@ -119,20 +119,20 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @see Delete
121 121
 	 */
122
-	public function delete_all(){
122
+	public function delete_all() {
123 123
 
124
-		$delete =  new Delete;
124
+		$delete = new Delete;
125 125
 
126 126
 		// Make sure that the current user is logged in & has full permissions.
127
-		if ( ! $delete->user_can_delete() ){
127
+		if (!$delete->user_can_delete()) {
128 128
 			return;
129 129
 		}
130 130
 
131 131
 		// Loop through all taxonomies and remove any data
132 132
 		$taxonomies = get_taxonomies();
133
-		foreach ( $taxonomies as $tax ) :
133
+		foreach ($taxonomies as $tax) :
134 134
 
135
-			$this->delete( $tax );
135
+			$this->delete($tax);
136 136
 
137 137
 		endforeach;
138 138
 
@@ -150,17 +150,17 @@  discard block
 block discarded – undo
150 150
 	 *
151 151
 	 * @param string $slug a custom post type ID.
152 152
 	 */
153
-	public function delete( $slug ){
153
+	public function delete($slug) {
154 154
 
155
-		$delete =  new Delete;
155
+		$delete = new Delete;
156 156
 
157 157
 		// Make sure that the current user is logged in & has full permissions.
158
-		if ( !$delete->user_can_delete() ){
158
+		if (!$delete->user_can_delete()) {
159 159
 			return;
160 160
 		}
161 161
 
162 162
 		// Check that $cptslg has a string.
163
-		if ( empty( $slug ) ){
163
+		if (empty($slug)) {
164 164
 			return;
165 165
 		}
166 166
 
@@ -182,16 +182,16 @@  discard block
 block discarded – undo
182 182
 		    )
183 183
 		);
184 184
 
185
-		$terms = get_terms( $slug, $args );
185
+		$terms = get_terms($slug, $args);
186 186
 
187
-		if ( !empty( $terms ) ){
187
+		if (!empty($terms)) {
188 188
 
189 189
 			$events = array();
190 190
 
191
-			foreach ( $terms as $term ){
191
+			foreach ($terms as $term) {
192 192
 
193 193
 				// Double check our set user meta value
194
-				if ( '__test__' != get_term_meta( $term->term_id, 'dummypress_test_data', true ) && '__test__' != get_term_meta( $term->term_id, 'evans_test_content', true ) ){
194
+				if ('__test__' != get_term_meta($term->term_id, 'dummypress_test_data', true) && '__test__' != get_term_meta($term->term_id, 'evans_test_content', true)) {
195 195
 					continue;
196 196
 				}
197 197
 
@@ -203,15 +203,15 @@  discard block
 block discarded – undo
203 203
 				);
204 204
 
205 205
 				// Delete our term
206
-				wp_delete_term( $term->term_id, $slug );
206
+				wp_delete_term($term->term_id, $slug);
207 207
 
208 208
 			}
209 209
 
210
-			$taxonomy = get_taxonomy( $slug );
210
+			$taxonomy = get_taxonomy($slug);
211 211
 
212 212
 			$events[] = array(
213 213
 				'action'	=> 'general',
214
-				'message'	=> __( 'Deleted', 'dummybot' ) . ' ' . $taxonomy->labels->name
214
+				'message'	=> __('Deleted', 'dummybot') . ' ' . $taxonomy->labels->name
215 215
 			);
216 216
 
217 217
 			return $events;
Please login to merge, or discard this patch.
types/post.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 		$post_types = get_post_types( array( 'public' => true ), 'objects' );
287 287
 		foreach ( $post_types as $post_type ) :
288 288
 
289
-		    return $this->delete( $post_type->name );
289
+			return $this->delete( $post_type->name );
290 290
 
291 291
 		endforeach;
292 292
 
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 			'posts_per_page'	=> 500,
325 325
 			'meta_query' 		=> array(
326 326
 				'relation'		=> 'OR',
327
-		        array(
328
-		           'key'       => 'dummypress_test_data',
329
-		           'value'     => '__test__',
330
-		           'compare'   => '='
327
+				array(
328
+				   'key'       => 'dummypress_test_data',
329
+				   'value'     => '__test__',
330
+				   'compare'   => '='
331 331
 			   ),
332 332
 			   array(
333 333
 				  'key'       => 'evans_test_content',
Please login to merge, or discard this patch.
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  * @subpackage Evans
14 14
  * @author     Old Town Media
15 15
  */
16
-class Post extends Abs\Type{
16
+class Post extends Abs\Type {
17 17
 
18 18
 	/**
19 19
 	 * metabox_types
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 *
48 48
 	 * @see MetaboxTypes, MetaboxValues
49 49
 	 */
50
-	public function __construct(){
50
+	public function __construct() {
51 51
 
52 52
 		$this->metabox_types = new Main\MetaboxTypes;
53 53
 		$this->metabox_values = new Main\MetaboxValues;
@@ -69,29 +69,29 @@  discard block
 block discarded – undo
69 69
 	 * @param boolean $connection Whether or not we're connected to the Internet.
70 70
 	 * @param int $num Optional. Number of posts to create.
71 71
 	 */
72
-	public function create_objects( $slug, $connection, $num = '' ){
72
+	public function create_objects($slug, $connection, $num = '') {
73 73
 
74 74
 		// If we're missing a custom post type id - don't do anything
75
-		if ( empty( $slug ) ){
75
+		if (empty($slug)) {
76 76
 			return;
77 77
 		}
78 78
 
79 79
 		// Gather the necessary data to create the posts
80
-		$supports 	= $this->get_cpt_supports( $slug );
81
-		$metaboxes	= $this->metabox_types->get_metaboxes( $slug );
80
+		$supports 	= $this->get_cpt_supports($slug);
81
+		$metaboxes	= $this->metabox_types->get_metaboxes($slug);
82 82
 
83 83
 		// Set our connection status for the rest of the methods
84 84
 		$this->connected = $connection;
85 85
 
86 86
 		// If we forgot to put in a quantity, make one for us
87
-		if ( empty( $num ) ){
88
-			$num = rand( 5, 30 );
87
+		if (empty($num)) {
88
+			$num = rand(5, 30);
89 89
 		}
90 90
 
91 91
 		// Create test posts
92
-		for( $i = 0; $i < $num; $i++ ){
92
+		for ($i = 0; $i < $num; $i++) {
93 93
 
94
-			$return = $this->create_test_object( $slug, $supports, $metaboxes );
94
+			$return = $this->create_test_object($slug, $supports, $metaboxes);
95 95
 
96 96
 			return $return;
97 97
 
@@ -115,15 +115,15 @@  discard block
 block discarded – undo
115 115
 	 * @param array $supports Features that the post type supports.
116 116
 	 * @param array $supports All CMB2 metaboxes attached to the post type.
117 117
 	 */
118
-	private function create_test_object( $slug, $supports, $metaboxes ){
118
+	private function create_test_object($slug, $supports, $metaboxes) {
119 119
 		$return = '';
120 120
 
121 121
 		// Get a random title
122
-		$title = apply_filters( "tc_{$slug}_post_title", TestContent::title() );
122
+		$title = apply_filters("tc_{$slug}_post_title", TestContent::title());
123 123
 
124 124
 		// First, insert our post
125 125
 		$post = array(
126
-		  'post_name'      => sanitize_title( $title ),
126
+		  'post_name'      => sanitize_title($title),
127 127
 		  'post_status'    => 'publish',
128 128
 		  'post_type'      => $slug,
129 129
 		  'ping_status'    => 'closed',
@@ -131,57 +131,57 @@  discard block
 block discarded – undo
131 131
 		);
132 132
 
133 133
 		// Add title if supported
134
-		if ( $supports['title'] === true ){
134
+		if ($supports['title'] === true) {
135 135
 			$post['post_title'] = $title;
136 136
 		}
137 137
 
138 138
 		// Add main content if supported
139
-		if ( $supports['editor'] === true ){
140
-			$post['post_content'] = apply_filters( "tc_{$slug}_post_content", TestContent::paragraphs() );
139
+		if ($supports['editor'] === true) {
140
+			$post['post_content'] = apply_filters("tc_{$slug}_post_content", TestContent::paragraphs());
141 141
 		}
142 142
 
143 143
 		// Add excerpt content if supported
144
-		if ( $supports['excerpt'] === true ){
145
-			$post['post_excerpt'] = apply_filters( "tc_{$slug}_post_excerpt", TestContent::plain_text() );
144
+		if ($supports['excerpt'] === true) {
145
+			$post['post_excerpt'] = apply_filters("tc_{$slug}_post_excerpt", TestContent::plain_text());
146 146
 		}
147 147
 
148 148
 		// Insert then post object
149
-		$post_id = wp_insert_post( apply_filters( "tc_{$slug}_post_arguments", $post ) );
149
+		$post_id = wp_insert_post(apply_filters("tc_{$slug}_post_arguments", $post));
150 150
 
151 151
 		// Then, set a test content flag on the new post for later deletion
152
-		add_post_meta( $post_id, 'dummypress_test_data', '__test__', true );
152
+		add_post_meta($post_id, 'dummypress_test_data', '__test__', true);
153 153
 
154 154
 		// Add thumbnail if supported
155
-		if ( $this->connected == true && ( $supports['thumbnail'] === true || in_array( $slug, array( 'post', 'page' ) ) ) ){
156
-			 update_post_meta( $post_id, '_thumbnail_id', TestContent::image( $post_id ) );
155
+		if ($this->connected == true && ($supports['thumbnail'] === true || in_array($slug, array('post', 'page')))) {
156
+			 update_post_meta($post_id, '_thumbnail_id', TestContent::image($post_id));
157 157
 		}
158 158
 
159
-		$taxonomies = get_object_taxonomies( $slug );
159
+		$taxonomies = get_object_taxonomies($slug);
160 160
 
161 161
 		// Assign the post to terms
162
-		if ( !empty( $taxonomies ) ){
163
-			$return .= $this->assign_terms( $post_id, $taxonomies );
162
+		if (!empty($taxonomies)) {
163
+			$return .= $this->assign_terms($post_id, $taxonomies);
164 164
 		}
165 165
 
166 166
 		// Spin up metaboxes
167
-		if ( !empty( $metaboxes ) ){
168
-			foreach ( $metaboxes as $cmb ) :
169
-				$return .= $this->metabox_values->get_values( $post_id, $cmb, $this->connected );
167
+		if (!empty($metaboxes)) {
168
+			foreach ($metaboxes as $cmb) :
169
+				$return .= $this->metabox_values->get_values($post_id, $cmb, $this->connected);
170 170
 			endforeach;
171 171
 		}
172 172
 
173 173
 		// Check if we have errors and return them or created message
174
-		if ( is_wp_error( $post_id ) ){
175
-			error_log( $post_id->get_error_message() );
174
+		if (is_wp_error($post_id)) {
175
+			error_log($post_id->get_error_message());
176 176
 			return $post_id;
177 177
 		} else {
178 178
 			return array(
179 179
 				'action'	=> 'created',
180 180
 				'object'	=> 'post',
181 181
 				'oid'		=> $post_id,
182
-				'type'		=> get_post_type( $post_id ),
183
-				'link_edit'	=> admin_url( '/post.php?post='.$post_id.'&action=edit' ),
184
-				'link_view'	=> get_permalink( $post_id ),
182
+				'type'		=> get_post_type($post_id),
183
+				'link_edit'	=> admin_url('/post.php?post=' . $post_id . '&action=edit'),
184
+				'link_view'	=> get_permalink($post_id),
185 185
 			);
186 186
 		}
187 187
 
@@ -198,13 +198,13 @@  discard block
 block discarded – undo
198 198
 	 * @param string $slug a custom post type ID.
199 199
 	 * @return array Array of necessary supports booleans.
200 200
 	 */
201
-	private function get_cpt_supports( $slug ){
201
+	private function get_cpt_supports($slug) {
202 202
 
203 203
 		$supports = array(
204
-			'title'		=> post_type_supports( $slug, 'title' ),
205
-			'editor'	=> post_type_supports( $slug, 'editor' ),
206
-			'excerpt'	=> post_type_supports( $slug, 'excerpt' ),
207
-			'thumbnail'	=> post_type_supports( $slug, 'thumbnail' ),
204
+			'title'		=> post_type_supports($slug, 'title'),
205
+			'editor'	=> post_type_supports($slug, 'editor'),
206
+			'excerpt'	=> post_type_supports($slug, 'excerpt'),
207
+			'thumbnail'	=> post_type_supports($slug, 'thumbnail'),
208 208
 		);
209 209
 
210 210
 		return $supports;
@@ -225,26 +225,26 @@  discard block
 block discarded – undo
225 225
 	 * @param array $taxonomies taxonomies assigned to this cpt.
226 226
 	 * @return object WP Error if there is one.
227 227
 	 */
228
-	private function assign_terms( $post_id, $taxonomies ){
228
+	private function assign_terms($post_id, $taxonomies) {
229 229
 
230 230
 		// Make sure it's an array & has items
231
-		if ( empty( $taxonomies ) || !is_array( $taxonomies ) ){
231
+		if (empty($taxonomies) || !is_array($taxonomies)) {
232 232
 			return;
233 233
 		}
234 234
 
235
-		foreach ( $taxonomies as $tax ){
235
+		foreach ($taxonomies as $tax) {
236 236
 
237 237
 			// Get the individual terms already existing
238
-			$terms = get_terms( $tax, array( 'hide_empty'	=> false ) );
239
-			$count = count( $terms ) - 1;
238
+			$terms = get_terms($tax, array('hide_empty'	=> false));
239
+			$count = count($terms) - 1;
240 240
 
241 241
 			// If there are no terms, skip to the next taxonomy
242
-			if ( empty( $terms ) ){
242
+			if (empty($terms)) {
243 243
 				continue;
244 244
 			}
245 245
 
246 246
 			// Get a random index to use
247
-			$index = rand( 0, $count );
247
+			$index = rand(0, $count);
248 248
 
249 249
 			// Initialize our array
250 250
 			$post_data = array(
@@ -252,14 +252,14 @@  discard block
 block discarded – undo
252 252
 			);
253 253
 
254 254
 			// Set the term data to update
255
-			$post_data['tax_input'][ $tax ] = array( $terms[$index]->term_id );
255
+			$post_data['tax_input'][$tax] = array($terms[$index]->term_id);
256 256
 
257 257
 			// Update the post with the taxonomy info
258
-			$return = wp_update_post( $post_data );
258
+			$return = wp_update_post($post_data);
259 259
 
260 260
 			// Return the error if it exists
261
-			if ( is_wp_error( $return ) ){
262
-				error_log( $return->get_error_messages() );
261
+			if (is_wp_error($return)) {
262
+				error_log($return->get_error_messages());
263 263
 				return $return->get_error_messages();
264 264
 			}
265 265
 
@@ -273,20 +273,20 @@  discard block
 block discarded – undo
273 273
 	 *
274 274
 	 * @see Delete
275 275
 	 */
276
-	public function delete_all(){
276
+	public function delete_all() {
277 277
 
278
-		$delete =  new Delete;
278
+		$delete = new Delete;
279 279
 
280 280
 		// Make sure that the current user is logged in & has full permissions.
281
-		if ( ! $delete->user_can_delete() ){
281
+		if (!$delete->user_can_delete()) {
282 282
 			return;
283 283
 		}
284 284
 
285 285
 		// Loop through all post types and remove any test data
286
-		$post_types = get_post_types( array( 'public' => true ), 'objects' );
287
-		foreach ( $post_types as $post_type ) :
286
+		$post_types = get_post_types(array('public' => true), 'objects');
287
+		foreach ($post_types as $post_type) :
288 288
 
289
-		    return $this->delete( $post_type->name );
289
+		    return $this->delete($post_type->name);
290 290
 
291 291
 		endforeach;
292 292
 
@@ -304,17 +304,17 @@  discard block
 block discarded – undo
304 304
 	 *
305 305
 	 * @param string $slug a custom post type ID.
306 306
 	 */
307
-	public function delete( $slug ){
307
+	public function delete($slug) {
308 308
 
309
-		$delete =  new Delete;
309
+		$delete = new Delete;
310 310
 
311 311
 		// Make sure that the current user is logged in & has full permissions.
312
-		if ( ! $delete->user_can_delete() ){
312
+		if (!$delete->user_can_delete()) {
313 313
 			return;
314 314
 		}
315 315
 
316 316
 		// Check that $cptslg has a string.
317
-		if ( empty( $slug ) ){
317
+		if (empty($slug)) {
318 318
 			return;
319 319
 		}
320 320
 
@@ -337,39 +337,39 @@  discard block
 block discarded – undo
337 337
 			),
338 338
 		);
339 339
 
340
-		$objects = new \WP_Query( $query );
340
+		$objects = new \WP_Query($query);
341 341
 
342
-		if ( $objects->have_posts() ){
342
+		if ($objects->have_posts()) {
343 343
 
344 344
 			$events = array();
345 345
 
346
-			while ( $objects->have_posts() ) : $objects->the_post();
346
+			while ($objects->have_posts()) : $objects->the_post();
347 347
 
348 348
 				// Find any media associated with the test post and delete it as well
349
-				$this->delete_associated_media( get_the_id() );
349
+				$this->delete_associated_media(get_the_id());
350 350
 
351 351
 				// Double check our set user meta value
352
-				if ( '__test__' != get_post_meta( get_the_id(), 'dummypress_test_data', true ) && '__test__' != get_post_meta( get_the_id(), 'evans_test_content', true ) ){
352
+				if ('__test__' != get_post_meta(get_the_id(), 'dummypress_test_data', true) && '__test__' != get_post_meta(get_the_id(), 'evans_test_content', true)) {
353 353
 					continue;
354 354
 				}
355 355
 
356 356
 				$events[] = array(
357 357
 					'action'	=> 'deleted',
358 358
 					'oid'		=> get_the_id(),
359
-					'type'		=> get_post_type( get_the_id() ),
359
+					'type'		=> get_post_type(get_the_id()),
360 360
 					'link'		=> ''
361 361
 				);
362 362
 
363 363
 				// Force delete the post
364
-				wp_delete_post( get_the_id(), true );
364
+				wp_delete_post(get_the_id(), true);
365 365
 
366 366
 			endwhile;
367 367
 
368
-			$obj = get_post_type_object( $slug );
368
+			$obj = get_post_type_object($slug);
369 369
 
370 370
 			$events[] = array(
371 371
 				'action'	=> 'general',
372
-				'message'	=> __( 'Deleted', 'dummybot' ) . ' ' . $obj->labels->all_items
372
+				'message'	=> __('Deleted', 'dummybot') . ' ' . $obj->labels->all_items
373 373
 			);
374 374
 
375 375
 			return $events;
@@ -392,28 +392,28 @@  discard block
 block discarded – undo
392 392
 	 *
393 393
 	 * @param int $pid a custom post type ID.
394 394
 	 */
395
-	private function delete_associated_media( $pid ){
395
+	private function delete_associated_media($pid) {
396 396
 
397
-		$delete =  new Delete;
397
+		$delete = new Delete;
398 398
 
399 399
 		// Make sure that the current user is logged in & has full permissions.
400
-		if ( !$delete->user_can_delete() ){
400
+		if (!$delete->user_can_delete()) {
401 401
 			return;
402 402
 		}
403 403
 
404 404
 		// Make sure $pid is, in fact, an ID
405
-		if ( !is_int( $pid ) ){
405
+		if (!is_int($pid)) {
406 406
 			return;
407 407
 		}
408 408
 
409 409
 		// Get our images
410
-		$media = get_attached_media( 'image', $pid );
410
+		$media = get_attached_media('image', $pid);
411 411
 
412
-		if ( !empty( $media ) ){
412
+		if (!empty($media)) {
413 413
 
414 414
 			// Loop through the media & delete each one
415
-			foreach ( $media as $attachment ){
416
-				wp_delete_attachment( $attachment->ID, true );
415
+			foreach ($media as $attachment) {
416
+				wp_delete_attachment($attachment->ID, true);
417 417
 			}
418 418
 
419 419
 		}
Please login to merge, or discard this patch.
uninstall.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,12 +4,12 @@
 block discarded – undo
4 4
 
5 5
 // If uninstall is not called from WordPress, exit
6 6
 if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
7
-    exit();
7
+	exit();
8 8
 }
9 9
 
10 10
 // Check if the current user has priveledges to run this method
11 11
 if ( ! current_user_can( 'activate_plugins' ) ){
12
-    return;
12
+	return;
13 13
 }
14 14
 
15 15
 require dirname( __FILE__ ) . '/includes/class-delete.php';
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,16 +3,16 @@
 block discarded – undo
3 3
 use DummyPress as test;
4 4
 
5 5
 // If uninstall is not called from WordPress, exit
6
-if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
6
+if (!defined('WP_UNINSTALL_PLUGIN')) {
7 7
     exit();
8 8
 }
9 9
 
10 10
 // Check if the current user has priveledges to run this method
11
-if ( ! current_user_can( 'activate_plugins' ) ){
11
+if (!current_user_can('activate_plugins')) {
12 12
     return;
13 13
 }
14 14
 
15
-require dirname( __FILE__ ) . '/includes/class-delete.php';
15
+require dirname(__FILE__) . '/includes/class-delete.php';
16 16
 $delete = new test\Delete;
17 17
 
18 18
 // Delete all the things
Please login to merge, or discard this patch.
abstracts/type.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @subpackage Test Content
10 10
  * @author     Old Town Media
11 11
  */
12
-abstract class Type{
12
+abstract class Type {
13 13
 
14 14
 	/**
15 15
 	 * type
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
 	/**
34 34
 	 * Registers the type with the rest of the plugin
35 35
 	 */
36
-	public function register_type(){
36
+	public function register_type() {
37 37
 
38
-		add_filter( 'tc-types', array( $this, 'set_type' ) );
38
+		add_filter('tc-types', array($this, 'set_type'));
39 39
 
40 40
 	}
41 41
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * @param array $types Original types array
47 47
 	 * @return array Modified types array with our current type
48 48
 	 */
49
-	public function set_type( $types ){
49
+	public function set_type($types) {
50 50
 
51 51
 		$types[] = $this->type;
52 52
 		return $types;
Please login to merge, or discard this patch.
abstracts/view.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @subpackage Test Content
11 11
  * @author     Old Town Media
12 12
  */
13
-abstract class View{
13
+abstract class View {
14 14
 
15 15
 	/**
16 16
 	 * title
@@ -44,10 +44,10 @@  discard block
 block discarded – undo
44 44
 	 *
45 45
 	 * @see tab, view
46 46
 	 */
47
-	public function register_view(){
47
+	public function register_view() {
48 48
 
49
-		add_action( 'tc-admin-tabs', array( $this, 'tab' ), $this->priority );
50
-		add_action( 'tc-admin-sections', array( $this, 'view' ), $this->priority );
49
+		add_action('tc-admin-tabs', array($this, 'tab'), $this->priority);
50
+		add_action('tc-admin-sections', array($this, 'view'), $this->priority);
51 51
 
52 52
 	}
53 53
 
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 	 * Each view has a tab and tab navigation - this function compiles our
59 59
 	 * navigation tab. Rarely extended.
60 60
 	 */
61
-	public function tab(){
61
+	public function tab() {
62 62
 		$html = "";
63 63
 
64
-		$html .= "<a class='nav-tab' data-type='".sanitize_title( $this->title )."' href='javascript:void(0)'>";
64
+		$html .= "<a class='nav-tab' data-type='" . sanitize_title($this->title) . "' href='javascript:void(0)'>";
65 65
 			$html .= $this->title;
66 66
 		$html .= "</a>";
67 67
 
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
 	 *
79 79
 	 * @see actions_section, options_section
80 80
 	 */
81
-	public function view(){
81
+	public function view() {
82 82
 		$html = '';
83 83
 
84
-		$html .= "<section class='test-content-tab' data-type='".sanitize_title( $this->title )."'>";
84
+		$html .= "<section class='test-content-tab' data-type='" . sanitize_title($this->title) . "'>";
85 85
 			$html .= $this->actions_section();
86 86
 			$html .= $this->options_section();
87 87
 		$html .= "</section>";
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @return string HTML content.
100 100
 	 */
101
-	protected function actions_section(){
101
+	protected function actions_section() {
102 102
 		$html = '';
103 103
 		return $html;
104 104
 	}
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
 	 * @param string $html Existing HTML content.
116 116
 	 * @return string HTML section content.
117 117
 	 */
118
-	protected function options_section( $html = '' ){
118
+	protected function options_section($html = '') {
119 119
 		$html .= "<hr>";
120 120
 
121 121
 		$html .= "<div class='test-data-cpt'>";
122 122
 			$html .= "<h3>";
123
-				$html .= "<span class='label'>".__( 'Quantity', 'dummybot' )."</span>";
124
-				$html .= "<input type='number' value='0' class='quantity-adjustment' for='".$this->type."' > ";
123
+				$html .= "<span class='label'>" . __('Quantity', 'dummybot') . "</span>";
124
+				$html .= "<input type='number' value='0' class='quantity-adjustment' for='" . $this->type . "' > ";
125 125
 			$html .= "</h3>";
126 126
 		$html .= "</div>";
127 127
 
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
 	 * @param string $text Text to display in the button.
140 140
 	 * @return string HTML.
141 141
 	 */
142
-	protected function build_button( $action, $slug, $text ){
142
+	protected function build_button($action, $slug, $text) {
143 143
 		$html = $dashicon = '';
144 144
 
145
-		if ( $action == 'create' ){
145
+		if ($action == 'create') {
146 146
 			$dashicon = 'dashicons-plus';
147
-		} elseif ( $action == 'delete' ){
147
+		} elseif ($action == 'delete') {
148 148
 			$dashicon = 'dashicons-trash';
149 149
 		}
150 150
 
Please login to merge, or discard this patch.
views/posts.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  * @subpackage Test Content
11 11
  * @author     Old Town Media
12 12
  */
13
-class Posts extends Abs\View{
13
+class Posts extends Abs\View {
14 14
 
15
-	public function __construct(){
15
+	public function __construct() {
16 16
 
17
-		$this->title	= __( 'Posts', 'dummybot' );
17
+		$this->title	= __('Posts', 'dummybot');
18 18
 		$this->type		= 'post';
19
-		$this->priority	= 1;
19
+		$this->priority = 1;
20 20
 
21 21
 	}
22 22
 
@@ -27,20 +27,20 @@  discard block
 block discarded – undo
27 27
 	 *
28 28
 	 * @return string HTML content.
29 29
 	 */
30
-	protected function actions_section(){
30
+	protected function actions_section() {
31 31
 		$html = '';
32 32
 
33 33
 		// Loop through every post type available on the site
34
-		$post_types = get_post_types( array( 'public' => true ), 'objects' );
34
+		$post_types = get_post_types(array('public' => true), 'objects');
35 35
 
36
-		foreach ( $post_types as $post_type ) :
36
+		foreach ($post_types as $post_type) :
37 37
 
38 38
 			$skipped_cpts = array(
39 39
 				'attachment'
40 40
 			);
41 41
 
42 42
 			// Skip banned cpts
43
-			if ( in_array( $post_type->name, $skipped_cpts ) ){
43
+			if (in_array($post_type->name, $skipped_cpts)) {
44 44
 				continue;
45 45
 			}
46 46
 
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 				$html .= "<h3>";
50 50
 
51 51
 					$html .= "<span class='label'>" . $post_type->labels->name . "</span>";
52
-					$html .= $this->build_button( 'create', $post_type->name, __( 'Create Test Data', 'dummybot' ) );
53
-					$html .= $this->build_button( 'delete', $post_type->name, __( 'Delete Test Data', 'dummybot' ) );
52
+					$html .= $this->build_button('create', $post_type->name, __('Create Test Data', 'dummybot'));
53
+					$html .= $this->build_button('delete', $post_type->name, __('Delete Test Data', 'dummybot'));
54 54
 
55 55
 				$html .= "</h3>";
56 56
 
Please login to merge, or discard this patch.
views/terms.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  * @subpackage Test Content
11 11
  * @author     Old Town Media
12 12
  */
13
-class Terms extends Abs\View{
13
+class Terms extends Abs\View {
14 14
 
15
-	public function __construct(){
15
+	public function __construct() {
16 16
 
17
-		$this->title	= __( 'Terms', 'dummybot' );
17
+		$this->title	= __('Terms', 'dummybot');
18 18
 		$this->type		= 'term';
19
-		$this->priority	= 2;
19
+		$this->priority = 2;
20 20
 
21 21
 	}
22 22
 
@@ -28,34 +28,34 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @return string HTML content.
30 30
 	 */
31
-	protected function actions_section(){
31
+	protected function actions_section() {
32 32
 		$html = '';
33 33
 
34 34
 		$taxonomies = get_taxonomies();
35 35
 
36
-		foreach ( $taxonomies as $tax ) :
36
+		foreach ($taxonomies as $tax) :
37 37
 
38 38
 			$skipped_taxonomies = array(
39
-				'post_format',				// We shouldn't be making random post format classes
40
-				'product_shipping_class',	// These aren't used visually and are therefore skipped
41
-				'nav_menu',					// Menus are handled seperately of taxonomies
39
+				'post_format', // We shouldn't be making random post format classes
40
+				'product_shipping_class', // These aren't used visually and are therefore skipped
41
+				'nav_menu', // Menus are handled seperately of taxonomies
42 42
 			);
43 43
 
44 44
 			// Skip banned taxonomies
45
-			if ( in_array( $tax, $skipped_taxonomies ) ){
45
+			if (in_array($tax, $skipped_taxonomies)) {
46 46
 				continue;
47 47
 			}
48 48
 
49
-			$taxonomy = get_taxonomy( $tax );
49
+			$taxonomy = get_taxonomy($tax);
50 50
 
51 51
 			$html .= "<div class='test-data-cpt'>";
52 52
 
53 53
 				$html .= "<h3>";
54 54
 
55
-				$html .= "<span class='label'>".$taxonomy->labels->name."</span>";
55
+				$html .= "<span class='label'>" . $taxonomy->labels->name . "</span>";
56 56
 
57
-				$html .= $this->build_button( 'create', $tax, __( 'Create', 'dummybot' )." ".$taxonomy->labels->name );
58
-				$html .= $this->build_button( 'delete', $tax, __( 'Delete', 'dummybot' )." ".$taxonomy->labels->name );
57
+				$html .= $this->build_button('create', $tax, __('Create', 'dummybot') . " " . $taxonomy->labels->name);
58
+				$html .= $this->build_button('delete', $tax, __('Delete', 'dummybot') . " " . $taxonomy->labels->name);
59 59
 
60 60
 				$html .= "</h3>";
61 61
 
Please login to merge, or discard this patch.
views/users.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
  * @subpackage Test Content
12 12
  * @author     Old Town Media
13 13
  */
14
-class Users extends Abs\View{
14
+class Users extends Abs\View {
15 15
 
16
-	public function __construct(){
16
+	public function __construct() {
17 17
 
18
-		$this->title	= __( 'Users', 'dummybot' );
18
+		$this->title	= __('Users', 'dummybot');
19 19
 		$this->type		= 'user';
20
-		$this->priority	= 4;
20
+		$this->priority = 4;
21 21
 
22 22
 	}
23 23
 
@@ -28,21 +28,21 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @return string HTML content.
30 30
 	 */
31
-	protected function actions_section(){
31
+	protected function actions_section() {
32 32
 		$html = '';
33 33
 
34 34
 		$user_class = new Type\User;
35 35
 		$roles = $user_class->get_roles();
36 36
 
37
-		foreach ( $roles as $role ) :
37
+		foreach ($roles as $role) :
38 38
 
39 39
 			$html .= "<div class='test-data-cpt'>";
40 40
 
41 41
 				$html .= "<h3>";
42 42
 
43 43
 					$html .= "<span class='label'>" . $role['name'] . "</span>";
44
-					$html .= $this->build_button( 'create', $role['slug'], __( 'Create Users', 'dummybot' ) );
45
-					$html .= $this->build_button( 'delete', $role['slug'], __( 'Delete Users', 'dummybot' ) );
44
+					$html .= $this->build_button('create', $role['slug'], __('Create Users', 'dummybot'));
45
+					$html .= $this->build_button('delete', $role['slug'], __('Delete Users', 'dummybot'));
46 46
 
47 47
 				$html .= "</h3>";
48 48
 
Please login to merge, or discard this patch.
views/various.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -10,13 +10,13 @@  discard block
 block discarded – undo
10 10
  * @subpackage Test Content
11 11
  * @author     Old Town Media
12 12
  */
13
-class Various extends Abs\View{
13
+class Various extends Abs\View {
14 14
 
15
-	public function __construct(){
15
+	public function __construct() {
16 16
 
17
-		$this->title	= __( 'Various', 'dummybot' );
17
+		$this->title	= __('Various', 'dummybot');
18 18
 		$this->type		= 'all';
19
-		$this->priority	= 10;
19
+		$this->priority = 10;
20 20
 
21 21
 	}
22 22
 
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @return string HTML content.
30 30
 	 */
31
-	protected function actions_section(){
31
+	protected function actions_section() {
32 32
 		$html = '';
33 33
 
34 34
 		$html .= "<div class='test-data-cpt'>";
35 35
 
36 36
 			$html .= "<h3>";
37 37
 
38
-				$html .= "<span class='label'>" . __( 'Clean Site', 'dummybot' ) . "</span>";
39
-				$html .= $this->build_button( 'delete', 'all', __( 'Delete All Test Data', 'dummybot' ) );
38
+				$html .= "<span class='label'>" . __('Clean Site', 'dummybot') . "</span>";
39
+				$html .= $this->build_button('delete', 'all', __('Delete All Test Data', 'dummybot'));
40 40
 
41 41
 			$html .= "</h3>";
42 42
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @param string $html Existing HTML content.
55 55
 	 * @return string HTML section content.
56 56
 	 */
57
-	protected function options_section( $html = '' ){
57
+	protected function options_section($html = '') {
58 58
 		return $html;
59 59
 	}
60 60
 
Please login to merge, or discard this patch.