WC_Gateway_Paypal_Request::limit_length( string $string, integer $limit = 127 )

Limit length of an arg.


Description Description


Parameters Parameters

$string

(Required) Argument to limit.

$limit

(Optional) Limit size in characters.

Default value: 127


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/gateways/paypal/includes/class-wc-gateway-paypal-request.php

	protected function limit_length( $string, $limit = 127 ) {
		$str_limit = $limit - 3;
		if ( function_exists( 'mb_strimwidth' ) ) {
			if ( mb_strlen( $string ) > $limit ) {
				$string = mb_strimwidth( $string, 0, $str_limit ) . '...';
			}
		} else {
			if ( strlen( $string ) > $limit ) {
				$string = substr( $string, 0, $str_limit ) . '...';
			}
		}
		return $string;
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.