@@ -24,7 +24,7 @@ |
||
| 24 | 24 | * |
| 25 | 25 | * @see check_admin_page, check_airplane_mode, check_internet, check_splashbase |
| 26 | 26 | * |
| 27 | - * @return boolean Status of connection to Internet/Splashbase. |
|
| 27 | + * @return null|boolean Status of connection to Internet/Splashbase. |
|
| 28 | 28 | */ |
| 29 | 29 | public function test(){ |
| 30 | 30 | |
@@ -17,7 +17,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | 92 | $last_uri_bit = explode( '=', $_SERVER['REQUEST_URI'] ); |
| 93 | - if ( 'create-test-data' != end( $last_uri_bit ) ){ |
|
| 93 | + if ( 'create-test-data' != end( $last_uri_bit ) ) { |
|
| 94 | 94 | return false; |
| 95 | 95 | } |
| 96 | 96 | |
@@ -108,13 +108,13 @@ discard block |
||
| 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 | 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,12 +133,12 @@ discard block |
||
| 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 | 139 | $connected = @fsockopen( "www.google.com", 80 ); |
| 140 | 140 | |
| 141 | - if ( !$connected ){ |
|
| 141 | + if ( !$connected ) { |
|
| 142 | 142 | return false; |
| 143 | 143 | } |
| 144 | 144 | |
@@ -160,12 +160,12 @@ discard block |
||
| 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 | 165 | $test_url = esc_url( $url ); |
| 166 | 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 | |
@@ -306,6 +306,9 @@ |
||
| 306 | 306 | |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | + /** |
|
| 310 | + * @param string $source |
|
| 311 | + */ |
|
| 309 | 312 | private function add_source( $fields, $source ){ |
| 310 | 313 | |
| 311 | 314 | if ( empty( $fields ) || empty( $source ) ){ |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * @subpackage Evans |
| 9 | 9 | * @author Old Town Media |
| 10 | 10 | */ |
| 11 | -class MetaboxTypes{ |
|
| 11 | +class MetaboxTypes { |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * Decide which cmb library to try and loop to get our metaboxes. |
@@ -22,7 +22,7 @@ discard block |
||
| 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 | $cmb2_fields = $cmb_fields = $acf_fields = array(); |
| 27 | 27 | |
| 28 | 28 | // CMB2 |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * @param string $slug Post type. |
| 57 | 57 | * @return array Fields array. |
| 58 | 58 | */ |
| 59 | - private function get_acf_free_metaboxes( $slug ){ |
|
| 59 | + private function get_acf_free_metaboxes( $slug ) { |
|
| 60 | 60 | |
| 61 | 61 | $fields = array(); |
| 62 | 62 | |
@@ -64,18 +64,18 @@ discard block |
||
| 64 | 64 | $fieldsets = $this->get_all_acf_field_groups(); |
| 65 | 65 | |
| 66 | 66 | // Return empty array if there are no fieldsets at all |
| 67 | - if ( empty( $fieldsets ) ){ |
|
| 67 | + if ( empty( $fieldsets ) ) { |
|
| 68 | 68 | return $fields; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | // Loop through each fieldset for possible matches |
| 72 | - foreach ( $fieldsets as $fieldset ){ |
|
| 72 | + foreach ( $fieldsets as $fieldset ) { |
|
| 73 | 73 | |
| 74 | - if ( $this->is_acf_field_in_post_type( $slug, $fieldset ) ){ |
|
| 74 | + if ( $this->is_acf_field_in_post_type( $slug, $fieldset ) ) { |
|
| 75 | 75 | |
| 76 | 76 | // If this is the first group of fields, simply set the value |
| 77 | 77 | // Else, merge this group with the previous one |
| 78 | - if ( empty( $fields ) ){ |
|
| 78 | + if ( empty( $fields ) ) { |
|
| 79 | 79 | $fields = $fieldset->fields; |
| 80 | 80 | } else { |
| 81 | 81 | $fields = array_merge( $fields, $fieldset->fields ); |
@@ -99,16 +99,16 @@ discard block |
||
| 99 | 99 | * @param object $fieldset Fieldset group. |
| 100 | 100 | * @return boolean Whether or not the grouping is assigned to the post type. |
| 101 | 101 | */ |
| 102 | - private function is_acf_field_in_post_type( $slug, $fieldset ){ |
|
| 102 | + private function is_acf_field_in_post_type( $slug, $fieldset ) { |
|
| 103 | 103 | |
| 104 | 104 | // Make sure we have something to parse |
| 105 | - if ( empty( $fieldset ) ){ |
|
| 105 | + if ( empty( $fieldset ) ) { |
|
| 106 | 106 | return false; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | // Loop through the rules to check for post type matches |
| 110 | - foreach ( $fieldset->rules as $rule ){ |
|
| 111 | - if ( $rule['param'] === 'post_type' && $rule['value'] === $slug ){ |
|
| 110 | + foreach ( $fieldset->rules as $rule ) { |
|
| 111 | + if ( $rule['param'] === 'post_type' && $rule['value'] === $slug ) { |
|
| 112 | 112 | return true; |
| 113 | 113 | } |
| 114 | 114 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * |
| 131 | 131 | * @return array All acf fieldsets. |
| 132 | 132 | */ |
| 133 | - private function get_all_acf_field_groups(){ |
|
| 133 | + private function get_all_acf_field_groups() { |
|
| 134 | 134 | $info = $rules = $fields = array(); |
| 135 | 135 | |
| 136 | 136 | $args = array( |
@@ -145,11 +145,11 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | $data = get_metadata( 'post', get_the_id() ); |
| 147 | 147 | |
| 148 | - foreach ( $data['rule'] as $rule ){ |
|
| 148 | + foreach ( $data['rule'] as $rule ) { |
|
| 149 | 149 | $rules[] = unserialize( $rule ); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - foreach ( $data as $key => $value ){ |
|
| 152 | + foreach ( $data as $key => $value ) { |
|
| 153 | 153 | if ( substr( $key, 0, 6 ) == 'field_' ) : |
| 154 | 154 | $field_detail = unserialize( $value[0] ); |
| 155 | 155 | $fields[] = array( |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * @param string $slug a custom post type ID. |
| 197 | 197 | * @return array Array of fields. |
| 198 | 198 | */ |
| 199 | - private function get_cmb2_metaboxes( $slug ){ |
|
| 199 | + private function get_cmb2_metaboxes( $slug ) { |
|
| 200 | 200 | |
| 201 | 201 | $fields = array(); |
| 202 | 202 | |
@@ -204,14 +204,14 @@ discard block |
||
| 204 | 204 | $all_metaboxes = apply_filters( 'cmb2_meta_boxes', array() ); |
| 205 | 205 | |
| 206 | 206 | // Loop through all possible sets of metaboxes added the old way |
| 207 | - foreach ( $all_metaboxes as $metabox_array ){ |
|
| 207 | + foreach ( $all_metaboxes as $metabox_array ) { |
|
| 208 | 208 | |
| 209 | 209 | // If the custom post type ID matches this set of fields, set & stop |
| 210 | 210 | if ( in_array( $slug, $metabox_array['object_types'] ) ) { |
| 211 | 211 | |
| 212 | 212 | // If this is the first group of fields, simply set the value |
| 213 | 213 | // Else, merge this group with the previous one |
| 214 | - if ( empty( $fields ) ){ |
|
| 214 | + if ( empty( $fields ) ) { |
|
| 215 | 215 | $fields = $metabox_array['fields']; |
| 216 | 216 | } else { |
| 217 | 217 | $fields = array_merge( $fields, $metabox_array['fields'] ); |
@@ -227,21 +227,21 @@ discard block |
||
| 227 | 227 | $match = false; |
| 228 | 228 | |
| 229 | 229 | // Establish correct cmb types |
| 230 | - if ( is_string( $cmb->meta_box['object_types'] ) ){ |
|
| 231 | - if ( $cmb->meta_box['object_types'] == $slug ){ |
|
| 230 | + if ( is_string( $cmb->meta_box['object_types'] ) ) { |
|
| 231 | + if ( $cmb->meta_box['object_types'] == $slug ) { |
|
| 232 | 232 | $match = true; |
| 233 | 233 | } |
| 234 | 234 | } else { |
| 235 | - if ( in_array( $slug, $cmb->meta_box['object_types'] ) ){ |
|
| 235 | + if ( in_array( $slug, $cmb->meta_box['object_types'] ) ) { |
|
| 236 | 236 | $match = true; |
| 237 | 237 | } |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - if ( $match !== true ){ |
|
| 240 | + if ( $match !== true ) { |
|
| 241 | 241 | continue; |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - if ( empty( $fields ) ){ |
|
| 244 | + if ( empty( $fields ) ) { |
|
| 245 | 245 | $fields = $cmb->meta_box['fields']; |
| 246 | 246 | } else { |
| 247 | 247 | $fields = array_merge( $fields, $cmb->meta_box['fields'] ); |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | * @param string $slug a custom post type ID. |
| 271 | 271 | * @return array Array of fields. |
| 272 | 272 | */ |
| 273 | - private function get_cmb1_metaboxes( $slug ){ |
|
| 273 | + private function get_cmb1_metaboxes( $slug ) { |
|
| 274 | 274 | |
| 275 | 275 | $fields = array(); |
| 276 | 276 | |
@@ -278,14 +278,14 @@ discard block |
||
| 278 | 278 | $all_metaboxes = apply_filters( 'cmb_meta_boxes', array() ); |
| 279 | 279 | |
| 280 | 280 | // Loop through all possible sets of metaboxes |
| 281 | - foreach ( $all_metaboxes as $metabox_array ){ |
|
| 281 | + foreach ( $all_metaboxes as $metabox_array ) { |
|
| 282 | 282 | |
| 283 | 283 | // If the custom post type ID matches this set of fields, set & stop |
| 284 | 284 | if ( in_array( $slug, $metabox_array['pages'] ) ) { |
| 285 | 285 | |
| 286 | 286 | // If this is the first group of fields, simply set the value |
| 287 | 287 | // Else, merge this group with the previous one |
| 288 | - if ( empty( $fields ) ){ |
|
| 288 | + if ( empty( $fields ) ) { |
|
| 289 | 289 | $fields = $metabox_array['fields']; |
| 290 | 290 | } else { |
| 291 | 291 | $fields = array_merge( $fields, $metabox_array['fields'] ); |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | // Identify Human Made's CMB library |
| 298 | - if ( defined( 'CMB_DEV' ) ){ |
|
| 298 | + if ( defined( 'CMB_DEV' ) ) { |
|
| 299 | 299 | $fields = $this->add_source( $fields, 'cmb_hm' ); |
| 300 | 300 | // Default to CMB1 library |
| 301 | 301 | } else { |
@@ -306,13 +306,13 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | - private function add_source( $fields, $source ){ |
|
| 309 | + private function add_source( $fields, $source ) { |
|
| 310 | 310 | |
| 311 | - if ( empty( $fields ) || empty( $source ) ){ |
|
| 311 | + if ( empty( $fields ) || empty( $source ) ) { |
|
| 312 | 312 | return $fields; |
| 313 | 313 | } |
| 314 | 314 | |
| 315 | - foreach ( $fields as $key => $value ){ |
|
| 315 | + foreach ( $fields as $key => $value ) { |
|
| 316 | 316 | $fields[ $key ]['source'] = $source; |
| 317 | 317 | } |
| 318 | 318 | |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * @subpackage Test Content |
| 10 | 10 | * @author Old Town Media |
| 11 | 11 | */ |
| 12 | -abstract class Type{ |
|
| 12 | +abstract class Type { |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * type |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | /** |
| 34 | 34 | * Registers the type with the rest of the plugin |
| 35 | 35 | */ |
| 36 | - public function register_type(){ |
|
| 36 | + public function register_type() { |
|
| 37 | 37 | |
| 38 | 38 | add_filter( 'tc-types', array( $this, 'set_type' ) ); |
| 39 | 39 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | * @param array $types Original types array |
| 47 | 47 | * @return array Modified types array with our current type |
| 48 | 48 | */ |
| 49 | - public function set_type( $types ){ |
|
| 49 | + public function set_type( $types ) { |
|
| 50 | 50 | |
| 51 | 51 | $types[] = $this->type; |
| 52 | 52 | return $types; |
@@ -10,7 +10,7 @@ discard block |
||
| 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,7 +44,7 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @see tab, view |
| 46 | 46 | */ |
| 47 | - public function register_view(){ |
|
| 47 | + public function register_view() { |
|
| 48 | 48 | |
| 49 | 49 | add_action( 'tc-admin-tabs', array( $this, 'tab' ), $this->priority ); |
| 50 | 50 | add_action( 'tc-admin-sections', array( $this, 'view' ), $this->priority ); |
@@ -58,7 +58,7 @@ discard block |
||
| 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 | 64 | $html .= "<a class='nav-tab' data-type='".sanitize_title( $this->title )."' href='javascript:void(0)'>"; |
@@ -78,7 +78,7 @@ discard block |
||
| 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 | 84 | $html .= "<section class='test-content-tab' data-type='".sanitize_title( $this->title )."'>"; |
@@ -98,7 +98,7 @@ discard block |
||
| 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,7 +115,7 @@ discard block |
||
| 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'>"; |
@@ -139,12 +139,12 @@ discard block |
||
| 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 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | * @subpackage Evans |
| 14 | 14 | * @author Old Town Media |
| 15 | 15 | */ |
| 16 | -class Post extends Abs\Type{ |
|
| 16 | +class Post extends Abs\Type { |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * metabox_types |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * |
| 48 | 48 | * @see MetaboxTypes, MetaboxValues |
| 49 | 49 | */ |
| 50 | - public function __construct(){ |
|
| 50 | + public function __construct() { |
|
| 51 | 51 | |
| 52 | 52 | $this->metabox_types = new Main\MetaboxTypes; |
| 53 | 53 | $this->metabox_values = new Main\MetaboxValues; |
@@ -69,10 +69,10 @@ discard block |
||
| 69 | 69 | * @param boolean $connection Whether or not we're connected to the Internet. |
| 70 | 70 | * @param int $num Optional. Number of posts to create. |
| 71 | 71 | */ |
| 72 | - public function create_objects( $slug, $connection, $num = '' ){ |
|
| 72 | + public function create_objects( $slug, $connection, $num = '' ) { |
|
| 73 | 73 | |
| 74 | 74 | // If we're missing a custom post type id - don't do anything |
| 75 | - if ( empty( $slug ) ){ |
|
| 75 | + if ( empty( $slug ) ) { |
|
| 76 | 76 | return; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -84,12 +84,12 @@ discard block |
||
| 84 | 84 | $this->connected = $connection; |
| 85 | 85 | |
| 86 | 86 | // If we forgot to put in a quantity, make one for us |
| 87 | - if ( empty( $num ) ){ |
|
| 87 | + if ( empty( $num ) ) { |
|
| 88 | 88 | $num = rand( 5, 30 ); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | // Create test posts |
| 92 | - for( $i = 0; $i < $num; $i++ ){ |
|
| 92 | + for( $i = 0; $i < $num; $i++ ) { |
|
| 93 | 93 | |
| 94 | 94 | $return = $this->create_test_object( $slug, $supports, $metaboxes ); |
| 95 | 95 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @param array $supports Features that the post type supports. |
| 116 | 116 | * @param array $supports All CMB2 metaboxes attached to the post type. |
| 117 | 117 | */ |
| 118 | - private function create_test_object( $slug, $supports, $metaboxes ){ |
|
| 118 | + private function create_test_object( $slug, $supports, $metaboxes ) { |
|
| 119 | 119 | $return = ''; |
| 120 | 120 | |
| 121 | 121 | // Get a random title |
@@ -131,17 +131,17 @@ discard block |
||
| 131 | 131 | ); |
| 132 | 132 | |
| 133 | 133 | // Add title if supported |
| 134 | - if ( $supports['title'] === true ){ |
|
| 134 | + if ( $supports['title'] === true ) { |
|
| 135 | 135 | $post['post_title'] = $title; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | // Add main content if supported |
| 139 | - if ( $supports['editor'] === true ){ |
|
| 139 | + if ( $supports['editor'] === true ) { |
|
| 140 | 140 | $post['post_content'] = apply_filters( "tc_{$slug}_post_content", TestContent::paragraphs() ); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | // Add excerpt content if supported |
| 144 | - if ( $supports['excerpt'] === true ){ |
|
| 144 | + if ( $supports['excerpt'] === true ) { |
|
| 145 | 145 | $post['post_excerpt'] = apply_filters( "tc_{$slug}_post_excerpt", TestContent::plain_text() ); |
| 146 | 146 | } |
| 147 | 147 | |
@@ -152,26 +152,26 @@ discard block |
||
| 152 | 152 | add_post_meta( $post_id, 'dummypress_test_data', '__test__', true ); |
| 153 | 153 | |
| 154 | 154 | // Add thumbnail if supported |
| 155 | - if ( $this->connected == true && ( $supports['thumbnail'] === true || in_array( $slug, array( 'post', 'page' ) ) ) ){ |
|
| 155 | + if ( $this->connected == true && ( $supports['thumbnail'] === true || in_array( $slug, array( 'post', 'page' ) ) ) ) { |
|
| 156 | 156 | update_post_meta( $post_id, '_thumbnail_id', TestContent::image( $post_id ) ); |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | $taxonomies = get_object_taxonomies( $slug ); |
| 160 | 160 | |
| 161 | 161 | // Assign the post to terms |
| 162 | - if ( !empty( $taxonomies ) ){ |
|
| 162 | + if ( !empty( $taxonomies ) ) { |
|
| 163 | 163 | $return .= $this->assign_terms( $post_id, $taxonomies ); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | // Spin up metaboxes |
| 167 | - if ( !empty( $metaboxes ) ){ |
|
| 167 | + if ( !empty( $metaboxes ) ) { |
|
| 168 | 168 | foreach ( $metaboxes as $cmb ) : |
| 169 | 169 | $return .= $this->metabox_values->get_values( $post_id, $cmb, $this->connected ); |
| 170 | 170 | endforeach; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | // Check if we have errors and return them or created message |
| 174 | - if ( is_wp_error( $post_id ) ){ |
|
| 174 | + if ( is_wp_error( $post_id ) ) { |
|
| 175 | 175 | error_log( $post_id->get_error_message() ); |
| 176 | 176 | return $post_id; |
| 177 | 177 | } else { |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * @param string $slug a custom post type ID. |
| 199 | 199 | * @return array Array of necessary supports booleans. |
| 200 | 200 | */ |
| 201 | - private function get_cpt_supports( $slug ){ |
|
| 201 | + private function get_cpt_supports( $slug ) { |
|
| 202 | 202 | |
| 203 | 203 | $supports = array( |
| 204 | 204 | 'title' => post_type_supports( $slug, 'title' ), |
@@ -225,21 +225,21 @@ discard block |
||
| 225 | 225 | * @param array $taxonomies taxonomies assigned to this cpt. |
| 226 | 226 | * @return object WP Error if there is one. |
| 227 | 227 | */ |
| 228 | - private function assign_terms( $post_id, $taxonomies ){ |
|
| 228 | + private function assign_terms( $post_id, $taxonomies ) { |
|
| 229 | 229 | |
| 230 | 230 | // Make sure it's an array & has items |
| 231 | - if ( empty( $taxonomies ) || !is_array( $taxonomies ) ){ |
|
| 231 | + if ( empty( $taxonomies ) || !is_array( $taxonomies ) ) { |
|
| 232 | 232 | return; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - foreach ( $taxonomies as $tax ){ |
|
| 235 | + foreach ( $taxonomies as $tax ) { |
|
| 236 | 236 | |
| 237 | 237 | // Get the individual terms already existing |
| 238 | 238 | $terms = get_terms( $tax, array( 'hide_empty' => false ) ); |
| 239 | 239 | $count = count( $terms ) - 1; |
| 240 | 240 | |
| 241 | 241 | // If there are no terms, skip to the next taxonomy |
| 242 | - if ( empty( $terms ) ){ |
|
| 242 | + if ( empty( $terms ) ) { |
|
| 243 | 243 | continue; |
| 244 | 244 | } |
| 245 | 245 | |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | $return = wp_update_post( $post_data ); |
| 259 | 259 | |
| 260 | 260 | // Return the error if it exists |
| 261 | - if ( is_wp_error( $return ) ){ |
|
| 261 | + if ( is_wp_error( $return ) ) { |
|
| 262 | 262 | error_log( $return->get_error_messages() ); |
| 263 | 263 | return $return->get_error_messages(); |
| 264 | 264 | } |
@@ -273,12 +273,12 @@ discard block |
||
| 273 | 273 | * |
| 274 | 274 | * @see Delete |
| 275 | 275 | */ |
| 276 | - public function delete_all(){ |
|
| 276 | + public function delete_all() { |
|
| 277 | 277 | |
| 278 | 278 | $delete = new Delete; |
| 279 | 279 | |
| 280 | 280 | // Make sure that the current user is logged in & has full permissions. |
| 281 | - if ( ! $delete->user_can_delete() ){ |
|
| 281 | + if ( ! $delete->user_can_delete() ) { |
|
| 282 | 282 | return; |
| 283 | 283 | } |
| 284 | 284 | |
@@ -304,17 +304,17 @@ discard block |
||
| 304 | 304 | * |
| 305 | 305 | * @param string $slug a custom post type ID. |
| 306 | 306 | */ |
| 307 | - public function delete( $slug ){ |
|
| 307 | + public function delete( $slug ) { |
|
| 308 | 308 | |
| 309 | 309 | $delete = new Delete; |
| 310 | 310 | |
| 311 | 311 | // Make sure that the current user is logged in & has full permissions. |
| 312 | - if ( ! $delete->user_can_delete() ){ |
|
| 312 | + if ( ! $delete->user_can_delete() ) { |
|
| 313 | 313 | return; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | // Check that $cptslg has a string. |
| 317 | - if ( empty( $slug ) ){ |
|
| 317 | + if ( empty( $slug ) ) { |
|
| 318 | 318 | return; |
| 319 | 319 | } |
| 320 | 320 | |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | |
| 340 | 340 | $objects = new \WP_Query( $query ); |
| 341 | 341 | |
| 342 | - if ( $objects->have_posts() ){ |
|
| 342 | + if ( $objects->have_posts() ) { |
|
| 343 | 343 | |
| 344 | 344 | $events = array(); |
| 345 | 345 | |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | $this->delete_associated_media( get_the_id() ); |
| 350 | 350 | |
| 351 | 351 | // Double check our set user meta value |
| 352 | - if ( '__test__' != get_post_meta( get_the_id(), 'dummypress_test_data', true ) && '__test__' != get_post_meta( get_the_id(), 'evans_test_content', true ) ){ |
|
| 352 | + if ( '__test__' != get_post_meta( get_the_id(), 'dummypress_test_data', true ) && '__test__' != get_post_meta( get_the_id(), 'evans_test_content', true ) ) { |
|
| 353 | 353 | continue; |
| 354 | 354 | } |
| 355 | 355 | |
@@ -392,27 +392,27 @@ discard block |
||
| 392 | 392 | * |
| 393 | 393 | * @param int $pid a custom post type ID. |
| 394 | 394 | */ |
| 395 | - private function delete_associated_media( $pid ){ |
|
| 395 | + private function delete_associated_media( $pid ) { |
|
| 396 | 396 | |
| 397 | 397 | $delete = new Delete; |
| 398 | 398 | |
| 399 | 399 | // Make sure that the current user is logged in & has full permissions. |
| 400 | - if ( !$delete->user_can_delete() ){ |
|
| 400 | + if ( !$delete->user_can_delete() ) { |
|
| 401 | 401 | return; |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | // Make sure $pid is, in fact, an ID |
| 405 | - if ( !is_int( $pid ) ){ |
|
| 405 | + if ( !is_int( $pid ) ) { |
|
| 406 | 406 | return; |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | // Get our images |
| 410 | 410 | $media = get_attached_media( 'image', $pid ); |
| 411 | 411 | |
| 412 | - if ( !empty( $media ) ){ |
|
| 412 | + if ( !empty( $media ) ) { |
|
| 413 | 413 | |
| 414 | 414 | // Loop through the media & delete each one |
| 415 | - foreach ( $media as $attachment ){ |
|
| 415 | + foreach ( $media as $attachment ) { |
|
| 416 | 416 | wp_delete_attachment( $attachment->ID, true ); |
| 417 | 417 | } |
| 418 | 418 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | * @subpackage Evans |
| 14 | 14 | * @author Old Town Media |
| 15 | 15 | */ |
| 16 | -class User extends Abs\Type{ |
|
| 16 | +class User extends Abs\Type { |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * type |
@@ -39,10 +39,10 @@ discard block |
||
| 39 | 39 | * @param boolean $connection Whether or not we're connected to the Internet. |
| 40 | 40 | * @param int $num Optional. Number of posts to create. |
| 41 | 41 | */ |
| 42 | - public function create_objects( $slug, $connection, $num = '' ){ |
|
| 42 | + public function create_objects( $slug, $connection, $num = '' ) { |
|
| 43 | 43 | |
| 44 | 44 | // If we're missing a custom post type id - don't do anything |
| 45 | - if ( empty( $slug ) ){ |
|
| 45 | + if ( empty( $slug ) ) { |
|
| 46 | 46 | return; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -50,12 +50,12 @@ discard block |
||
| 50 | 50 | $this->connected = $connection; |
| 51 | 51 | |
| 52 | 52 | // If we forgot to put in a quantity, make one for us |
| 53 | - if ( empty( $num ) ){ |
|
| 53 | + if ( empty( $num ) ) { |
|
| 54 | 54 | $num = rand( 5, 30 ); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | // Create test posts |
| 58 | - for( $i = 0; $i < $num; $i++ ){ |
|
| 58 | + for( $i = 0; $i < $num; $i++ ) { |
|
| 59 | 59 | |
| 60 | 60 | $return = $this->create_test_object( $slug ); |
| 61 | 61 | |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @param string $slug a custom post type ID. |
| 81 | 81 | */ |
| 82 | - private function create_test_object( $slug ){ |
|
| 82 | + private function create_test_object( $slug ) { |
|
| 83 | 83 | |
| 84 | - if ( !is_user_logged_in() ){ |
|
| 84 | + if ( !is_user_logged_in() ) { |
|
| 85 | 85 | return false; |
| 86 | 86 | } |
| 87 | 87 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | add_user_meta( $user_id, 'dummypress_test_data', '__test__', true ); |
| 108 | 108 | |
| 109 | 109 | // Check if we have errors and return them or created message |
| 110 | - if ( is_wp_error( $user_id ) ){ |
|
| 110 | + if ( is_wp_error( $user_id ) ) { |
|
| 111 | 111 | error_log( $user_id->get_error_message() ); |
| 112 | 112 | return $user_id; |
| 113 | 113 | } else { |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | * |
| 134 | 134 | * @return array Array of roles for use in creation and deletion |
| 135 | 135 | */ |
| 136 | - public function get_roles(){ |
|
| 136 | + public function get_roles() { |
|
| 137 | 137 | global $wp_roles; |
| 138 | 138 | $clean_roles = array(); |
| 139 | 139 | |
@@ -147,9 +147,9 @@ discard block |
||
| 147 | 147 | 'Administrator' |
| 148 | 148 | ); |
| 149 | 149 | |
| 150 | - foreach ( $roles as $role ){ |
|
| 150 | + foreach ( $roles as $role ) { |
|
| 151 | 151 | |
| 152 | - if ( in_array( $role['name'], $skipped_roles ) ){ |
|
| 152 | + if ( in_array( $role['name'], $skipped_roles ) ) { |
|
| 153 | 153 | continue; |
| 154 | 154 | } |
| 155 | 155 | |
@@ -170,12 +170,12 @@ discard block |
||
| 170 | 170 | * |
| 171 | 171 | * @see Delete |
| 172 | 172 | */ |
| 173 | - public function delete_all(){ |
|
| 173 | + public function delete_all() { |
|
| 174 | 174 | |
| 175 | 175 | $delete = new Delete; |
| 176 | 176 | |
| 177 | 177 | // Make sure that the current user is logged in & has full permissions. |
| 178 | - if ( ! $delete->user_can_delete() ){ |
|
| 178 | + if ( ! $delete->user_can_delete() ) { |
|
| 179 | 179 | return; |
| 180 | 180 | } |
| 181 | 181 | |
@@ -208,17 +208,17 @@ discard block |
||
| 208 | 208 | * |
| 209 | 209 | * @param string $slug a custom post type ID. |
| 210 | 210 | */ |
| 211 | - public function delete( $slug ){ |
|
| 211 | + public function delete( $slug ) { |
|
| 212 | 212 | |
| 213 | 213 | $delete = new Delete; |
| 214 | 214 | |
| 215 | 215 | // Make sure that the current user is logged in & has full permissions. |
| 216 | - if ( !$delete->user_can_delete() ){ |
|
| 216 | + if ( !$delete->user_can_delete() ) { |
|
| 217 | 217 | return; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | // Check that $cptslg has a string. |
| 221 | - if ( empty( $slug ) ){ |
|
| 221 | + if ( empty( $slug ) ) { |
|
| 222 | 222 | return; |
| 223 | 223 | } |
| 224 | 224 | |
@@ -244,19 +244,19 @@ discard block |
||
| 244 | 244 | $objects = new \WP_User_Query( $query ); |
| 245 | 245 | $users = $objects->get_results(); |
| 246 | 246 | |
| 247 | - if ( !empty( $users ) ){ |
|
| 247 | + if ( !empty( $users ) ) { |
|
| 248 | 248 | |
| 249 | 249 | $events = array(); |
| 250 | 250 | |
| 251 | - foreach ( $users as $user ){ |
|
| 251 | + foreach ( $users as $user ) { |
|
| 252 | 252 | |
| 253 | 253 | // Make sure we can't delete ourselves by accident |
| 254 | - if ( $user->ID == get_current_user_id() ){ |
|
| 254 | + if ( $user->ID == get_current_user_id() ) { |
|
| 255 | 255 | continue; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | // Double check our set user meta value |
| 259 | - if ( '__test__' != get_user_meta( $user->ID, 'dummypress_test_data', true ) && '__test__' != get_user_meta( $user->ID, 'evans_test_content', true ) ){ |
|
| 259 | + if ( '__test__' != get_user_meta( $user->ID, 'dummypress_test_data', true ) && '__test__' != get_user_meta( $user->ID, 'evans_test_content', true ) ) { |
|
| 260 | 260 | continue; |
| 261 | 261 | } |
| 262 | 262 | |
@@ -12,7 +12,7 @@ discard block |
||
| 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 |
||
| 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,12 +48,12 @@ discard block |
||
| 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 ) ){ |
|
| 51 | + if ( empty( $num ) ) { |
|
| 52 | 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 | 58 | $return = $this->create_test_object( $slug ); |
| 59 | 59 | |
@@ -77,7 +77,7 @@ discard block |
||
| 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 | 83 | $title = apply_filters( "tc_{$slug}_term_title", TestContent::title() ); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | add_term_meta( $return['term_id'], 'dummypress_test_data', '__test__', true ); |
| 97 | 97 | |
| 98 | 98 | // Check if we have errors and return them or created message |
| 99 | - if ( is_wp_error( $return ) ){ |
|
| 99 | + if ( is_wp_error( $return ) ) { |
|
| 100 | 100 | error_log( $return->get_error_message() ); |
| 101 | 101 | return $return; |
| 102 | 102 | } else { |
@@ -119,12 +119,12 @@ discard block |
||
| 119 | 119 | * |
| 120 | 120 | * @see Delete |
| 121 | 121 | */ |
| 122 | - public function delete_all(){ |
|
| 122 | + public function delete_all() { |
|
| 123 | 123 | |
| 124 | 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 | |
@@ -150,17 +150,17 @@ discard block |
||
| 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 | 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 | |
@@ -184,14 +184,14 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | $terms = get_terms( $slug, $args ); |
| 186 | 186 | |
| 187 | - if ( !empty( $terms ) ){ |
|
| 187 | + if ( !empty( $terms ) ) { |
|
| 188 | 188 | |
| 189 | 189 | $events = array(); |
| 190 | 190 | |
| 191 | - foreach ( $terms as $term ){ |
|
| 191 | + foreach ( $terms as $term ) { |
|
| 192 | 192 | |
| 193 | 193 | // Double check our set user meta value |
| 194 | - if ( '__test__' != get_term_meta( $term->term_id, 'dummypress_test_data', true ) && '__test__' != get_term_meta( $term->term_id, 'evans_test_content', true ) ){ |
|
| 194 | + if ( '__test__' != get_term_meta( $term->term_id, 'dummypress_test_data', true ) && '__test__' != get_term_meta( $term->term_id, 'evans_test_content', true ) ) { |
|
| 195 | 195 | continue; |
| 196 | 196 | } |
| 197 | 197 | |
@@ -8,7 +8,7 @@ |
||
| 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 | |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * @subpackage Evans |
| 9 | 9 | * @author Old Town Media |
| 10 | 10 | */ |
| 11 | -class Ajax{ |
|
| 11 | +class Ajax { |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * reporting |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | /** |
| 40 | 40 | * Instantiate any WP hooks that need to be fired. |
| 41 | 41 | */ |
| 42 | - public function hooks(){ |
|
| 42 | + public function hooks() { |
|
| 43 | 43 | |
| 44 | 44 | $this->reporting = new Reporting; |
| 45 | 45 | $this->action = 'handle_test_data'; |
@@ -77,13 +77,13 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | public function ajax_exclude_plugins( $plugins ) { |
| 79 | 79 | |
| 80 | - if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || ! isset( $_POST['action'] ) || false === strpos( $_POST['action'], $this->action ) ){ |
|
| 80 | + if ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX || ! isset( $_POST['action'] ) || false === strpos( $_POST['action'], $this->action ) ) { |
|
| 81 | 81 | return $plugins; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | foreach( $plugins as $key => $plugin ) { |
| 85 | 85 | |
| 86 | - if ( false !== strpos( $plugin, $this->plugin->definitions->slug ) ){ |
|
| 86 | + if ( false !== strpos( $plugin, $this->plugin->definitions->slug ) ) { |
|
| 87 | 87 | continue; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -106,15 +106,15 @@ discard block |
||
| 106 | 106 | $nonce = $_REQUEST['nonce']; |
| 107 | 107 | |
| 108 | 108 | // Verify that we have a proper logged in user and it's the right person |
| 109 | - if ( empty( $nonce ) || ! wp_verify_nonce( $nonce, 'handle-test-data' ) ){ |
|
| 109 | + if ( empty( $nonce ) || ! wp_verify_nonce( $nonce, 'handle-test-data' ) ) { |
|
| 110 | 110 | return; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if ( $action == 'delete' ){ |
|
| 113 | + if ( $action == 'delete' ) { |
|
| 114 | 114 | |
| 115 | 115 | $this->deletion_routing( $_REQUEST ); |
| 116 | 116 | |
| 117 | - } elseif ( $action == 'create' ){ |
|
| 117 | + } elseif ( $action == 'create' ) { |
|
| 118 | 118 | |
| 119 | 119 | $this->creation_routing( $_REQUEST ); |
| 120 | 120 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * Choose which type of creation needs to be accomplished and route through |
| 130 | 130 | * the correct class. |
| 131 | 131 | */ |
| 132 | - private function creation_routing( $data ){ |
|
| 132 | + private function creation_routing( $data ) { |
|
| 133 | 133 | |
| 134 | 134 | $type = 'DummyPress\Types\\' . ucwords( $data['type'] ); |
| 135 | 135 | $object = new $type(); |
@@ -146,11 +146,11 @@ discard block |
||
| 146 | 146 | * Choose which type of deletion needs to be accomplished and route through |
| 147 | 147 | * the correct method of Delete. |
| 148 | 148 | */ |
| 149 | - private function deletion_routing( $data ){ |
|
| 149 | + private function deletion_routing( $data ) { |
|
| 150 | 150 | |
| 151 | 151 | $delete_content = new Delete; |
| 152 | 152 | |
| 153 | - if ( $data['type'] == 'all' ){ |
|
| 153 | + if ( $data['type'] == 'all' ) { |
|
| 154 | 154 | |
| 155 | 155 | $return = $delete_content->delete_all_test_data(); |
| 156 | 156 | |