Completed
Push — master ( add22c...fb4c0b )
by Mike
02:33
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   +32 added lines, -32 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,15 +45,15 @@  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_filter( 'plugin_action_links_' . $this->definitions->basename , array( $this, 'add_settings_link' ) );
56
-		add_action( 'admin_notices', array( $this, 'internet_connected_admin_notice' ) );
54
+		add_action('admin_menu', array($this, 'add_menu_item'));
55
+		add_filter('plugin_action_links_'.$this->definitions->basename, array($this, 'add_settings_link'));
56
+		add_action('admin_notices', array($this, 'internet_connected_admin_notice'));
57 57
 
58 58
 	}
59 59
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @param Plugin $plugin Main plugin instance.
65 65
 	 */
66
-	public function set_plugin( $plugin ) {
66
+	public function set_plugin($plugin) {
67 67
 
68 68
 		$this->plugin = $plugin;
69 69
 		return $this;
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 
81 81
 		$page = add_submenu_page(
82 82
 			'tools.php',
83
-			__( 'Create Test Content', 'otm-test-content' ),
84
-			__( 'Test Content', 'otm-test-content' ),
83
+			__('Create Test Content', 'otm-test-content'),
84
+			__('Test Content', 'otm-test-content'),
85 85
 			'manage_options',
86 86
 			'create-test-data',
87
-			array( $this, 'admin_page' )
87
+			array($this, 'admin_page')
88 88
 		);
89 89
 
90
-		add_action( 'admin_print_styles-' . $page, array( $this, 'load_scripts' ) );
90
+		add_action('admin_print_styles-'.$page, array($this, 'load_scripts'));
91 91
 
92 92
 	}
93 93
 
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
 	 * @param  array $links Existing links
98 98
 	 * @return array 		Modified links
99 99
 	 */
100
-	public function add_settings_link( $links ) {
100
+	public function add_settings_link($links) {
101 101
 
102
-		$settings_link = '<a href="tools.php?page=create-test-data">' . __( 'Build Test Content', 'otm-test-content' ) . '</a>';
103
-  		array_push( $links, $settings_link );
102
+		$settings_link = '<a href="tools.php?page=create-test-data">'.__('Build Test Content', 'otm-test-content').'</a>';
103
+  		array_push($links, $settings_link);
104 104
   		return $links;
105 105
 
106 106
 	}
@@ -113,24 +113,24 @@  discard block
 block discarded – undo
113 113
 	 * Internet, and the test fails displays a notice informing the user that
114 114
 	 * images will not pull into test data.
115 115
 	 */
116
-	public function internet_connected_admin_notice(){
116
+	public function internet_connected_admin_notice() {
117 117
 
118 118
 		// Get the current admin screen & verify that we're on the right one
119 119
 		// before continuing.
120 120
 		$screen = get_current_screen();
121 121
 
122
-		if ( $screen->base != 'tools_page_create-test-data' ){
122
+		if ($screen->base != 'tools_page_create-test-data') {
123 123
 			return;
124 124
 		}
125 125
 
126 126
 		// Check the response
127
-		if ( $this->connected ) {
127
+		if ($this->connected) {
128 128
 			// We got a response so early return
129 129
 			return;
130 130
 		} else {
131 131
 			// We didn't get a reponse so print the notice out
132 132
 			echo '<div class="notice notice-error">';
133
-		        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>';
133
+		        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 134
 		    echo '</div>';
135 135
 		}
136 136
 
@@ -140,19 +140,19 @@  discard block
 block discarded – undo
140 140
 	/**
141 141
 	 * Load our script in the admin section and serve in data.
142 142
 	 */
143
-	public function load_scripts(){
143
+	public function load_scripts() {
144 144
 
145
-		wp_enqueue_script( 'test-content-js', plugins_url( 'assets/admin.js' , dirname( __FILE__ ) ) );
146
-		wp_enqueue_style( 'test-content-css', plugins_url( 'assets/admin.css' , dirname( __FILE__ ) ) );
145
+		wp_enqueue_script('test-content-js', plugins_url('assets/admin.js', dirname(__FILE__)));
146
+		wp_enqueue_style('test-content-css', plugins_url('assets/admin.css', dirname(__FILE__)));
147 147
 
148 148
 		$data = array(
149
-			'nonce'			=> wp_create_nonce( 'handle-test-data' ),
150
-			'createdStr'	=> __( 'Created', 'otm-test-content' ),
151
-			'deletedStr'	=> __( 'Deleting', 'otm-test-content' ),
152
-			'creatingStr'	=> __( 'Creating', 'otm-test-content' ),
149
+			'nonce'			=> wp_create_nonce('handle-test-data'),
150
+			'createdStr'	=> __('Created', 'otm-test-content'),
151
+			'deletedStr'	=> __('Deleting', 'otm-test-content'),
152
+			'creatingStr'	=> __('Creating', 'otm-test-content'),
153 153
 		);
154 154
 
155
-		wp_localize_script( 'test-content-js', 'test_content', $data );
155
+		wp_localize_script('test-content-js', 'test_content', $data);
156 156
 
157 157
 	}
158 158
 
@@ -160,20 +160,20 @@  discard block
 block discarded – undo
160 160
 	/**
161 161
 	 * Print out our admin page to control test data.
162 162
 	 */
163
-	public function admin_page(){
164
-		echo '<div class="wrap" id="options_editor">' . "\n";
163
+	public function admin_page() {
164
+		echo '<div class="wrap" id="options_editor">'."\n";
165 165
 
166
-			echo '<h2>' . __( 'Create Test Data' , 'otm-test-content' ) . '</h2>' . "\n";
166
+			echo '<h2>'.__('Create Test Data', 'otm-test-content').'</h2>'."\n";
167 167
 
168 168
 			echo "<div class='nav-tab-wrapper'>";
169 169
 
170
-				do_action( 'tc-admin-tabs', '' );
170
+				do_action('tc-admin-tabs', '');
171 171
 
172 172
 			echo "</div>";
173 173
 
174 174
 			echo "";
175 175
 
176
-				do_action( 'tc-admin-sections', '' );
176
+				do_action('tc-admin-sections', '');
177 177
 
178 178
 			echo "";
179 179
 
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   +8 added lines, -8 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_view( $provider ) {
69
+	public function register_view($provider) {
70 70
 
71 71
 		$provider->register_view();
72 72
 		return $this;
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @param  object $provider Hook provider.
81 81
 	 * @return object $this
82 82
 	 */
83
-	public function register_type( $provider ) {
83
+	public function register_type($provider) {
84 84
 
85 85
 		$provider->register_type();
86 86
 		return $this;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 * @see load_plugin_textdomain
95 95
 	 */
96 96
 	public function load_textdomain() {
97
-	    load_plugin_textdomain( 'otm-test-content', FALSE, basename( dirname( $this->definitions->file ) ) . '/languages/' );
97
+	    load_plugin_textdomain('otm-test-content', FALSE, basename(dirname($this->definitions->file)).'/languages/');
98 98
 	}
99 99
 
100 100
 }
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.
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.
views/posts.php 1 patch
Spacing   +9 added lines, -9 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 Posts extends Abs\View{
13
+class Posts extends Abs\View {
14 14
 
15 15
 	protected $title	= 'Posts';
16 16
 	protected $type		= 'post';
17
-	protected $priority	= 1;
17
+	protected $priority = 1;
18 18
 
19 19
 	/**
20 20
 	 * Our sections action block - button to create and delete.
@@ -23,20 +23,20 @@  discard block
 block discarded – undo
23 23
 	 *
24 24
 	 * @return string HTML content.
25 25
 	 */
26
-	protected function actions_section(){
26
+	protected function actions_section() {
27 27
 		$html = '';
28 28
 
29 29
 		// Loop through every post type available on the site
30
-		$post_types = get_post_types( array( 'public' => true ), 'objects' );
30
+		$post_types = get_post_types(array('public' => true), 'objects');
31 31
 
32
-		foreach ( $post_types as $post_type ) :
32
+		foreach ($post_types as $post_type) :
33 33
 
34 34
 			$skipped_cpts = array(
35 35
 				'attachment'
36 36
 			);
37 37
 
38 38
 			// Skip banned cpts
39
-			if ( in_array( $post_type->name, $skipped_cpts ) ){
39
+			if (in_array($post_type->name, $skipped_cpts)) {
40 40
 				continue;
41 41
 			}
42 42
 
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 
45 45
 				$html .= "<h3>";
46 46
 
47
-					$html .= "<span class='label'>" . $post_type->labels->name . "</span>";
48
-					$html .= $this->build_button( 'create', $post_type->name, __( 'Create Test Data', 'otm-test-content' ) );
49
-					$html .= $this->build_button( 'delete', $post_type->name, __( 'Delete Test Data', 'otm-test-content' ) );
47
+					$html .= "<span class='label'>".$post_type->labels->name."</span>";
48
+					$html .= $this->build_button('create', $post_type->name, __('Create Test Data', 'otm-test-content'));
49
+					$html .= $this->build_button('delete', $post_type->name, __('Delete Test Data', 'otm-test-content'));
50 50
 
51 51
 				$html .= "</h3>";
52 52
 
Please login to merge, or discard this patch.
types/term.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -133,14 +133,14 @@
 block discarded – undo
133 133
 
134 134
 		// Query for our terms
135 135
 		$args = array(
136
-		    'hide_empty' => false,
137
-		    'meta_query' => array(
138
-		        array(
139
-		           'key'       => 'evans_test_content',
140
-		           'value'     => '__test__',
141
-		           'compare'   => '='
142
-		        )
143
-		    )
136
+			'hide_empty' => false,
137
+			'meta_query' => array(
138
+				array(
139
+				   'key'       => 'evans_test_content',
140
+				   'value'     => '__test__',
141
+				   'compare'   => '='
142
+				)
143
+			)
144 144
 		);
145 145
 
146 146
 		$terms = get_terms( $slug, $args );
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 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'], 'evans_test_content', '__test__', true );
96
+		add_term_meta($return['term_id'], 'evans_test_content', '__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
 
@@ -176,13 +176,13 @@  discard block
 block discarded – undo
176 176
 		    )
177 177
 		);
178 178
 
179
-		$terms = get_terms( $slug, $args );
179
+		$terms = get_terms($slug, $args);
180 180
 
181
-		if ( !empty( $terms ) ){
181
+		if (!empty($terms)) {
182 182
 
183 183
 			$events = array();
184 184
 
185
-			foreach ( $terms as $term ){
185
+			foreach ($terms as $term) {
186 186
 
187 187
 				$events[] = array(
188 188
 					'action'	=> 'deleted',
@@ -192,15 +192,15 @@  discard block
 block discarded – undo
192 192
 				);
193 193
 
194 194
 				// Delete our term
195
-				wp_delete_term( $term->term_id, $slug );
195
+				wp_delete_term($term->term_id, $slug);
196 196
 
197 197
 			}
198 198
 
199
-			$taxonomy = get_taxonomy( $slug );
199
+			$taxonomy = get_taxonomy($slug);
200 200
 
201 201
 			$events[] = array(
202 202
 				'action'	=> 'general',
203
-				'message'	=> __( 'Deleted', 'otm-test-content' ) . ' ' . $taxonomy->labels->name
203
+				'message'	=> __('Deleted', 'otm-test-content').' '.$taxonomy->labels->name
204 204
 			);
205 205
 
206 206
 			return $events;
Please login to merge, or discard this patch.
abstracts/view.php 1 patch
Spacing   +19 added lines, -19 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', 'otm-test-content' )."</span>";
124
-				$html .= "<input type='number' value='0' class='quantity-adjustment' for='".$this->type."' placeholder='".__( '', 'otm-test-content' )."'> ";
123
+				$html .= "<span class='label'>".__('Quantity', 'otm-test-content')."</span>";
124
+				$html .= "<input type='number' value='0' class='quantity-adjustment' for='".$this->type."' placeholder='".__('', 'otm-test-content')."'> ";
125 125
 			$html .= "</h3>";
126 126
 		$html .= "</div>";
127 127
 
@@ -139,22 +139,22 @@  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
 
151 151
 		$html .= "<a href='javascript:void(0);' ";
152
-			$html .= " data-type='" . $this->type . "'";
153
-			$html .= " data-slug='" . $slug . "'";
154
-			$html .= " data-todo='" . $action . "'";
152
+			$html .= " data-type='".$this->type."'";
153
+			$html .= " data-slug='".$slug."'";
154
+			$html .= " data-todo='".$action."'";
155 155
 			$html .= " class='button-primary handle-test-data'";
156 156
 		$html .= "/>";
157
-			$html .= "<span class='dashicons " . $dashicon . "'></span>";
157
+			$html .= "<span class='dashicons ".$dashicon."'></span>";
158 158
 			$html .= $text;
159 159
 		$html .= "</a>";
160 160
 
Please login to merge, or discard this patch.
includes/class-delete.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,5 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace testContent;
3
-use testContent\Views\Users as Users;
4 3
 
5 4
 /**
6 5
  * Class to handle deletion of test data for the plugin.
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -9,27 +9,27 @@  discard block
 block discarded – undo
9 9
  * @subpackage Evans
10 10
  * @author     Old Town Media
11 11
  */
12
-class Delete{
12
+class Delete {
13 13
 
14 14
 	/**
15 15
 	 * Delete all test content created ever.
16 16
 	 *
17 17
 	 * @access private
18 18
 	 */
19
-	public function delete_all_test_data(){
19
+	public function delete_all_test_data() {
20 20
 		$return = '';
21 21
 
22
-		if ( ! $this->user_can_delete() ){
22
+		if (!$this->user_can_delete()) {
23 23
 			return;
24 24
 		}
25 25
 
26
-		$types = apply_filters( 'tc-types', array() );
26
+		$types = apply_filters('tc-types', array());
27 27
 
28
-		if ( !empty( $types ) ){
28
+		if (!empty($types)) {
29 29
 
30
-			foreach ( $types as $type ){
30
+			foreach ($types as $type) {
31 31
 
32
-				$class = 'testContent\Types\\' . ucwords( $type );
32
+				$class = 'testContent\Types\\'.ucwords($type);
33 33
 				$object = new $class();
34 34
 
35 35
 				$return .= $object->delete_all();
@@ -53,23 +53,23 @@  discard block
 block discarded – undo
53 53
 	 *
54 54
 	 * @param string $data Information about the type.
55 55
 	 */
56
-	public function delete_objects( $data ){
56
+	public function delete_objects($data) {
57 57
 
58 58
 		// Make sure that the current user is logged in & has full permissions.
59
-		if ( !$this->user_can_delete() ){
59
+		if (!$this->user_can_delete()) {
60 60
 			return;
61 61
 		}
62 62
 
63
-		if ( empty( $data ) ){
63
+		if (empty($data)) {
64 64
 			return;
65 65
 		}
66 66
 
67
-		$type = 'testContent\Types\\' . ucwords( $data['type'] );
67
+		$type = 'testContent\Types\\'.ucwords($data['type']);
68 68
 		$slug = $data['slug'];
69 69
 
70 70
 		$object = new $type();
71 71
 
72
-		return $object->delete( $slug );
72
+		return $object->delete($slug);
73 73
 
74 74
 	}
75 75
 
@@ -79,15 +79,15 @@  discard block
 block discarded – undo
79 79
 	 *
80 80
 	 * @see is_user_logged_in, current_user_can
81 81
 	 */
82
-	public function user_can_delete(){
82
+	public function user_can_delete() {
83 83
 
84 84
 		// User must be logged in
85
-		if ( !is_user_logged_in() ){
85
+		if (!is_user_logged_in()) {
86 86
 			return false;
87 87
 		}
88 88
 
89 89
 		// User must have editor priveledges, at a minimum
90
-		if ( !current_user_can( 'delete_others_posts' ) ){
90
+		if (!current_user_can('delete_others_posts')) {
91 91
 			return false;
92 92
 		}
93 93
 
Please login to merge, or discard this patch.