soderlind/read-offline

View on GitHub
inc/class-read-offline.php

Summary

Maintainability
F
3 days
Test Coverage

Method save_as_attachment_to_post_type has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function save_as_attachment_to_post_type( $post_id, $post ) {

        // Autosave, do nothing
        if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
                return $post_id; }
Severity: Major
Found in inc/class-read-offline.php - About 2 hrs to fix

    File class-read-offline.php has 266 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    if ( ! defined( 'FS_CHMOD_DIR' ) ) {
        define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) );
    }
    Severity: Minor
    Found in inc/class-read-offline.php - About 2 hrs to fix

      Function save_as_attachment_to_post_type has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public function save_as_attachment_to_post_type( $post_id, $post ) {
      
              // Autosave, do nothing
              if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
                      return $post_id; }
      Severity: Minor
      Found in inc/class-read-offline.php - About 2 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function _create_tmp_directories has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          private function _create_tmp_directories() {
              global $wp_filesystem;
              if ( ! $wp_filesystem || ! is_object( $wp_filesystem ) ) {
                  WP_Filesystem(); }
              if ( ! is_object( $wp_filesystem ) ) {
      Severity: Minor
      Found in inc/class-read-offline.php - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method __construct has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function __construct() {
      
              self::$options = get_option( 'Read_Offline_Admin_Settings' );
      
              // Only generate files for formats selected in plugin settings
      Severity: Minor
      Found in inc/class-read-offline.php - About 1 hr to fix

        Function _remove_tmp_directories has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            private function _remove_tmp_directories() {
                global $wp_filesystem;
                if ( ! $wp_filesystem || ! is_object( $wp_filesystem ) ) {
                    WP_Filesystem(); }
                if ( ! is_object( $wp_filesystem ) ) {
        Severity: Minor
        Found in inc/class-read-offline.php - About 55 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function __construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            private function __construct() {
        
                self::$options = get_option( 'Read_Offline_Admin_Settings' );
        
                // Only generate files for formats selected in plugin settings
        Severity: Minor
        Found in inc/class-read-offline.php - About 45 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function read_offline_update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function read_offline_update() {
        
                $options = get_option( 'Read_Offline' );
                $version = (isset( $options['version'] )) ? $options['version'] : '0';
        
        
        Severity: Minor
        Found in inc/class-read-offline.php - About 35 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Avoid too many return statements within this method.
        Open

                        return $post_id; }
        Severity: Major
        Found in inc/class-read-offline.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return add_action( 'admin_notices', function() use ( $error ) {
                                  $msg[] = '<div class="error"><p>';
                                  $msg[] = '<strong>Read Offline</strong>: ';
                                  $msg[] = sprintf( __( 'wp_upload_bits failed,  error: "<strong>%s</strong>','read-offline' ), $error );
                                  $msg[] = '</p></div>';
          Severity: Major
          Found in inc/class-read-offline.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return $post_id; }
            Severity: Major
            Found in inc/class-read-offline.php - About 30 mins to fix

              Function image_create_frome_image has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function image_create_frome_image( $filepath ) {
                      $type = exif_imagetype( $filepath ); // [] if you don't have exif you could use getImageSize()
                      $allowed_types = array(
                          1,  // [] gif
                          2,  // [] jpg
              Severity: Minor
              Found in inc/class-read-offline.php - About 25 mins to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                              if ( true !== $wp_filesystem->rmdir( $directory , true ) ) {
                                  return add_action( 'admin_notices', function() use ( $directory ) {
                                          $msg[] = '<div class="error"><p>';
                                          $msg[] = '<strong>Read Offline</strong>: ';
                                          $msg[] = sprintf( __( 'Unable to remove cache directory "<strong>%s</strong>". Is it and its directories writable by the server?','read-offline' ), $directory );
              Severity: Major
              Found in inc/class-read-offline.php and 1 other location - About 3 hrs to fix
              inc/class-read-offline.php on lines 290..298

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 93.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                                  if ( ! $wp_filesystem->mkdir( $path, FS_CHMOD_DIR ) ) {
                                      return add_action( 'admin_notices', function() use ( $path ) {
                                          $msg[] = '<div class="error"><p>';
                                          $msg[] = '<strong>Read Offline</strong>: ';
                                          $msg[] = sprintf( __( 'Unable to create directory "<strong>%s</strong>". Is its parent directory writable by the server?','read-offline' ), $path );
              Severity: Major
              Found in inc/class-read-offline.php and 1 other location - About 3 hrs to fix
              inc/class-read-offline.php on lines 315..323

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 93.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                          if ( false === isset( self::$options['mobi']['add_toc'] ) ) {
                              self::$options['mobi']['add_toc'] = 0;
                              self::$options['mobi']['toc'] = 0;
                              update_option( 'Read_Offline_Admin_Settings', self::$options );
                          }
              Severity: Major
              Found in inc/class-read-offline.php and 1 other location - About 2 hrs to fix
              inc/class-read-offline.php on lines 266..270

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 77.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                          if ( false === isset( self::$options['epub']['add_toc'] ) ) {
                              self::$options['epub']['add_toc'] = 0;
                              self::$options['epub']['toc'] = 0;
                              update_option( 'Read_Offline_Admin_Settings', self::$options );
                          }
              Severity: Major
              Found in inc/class-read-offline.php and 1 other location - About 2 hrs to fix
              inc/class-read-offline.php on lines 261..265

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 77.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 3 locations. Consider refactoring.
              Open

                      $post_types = array_keys(array_intersect(
                          self::$options['where']['post_types'],
                          array(
                               'post' => 1,
                               'page' => 1,
              Severity: Major
              Found in inc/class-read-offline.php and 2 other locations - About 45 mins to fix
              inc/class-read-offline-shortcode.php on lines 79..85
              inc/class-read-offline-ux.php on lines 93..99

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 46.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                      if ( ! is_object( $wp_filesystem ) ) {
                          wp_die( 'WP_Filesystem Error:' . print_r( $wp_filesystem,true ) ); }
              Severity: Minor
              Found in inc/class-read-offline.php and 1 other location - About 30 mins to fix
              inc/class-read-offline.php on lines 281..282

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 41.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                      if ( ! is_object( $wp_filesystem ) ) {
                          wp_die( 'WP_Filesystem Error:' . print_r( $wp_filesystem,true ) ); }
              Severity: Minor
              Found in inc/class-read-offline.php and 1 other location - About 30 mins to fix
              inc/class-read-offline.php on lines 309..310

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 41.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                      } else {
                          return sprintf('%s/index.php?read_offline_id=%s&read_offline_name=%s&&read_offline_format=%s%s',
                              site_url(),$post_id,$name,$format,
                              ( $refresh ) ? '&read-offline-code=' . $code  : ''
                          );
              Severity: Minor
              Found in inc/class-read-offline.php and 1 other location - About 30 mins to fix
              inc/class-read-offline.php on lines 72..82

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 40.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                          $attachments = new WP_Query( array(
                              'post_type'      => 'attachment',
                              'post_status'    => 'any',
                              'posts_per_page' => 500,
                              'post_parent'    => $post_id,
              Severity: Minor
              Found in inc/class-read-offline.php and 1 other location - About 30 mins to fix
              inc/class-read-offline-parser.php on lines 67..73

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 40.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                      if ( get_option( 'permalink_structure' ) ) {
                          return sprintf('%s/read-offline/%s/%s.%s%s',
                              site_url(),$post_id,$name,$format,
                              ( $refresh ) ? '?read-offline-code=' . $code  : ''
                          );
              Severity: Minor
              Found in inc/class-read-offline.php and 1 other location - About 30 mins to fix
              inc/class-read-offline.php on lines 77..82

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 40.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Tabs must be used to indent lines; spaces are not allowed
              Open

                      $allowed_types = array(
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Terminating statement must be indented to the same level as the CASE body
              Open

                          break;
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                      $the_excerpt = '<p>' . $the_excerpt . '</p>';
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Space after opening control structure is required
              Open

                      if( (bool) self::$options['what']['formats']['epub'] ) {
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Space after opening control structure is required
              Open

                      if( (bool) self::$options['what']['formats']['pdf'] ) {
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Expected 1 space before ":"; 2 found
              Open

                              ( $refresh ) ? '?read-offline-code=' . $code  : ''
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                          return false;
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                      switch ( $type ) {
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              There must be no space before the colon in a CASE statement
              Open

                          case 1 :
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Array item not aligned correctly; expected 16 spaces but found 17
              Open

                               'page' => 1,
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Terminating statement must be indented to the same level as the CASE body
              Open

                          break;
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                      $the_excerpt = $the_post->post_content; //Gets post_content to be used as a basis for the excerpt
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Equals sign not aligned with surrounding assignments; expected 10 spaces but found 1 space
              Open

                      $words = explode( ' ', $the_excerpt, $excerpt_length + 1 );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                      return $the_excerpt;
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              No space before opening parenthesis is prohibited
              Open

                      if( (bool) self::$options['what']['formats']['epub'] ) {
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                          case 1 :
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                      }
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                              return $post_id; }
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                      }
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                              $im = imageCreateFromBmp( $filepath );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                      $words = explode( ' ', $the_excerpt, $excerpt_length + 1 );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                      if ( ! in_array( $type, $allowed_types ) ) {
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                          case 3 :
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                      $type = exif_imagetype( $filepath ); // [] if you don't have exif you could use getImageSize()
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              There must be no space before the colon in a CASE statement
              Open

                          case 2 :
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Terminating statement must be indented to the same level as the CASE body
              Open

                          break;
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                          break;
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                          $the_excerpt = implode( ' ', $words );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                              return $post_id; }
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              No space before opening parenthesis is prohibited
              Open

                      if( (bool) self::$options['what']['formats']['pdf'] ) {
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Found precision alignment of 1 spaces.
              Open

                               'page' => 1,
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Equals sign not aligned with surrounding assignments; expected 10 spaces but found 1 space
              Open

                      $type = exif_imagetype( $filepath ); // [] if you don't have exif you could use getImageSize()
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                              $im = imageCreateFromPng( $filepath );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Terminating statement must be indented to the same level as the CASE body
              Open

                          break;
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space
              Open

                      $the_excerpt = $the_post->post_content; //Gets post_content to be used as a basis for the excerpt
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                          break;
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                          case 2 :
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                      return $im;
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                      $the_post = get_post( $post_id ); //Gets post ID
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                          array_pop( $words );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                                          $msg[] = sprintf( __( 'Unable to remove cache directory "<strong>%s</strong>". Is it and its directories writable by the server?','read-offline' ), $directory );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Array item not aligned correctly; expected 16 spaces but found 17
              Open

                               'post' => 1,
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                          array_push( $words, '…' );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space
              Open

                              self::$options['epub']['toc'] = 0;
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                                          $msg[] = '<div class="error"><p>';
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                                          $msg[] = '<div class="error"><p>';
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              A gettext call containing placeholders was found, but was not accompanied by a "translators:" comment on the line above to clarify the meaning of the placeholders.
              Open

                                          $msg[] = sprintf( __( 'Unable to remove cache directory "<strong>%s</strong>". Is it and its directories writable by the server?','read-offline' ), $directory );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space
              Open

                          $to_filename = sprintf( '%s.%s',$post->post_name,$file_extention );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                                      echo implode( PHP_EOL, $msg );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Concat operator must be surrounded by a single space
              Open

                          header( 'Content-disposition: attachment; filename="'. basename( $attached_file ) .'"' );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Expected 1 space after open parenthesis; 0 found
              Open

                      $version = (isset( $options['version'] )) ? $options['version'] : '0';
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                                          $msg[] = '</p></div>';
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                                          echo implode( PHP_EOL, $msg );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                                      $msg[] = sprintf( __( 'wp_upload_bits failed,  error: "<strong>%s</strong>','read-offline' ), $error );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                              $im = imageCreateFromGif( $filepath );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                          break;
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              A gettext call containing placeholders was found, but was not accompanied by a "translators:" comment on the line above to clarify the meaning of the placeholders.
              Open

                                      $msg[] = sprintf( __( 'wp_upload_bits failed,  error: "<strong>%s</strong>','read-offline' ), $error );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                              return $post_id; }
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                                  return add_action( 'admin_notices', function() use ( $directory ) {
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Space found before comma in function call
              Open

                          header( 'Content-Type: ' . $mime_type , false );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Space after opening control structure is required
              Open

                      if( (bool) self::$options['what']['formats']['mobi'] ) {
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Expected 1 space before ":"; 2 found
              Open

                              ( $refresh ) ? '&read-offline-code=' . $code  : ''
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                          6,   // [] bmp
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                      );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              There must be no space before the colon in a CASE statement
              Open

                          case 6 :
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              No space before opening parenthesis is prohibited
              Open

                      if( (bool) self::$options['what']['formats']['mobi'] ) {
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space
              Open

                          $attachments = new WP_Query( array(
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                                      $msg[] = '<div class="error"><p>';
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                          2,  // [] jpg
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                              $im = imageCreateFromJpeg( $filepath );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                      $excerpt_length = 35; //Sets excerpt length by word count
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                      return $mime_types;
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                      if ( count( $words ) > $excerpt_length ) :
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Concat operator must be surrounded by a single space
              Open

                              header( 'Content-Length: '.filesize( $attached_file ) );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                                          $msg[] = sprintf( __( 'Unable to create directory "<strong>%s</strong>". Is its parent directory writable by the server?','read-offline' ), $path );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                                          $msg[] = '</p></div>';
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                                          $msg[] = '<strong>Read Offline</strong>: ';
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                      }
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                          $mime_types[ $file_extention ] = $mime_type;
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Concat operator must be surrounded by a single space
              Open

                          header( 'Content-disposition: attachment; filename="'. basename( $attached_file ) .'"' );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space
              Open

                              self::$options['mobi']['toc'] = 0;
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Found precision alignment of 1 spaces.
              Open

                               'post' => 1,
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                      endif;
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                                      $msg[] = '</p></div>';
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Expected 1 space before close parenthesis; 0 found
              Open

                      $version = (isset( $options['version'] )) ? $options['version'] : '0';
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                          3,  // [] png
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                          case 6 :
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                      $the_excerpt = strip_tags( strip_shortcodes( $the_excerpt ) ); //Strips tags and images
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space
              Open

                      $the_excerpt = strip_tags( strip_shortcodes( $the_excerpt ) ); //Strips tags and images
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              A gettext call containing placeholders was found, but was not accompanied by a "translators:" comment on the line above to clarify the meaning of the placeholders.
              Open

                                          $msg[] = sprintf( __( 'Unable to create directory "<strong>%s</strong>". Is its parent directory writable by the server?','read-offline' ), $path );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                                          echo implode( PHP_EOL, $msg );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                          1,  // [] gif
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              There must be no space before the colon in a CASE statement
              Open

                          case 3 :
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                          break;
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space
              Open

                      $the_post = get_post( $post_id ); //Gets post ID
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                              return $post_id; }
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                                      $msg[] = '<strong>Read Offline</strong>: ';
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                      foreach ( self::$mime_types as $file_extention => $mime_type ) {
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Concat operator must be surrounded by a single space
              Open

                          header( 'Last-Modified: '.gmdate( 'D, d M Y H:i:s' ).' GMT' );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Concat operator must be surrounded by a single space
              Open

                          header( 'Last-Modified: '.gmdate( 'D, d M Y H:i:s' ).' GMT' );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Space found before comma in function call
              Open

                              if ( true !== $wp_filesystem->rmdir( $directory , true ) ) {
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Tabs must be used to indent lines; spaces are not allowed
              Open

                                          $msg[] = '<strong>Read Offline</strong>: ';
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              No space found after comma in function call
              Open

                              add_action( 'save_post_' . $post_type, array( $this, 'save_as_attachment_to_post_type' ),10,2 );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Expected 1 space after IF keyword; 0 found
              Open

                      if( (bool) self::$options['what']['formats']['mobi'] ) {
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              No space found after comma in function call
              Open

                              site_url(),$post_id,$name,$format,
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              No space found after comma in function call
              Open

                              site_url(),$post_id,$name,$format,
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              No space found after comma in function call
              Open

                              site_url(),$post_id,$name,$format,
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Expected 1 space after IF keyword; 0 found
              Open

                      if( (bool) self::$options['what']['formats']['epub'] ) {
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              No space found after comma in function call
              Open

                          $to_filename = sprintf( '%s.%s',$post->post_name,$file_extention );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              No space found after comma in function call
              Open

                              site_url(),$post_id,$name,$format,
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              No space found after comma in function call
              Open

                          $to_filename = sprintf( '%s.%s',$post->post_name,$file_extention );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Whitespace found at end of line
              Open

                      
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Expected 1 space after IF keyword; 0 found
              Open

                      if( (bool) self::$options['what']['formats']['pdf'] ) {
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              No space found after comma in function call
              Open

                                      $msg[] = sprintf( __( 'wp_upload_bits failed,  error: "<strong>%s</strong>','read-offline' ), $error );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              No space found after comma in function call
              Open

                          $readoffline_url = self::query_url( $post_id,$post->post_name,$file_extention,true );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              No space found after comma in function call
              Open

                          wp_die( 'WP_Filesystem Error:' . print_r( $wp_filesystem,true ) ); }
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              No space found after comma in function call
              Open

                          $readoffline_url = self::query_url( $post_id,$post->post_name,$file_extention,true );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              No space found after comma in function call
              Open

                                          $msg[] = sprintf( __( 'Unable to create directory "<strong>%s</strong>". Is its parent directory writable by the server?','read-offline' ), $path );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              No space found after comma in function call
              Open

                          wp_die( 'WP_Filesystem Error:' . print_r( $wp_filesystem,true ) ); }
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              No space found after comma in function call
              Open

                              add_action( 'save_post_' . $post_type, array( $this, 'save_as_attachment_to_post_type' ),10,2 );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              No space found after comma in function call
              Open

                              site_url(),$post_id,$name,$format,
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              No space found after comma in function call
              Open

                              site_url(),$post_id,$name,$format,
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              No space found after comma in function call
              Open

                                          $msg[] = sprintf( __( 'Unable to remove cache directory "<strong>%s</strong>". Is it and its directories writable by the server?','read-offline' ), $directory );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              Whitespace found at end of line
              Open

                  
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              No space found after comma in function call
              Open

                          $readoffline_url = self::query_url( $post_id,$post->post_name,$file_extention,true );
              Severity: Minor
              Found in inc/class-read-offline.php by phpcodesniffer

              There are no issues that match your filters.

              Category
              Status