Code Duplication    Length = 32-33 lines in 2 locations

includes/class-sensei-course.php 2 locations

@@ 1354-1385 (lines=32) @@
1351
			}
1352
1353
			// Active pagination
1354
			if( $active_count > $per_page ) {
1355
1356
				$current_page = 1;
1357
				if( isset( $_GET['active_page'] ) && 0 < intval( $_GET['active_page'] ) ) {
1358
					$current_page = $_GET['active_page'];
1359
				}
1360
1361
				$active_html .= '<nav class="pagination woo-pagination">';
1362
				$total_pages = ceil( $active_count / $per_page );
1363
1364
				if( $current_page > 1 ) {
1365
					$prev_link = add_query_arg( 'active_page', $current_page - 1 );
1366
					$active_html .= '<a class="prev page-numbers" href="' . esc_url( $prev_link ) . '">' . __( 'Previous' , 'woothemes-sensei' ) . '</a> ';
1367
				}
1368
1369
				for ( $i = 1; $i <= $total_pages; $i++ ) {
1370
					$link = add_query_arg( 'active_page', $i );
1371
1372
					if( $i == $current_page ) {
1373
						$active_html .= '<span class="page-numbers current">' . $i . '</span> ';
1374
					} else {
1375
						$active_html .= '<a class="page-numbers" href="' . esc_url( $link ). '">' . $i . '</a> ';
1376
					}
1377
				}
1378
1379
				if( $current_page < $total_pages ) {
1380
					$next_link = add_query_arg( 'active_page', $current_page + 1 );
1381
					$active_html .= '<a class="next page-numbers" href="' . esc_url( $next_link ) . '">' . __( 'Next' , 'woothemes-sensei' ) . '</a> ';
1382
				}
1383
1384
				$active_html .= '</nav>';
1385
			}
1386
1387
			foreach ( $completed_courses as $course_item ) {
1388
				$course = $course_item;
@@ 1464-1496 (lines=33) @@
1461
			}
1462
1463
			// Active pagination
1464
			if( $completed_count > $per_page ) {
1465
1466
				$current_page = 1;
1467
				if( isset( $_GET['completed_page'] ) && 0 < intval( $_GET['completed_page'] ) ) {
1468
					$current_page = $_GET['completed_page'];
1469
				}
1470
1471
				$complete_html .= '<nav class="pagination woo-pagination">';
1472
				$total_pages = ceil( $completed_count / $per_page );
1473
1474
1475
				if( $current_page > 1 ) {
1476
					$prev_link = add_query_arg( 'completed_page', $current_page - 1 );
1477
					$complete_html .= '<a class="prev page-numbers" href="' . esc_url( $prev_link ) . '">' . __( 'Previous' , 'woothemes-sensei' ) . '</a> ';
1478
				}
1479
1480
				for ( $i = 1; $i <= $total_pages; $i++ ) {
1481
					$link = add_query_arg( 'completed_page', $i );
1482
1483
					if( $i == $current_page ) {
1484
						$complete_html .= '<span class="page-numbers current">' . $i . '</span> ';
1485
					} else {
1486
						$complete_html .= '<a class="page-numbers" href="' . esc_url( $link ) . '">' . $i . '</a> ';
1487
					}
1488
				}
1489
1490
				if( $current_page < $total_pages ) {
1491
					$next_link = add_query_arg( 'completed_page', $current_page + 1 );
1492
					$complete_html .= '<a class="next page-numbers" href="' . esc_url( $next_link ) . '">' . __( 'Next' , 'woothemes-sensei' ) . '</a> ';
1493
				}
1494
1495
				$complete_html .= '</nav>';
1496
			}
1497
1498
		} // End If Statement
1499