SILENT KILLERPanel

Current Path: > home > codekrsu > > cuddlebuds.lk > wp-content > plugins > woocommerce > src > StoreApi > Utilities


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: /home/codekrsu//cuddlebuds.lk/wp-content/plugins/woocommerce/src/StoreApi/Utilities

NameTypeSizeLast ModifiedActions
ArrayUtils.php File 1530 bytes April 30 2024 19:35:34.
CartController.php File 49454 bytes June 30 2025 17:49:22.
CartTokenUtils.php File 1853 bytes June 23 2025 19:46:28.
CheckoutTrait.php File 11076 bytes June 23 2025 19:46:28.
DraftOrderTrait.php File 1807 bytes September 04 2024 20:34:26.
JsonWebToken.php File 5194 bytes August 27 2024 23:04:44.
LocalPickupUtils.php File 3251 bytes May 12 2025 21:07:28.
NoticeHandler.php File 2070 bytes March 03 2025 22:28:12.
OrderAuthorizationTrait.php File 2335 bytes February 06 2024 22:01:42.
OrderController.php File 31956 bytes June 23 2025 19:46:28.
Pagination.php File 2100 bytes December 27 2023 00:45:02.
PaymentUtils.php File 3737 bytes May 12 2025 21:07:28.
ProductItemTrait.php File 3021 bytes December 27 2023 00:45:02.
ProductQuery.php File 19476 bytes May 12 2025 21:07:28.
ProductQueryFilters.php File 8203 bytes March 03 2025 22:28:12.
QuantityLimits.php File 10137 bytes June 23 2025 19:46:28.
RateLimits.php File 6289 bytes March 03 2025 22:28:12.
SanitizationUtils.php File 794 bytes February 27 2024 18:59:46.
ValidationUtils.php File 1770 bytes December 27 2023 00:45:02.

Reading File: /home/codekrsu//cuddlebuds.lk/wp-content/plugins/woocommerce/src/StoreApi/Utilities/Pagination.php

<?php
namespace Automattic\WooCommerce\StoreApi\Utilities;

/**
 * Pagination class.
 */
class Pagination {

	/**
	 * Add pagination headers to a response object.
	 *
	 * @param \WP_REST_Response $response Reference to the response object.
	 * @param \WP_REST_Request  $request The request object.
	 * @param int               $total_items Total items found.
	 * @param int               $total_pages Total pages found.
	 * @return \WP_REST_Response
	 */
	public function add_headers( $response, $request, $total_items, $total_pages ) {
		$response->header( 'X-WP-Total', $total_items );
		$response->header( 'X-WP-TotalPages', $total_pages );

		$current_page = $this->get_current_page( $request );
		$link_base    = $this->get_link_base( $request );

		if ( $current_page > 1 ) {
			$previous_page = $current_page - 1;
			if ( $previous_page > $total_pages ) {
				$previous_page = $total_pages;
			}
			$this->add_page_link( $response, 'prev', $previous_page, $link_base );
		}

		if ( $total_pages > $current_page ) {
			$this->add_page_link( $response, 'next', ( $current_page + 1 ), $link_base );
		}

		return $response;
	}

	/**
	 * Get current page.
	 *
	 * @param \WP_REST_Request $request The request object.
	 * @return int Get the page from the request object.
	 */
	protected function get_current_page( $request ) {
		return (int) $request->get_param( 'page' );
	}

	/**
	 * Get base for links from the request object.
	 *
	 * @param \WP_REST_Request $request The request object.
	 * @return string
	 */
	protected function get_link_base( $request ) {
		return esc_url( add_query_arg( $request->get_query_params(), rest_url( $request->get_route() ) ) );
	}

	/**
	 * Add a page link.
	 *
	 * @param \WP_REST_Response $response Reference to the response object.
	 * @param string            $name Page link name. e.g. prev.
	 * @param int               $page Page number.
	 * @param string            $link_base Base URL.
	 */
	protected function add_page_link( &$response, $name, $page, $link_base ) {
		$response->link_header( $name, add_query_arg( 'page', $page, $link_base ) );
	}
}

SILENT KILLER Tool