Completed
Push — master ( c6a753...e758eb )
by Mike
02:16
created
includes/class-admin-page.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -89,8 +89,8 @@
 block discarded – undo
89 89
 		} else {
90 90
 			// We didn't get a reponse so print the notice out
91 91
 			echo '<div class="notice notice-error is-dismissible">';
92
-		        echo '<p>'.__( 'WordPress could not connect to Splashbase and therefore images will not pull into metaboxes/thumbnails. Turn Airplane Mode off or reconnect to the Internet to get images when creating test data.', 'otm-test-content' ).'</p>';
93
-		    echo '</div>';
92
+				echo '<p>'.__( 'WordPress could not connect to Splashbase and therefore images will not pull into metaboxes/thumbnails. Turn Airplane Mode off or reconnect to the Internet to get images when creating test data.', 'otm-test-content' ).'</p>';
93
+			echo '</div>';
94 94
 		}
95 95
 
96 96
 	}
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @subpackage Evans
9 9
  * @author     Old Town Media
10 10
  */
11
-class AdminPage{
11
+class AdminPage {
12 12
 
13 13
 	/**
14 14
 	 * plugin
@@ -45,16 +45,16 @@  discard block
 block discarded – undo
45 45
 	 *
46 46
 	 * @see admin_menu, wp_ajax actions
47 47
 	 */
48
-	public function hooks(){
48
+	public function hooks() {
49 49
 
50 50
 		$connection = new ConnectionTest;
51
-		$this->definitions	= $this->plugin->get_definitions();
52
-		$this->connected	= $connection->test();
51
+		$this->definitions = $this->plugin->get_definitions();
52
+		$this->connected = $connection->test();
53 53
 
54
-		add_action( 'admin_menu' , array( $this, 'add_menu_item' ) );
55
-		add_action( 'wp_ajax_handle_test_data', array( $this, 'handle_test_data_callback' ) );
56
-		add_filter( 'plugin_action_links_' . $this->definitions->basename , array( $this, 'add_settings_link' ) );
57
-		add_action( 'admin_notices', array( $this, 'internet_connected_admin_notice' ) );
54
+		add_action('admin_menu', array($this, 'add_menu_item'));
55
+		add_action('wp_ajax_handle_test_data', array($this, 'handle_test_data_callback'));
56
+		add_filter('plugin_action_links_'.$this->definitions->basename, array($this, 'add_settings_link'));
57
+		add_action('admin_notices', array($this, 'internet_connected_admin_notice'));
58 58
 
59 59
 	}
60 60
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @param Plugin $plugin Main plugin instance.
66 66
 	 */
67
-	public function set_plugin( $plugin ) {
67
+	public function set_plugin($plugin) {
68 68
 
69 69
 		$this->plugin = $plugin;
70 70
 		return $this;
@@ -81,14 +81,14 @@  discard block
 block discarded – undo
81 81
 
82 82
 		$page = add_submenu_page(
83 83
 			'tools.php',
84
-			__( 'Create Test Content', 'otm-test-content' ),
85
-			__( 'Test Content', 'otm-test-content' ),
84
+			__('Create Test Content', 'otm-test-content'),
85
+			__('Test Content', 'otm-test-content'),
86 86
 			'manage_options',
87 87
 			'create-test-data',
88
-			array( $this, 'admin_page' )
88
+			array($this, 'admin_page')
89 89
 		);
90 90
 
91
-		add_action( 'admin_print_styles-' . $page, array( $this, 'load_scripts' ) );
91
+		add_action('admin_print_styles-'.$page, array($this, 'load_scripts'));
92 92
 
93 93
 	}
94 94
 
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
 	 * @param  array $links Existing links
99 99
 	 * @return array 		Modified links
100 100
 	 */
101
-	public function add_settings_link( $links ) {
101
+	public function add_settings_link($links) {
102 102
 
103
-		$settings_link = '<a href="tools.php?page=create-test-data">' . __( 'Build Test Content', 'otm-test-content' ) . '</a>';
104
-  		array_push( $links, $settings_link );
103
+		$settings_link = '<a href="tools.php?page=create-test-data">'.__('Build Test Content', 'otm-test-content').'</a>';
104
+  		array_push($links, $settings_link);
105 105
   		return $links;
106 106
 
107 107
 	}
@@ -114,24 +114,24 @@  discard block
 block discarded – undo
114 114
 	 * Internet, and the test fails displays a notice informing the user that
115 115
 	 * images will not pull into test data.
116 116
 	 */
117
-	public function internet_connected_admin_notice(){
117
+	public function internet_connected_admin_notice() {
118 118
 
119 119
 		// Get the current admin screen & verify that we're on the right one
120 120
 		// before continuing.
121 121
 		$screen = get_current_screen();
122 122
 
123
-		if ( $screen->base != 'tools_page_create-test-data' ){
123
+		if ($screen->base != 'tools_page_create-test-data') {
124 124
 			return;
125 125
 		}
126 126
 
127 127
 		// Check the response
128
-		if ( $this->connected ) {
128
+		if ($this->connected) {
129 129
 			// We got a response so early return
130 130
 			return;
131 131
 		} else {
132 132
 			// We didn't get a reponse so print the notice out
133 133
 			echo '<div class="notice notice-error">';
134
-		        echo '<p>'.__( 'WordPress could not connect to Splashbase and therefore images will not pull into metaboxes/thumbnails. Turn Airplane Mode off or reconnect to the Internet to get images when creating test data.', 'otm-test-content' ).'</p>';
134
+		        echo '<p>'.__('WordPress could not connect to Splashbase and therefore images will not pull into metaboxes/thumbnails. Turn Airplane Mode off or reconnect to the Internet to get images when creating test data.', 'otm-test-content').'</p>';
135 135
 		    echo '</div>';
136 136
 		}
137 137
 
@@ -141,19 +141,19 @@  discard block
 block discarded – undo
141 141
 	/**
142 142
 	 * Load our script in the admin section and serve in data.
143 143
 	 */
144
-	public function load_scripts(){
144
+	public function load_scripts() {
145 145
 
146
-		wp_enqueue_script( 'test-content-js', plugins_url( 'assets/admin.js' , dirname( __FILE__ ) ) );
147
-		wp_enqueue_style( 'test-content-css', plugins_url( 'assets/admin.css' , dirname( __FILE__ ) ) );
146
+		wp_enqueue_script('test-content-js', plugins_url('assets/admin.js', dirname(__FILE__)));
147
+		wp_enqueue_style('test-content-css', plugins_url('assets/admin.css', dirname(__FILE__)));
148 148
 
149 149
 		$data = array(
150
-			'nonce'			=> wp_create_nonce( 'handle-test-data' ),
151
-			'createdStr'	=> __( 'Created', 'otm-test-content' ),
152
-			'deletedStr'	=> __( 'Deleting', 'otm-test-content' ),
153
-			'creatingStr'	=> __( 'Creating', 'otm-test-content' ),
150
+			'nonce'			=> wp_create_nonce('handle-test-data'),
151
+			'createdStr'	=> __('Created', 'otm-test-content'),
152
+			'deletedStr'	=> __('Deleting', 'otm-test-content'),
153
+			'creatingStr'	=> __('Creating', 'otm-test-content'),
154 154
 		);
155 155
 
156
-		wp_localize_script( 'test-content-js', 'test_content', $data );
156
+		wp_localize_script('test-content-js', 'test_content', $data);
157 157
 
158 158
 	}
159 159
 
@@ -165,21 +165,21 @@  discard block
 block discarded – undo
165 165
 	 */
166 166
 	public function handle_test_data_callback() {
167 167
 
168
-		$action		= $_REQUEST['todo'];
169
-		$nonce		= $_REQUEST['nonce'];
168
+		$action = $_REQUEST['todo'];
169
+		$nonce = $_REQUEST['nonce'];
170 170
 
171 171
 		// Verify that we have a proper logged in user and it's the right person
172
-		if ( empty( $nonce ) || ! wp_verify_nonce( $nonce, 'handle-test-data' ) ){
172
+		if (empty($nonce) || !wp_verify_nonce($nonce, 'handle-test-data')) {
173 173
 			return;
174 174
 		}
175 175
 
176
-		if ( $action == 'delete' ){
176
+		if ($action == 'delete') {
177 177
 
178
-			$this->deletion_routing( $_REQUEST );
178
+			$this->deletion_routing($_REQUEST);
179 179
 
180
-		} elseif ( $action == 'create' ){
180
+		} elseif ($action == 'create') {
181 181
 
182
-			$this->creation_routing( $_REQUEST );
182
+			$this->creation_routing($_REQUEST);
183 183
 
184 184
 		}
185 185
 
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
 	 * Choose which type of creation needs to be accomplished and route through
193 193
 	 * the correct class.
194 194
 	 */
195
-	private function creation_routing( $data ){
195
+	private function creation_routing($data) {
196 196
 
197
-		$type = 'testContent\Types\\' . ucwords( $data['type'] );
197
+		$type = 'testContent\Types\\'.ucwords($data['type']);
198 198
 		$object = new $type();
199
-		$object->create_objects( $data['slug'], $data['connection'], true, 1 );
199
+		$object->create_objects($data['slug'], $data['connection'], true, 1);
200 200
 
201 201
 	}
202 202
 
@@ -205,17 +205,17 @@  discard block
 block discarded – undo
205 205
 	 * Choose which type of deletion needs to be accomplished and route through
206 206
 	 * the correct method of Delete.
207 207
 	 */
208
-	private function deletion_routing( $data ){
208
+	private function deletion_routing($data) {
209 209
 
210 210
 		$delete_content = new Delete;
211 211
 
212
-		if ( $data['type'] == 'all' ){
212
+		if ($data['type'] == 'all') {
213 213
 
214
-			$delete_content->delete_all_test_data( true );
214
+			$delete_content->delete_all_test_data(true);
215 215
 
216 216
 		} else {
217 217
 
218
-			$delete_content->delete_objects( true, $data );
218
+			$delete_content->delete_objects(true, $data);
219 219
 
220 220
 		}
221 221
 
@@ -225,20 +225,20 @@  discard block
 block discarded – undo
225 225
 	/**
226 226
 	 * Print out our admin page to control test data.
227 227
 	 */
228
-	public function admin_page(){
229
-		echo '<div class="wrap" id="options_editor">' . "\n";
228
+	public function admin_page() {
229
+		echo '<div class="wrap" id="options_editor">'."\n";
230 230
 
231
-			echo '<h2>' . __( 'Create Test Data' , 'otm-test-content' ) . '</h2>' . "\n";
231
+			echo '<h2>'.__('Create Test Data', 'otm-test-content').'</h2>'."\n";
232 232
 
233 233
 			echo "<div class='nav-tab-wrapper'>";
234 234
 
235
-				do_action( 'tc-admin-tabs', '' );
235
+				do_action('tc-admin-tabs', '');
236 236
 
237 237
 			echo "</div>";
238 238
 
239 239
 			echo "";
240 240
 
241
-				do_action( 'tc-admin-sections', '' );
241
+				do_action('tc-admin-sections', '');
242 242
 
243 243
 			echo "";
244 244
 
Please login to merge, or discard this patch.
includes/class-plugin.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
 	 * @see load_plugin_textdomain
66 66
 	 */
67 67
 	public function load_textdomain() {
68
-	    load_plugin_textdomain( 'otm-test-content', FALSE, basename( dirname( $this->definitions->file ) ) . '/languages/' );
68
+		load_plugin_textdomain( 'otm-test-content', FALSE, basename( dirname( $this->definitions->file ) ) . '/languages/' );
69 69
 	}
70 70
 
71 71
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @subpackage Evans
9 9
  * @author     Old Town Media
10 10
  */
11
-class Plugin{
11
+class Plugin {
12 12
 
13 13
 	/**
14 14
 	 * Plugin definitions.
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @param  object $definitions Information about the plugin
35 35
 	 * @return object $this
36 36
 	 */
37
-	public function set_definitions( $definitions ) {
37
+	public function set_definitions($definitions) {
38 38
 
39 39
 		$this->definitions = $definitions;
40 40
 		return $this;
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
 	 * @param  object $provider Hook provider.
49 49
 	 * @return object $this
50 50
 	 */
51
-	public function register_hooks( $provider ) {
51
+	public function register_hooks($provider) {
52 52
 
53
-		if ( method_exists( $provider, 'set_plugin' ) ) {
54
-			$provider->set_plugin( $this );
53
+		if (method_exists($provider, 'set_plugin')) {
54
+			$provider->set_plugin($this);
55 55
 		}
56 56
 
57 57
 		$provider->hooks();
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 * @param  object $provider Hook provider.
67 67
 	 * @return object $this
68 68
 	 */
69
-	public function register_views( $provider ) {
69
+	public function register_views($provider) {
70 70
 
71 71
 		$provider->register_view();
72 72
 		return $this;
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @see load_plugin_textdomain
81 81
 	 */
82 82
 	public function load_textdomain() {
83
-	    load_plugin_textdomain( 'otm-test-content', FALSE, basename( dirname( $this->definitions->file ) ) . '/languages/' );
83
+	    load_plugin_textdomain('otm-test-content', FALSE, basename(dirname($this->definitions->file)).'/languages/');
84 84
 	}
85 85
 
86 86
 }
Please login to merge, or discard this patch.
includes/class-connection-test.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  * @subpackage Evans
18 18
  * @author     Old Town Media
19 19
  */
20
-class ConnectionTest{
20
+class ConnectionTest {
21 21
 
22 22
 	/**
23 23
 	 * Run all of our connection tests.
@@ -26,33 +26,33 @@  discard block
 block discarded – undo
26 26
 	 *
27 27
 	 * @return boolean Status of connection to Internet/Splashbase.
28 28
 	 */
29
-	public function test(){
29
+	public function test() {
30 30
 
31 31
 		/*
32 32
 		 * Make sure that we're looking at the correct admin page
33 33
 		 */
34
-		if ( ! $this->check_admin_page() ){
34
+		if (!$this->check_admin_page()) {
35 35
 			return;
36 36
 		}
37 37
 
38 38
 		/*
39 39
 		 * Test #1 - Check for Airplane Mode plugin status
40 40
 		 */
41
-		if ( ! $this->check_airplane_mode() ){
41
+		if (!$this->check_airplane_mode()) {
42 42
 			return false;
43 43
 		}
44 44
 
45 45
 		/*
46 46
 		 * Test #2 - Check Internet connection in general
47 47
 		 */
48
-		if ( ! $this->check_internet() ){
48
+		if (!$this->check_internet()) {
49 49
 			return false;
50 50
 		}
51 51
 
52 52
 		/*
53 53
 		 * Test #3 - Check External URL itself (Splashbase here)
54 54
 		 */
55
-		if ( ! $this->check_external_url( 'http://www.splashbase.co/api/v1/images/' ) ){
55
+		if (!$this->check_external_url('http://www.splashbase.co/api/v1/images/')) {
56 56
 			return false;
57 57
 		}
58 58
 
@@ -75,22 +75,22 @@  discard block
 block discarded – undo
75 75
 	 *
76 76
 	 * @return boolean Whether or not we're in the right place.
77 77
 	 */
78
-	private function check_admin_page(){
78
+	private function check_admin_page() {
79 79
 		global $current_screen;
80 80
 
81 81
 		// Only run if we're in the admin page
82
-		if ( !is_admin() ){
82
+		if (!is_admin()) {
83 83
 			return false;
84 84
 		}
85 85
 
86 86
 		// Get the current admin screen & verify that we're on the right one
87 87
 		// before continuing.
88
-		if ( isset ( $current_screen ) && 'tools_page_create-test-data' != $current_screen->base ){
88
+		if (isset ($current_screen) && 'tools_page_create-test-data' != $current_screen->base) {
89 89
 			return false;
90 90
 		}
91 91
 
92
-		$last_uri_bit = explode( '=', $_SERVER['REQUEST_URI'] );
93
-		if ( 'create-test-data' != end( $last_uri_bit ) ){
92
+		$last_uri_bit = explode('=', $_SERVER['REQUEST_URI']);
93
+		if ('create-test-data' != end($last_uri_bit)) {
94 94
 			return false;
95 95
 		}
96 96
 
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @return boolean Connected or not.
110 110
 	 */
111
-	private function check_airplane_mode(){
111
+	private function check_airplane_mode() {
112 112
 
113
-		if ( class_exists( 'Airplane_Mode_Core' ) ){
113
+		if (class_exists('Airplane_Mode_Core')) {
114 114
 			// Is airplane mode active?
115
-			$airplane_mode = get_site_option( 'airplane-mode' );
115
+			$airplane_mode = get_site_option('airplane-mode');
116 116
 
117
-			if ( $airplane_mode === 'on' ){
117
+			if ($airplane_mode === 'on') {
118 118
 				return false;
119 119
 			}
120 120
 		}
@@ -133,17 +133,17 @@  discard block
 block discarded – undo
133 133
 	 *
134 134
 	 * @return boolean Connected or not.
135 135
 	 */
136
-	private function check_internet(){
136
+	private function check_internet() {
137 137
 
138 138
 		// Attempt to open a socket connection to Google
139
-		$connected = @fsockopen( "www.google.com", 80 );
139
+		$connected = @fsockopen("www.google.com", 80);
140 140
 
141
-		if ( !$connected ){
141
+		if (!$connected) {
142 142
 			return false;
143 143
 		}
144 144
 
145 145
 		// Close out our 1st test
146
-		fclose( $connected );
146
+		fclose($connected);
147 147
 
148 148
 		return true;
149 149
 
@@ -160,12 +160,12 @@  discard block
 block discarded – undo
160 160
 	 * @param string $url External URL to attempt to reach.
161 161
 	 * @return boolean Connected or not.
162 162
 	 */
163
-	private function check_external_url( $url ){
163
+	private function check_external_url($url) {
164 164
 
165
-		$test_url = esc_url( $url );
166
-		$response = wp_remote_get( $test_url );
165
+		$test_url = esc_url($url);
166
+		$response = wp_remote_get($test_url);
167 167
 
168
-		if ( !is_array( $response ) ){
168
+		if (!is_array($response)) {
169 169
 			return false;
170 170
 		}
171 171
 
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 testContent 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.
includes/class-metaboxes.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -47,6 +47,9 @@
 block discarded – undo
47 47
 	}
48 48
 
49 49
 
50
+	/**
51
+	 * @param string $slug
52
+	 */
50 53
 	private function get_acf_free_metaboxes( $slug ){
51 54
 
52 55
 		// This damn plugin. Is. A. Freaking. Nightmare.
Please login to merge, or discard this patch.
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @subpackage Evans
9 9
  * @author     Old Town Media
10 10
  */
11
-class Metaboxes{
11
+class Metaboxes {
12 12
 
13 13
 	/**
14 14
 	 * Decide which cmb library to try and loop to get our metaboxes.
@@ -22,23 +22,23 @@  discard block
 block discarded – undo
22 22
 	 * @param string $slug Post Type slug ID.
23 23
 	 * @return array Fields to fill in for our post object.
24 24
 	 */
25
-	public function get_metaboxes( $slug ){
25
+	public function get_metaboxes($slug) {
26 26
 
27 27
 		$fields = array();
28 28
 
29 29
 		// CMB2
30
-		if ( class_exists( 'CMB2', false ) ) {
31
-			$fields = $this->get_cmb2_metaboxes( $slug );
30
+		if (class_exists('CMB2', false)) {
31
+			$fields = $this->get_cmb2_metaboxes($slug);
32 32
 		}
33 33
 
34 34
 		// Custom Metaboxes and Fields (CMB1)
35
-		if ( class_exists( 'cmb_Meta_Box', false ) ) {
36
-			$fields = $this->get_cmb1_metaboxes( $slug );
35
+		if (class_exists('cmb_Meta_Box', false)) {
36
+			$fields = $this->get_cmb1_metaboxes($slug);
37 37
 		}
38 38
 
39 39
 		// Advanced Custom Fields (ACF Free)
40
-		if ( class_exists( 'acf', false ) ) {
41
-			$fields = $this->get_acf_free_metaboxes( $slug );
40
+		if (class_exists('acf', false)) {
41
+			$fields = $this->get_acf_free_metaboxes($slug);
42 42
 		}
43 43
 
44 44
 		// Return our array
@@ -47,25 +47,25 @@  discard block
 block discarded – undo
47 47
 	}
48 48
 
49 49
 
50
-	private function get_acf_free_metaboxes( $slug ){
50
+	private function get_acf_free_metaboxes($slug) {
51 51
 
52 52
 		// This damn plugin. Is. A. Freaking. Nightmare.
53 53
 		$fieldsets = $this->get_all_acf_field_groups();
54 54
 
55
-		if ( empty( $fieldsets ) ){
55
+		if (empty($fieldsets)) {
56 56
 			return true;
57 57
 		}
58 58
 
59
-		foreach ( $fieldsets as $fieldset ){
59
+		foreach ($fieldsets as $fieldset) {
60 60
 
61
-			if ( $this->is_acf_field_in_post_type( $slug, $fieldset ) ){
61
+			if ($this->is_acf_field_in_post_type($slug, $fieldset)) {
62 62
 
63 63
 				// If this is the first group of fields, simply set the value
64 64
 				// Else, merge this group with the previous one
65
-				if ( empty( $fields ) ){
65
+				if (empty($fields)) {
66 66
 					$fields = $fieldset->fields;
67 67
 				} else {
68
-					$fields = array_merge( $fields, $fieldset->fields );
68
+					$fields = array_merge($fields, $fieldset->fields);
69 69
 				}
70 70
 
71 71
 			}
@@ -77,14 +77,14 @@  discard block
 block discarded – undo
77 77
 	}
78 78
 
79 79
 
80
-	private function is_acf_field_in_post_type( $slug, $fieldset ){
80
+	private function is_acf_field_in_post_type($slug, $fieldset) {
81 81
 
82
-		if ( empty( $fieldset ) ){
82
+		if (empty($fieldset)) {
83 83
 			return;
84 84
 		}
85 85
 
86
-		foreach ( $fieldset->rules as $rule ){
87
-			if ( $rule['param'] === 'post_type' && $rule['value'] === $slug ){
86
+		foreach ($fieldset->rules as $rule) {
87
+			if ($rule['param'] === 'post_type' && $rule['value'] === $slug) {
88 88
 				return true;
89 89
 			}
90 90
 		}
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	}
95 95
 
96 96
 
97
-	private function get_all_acf_field_groups(){
97
+	private function get_all_acf_field_groups() {
98 98
 		$info = $rules = $fields = array();
99 99
 
100 100
 		$args = array(
@@ -102,20 +102,20 @@  discard block
 block discarded – undo
102 102
 			'posts_per_page'=> 500
103 103
 		);
104 104
 
105
-		$objects = new \WP_Query( $args );
105
+		$objects = new \WP_Query($args);
106 106
 
107
-		if ( $objects->have_posts() ) :
108
-			while ( $objects->have_posts() ) : $objects->the_post();
107
+		if ($objects->have_posts()) :
108
+			while ($objects->have_posts()) : $objects->the_post();
109 109
 
110
-				$data = get_metadata( 'post', get_the_id() );
110
+				$data = get_metadata('post', get_the_id());
111 111
 
112
-				foreach ( $data['rule'] as $rule ){
113
-					$rules[] = unserialize( $rule );
112
+				foreach ($data['rule'] as $rule) {
113
+					$rules[] = unserialize($rule);
114 114
 				}
115 115
 
116
-				foreach ( $data as $key => $value ){
117
-					if ( substr( $key, 0, 6 ) == 'field_' ) :
118
-						$field_detail = unserialize( $value[0] );
116
+				foreach ($data as $key => $value) {
117
+					if (substr($key, 0, 6) == 'field_') :
118
+						$field_detail = unserialize($value[0]);
119 119
 						$fields[] = array(
120 120
 							'key'	 => $field_detail['key'],
121 121
 							'type'	 => $field_detail['type'],
@@ -153,55 +153,55 @@  discard block
 block discarded – undo
153 153
 	 * @param string $slug a custom post type ID.
154 154
 	 * @return array Array of fields.
155 155
 	 */
156
-	private function get_cmb2_metaboxes( $slug ){
156
+	private function get_cmb2_metaboxes($slug) {
157 157
 
158 158
 		$fields = array();
159 159
 
160 160
 		// Get all metaboxes from CMB2 library
161
-		$all_metaboxes = apply_filters( 'cmb2_meta_boxes', array() );
161
+		$all_metaboxes = apply_filters('cmb2_meta_boxes', array());
162 162
 
163 163
 		// Loop through all possible sets of metaboxes added the old way
164
-		foreach ( $all_metaboxes as $metabox_array ){
164
+		foreach ($all_metaboxes as $metabox_array) {
165 165
 
166 166
 			// If the custom post type ID matches this set of fields, set & stop
167
-			if ( in_array( $slug, $metabox_array['object_types'] ) ) {
167
+			if (in_array($slug, $metabox_array['object_types'])) {
168 168
 
169 169
 				// If this is the first group of fields, simply set the value
170 170
 				// Else, merge this group with the previous one
171
-				if ( empty( $fields ) ){
171
+				if (empty($fields)) {
172 172
 					$fields = $metabox_array['fields'];
173 173
 				} else {
174
-					$fields = array_merge( $fields, $metabox_array['fields'] );
174
+					$fields = array_merge($fields, $metabox_array['fields']);
175 175
 				}
176 176
 			}
177 177
 
178 178
 		}
179 179
 
180 180
 		// Loop through all metaboxes added the new way
181
-		foreach ( \CMB2_Boxes::get_all() as $cmb ) {
181
+		foreach (\CMB2_Boxes::get_all() as $cmb) {
182 182
 
183 183
 			// Create the default
184 184
 			$match = false;
185 185
 
186 186
 			// Establish correct cmb types
187
-			if ( is_string( $cmb->meta_box['object_types'] ) ){
188
-				if ( $cmb->meta_box['object_types'] == $slug ){
187
+			if (is_string($cmb->meta_box['object_types'])) {
188
+				if ($cmb->meta_box['object_types'] == $slug) {
189 189
 					$match = true;
190 190
 				}
191 191
 			} else {
192
-				if ( in_array( $slug, $cmb->meta_box['object_types'] ) ){
192
+				if (in_array($slug, $cmb->meta_box['object_types'])) {
193 193
 					$match = true;
194 194
 				}
195 195
 			}
196 196
 
197
-			if ( $match !== true ){
197
+			if ($match !== true) {
198 198
 				continue;
199 199
 			}
200 200
 
201
-			if ( empty( $fields ) ){
201
+			if (empty($fields)) {
202 202
 				$fields = $cmb->meta_box['fields'];
203 203
 			} else {
204
-				$fields = array_merge( $fields, $cmb->meta_box['fields'] );
204
+				$fields = array_merge($fields, $cmb->meta_box['fields']);
205 205
 			}
206 206
 
207 207
 		}
@@ -225,25 +225,25 @@  discard block
 block discarded – undo
225 225
 	 * @param string $slug a custom post type ID.
226 226
 	 * @return array Array of fields.
227 227
 	 */
228
-	private function get_cmb1_metaboxes( $slug ){
228
+	private function get_cmb1_metaboxes($slug) {
229 229
 
230 230
 		$fields = array();
231 231
 
232 232
 		// Get all metaboxes from CMB2 library
233
-		$all_metaboxes = apply_filters( 'cmb_meta_boxes', array() );
233
+		$all_metaboxes = apply_filters('cmb_meta_boxes', array());
234 234
 
235 235
 		// Loop through all possible sets of metaboxes
236
-		foreach ( $all_metaboxes as $metabox_array ){
236
+		foreach ($all_metaboxes as $metabox_array) {
237 237
 
238 238
 			// If the custom post type ID matches this set of fields, set & stop
239
-			if ( in_array( $slug, $metabox_array['pages'] ) ) {
239
+			if (in_array($slug, $metabox_array['pages'])) {
240 240
 
241 241
 				// If this is the first group of fields, simply set the value
242 242
 				// Else, merge this group with the previous one
243
-				if ( empty( $fields ) ){
243
+				if (empty($fields)) {
244 244
 					$fields = $metabox_array['fields'];
245 245
 				} else {
246
-					$fields = array_merge( $fields, $metabox_array['fields'] );
246
+					$fields = array_merge($fields, $metabox_array['fields']);
247 247
 				}
248 248
 			}
249 249
 
@@ -266,36 +266,36 @@  discard block
 block discarded – undo
266 266
 	 * @param int $post_id Single post ID.
267 267
 	 * @param array $cmb custom metabox array from CMB2.
268 268
 	 */
269
-	public function random_metabox_content( $post_id, $cmb, $connected ){
269
+	public function random_metabox_content($post_id, $cmb, $connected) {
270 270
 		$value = '';
271 271
 
272 272
 		// First check that our post ID & cmb array aren't empty
273
-		if ( empty( $cmb ) || empty( $post_id ) ){
273
+		if (empty($cmb) || empty($post_id)) {
274 274
 			return;
275 275
 		}
276 276
 
277 277
 		// Fetch the appropriate type of data and return
278
-		switch( $cmb['type'] ){
278
+		switch ($cmb['type']) {
279 279
 
280 280
 			case 'text':
281 281
 			case 'text_small':
282 282
 			case 'text_medium':
283 283
 
284 284
 				// If phone is in the id, fetch a phone #
285
-				if ( stripos( $cmb['id'], 'phone' ) ){
285
+				if (stripos($cmb['id'], 'phone')) {
286 286
 					$value = TestContent::phone();
287 287
 
288 288
 				// If email is in the id, fetch an email address
289
-				} elseif ( stripos( $cmb['id'], 'email' ) ){
289
+				} elseif (stripos($cmb['id'], 'email')) {
290 290
 					$value = TestContent::email();
291 291
 
292 292
 				// If time is in the id, fetch a time string
293
-				} elseif ( stripos( $cmb['id'], 'time' ) ){
293
+				} elseif (stripos($cmb['id'], 'time')) {
294 294
 					$value = TestContent::time();
295 295
 
296 296
 				// Otherwise, just a random text string
297 297
 				} else {
298
-					$value = TestContent::title( rand( 10, 50 ) );
298
+					$value = TestContent::title(rand(10, 50));
299 299
 				}
300 300
 
301 301
 				break;
@@ -326,14 +326,14 @@  discard block
 block discarded – undo
326 326
 
327 327
 			case 'text_date':
328 328
 
329
-				$value = TestContent::date( 'm/d/Y' );
329
+				$value = TestContent::date('m/d/Y');
330 330
 
331 331
 				break;
332 332
 
333 333
 			case 'text_date_timestamp':
334 334
 			case 'text_datetime_timestamp':
335 335
 
336
-				$value = TestContent::date( 'U' );
336
+				$value = TestContent::date('U');
337 337
 
338 338
 				break;
339 339
 
@@ -341,13 +341,13 @@  discard block
 block discarded – undo
341 341
 
342 342
 			case 'text_money':
343 343
 
344
-				$value = rand( 0, 100000 );
344
+				$value = rand(0, 100000);
345 345
 
346 346
 				break;
347 347
 
348 348
 			case 'test_colorpicker':
349 349
 
350
-				$value = '#' . str_pad( dechex( mt_rand( 0, 0xFFFFFF ) ), 6, '0', STR_PAD_LEFT );
350
+				$value = '#'.str_pad(dechex(mt_rand(0, 0xFFFFFF)), 6, '0', STR_PAD_LEFT);
351 351
 
352 352
 				break;
353 353
 
@@ -364,8 +364,8 @@  discard block
 block discarded – undo
364 364
 			case 'radio':
365 365
 
366 366
 				// Grab a random item out of the array and return the key
367
-				$new_val = array_slice( $cmb['options'], rand( 0, count( $cmb['options'] ) ), 1 );
368
-				$value = key( $new_val );
367
+				$new_val = array_slice($cmb['options'], rand(0, count($cmb['options'])), 1);
368
+				$value = key($new_val);
369 369
 
370 370
 				break;
371 371
 
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 			case 'checkbox':
377 377
 
378 378
 				// 50/50 odds of being turned on
379
-				if ( rand( 0, 1 ) == 1 ){
379
+				if (rand(0, 1) == 1) {
380 380
 					$value = 'on';
381 381
 				}
382 382
 
@@ -387,10 +387,10 @@  discard block
 block discarded – undo
387 387
 				$new_option = array();
388 388
 
389 389
 				// Loop through each of our options
390
-				foreach ( $cmb['options'] as $key => $value ){
390
+				foreach ($cmb['options'] as $key => $value) {
391 391
 
392 392
 					// 50/50 chance of being included
393
-					if ( rand( 0, 1 ) ){
393
+					if (rand(0, 1)) {
394 394
 						$new_option[] = $key;
395 395
 					}
396 396
 
@@ -408,8 +408,8 @@  discard block
 block discarded – undo
408 408
 
409 409
 			case 'file':
410 410
 
411
-				if ( true == $connected ){
412
-					$value = TestContent::image( $post_id );
411
+				if (true == $connected) {
412
+					$value = TestContent::image($post_id);
413 413
 				}
414 414
 
415 415
 				break;
@@ -425,29 +425,29 @@  discard block
 block discarded – undo
425 425
 		}
426 426
 
427 427
 		// Value must exist to attempt to insert
428
-		if ( !empty( $value ) && !is_wp_error( $value ) ){
428
+		if (!empty($value) && !is_wp_error($value)) {
429 429
 
430 430
 			$type 	= $cmb['type'];
431
-			$id		= $cmb['id'];
432
-			$value = apply_filters( "tc_{$type}_metabox", $value );	// Filter by metabox type
433
-			$value = apply_filters( "tc_{$id}_metabox", $value ); // Filter by metabox ID
431
+			$id = $cmb['id'];
432
+			$value = apply_filters("tc_{$type}_metabox", $value); // Filter by metabox type
433
+			$value = apply_filters("tc_{$id}_metabox", $value); // Filter by metabox ID
434 434
 
435 435
 			// Files must be treated separately - they use the attachment ID
436 436
 			// & url of media for separate cmb values
437
-			if ( $cmb['type'] != 'file' ){
438
-				add_post_meta( $post_id, $cmb['id'], $value, true );
437
+			if ($cmb['type'] != 'file') {
438
+				add_post_meta($post_id, $cmb['id'], $value, true);
439 439
 			} else {
440
-				add_post_meta( $post_id, $cmb['id'].'_id', $value, true );
441
-				add_post_meta( $post_id, $cmb['id'], wp_get_attachment_url( $value ), true );
440
+				add_post_meta($post_id, $cmb['id'].'_id', $value, true);
441
+				add_post_meta($post_id, $cmb['id'], wp_get_attachment_url($value), true);
442 442
 			}
443 443
 
444
-			if ( $cmb['source'] === 'acf' ){
445
-				add_post_meta( $post_id, '_' . $cmb['id'], $cmb['key'], true );
444
+			if ($cmb['source'] === 'acf') {
445
+				add_post_meta($post_id, '_'.$cmb['id'], $cmb['key'], true);
446 446
 			}
447 447
 
448 448
 		// If we're dealing with a WP Error object, just return the message for debugging
449
-		} elseif ( is_wp_error( $value ) ){
450
-			error_log( $value->get_error_message() );
449
+		} elseif (is_wp_error($value)) {
450
+			error_log($value->get_error_message());
451 451
 			return $value->get_error_message();
452 452
 		}
453 453
 
Please login to merge, or discard this patch.
test-content.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -28,17 +28,17 @@  discard block
 block discarded – undo
28 28
  		return;
29 29
  	}
30 30
 
31
-    $class = str_replace( __NAMESPACE__ . '\\', '', $class );
31
+	$class = str_replace( __NAMESPACE__ . '\\', '', $class );
32 32
 
33 33
 
34 34
 	if ( 'Views' === $namespace[1] ){
35
-        $class = strtolower( preg_replace( '/(?<!^)([A-Z])/', '/\1', $class ) );
36
-        $class = str_replace( '\\', '', $class );
37
-     	$file  = dirname( __FILE__ ) . '/' . $class . '.php';
38
-    } else {
39
-        $class = strtolower( preg_replace( '/(?<!^)([A-Z])/', '-\\1', $class ) );
40
-     	$file  = dirname( __FILE__ ) . '/includes/class-' . $class . '.php';
41
-    }
35
+		$class = strtolower( preg_replace( '/(?<!^)([A-Z])/', '/\1', $class ) );
36
+		$class = str_replace( '\\', '', $class );
37
+	 	$file  = dirname( __FILE__ ) . '/' . $class . '.php';
38
+	} else {
39
+		$class = strtolower( preg_replace( '/(?<!^)([A-Z])/', '-\\1', $class ) );
40
+	 	$file  = dirname( __FILE__ ) . '/includes/class-' . $class . '.php';
41
+	}
42 42
 
43 43
  	if ( file_exists( $file ) ) {
44 44
  		require_once( $file );
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 
77 77
  // Register hook providers and views.
78 78
  plugin()->register_hooks( new AdminPage() )
79
-         ->register_views( new Views\Posts() )
80
-         ->register_views( new Views\Terms() )
79
+		 ->register_views( new Views\Posts() )
80
+		 ->register_views( new Views\Terms() )
81 81
 		 ->register_views( new Views\Various() );
82 82
 
83 83
 // Load textdomain hook
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -21,14 +21,14 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * @param string $class Class name.
23 23
  */
24
-function test_content_autoloader( $class ) {
25
-	$namespace = explode( '\\', $class );
24
+function test_content_autoloader($class) {
25
+	$namespace = explode('\\', $class);
26 26
 
27
- 	if ( __NAMESPACE__ !== $namespace[0] ){
27
+ 	if (__NAMESPACE__ !== $namespace[0]) {
28 28
  		return;
29 29
  	}
30 30
 
31
-    $class = str_replace( __NAMESPACE__ . '\\', '', $class );
31
+    $class = str_replace(__NAMESPACE__.'\\', '', $class);
32 32
 
33 33
 	$nss = array(
34 34
 		'Abstracts',
@@ -36,20 +36,20 @@  discard block
 block discarded – undo
36 36
 		'Views'
37 37
 	);
38 38
 
39
-	if ( in_array( $namespace[1], $nss ) ){
40
-        $class = strtolower( preg_replace( '/(?<!^)([A-Z])/', '/\1', $class ) );
41
-        $class = str_replace( '\\', '', $class );
42
-     	$file  = dirname( __FILE__ ) . '/' . $class . '.php';
39
+	if (in_array($namespace[1], $nss)) {
40
+        $class = strtolower(preg_replace('/(?<!^)([A-Z])/', '/\1', $class));
41
+        $class = str_replace('\\', '', $class);
42
+     	$file  = dirname(__FILE__).'/'.$class.'.php';
43 43
     } else {
44
-        $class = strtolower( preg_replace( '/(?<!^)([A-Z])/', '-\\1', $class ) );
45
-     	$file  = dirname( __FILE__ ) . '/includes/class-' . $class . '.php';
44
+        $class = strtolower(preg_replace('/(?<!^)([A-Z])/', '-\\1', $class));
45
+     	$file  = dirname(__FILE__).'/includes/class-'.$class.'.php';
46 46
     }
47 47
 
48
- 	if ( is_readable( $file ) ) {
49
- 		require_once( $file );
48
+ 	if (is_readable($file)) {
49
+ 		require_once($file);
50 50
  	}
51 51
  }
52
- spl_autoload_register( __NAMESPACE__ . '\test_content_autoloader' );
52
+ spl_autoload_register(__NAMESPACE__.'\test_content_autoloader');
53 53
 
54 54
 
55 55
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
  function plugin() {
62 62
  	static $instance;
63 63
 
64
- 	if ( null === $instance ) {
64
+ 	if (null === $instance) {
65 65
  		$instance = new Plugin();
66 66
  	}
67 67
 
@@ -71,19 +71,19 @@  discard block
 block discarded – undo
71 71
 // Set our definitions for later use
72 72
  plugin()->set_definitions(
73 73
 	(object) array(
74
-		'basename'	=> plugin_basename( __FILE__ ),
75
-		'directory'	=> plugin_dir_path( __FILE__ ),
74
+		'basename'	=> plugin_basename(__FILE__),
75
+		'directory'	=> plugin_dir_path(__FILE__),
76 76
 		'file'		=> __FILE__,
77 77
 		'slug' 		=> 'structure',
78
-		'url'		=> plugin_dir_url( __FILE__ )
78
+		'url'		=> plugin_dir_url(__FILE__)
79 79
 	)
80 80
 );
81 81
 
82 82
  // Register hook providers and views.
83
- plugin()->register_hooks( new AdminPage() )
84
-         ->register_views( new Views\Posts() )
85
-         ->register_views( new Views\Terms() )
86
-		 ->register_views( new Views\Various() );
83
+ plugin()->register_hooks(new AdminPage())
84
+         ->register_views(new Views\Posts())
85
+         ->register_views(new Views\Terms())
86
+		 ->register_views(new Views\Various());
87 87
 
88 88
 // Load textdomain hook
89
-add_action( 'plugins_loaded', array( plugin(), 'load_textdomain' ) );
89
+add_action('plugins_loaded', array(plugin(), 'load_textdomain'));
Please login to merge, or discard this patch.
includes/class-test-content.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -417,29 +417,29 @@  discard block
 block discarded – undo
417 417
 		}
418 418
 
419 419
 		// Download the file
420
-	    $tmp = \download_url( $url );
420
+		$tmp = \download_url( $url );
421 421
 
422
-	    preg_match( '/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $url, $matches );
422
+		preg_match( '/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $url, $matches );
423 423
 
424
-        $file_array['name'] = basename( $matches[0] );
425
-        $file_array['tmp_name'] = $tmp;
424
+		$file_array['name'] = basename( $matches[0] );
425
+		$file_array['tmp_name'] = $tmp;
426 426
 
427
-	    // Check for download errors
428
-	    if ( is_wp_error( $tmp ) ) {
429
-	        unlink( $file_array[ 'tmp_name' ] );
430
-	        error_log( $tmp->get_error_message() );
431
-	    }
427
+		// Check for download errors
428
+		if ( is_wp_error( $tmp ) ) {
429
+			unlink( $file_array[ 'tmp_name' ] );
430
+			error_log( $tmp->get_error_message() );
431
+		}
432 432
 
433 433
 		// Pull the image into the media library
434
-	    $image_id = media_handle_sideload( $file_array, $post_id );
434
+		$image_id = media_handle_sideload( $file_array, $post_id );
435 435
 
436
-	    // Check for handle sideload errors.
437
-	    if ( is_wp_error( $image_id ) ) {
438
-	        unlink( $file_array['tmp_name'] );
439
-	        error_log( $image_id->get_error_message() );
440
-	    }
436
+		// Check for handle sideload errors.
437
+		if ( is_wp_error( $image_id ) ) {
438
+			unlink( $file_array['tmp_name'] );
439
+			error_log( $image_id->get_error_message() );
440
+		}
441 441
 
442
-	    return apply_filters( "tc_image_data", $image_id );
442
+		return apply_filters( "tc_image_data", $image_id );
443 443
 
444 444
 	}
445 445
 
@@ -462,9 +462,9 @@  discard block
 block discarded – undo
462 462
 
463 463
 		// If our cURL failed
464 464
 		if ( $curl_response === false ) {
465
-		    $info = curl_getinfo( $curl );
466
-		    curl_close( $curl );
467
-		    die( 'error occured during curl exec. Additional info: ' . var_export( $info ) );
465
+			$info = curl_getinfo( $curl );
466
+			curl_close( $curl );
467
+			die( 'error occured during curl exec. Additional info: ' . var_export( $info ) );
468 468
 		}
469 469
 
470 470
 		curl_close( $curl );
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * @subpackage Evans
15 15
  * @author     Old Town Media
16 16
  */
17
-class TestContent{
17
+class TestContent {
18 18
 
19 19
 	/**
20 20
 	 * Title function.
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 * @param int $num_words Number of words to return.
27 27
 	 * @return string Random title string.
28 28
 	 */
29
-	public static function title( $num_words = '' ){
29
+	public static function title($num_words = '') {
30 30
 
31 31
 		$title = '';
32 32
 
@@ -67,16 +67,16 @@  discard block
 block discarded – undo
67 67
 		);
68 68
 
69 69
 		// If we didn't choose a count, make one
70
-		if ( empty( $num_words ) ){
71
-			$num_words = rand( 2, 10 );
70
+		if (empty($num_words)) {
71
+			$num_words = rand(2, 10);
72 72
 		}
73 73
 
74 74
 		// Pull random words
75
-		for( $i = 1; $i <= $num_words; $i++ ){
76
-			$title .= $random_words[ rand( 0, 31 ) ] . " ";
75
+		for ($i = 1; $i <= $num_words; $i++) {
76
+			$title .= $random_words[rand(0, 31)]." ";
77 77
 		}
78 78
 
79
-		return apply_filters( "tc_title_data", substr( $title, 0, -1 ) );
79
+		return apply_filters("tc_title_data", substr($title, 0, -1));
80 80
 
81 81
 	}
82 82
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @return string Paragraph(s) of text.
91 91
 	 */
92
-	public static function paragraphs(){
92
+	public static function paragraphs() {
93 93
 
94 94
 		$content = '';
95 95
 
@@ -350,11 +350,11 @@  discard block
 block discarded – undo
350 350
 
351 351
 		);
352 352
 
353
-		for( $i = 1; $i < 6; $i++ ){
354
-			$content .= $random_content_types[rand( 0, 12 )];
353
+		for ($i = 1; $i < 6; $i++) {
354
+			$content .= $random_content_types[rand(0, 12)];
355 355
 		}
356 356
 
357
-		return apply_filters( "tc_paragraphs_data", $content );
357
+		return apply_filters("tc_paragraphs_data", $content);
358 358
 
359 359
 	}
360 360
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 	 *
367 367
 	 * @return string Plain text paragraphs.
368 368
 	 */
369
-	public static function plain_text(){
369
+	public static function plain_text() {
370 370
 
371 371
 		$paragraphs = array(
372 372
 			'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean tincidunt luctus eros, a tincidunt massa aliquet sit amet. Sed faucibus, eros non lacinia porttitor, risus odio efficitur sapien, id porta urna massa ac est. Cras efficitur lacinia magna eget tempus. Fusce ex felis, finibus consectetur mi at, finibus rhoncus augue. In ut tortor lacinia, rutrum mauris vel, maximus tortor. Praesent ac arcu nec eros pharetra tristique. Morbi congue leo sed ipsum fermentum vulputate. Ut nulla eros, porta varius pulvinar eget, bibendum quis dolor. Morbi sed diam eu dui semper ornare nec quis nisl.',
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 			'Fusce semper erat tortor, at pulvinar risus luctus suscipit. Phasellus quis enim nisl. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas semper dapibus odio, nec pellentesque sem laoreet sit amet. Maecenas ut enim tellus. Fusce malesuada mattis sem, porta interdum ex fermentum quis. Ut eget quam mi. In molestie volutpat feugiat. Nulla vel viverra nunc. Integer lobortis nisl vitae placerat egestas. Curabitur tristique nulla at libero blandit, a eleifend augue tempus.',
382 382
 		);
383 383
 
384
-		return apply_filters( "tc_plain_text_data", $paragraphs[ rand( 0, 9 ) ] );
384
+		return apply_filters("tc_plain_text_data", $paragraphs[rand(0, 9)]);
385 385
 
386 386
 	}
387 387
 
@@ -397,49 +397,49 @@  discard block
 block discarded – undo
397 397
 	 * @param int $post_id Post ID.
398 398
 	 * @return mixed Attachment ID or WP Error.
399 399
 	 */
400
-	public static function image( $post_id ){
400
+	public static function image($post_id) {
401 401
 		$file_array = array();
402 402
 
403 403
 		// Get the image from the API
404 404
 		$url = self::get_image_link();
405 405
 
406 406
 		// If the returned string is empty or it's not a string, try again.
407
-		if ( empty( $url ) || !is_string( $url ) ){
407
+		if (empty($url) || !is_string($url)) {
408 408
 
409 409
 			// Try again
410 410
 			$url = self::get_image_link();
411 411
 
412 412
 			// If it fails again, just give up
413
-			if ( empty( $url ) || !is_string( $url ) ){
413
+			if (empty($url) || !is_string($url)) {
414 414
 				return;
415 415
 			}
416 416
 
417 417
 		}
418 418
 
419 419
 		// Download the file
420
-	    $tmp = \download_url( $url );
420
+	    $tmp = \download_url($url);
421 421
 
422
-	    preg_match( '/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $url, $matches );
422
+	    preg_match('/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $url, $matches);
423 423
 
424
-        $file_array['name'] = basename( $matches[0] );
424
+        $file_array['name'] = basename($matches[0]);
425 425
         $file_array['tmp_name'] = $tmp;
426 426
 
427 427
 	    // Check for download errors
428
-	    if ( is_wp_error( $tmp ) ) {
429
-	        unlink( $file_array[ 'tmp_name' ] );
430
-	        error_log( $tmp->get_error_message() );
428
+	    if (is_wp_error($tmp)) {
429
+	        unlink($file_array['tmp_name']);
430
+	        error_log($tmp->get_error_message());
431 431
 	    }
432 432
 
433 433
 		// Pull the image into the media library
434
-	    $image_id = media_handle_sideload( $file_array, $post_id );
434
+	    $image_id = media_handle_sideload($file_array, $post_id);
435 435
 
436 436
 	    // Check for handle sideload errors.
437
-	    if ( is_wp_error( $image_id ) ) {
438
-	        unlink( $file_array['tmp_name'] );
439
-	        error_log( $image_id->get_error_message() );
437
+	    if (is_wp_error($image_id)) {
438
+	        unlink($file_array['tmp_name']);
439
+	        error_log($image_id->get_error_message());
440 440
 	    }
441 441
 
442
-	    return apply_filters( "tc_image_data", $image_id );
442
+	    return apply_filters("tc_image_data", $image_id);
443 443
 
444 444
 	}
445 445
 
@@ -451,31 +451,31 @@  discard block
 block discarded – undo
451 451
 	 *
452 452
 	 * @return string Image URL.
453 453
 	 */
454
-	private static function get_image_link(){
454
+	private static function get_image_link() {
455 455
 
456 456
 		// cURL an image API for a completely random photo
457
-		$curl = curl_init( "http://www.splashbase.co/api/v1/images/random?images_only=true" );
457
+		$curl = curl_init("http://www.splashbase.co/api/v1/images/random?images_only=true");
458 458
 
459
-		curl_setopt( $curl, CURLOPT_RETURNTRANSFER, TRUE );
459
+		curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
460 460
 
461
-		$curl_response = curl_exec( $curl );
461
+		$curl_response = curl_exec($curl);
462 462
 
463 463
 		// If our cURL failed
464
-		if ( $curl_response === false ) {
465
-		    $info = curl_getinfo( $curl );
466
-		    curl_close( $curl );
467
-		    die( 'error occured during curl exec. Additional info: ' . var_export( $info ) );
464
+		if ($curl_response === false) {
465
+		    $info = curl_getinfo($curl);
466
+		    curl_close($curl);
467
+		    die('error occured during curl exec. Additional info: '.var_export($info));
468 468
 		}
469 469
 
470
-		curl_close( $curl );
470
+		curl_close($curl);
471 471
 
472 472
 		// Decode the data
473
-		$response = json_decode( $curl_response, true );
473
+		$response = json_decode($curl_response, true);
474 474
 
475 475
 		// Check to make sure that the return contains a valid image extensions
476 476
 		preg_match('/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $response['url'], $matches);
477 477
 
478
-		if ( !empty( $matches ) ){
478
+		if (!empty($matches)) {
479 479
 			return $response['url'];
480 480
 		}
481 481
 
@@ -490,12 +490,12 @@  discard block
 block discarded – undo
490 490
 	 * @param string $format PHP Date format.
491 491
 	 * @return mixed Date in the format requested.
492 492
 	 */
493
-	public static function date( $format ){
493
+	public static function date($format) {
494 494
 
495
-		$num_days = rand( 1, 60 );
496
-		$date = date( $format, strtotime( " +$num_days days" ) );
495
+		$num_days = rand(1, 60);
496
+		$date = date($format, strtotime(" +$num_days days"));
497 497
 
498
-		return apply_filters( "tc_date_data", $date );
498
+		return apply_filters("tc_date_data", $date);
499 499
 
500 500
 	}
501 501
 
@@ -507,19 +507,19 @@  discard block
 block discarded – undo
507 507
 	 *
508 508
 	 * @return string Time string
509 509
 	 */
510
-	public static function time(){
510
+	public static function time() {
511 511
 
512 512
 		$times = array(
513 513
 			'8:00 am',
514 514
 			'5:00PM',
515 515
 			'13:00',
516 516
 			'2015',
517
-			date( 'G:i', strtotime( " +".rand( 4, 24 )." hours" ) ),
518
-			date( 'g:i', strtotime( " +".rand( 4, 24 )." hours" ) ),
519
-			date( 'G:i A', strtotime( " +".rand( 4, 24 )." hours" ) )
517
+			date('G:i', strtotime(" +".rand(4, 24)." hours")),
518
+			date('g:i', strtotime(" +".rand(4, 24)." hours")),
519
+			date('G:i A', strtotime(" +".rand(4, 24)." hours"))
520 520
 		);
521 521
 
522
-		return apply_filters( "tc_time_data", $times[ rand( 0, 6 ) ] );
522
+		return apply_filters("tc_time_data", $times[rand(0, 6)]);
523 523
 
524 524
 	}
525 525
 
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 	 *
532 532
 	 * @return string Timezone
533 533
 	 */
534
-	public static function timezone(){
534
+	public static function timezone() {
535 535
 
536 536
 		$timezones = array(
537 537
 			'America/Denver',
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 			'UTC'
550 550
 		);
551 551
 
552
-		return apply_filters( "tc_timezone_data", $timezones[ rand( 0, 12 ) ] );
552
+		return apply_filters("tc_timezone_data", $timezones[rand(0, 12)]);
553 553
 
554 554
 	}
555 555
 
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 	 *
563 563
 	 * @return string Phone #.
564 564
 	 */
565
-	public static function phone(){
565
+	public static function phone() {
566 566
 
567 567
 		$phone_numbers = array(
568 568
 			'7203893101',
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 			'+43 780 0047112'
579 579
 		);
580 580
 
581
-		return apply_filters( "tc_phone_data", $phone_numbers[ rand( 0, 10 ) ] );
581
+		return apply_filters("tc_phone_data", $phone_numbers[rand(0, 10)]);
582 582
 
583 583
 	}
584 584
 
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 	 *
591 591
 	 * @return string Email address.
592 592
 	 */
593
-	public static function email(){
593
+	public static function email() {
594 594
 
595 595
 		$email_addresses = array(
596 596
 			'[email protected]',
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 			'[email protected]'
604 604
 		);
605 605
 
606
-		return apply_filters( "tc_email_data", $email_addresses[ rand( 0, 7 ) ] );
606
+		return apply_filters("tc_email_data", $email_addresses[rand(0, 7)]);
607 607
 
608 608
 	}
609 609
 
@@ -617,12 +617,12 @@  discard block
 block discarded – undo
617 617
 	 *
618 618
 	 * @return string URL.
619 619
 	 */
620
-	public static function link(){
620
+	public static function link() {
621 621
 
622 622
 		$links = array(
623 623
 			'http://google.com',
624 624
 			'https://www.twitter.com',
625
-			site_url( '/?iam=anextravariable' ),
625
+			site_url('/?iam=anextravariable'),
626 626
 			'github.com',
627 627
 			'http://filebase.com',
628 628
 			'www.oldtownmediainc.com',
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 			'https://www.eff.org'
631 631
 		);
632 632
 
633
-		return apply_filters( "tc_link_data", $links[ rand( 0, 7 ) ] );
633
+		return apply_filters("tc_link_data", $links[rand(0, 7)]);
634 634
 
635 635
 	}
636 636
 
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 	 *
642 642
 	 * @return string URL.
643 643
 	 */
644
-	public static function oembed(){
644
+	public static function oembed() {
645 645
 
646 646
 		$links = array(
647 647
 			'https://www.youtube.com/watch?v=A85-YQsm6pY',
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 			'https://www.instagram.com/p/-eyLo0RMfX',
653 653
 		);
654 654
 
655
-		return apply_filters( "tc_oembed_data", $links[ rand( 0, 5 ) ] );
655
+		return apply_filters("tc_oembed_data", $links[rand(0, 5)]);
656 656
 
657 657
 	}
658 658
 
@@ -666,10 +666,10 @@  discard block
 block discarded – undo
666 666
 	 * @param	string $type Video service to get link from
667 667
 	 * @return	string URL.
668 668
 	 */
669
-	public static function video( $type ){
669
+	public static function video($type) {
670 670
 
671 671
 		// Switch through our video types. Expecting to add more in the future
672
-		switch( $type ){
672
+		switch ($type) {
673 673
 
674 674
 			// YouTube videos
675 675
 			case 'youtube' :
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 
711 711
 		}
712 712
 
713
-		return apply_filters( "tc_video_data", $links[ rand( 0, 8 ) ] );
713
+		return apply_filters("tc_video_data", $links[rand(0, 8)]);
714 714
 
715 715
 	}
716 716
 
Please login to merge, or discard this patch.
includes/class-delete.php 3 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,6 @@
 block discarded – undo
48 48
 	 *
49 49
 	 * @see WP_Query, wp_delete_post
50 50
 	 *
51
-	 * @param string $slug a custom post type ID.
52 51
 	 * @param boolean $echo Whether or not to echo the result
53 52
 	 */
54 53
 	public function delete_objects( $echo = false, $data ){
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 		$post_types = get_post_types( array( 'public' => true ), 'objects' );
26 26
 		foreach ( $post_types as $post_type ) :
27 27
 
28
-		    $this->delete_posts( $post_type->name, $echo );
28
+			$this->delete_posts( $post_type->name, $echo );
29 29
 
30 30
 		endforeach;
31 31
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 		$taxonomies = get_taxonomies();
34 34
 		foreach ( $taxonomies as $tax ) :
35 35
 
36
-		    $this->delete_terms( $tax, $echo );
36
+			$this->delete_terms( $tax, $echo );
37 37
 
38 38
 		endforeach;
39 39
 
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -8,32 +8,32 @@  discard block
 block discarded – undo
8 8
  * @subpackage Evans
9 9
  * @author     Old Town Media
10 10
  */
11
-class Delete{
11
+class Delete {
12 12
 
13 13
 	/**
14 14
 	 * Delete all test content created ever.
15 15
 	 *
16 16
 	 * @access private
17 17
 	 */
18
-	public function delete_all_test_data( $echo = false ){
18
+	public function delete_all_test_data($echo = false) {
19 19
 
20
-		if ( !$this->user_can_delete() ){
20
+		if (!$this->user_can_delete()) {
21 21
 			return;
22 22
 		}
23 23
 
24 24
 		// Loop through all post types and remove any test data
25
-		$post_types = get_post_types( array( 'public' => true ), 'objects' );
26
-		foreach ( $post_types as $post_type ) :
25
+		$post_types = get_post_types(array('public' => true), 'objects');
26
+		foreach ($post_types as $post_type) :
27 27
 
28
-		    $this->delete_posts( $post_type->name, $echo );
28
+		    $this->delete_posts($post_type->name, $echo);
29 29
 
30 30
 		endforeach;
31 31
 
32 32
 		// Loop through all taxonomies and remove any data
33 33
 		$taxonomies = get_taxonomies();
34
-		foreach ( $taxonomies as $tax ) :
34
+		foreach ($taxonomies as $tax) :
35 35
 
36
-		    $this->delete_terms( $tax, $echo );
36
+		    $this->delete_terms($tax, $echo);
37 37
 
38 38
 		endforeach;
39 39
 
@@ -51,22 +51,22 @@  discard block
 block discarded – undo
51 51
 	 * @param string $slug a custom post type ID.
52 52
 	 * @param boolean $echo Whether or not to echo the result
53 53
 	 */
54
-	public function delete_objects( $echo = false, $data ){
54
+	public function delete_objects($echo = false, $data) {
55 55
 
56 56
 		// Make sure that the current user is logged in & has full permissions.
57
-		if ( !$this->user_can_delete() ){
57
+		if (!$this->user_can_delete()) {
58 58
 			return;
59 59
 		}
60 60
 
61
-		if ( empty( $data ) ){
61
+		if (empty($data)) {
62 62
 			return;
63 63
 		}
64 64
 
65
-		$type = 'testContent\Types\\' . ucwords( $data['type'] );
65
+		$type = 'testContent\Types\\'.ucwords($data['type']);
66 66
 		$slug = $data['slug'];
67 67
 
68 68
 		$object = new $type();
69
-		$object->delete( $slug, $echo );
69
+		$object->delete($slug, $echo);
70 70
 
71 71
 	}
72 72
 
@@ -76,15 +76,15 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @see is_user_logged_in, current_user_can
78 78
 	 */
79
-	public function user_can_delete(){
79
+	public function user_can_delete() {
80 80
 
81 81
 		// User must be logged in
82
-		if ( !is_user_logged_in() ){
82
+		if (!is_user_logged_in()) {
83 83
 			return false;
84 84
 		}
85 85
 
86 86
 		// User must have editor priveledges, at a minimum
87
-		if ( !current_user_can( 'delete_others_posts' ) ){
87
+		if (!current_user_can('delete_others_posts')) {
88 88
 			return false;
89 89
 		}
90 90
 
Please login to merge, or discard this patch.
views/terms.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  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 15
 	protected $title	= 'Terms';
16 16
 	protected $type		= 'term';
17
-	protected $priority	= 2;
17
+	protected $priority = 2;
18 18
 
19 19
 
20 20
 	/**
@@ -24,25 +24,25 @@  discard block
 block discarded – undo
24 24
 	 *
25 25
 	 * @return string HTML content.
26 26
 	 */
27
-	protected function actions_section(){
27
+	protected function actions_section() {
28 28
 		$html = '';
29 29
 
30 30
 		$taxonomies = get_taxonomies();
31 31
 
32
-		foreach ( $taxonomies as $tax ) :
32
+		foreach ($taxonomies as $tax) :
33 33
 
34 34
 			$skipped_taxonomies = array(
35
-				'post_format',				// We shouldn't be making random post format classes
36
-				'product_shipping_class',	// These aren't used visually and are therefore skipped
37
-				'nav_menu',					// Menus are handled seperately of taxonomies
35
+				'post_format', // We shouldn't be making random post format classes
36
+				'product_shipping_class', // These aren't used visually and are therefore skipped
37
+				'nav_menu', // Menus are handled seperately of taxonomies
38 38
 			);
39 39
 
40 40
 			// Skip banned taxonomies
41
-			if ( in_array( $tax, $skipped_taxonomies ) ){
41
+			if (in_array($tax, $skipped_taxonomies)) {
42 42
 				continue;
43 43
 			}
44 44
 
45
-			$taxonomy = get_taxonomy( $tax );
45
+			$taxonomy = get_taxonomy($tax);
46 46
 
47 47
 			$html .= "<div class='test-data-cpt'>";
48 48
 
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 
51 51
 				$html .= "<span class='label'>".$taxonomy->labels->name."</span>";
52 52
 
53
-				$html .= $this->build_button( 'create', $tax, __( 'Create', 'otm-test-content' )." ".$taxonomy->labels->name );
54
-				$html .= $this->build_button( 'delete', $tax, __( 'Delete', 'otm-test-content' )." ".$taxonomy->labels->name );
53
+				$html .= $this->build_button('create', $tax, __('Create', 'otm-test-content')." ".$taxonomy->labels->name);
54
+				$html .= $this->build_button('delete', $tax, __('Delete', 'otm-test-content')." ".$taxonomy->labels->name);
55 55
 
56 56
 				$html .= "</h3>";
57 57
 
Please login to merge, or discard this patch.