Skip to content
This repository has been archived by the owner on Aug 12, 2023. It is now read-only.

Commit

Permalink
Travis re-introduce PHPCS
Browse files Browse the repository at this point in the history
  • Loading branch information
junaidbhura committed Nov 12, 2017
1 parent c82be9b commit a243f96
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
24 changes: 12 additions & 12 deletions inc/class-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down Expand Up @@ -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'] = '<a href="' . esc_url( $url ) . '" title="' . esc_attr( __( 'Delete all cached image sizes for this image', 'fly-images' ) ) . '">' . __( 'Delete Fly Images', 'fly-images' ) . '</a>';

return $actions;
Expand Down Expand Up @@ -234,20 +234,20 @@ 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:
return array();
}

// 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
Expand All @@ -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
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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 );
}

Expand Down
2 changes: 1 addition & 1 deletion tests/test-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit a243f96

Please sign in to comment.