From a243f9607ec81327f803d5bdd142e7d6332a523a Mon Sep 17 00:00:00 2001 From: Junaid Bhura Date: Mon, 13 Nov 2017 09:34:05 +1030 Subject: [PATCH] Travis re-introduce PHPCS --- .travis.yml | 2 ++ inc/class-core.php | 24 ++++++++++++------------ tests/test-plugin.php | 2 +- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index 56fbf51..151bf15 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,6 +26,8 @@ matrix: env: WP_VERSION=latest - php: 5.6 env: WP_VERSION=trunk + - php: 5.6 + env: WP_TRAVISCI=phpcs before_script: - export PATH="$HOME/.composer/vendor/bin:$PATH" diff --git a/inc/class-core.php b/inc/class-core.php index 4873ebe..8c6c0ad 100644 --- a/inc/class-core.php +++ b/inc/class-core.php @@ -18,7 +18,7 @@ class Core { */ public static function get_instance() { if ( ! self::$_instance ) { - $class = __CLASS__; + $class = __CLASS__; self::$_instance = new $class(); } return self::$_instance; @@ -28,7 +28,7 @@ public static function get_instance() { * Initialize plugin. */ public function init() { - $this->_fly_dir = apply_filters( 'fly_dir_path', $this->get_fly_dir() ); + $this->_fly_dir = apply_filters( 'fly_dir_path', $this->get_fly_dir() ); $this->_capability = apply_filters( 'fly_images_user_capability', $this->_capability ); $this->check_fly_dir(); @@ -96,7 +96,7 @@ public function media_row_action( $actions, $post ) { return $actions; } - $url = wp_nonce_url( admin_url( 'tools.php?page=fly-images&delete-fly-image&ids=' . $post->ID ), 'delete_fly_image', 'fly_nonce' ); + $url = wp_nonce_url( admin_url( 'tools.php?page=fly-images&delete-fly-image&ids=' . $post->ID ), 'delete_fly_image', 'fly_nonce' ); $actions['fly-image-delete'] = '' . __( 'Delete Fly Images', 'fly-images' ) . ''; return $actions; @@ -234,12 +234,12 @@ public function get_attachment_image_src( $attachment_id = 0, $size = '', $crop if ( empty( $image_size ) ) { return array(); } - $width = $image_size['size'][0]; + $width = $image_size['size'][0]; $height = $image_size['size'][1]; - $crop = isset( $crop ) ? $crop : $image_size['crop']; + $crop = isset( $crop ) ? $crop : $image_size['crop']; break; case 'array': - $width = $size[0]; + $width = $size[0]; $height = $size[1]; break; default: @@ -247,7 +247,7 @@ public function get_attachment_image_src( $attachment_id = 0, $size = '', $crop } // Get file path - $fly_dir = $this->get_fly_dir( $attachment_id ); + $fly_dir = $this->get_fly_dir( $attachment_id ); $fly_file_path = $fly_dir . DIRECTORY_SEPARATOR . $this->get_fly_file_name( basename( $image['file'] ), $width, $height, $crop ); // Check if file exsists @@ -273,7 +273,7 @@ public function get_attachment_image_src( $attachment_id = 0, $size = '', $crop $this->check_fly_dir(); // Get WP Image Editor Instance - $image_path = get_attached_file( $attachment_id ); + $image_path = get_attached_file( $attachment_id ); $image_editor = wp_get_image_editor( $image_path ); if ( ! is_wp_error( $image_editor ) ) { // Create new image @@ -318,15 +318,15 @@ public function get_attachment_image( $attachment_id = 0, $size = '', $crop = nu return wp_get_attachment_image( $attachment_id, $size, $attr ); } - $html = ''; + $html = ''; $image = $this->get_attachment_image_src( $attachment_id, $size, $crop ); if ( $image ) { - $hwstring = image_hwstring( $image['width'], $image['height'] ); + $hwstring = image_hwstring( $image['width'], $image['height'] ); $size_class = $size; if ( is_array( $size_class ) ) { $size_class = join( 'x', $size ); } - $attachment = get_post( $attachment_id ); + $attachment = get_post( $attachment_id ); $default_attr = array( 'src' => $image['src'], 'class' => "attachment-$size_class", @@ -388,7 +388,7 @@ public function get_fly_file_name( $file_name, $width, $height, $crop ) { */ public function get_fly_path( $absolute_path = '' ) { $wp_upload_dir = wp_upload_dir(); - $path = $wp_upload_dir['baseurl'] . str_replace( $wp_upload_dir['basedir'], '', $absolute_path ); + $path = $wp_upload_dir['baseurl'] . str_replace( $wp_upload_dir['basedir'], '', $absolute_path ); return str_replace( DIRECTORY_SEPARATOR, '/', $path ); } diff --git a/tests/test-plugin.php b/tests/test-plugin.php index a6e1a50..c7236ec 100644 --- a/tests/test-plugin.php +++ b/tests/test-plugin.php @@ -12,7 +12,7 @@ class JB_Test_Fly_Plugin extends WP_UnitTestCase { * Setup. */ static function setUpBeforeClass() { - self::$_core = \JB\FlyImages\Core::get_instance(); + self::$_core = \JB\FlyImages\Core::get_instance(); self::$_image_id = self::upload_image(); }