gocodebox/lifterlms

View on GitHub

Showing 1,420 of 1,425 total issues

Method set_query has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function set_query() {

        global $wpdb;

        $dates = $this->get_posted_dates();

    Method get_actions_html has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function get_actions_html( $certificate_id ) {
            ob_start();
            ?>
            <a class="llms-button-secondary small" href="<?php echo esc_url( get_permalink( $certificate_id ) ); ?>" target="_blank">
                <?php esc_html_e( 'View', 'lifterlms' ); ?>
    Severity: Minor
    Found in includes/admin/reporting/tables/llms.table.certificates.php - About 1 hr to fix

      Method set_query has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function set_query() {
      
              global $wpdb;
      
              $dates = $this->get_posted_dates();

        Method has_active_subscriptions has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function has_active_subscriptions( $use_cache = true ) {
        
                $found = false;
                if ( $use_cache ) {
                    $subscriptions_count = wp_cache_get( $this->get( 'id' ), 'llms_product_subscriptions_count', true, $found );
        Severity: Minor
        Found in includes/models/model.llms.product.php - About 1 hr to fix

          Method get_content_html has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function get_content_html() {
          
                  $this->find    = array(
                      '{site_title}',
                      '{user_login}',
          Severity: Minor
          Found in includes/achievements/class.llms.achievement.user.php - About 1 hr to fix

            Method get_count has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function get_count( $key ) {
            
                    $count     = 0;
                    $questions = $this->get_questions();
            
            
            Severity: Minor
            Found in includes/models/model.llms.quiz.attempt.php - About 1 hr to fix

              Method query_associated_posts has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function query_associated_posts( $post_type, $enabled_key, $enabled_value, $list_key ) {
              
                      global $wpdb;
              
                      // See if we have a cached result first.
              Severity: Minor
              Found in includes/models/model.llms.membership.php - About 1 hr to fix

                Method get_overall_grade has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function get_overall_grade( $use_cache = true ) {
                
                        $grade = null;
                
                        // Attempt to pull from the cache first.
                Severity: Minor
                Found in includes/models/model.llms.student.php - About 1 hr to fix

                  Method enroll has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function enroll( $product_id, $trigger = 'unspecified' ) {
                  
                          /**
                           * Fires before a user is enrolled into a course or membership.
                           *
                  Severity: Minor
                  Found in includes/models/model.llms.student.php - About 1 hr to fix

                    Method sql_where has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function sql_where() {
                    
                            global $wpdb;
                    
                            $sql = 'WHERE 1';
                    Severity: Minor
                    Found in includes/class.llms.query.quiz.attempt.php - About 1 hr to fix

                      Method maybe_add_export_files has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function maybe_add_export_files( $archive_pathname, $archive_url, $html_report_pathname, $request_id ) {
                      
                              if ( ! class_exists( 'ZipArchive' ) ) {
                                  return;
                              }
                      Severity: Minor
                      Found in includes/privacy/class-llms-privacy-exporters.php - About 1 hr to fix

                        Method get_password_fields has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private static function get_password_fields() {
                        
                                $fields = array();
                        
                                $fields[] = array(
                        Severity: Minor
                        Found in includes/class.llms.person.handler.php - About 1 hr to fix

                          Method prepare_options has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function prepare_options( $raw ) {
                          
                                  $prepared = array();
                          
                                  foreach ( $raw as $key => $val ) {
                          Severity: Minor
                          Found in includes/forms/class-llms-form-field.php - About 1 hr to fix

                            Method get_lost_password_fields has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public static function get_lost_password_fields() {
                            
                                    $usernames = LLMS_Forms::instance()->are_usernames_enabled();
                            
                                    if ( ! $usernames ) {
                            Severity: Minor
                            Found in includes/class.llms.person.handler.php - About 1 hr to fix

                              Method task has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function task( $notification_id ) {
                              
                                      $this->log( sprintf( 'sending email notification ID #%d', $notification_id ) );
                                      try {
                              
                              

                                Method get_test_settings has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function get_test_settings( $type ) {
                                
                                        $query = new WP_User_Query(
                                            array(
                                                'number' => 25,

                                  Method load has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      private function load() {
                                  
                                          $triggers = array(
                                              'achievement_earned',
                                              'certificate_earned',
                                  Severity: Minor
                                  Found in includes/notifications/class.llms.notifications.php - About 1 hr to fix

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

                                                            <?php $i = 1; while ( $i <= 6 ) : ?>
                                                                <option value="<?php echo esc_attr( $i ); ?>"<?php selected( $i, ( $plan && 'year' === $period ) ? $plan->get( 'length' ) : '' ); ?>><?php printf( esc_html( _n( 'for %s year', 'for %s years', $i, 'lifterlms' ) ), esc_html( $i ) ); ?></option>
                                                                <?php
                                                                ++$i;
                                    endwhile;
                                    Severity: Major
                                    Found in includes/admin/views/access-plans/access-plan.php and 3 other locations - About 1 hr to fix
                                    includes/admin/views/access-plans/access-plan.php on lines 186..190
                                    includes/admin/views/access-plans/access-plan.php on lines 196..200
                                    includes/admin/views/access-plans/access-plan.php on lines 206..210

                                    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 103.

                                    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 4 locations. Consider refactoring.
                                    Open

                                                            <?php $i = 1; while ( $i <= 90 ) : ?>
                                                                <option value="<?php echo esc_attr( $i ); ?>"<?php selected( $i, ( $plan && 'day' === $period ) ? $plan->get( 'length' ) : '' ); ?>><?php printf( esc_html( _n( 'for %s day', 'for %s days', $i, 'lifterlms' ) ), esc_html( $i ) ); ?></option>
                                                                <?php
                                                                ++$i;
                                    endwhile;
                                    Severity: Major
                                    Found in includes/admin/views/access-plans/access-plan.php and 3 other locations - About 1 hr to fix
                                    includes/admin/views/access-plans/access-plan.php on lines 176..180
                                    includes/admin/views/access-plans/access-plan.php on lines 186..190
                                    includes/admin/views/access-plans/access-plan.php on lines 196..200

                                    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 103.

                                    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 4 locations. Consider refactoring.
                                    Open

                                                            <?php $i = 1; while ( $i <= 52 ) : ?>
                                                                <option value="<?php echo esc_attr( $i ); ?>"<?php selected( $i, ( $plan && 'week' === $period ) ? $plan->get( 'length' ) : '' ); ?>><?php printf( esc_html( _n( 'for %s week', 'for %s weeks', $i, 'lifterlms' ) ), esc_html( $i ) ); ?></option>
                                                                <?php
                                                                ++$i;
                                    endwhile;
                                    Severity: Major
                                    Found in includes/admin/views/access-plans/access-plan.php and 3 other locations - About 1 hr to fix
                                    includes/admin/views/access-plans/access-plan.php on lines 176..180
                                    includes/admin/views/access-plans/access-plan.php on lines 186..190
                                    includes/admin/views/access-plans/access-plan.php on lines 206..210

                                    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 103.

                                    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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language