@@ -77,17 +77,17 @@ 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 | - foreach( $plugins as $key => $plugin ) { |
|
| 84 | + foreach ( $plugins as $key => $plugin ) { |
|
| 85 | 85 | |
| 86 | 86 | if ( false !== strpos( $plugin, $this->plugin->definitions->slug ) ) { |
| 87 | 87 | continue; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - unset( $plugins[$key] ); |
|
| 90 | + unset( $plugins[ $key ] ); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | return $plugins; |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | public function handle_ajax() { |
| 104 | 104 | |
| 105 | - $action = $_REQUEST['todo']; |
|
| 106 | - $nonce = $_REQUEST['nonce']; |
|
| 105 | + $action = $_REQUEST[ 'todo' ]; |
|
| 106 | + $nonce = $_REQUEST[ 'nonce' ]; |
|
| 107 | 107 | |
| 108 | 108 | // Verify that we have a proper logged in user and it's the right person |
| 109 | 109 | if ( empty( $nonce ) || ! wp_verify_nonce( $nonce, 'handle-test-data' ) ) { |
@@ -131,9 +131,9 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | private function creation_routing( $data ) { |
| 133 | 133 | |
| 134 | - $type = 'DummyPress\Types\\' . ucwords( $data['type'] ); |
|
| 134 | + $type = 'DummyPress\Types\\' . ucwords( $data[ 'type' ] ); |
|
| 135 | 135 | $object = new $type(); |
| 136 | - $return = $object->create_objects( $data['slug'], $data['connection'], true, 1 ); |
|
| 136 | + $return = $object->create_objects( $data[ 'slug' ], $data[ 'connection' ], true, 1 ); |
|
| 137 | 137 | |
| 138 | 138 | $clean = $this->reporting->create_report( $return ); |
| 139 | 139 | |
@@ -150,7 +150,7 @@ discard block |
||
| 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 | |
@@ -64,8 +64,8 @@ |
||
| 64 | 64 | return; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $type = 'DummyPress\Types\\' . ucwords( $data['type'] ); |
|
| 68 | - $slug = $data['slug']; |
|
| 67 | + $type = 'DummyPress\Types\\' . ucwords( $data[ 'type' ] ); |
|
| 68 | + $slug = $data[ 'slug' ]; |
|
| 69 | 69 | |
| 70 | 70 | $object = new $type(); |
| 71 | 71 | |
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 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 | 54 | add_action( 'admin_menu', array( $this, 'add_menu_item' ) ); |
| 55 | 55 | add_filter( 'plugin_action_links_' . $this->definitions->basename, array( $this, 'add_settings_link' ) ); |
@@ -142,8 +142,8 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 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 | 149 | 'nonce' => wp_create_nonce( 'handle-test-data' ), |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | // Pull random words |
| 75 | - for( $i = 1; $i <= $num_words; $i++ ) { |
|
| 75 | + for ( $i = 1; $i <= $num_words; $i++ ) { |
|
| 76 | 76 | $title .= $random_words[ rand( 0, 31 ) ] . " "; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -351,17 +351,17 @@ discard block |
||
| 351 | 351 | ); |
| 352 | 352 | |
| 353 | 353 | $used_keys = array(); |
| 354 | - for( $i = 1; $i < 7; $i++ ) { |
|
| 354 | + for ( $i = 1; $i < 7; $i++ ) { |
|
| 355 | 355 | |
| 356 | 356 | // Pull a new random key and make sure we're not repeating any elements |
| 357 | 357 | $key = rand( 0, 12 ); |
| 358 | - while( in_array( $key, $used_keys ) ) { |
|
| 358 | + while ( in_array( $key, $used_keys ) ) { |
|
| 359 | 359 | $key = rand( 0, 12 ); |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - $content .= $random_content_types[$key]; |
|
| 362 | + $content .= $random_content_types[ $key ]; |
|
| 363 | 363 | |
| 364 | - $used_keys[] = $key; |
|
| 364 | + $used_keys[ ] = $key; |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | return apply_filters( "tc_paragraphs_data", $content ); |
@@ -431,8 +431,8 @@ discard block |
||
| 431 | 431 | |
| 432 | 432 | preg_match( '/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $url, $matches ); |
| 433 | 433 | |
| 434 | - $file_array['name'] = basename( $matches[0] ); |
|
| 435 | - $file_array['tmp_name'] = $tmp; |
|
| 434 | + $file_array[ 'name' ] = basename( $matches[ 0 ] ); |
|
| 435 | + $file_array[ 'tmp_name' ] = $tmp; |
|
| 436 | 436 | |
| 437 | 437 | // Check for download errors |
| 438 | 438 | if ( is_wp_error( $tmp ) ) { |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | |
| 446 | 446 | // Check for handle sideload errors. |
| 447 | 447 | if ( is_wp_error( $image_id ) ) { |
| 448 | - unlink( $file_array['tmp_name'] ); |
|
| 448 | + unlink( $file_array[ 'tmp_name' ] ); |
|
| 449 | 449 | error_log( $image_id->get_error_message() ); |
| 450 | 450 | } |
| 451 | 451 | |
@@ -483,10 +483,10 @@ discard block |
||
| 483 | 483 | $response = json_decode( $curl_response, true ); |
| 484 | 484 | |
| 485 | 485 | // Check to make sure that the return contains a valid image extensions |
| 486 | - preg_match('/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $response['url'], $matches); |
|
| 486 | + preg_match( '/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG)/', $response[ 'url' ], $matches ); |
|
| 487 | 487 | |
| 488 | 488 | if ( ! empty( $matches ) ) { |
| 489 | - return $response['url']; |
|
| 489 | + return $response[ 'url' ]; |
|
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | } |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | public static function video( $type ) { |
| 719 | 719 | |
| 720 | 720 | // Switch through our video types. Expecting to add more in the future |
| 721 | - switch( $type ) { |
|
| 721 | + switch ( $type ) { |
|
| 722 | 722 | |
| 723 | 723 | // YouTube videos |
| 724 | 724 | case 'youtube' : |
@@ -89,7 +89,7 @@ |
||
| 89 | 89 | return false; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - $last_uri_bit = explode( '=', $_SERVER['REQUEST_URI'] ); |
|
| 92 | + $last_uri_bit = explode( '=', $_SERVER[ 'REQUEST_URI' ] ); |
|
| 93 | 93 | if ( 'create-test-data' != end( $last_uri_bit ) ) { |
| 94 | 94 | return false; |
| 95 | 95 | } |