diff --git a/composer.json b/composer.json index 82db627d3..e6ade859d 100644 --- a/composer.json +++ b/composer.json @@ -15,8 +15,9 @@ "issues": "https://github.com/LearnPress/learnpress/issues" }, "require-dev": { - "squizlabs/php_codesniffer": "3.10.2", - "wp-coding-standards/wpcs": "3.0.1" + "squizlabs/php_codesniffer": "3.11.1", + "wp-coding-standards/wpcs": "3.1.0", + "phpcompatibility/php-compatibility": "9.3.5" }, "scripts": { "format": "phpcbf --standard=phpcs.xml --report-summary --report-source", @@ -29,10 +30,5 @@ "psr-4": { "LearnPress\\": "inc/" } - }, - "config": { - "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true - } } } diff --git a/inc/Databases/class-lp-section-db.php b/inc/Databases/class-lp-section-db.php index 6d3e22c28..6e184bea9 100644 --- a/inc/Databases/class-lp-section-db.php +++ b/inc/Databases/class-lp-section-db.php @@ -395,4 +395,3 @@ public function get_last_number_order( int $course_id = 0 ): int { return $number_order; } } - diff --git a/inc/Models/Courses.php b/inc/Models/Courses.php index 60af590ba..5e32c81e1 100644 --- a/inc/Models/Courses.php +++ b/inc/Models/Courses.php @@ -78,9 +78,9 @@ public static function handle_params_for_query_courses( LP_Course_Filter &$filte // Get Columns $fields_str = LP_Helper::sanitize_params_submitted( urldecode( $param['c_fields'] ?? '' ) ); if ( ! empty( $fields_str ) ) { - $fields = explode( ',', $fields_str ); + $fields = explode( ',', $fields_str ); foreach ( $fields as $key => $field ) { - $fields[ $key ] = LP_Database::getInstance()->wpdb->prepare( '%i', $field );; + $fields[ $key ] = LP_Database::getInstance()->wpdb->prepare( '%i', $field ); } $filter->fields = $fields; } @@ -88,9 +88,9 @@ public static function handle_params_for_query_courses( LP_Course_Filter &$filte // Get only columns $fields_only_str = LP_Helper::sanitize_params_submitted( urldecode( $param['c_only_fields'] ?? '' ) ); if ( ! empty( $fields_only_str ) ) { - $fields_only = explode( ',', $fields_only_str ); + $fields_only = explode( ',', $fields_only_str ); foreach ( $fields_only as $key => $field ) { - $fields_only[ $key ] = LP_Database::getInstance()->wpdb->prepare( '%i', $field );; + $fields_only[ $key ] = LP_Database::getInstance()->wpdb->prepare( '%i', $field ); } $filter->only_fields = $fields_only; } diff --git a/inc/TemplateHooks/Course/FilterCourseTemplate.php b/inc/TemplateHooks/Course/FilterCourseTemplate.php index df8893a37..945965e1c 100644 --- a/inc/TemplateHooks/Course/FilterCourseTemplate.php +++ b/inc/TemplateHooks/Course/FilterCourseTemplate.php @@ -162,9 +162,9 @@ public function html_search( array $data = [] ): string { ); $this->check_param_url_has_lang( $data ); - $value = LP_Request::get_param( 'c_search' ); - $value = isset( $data['params_url'] ) ? ( $data['params_url']['c_search'] ?? $value ) : $value; - $content = sprintf( + $value = LP_Request::get_param( 'c_search' ); + $value = isset( $data['params_url'] ) ? ( $data['params_url']['c_search'] ?? $value ) : $value; + $content = sprintf( '', __( 'Search Course', 'learnpress' ), $value, @@ -172,9 +172,9 @@ public function html_search( array $data = [] ): string { $data['search_suggestion'] ?? 1 ); $content .= ''; - $content = Template::instance()->nest_elements( $html_wrapper, $content ); + $content = Template::instance()->nest_elements( $html_wrapper, $content ); $content .= '
'; - $content = $this->html_item( esc_html__( 'Search', 'learnpress' ), $content ); + $content = $this->html_item( esc_html__( 'Search', 'learnpress' ), $content ); } catch ( Throwable $e ) { error_log( __METHOD__ . ': ' . $e->getMessage() ); } @@ -300,7 +300,7 @@ public function html_category( array $data = [] ): string { if ( ! empty( $category_current ) ) { $parent_cat_id = $category_current_id; - $content .= $this->html_field_category( $category_current->term_id, $category_current->name, $data ); + $content .= $this->html_field_category( $category_current->term_id, $category_current->name, $data ); } } @@ -393,7 +393,8 @@ public function html_field_category( int $category_id, string $category_name, ar $checked = in_array( $category_id, $args['data_selected'] ?? [] ) && empty( $disabled ) ? 'checked' : ''; $input = sprintf( '', - esc_attr( $category_id ), esc_attr( $checked ), + esc_attr( $category_id ), + esc_attr( $checked ), $disabled ); $label = sprintf( '', wp_kses_post( $category_name ) ); @@ -692,11 +693,10 @@ public function handle_filter_params_before_query( LP_Course_Filter &$filter, ar // Check has in category page. if ( isset( $params_url['page_term_id_current'] ) && - empty( $params_url['term_id'] ) ) { + empty( $params_url['term_id'] ) ) { $filter->term_ids[] = $params_url['page_term_id_current']; - } // Check has in tag page. - elseif ( isset( $params_url['page_tag_id_current'] ) && - empty( $params_url['tag_id'] ) ) { + } elseif ( isset( $params_url['page_tag_id_current'] ) + && empty( $params_url['tag_id'] ) ) { $filter->tag_ids[] = $params_url['page_tag_id_current']; } } diff --git a/inc/TemplateHooks/Course/ListCoursesRelatedTemplate.php b/inc/TemplateHooks/Course/ListCoursesRelatedTemplate.php index f81440bff..b5934932d 100644 --- a/inc/TemplateHooks/Course/ListCoursesRelatedTemplate.php +++ b/inc/TemplateHooks/Course/ListCoursesRelatedTemplate.php @@ -60,7 +60,7 @@ public function layout_courses( CourseModel $course, $limit ) { $args = [ 'course_id' => $course->get_id(), - 'limit' => $limit + 'limit' => $limit, ]; $content = TemplateAJAX::load_content_via_ajax( $args, $callback ); @@ -126,7 +126,9 @@ public static function render_courses( array $settings = [] ): stdClass { 'header' => sprintf( '