__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace Automattic\WooCommerce\StoreApi\Utilities;
/**
* ArrayUtils class used for custom functions to operate on arrays
*/
class ArrayUtils {
/**
* Join a string with a natural language conjunction at the end.
*
* @param array $array The array to join together with the natural language conjunction.
* @param bool $enclose_items_with_quotes Whether each item in the array should be enclosed within quotation marks.
*
* @return string a string containing a list of items and a natural language conjuction.
*/
public static function natural_language_join( $array, $enclose_items_with_quotes = false ) {
if ( true === $enclose_items_with_quotes ) {
$array = array_map(
function ( $item ) {
return '"' . $item . '"';
},
$array
);
}
$last = array_pop( $array );
if ( $array ) {
return sprintf(
/* translators: 1: The first n-1 items of a list 2: the last item in the list. */
__( '%1$s and %2$s', 'woocommerce' ),
implode( ', ', $array ),
$last
);
}
return $last;
}
/**
* Check if a string contains any of the items in an array.
*
* @param string $needle The string to check.
* @param array $haystack The array of items to check for.
*
* @return bool true if the string contains any of the items in the array, false otherwise.
*/
public static function string_contains_array( $needle, $haystack ) {
foreach ( $haystack as $item ) {
if ( false !== strpos( $needle, $item ) ) {
return true;
}
}
return false;
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| AgenticCheckoutUtils.php | File | 16.45 KB | 0664 |
|
| ArrayUtils.php | File | 1.49 KB | 0664 |
|
| CartController.php | File | 49.83 KB | 0664 |
|
| CartTokenUtils.php | File | 1.81 KB | 0664 |
|
| CheckoutTrait.php | File | 10.82 KB | 0664 |
|
| DraftOrderTrait.php | File | 1.76 KB | 0664 |
|
| JsonWebToken.php | File | 5.45 KB | 0664 |
|
| LocalPickupUtils.php | File | 3.17 KB | 0664 |
|
| NoticeHandler.php | File | 2.02 KB | 0664 |
|
| OrderAuthorizationTrait.php | File | 3.29 KB | 0664 |
|
| OrderController.php | File | 31.7 KB | 0664 |
|
| Pagination.php | File | 2.05 KB | 0664 |
|
| PaymentUtils.php | File | 3.65 KB | 0664 |
|
| ProductItemTrait.php | File | 3.04 KB | 0664 |
|
| ProductQuery.php | File | 19.25 KB | 0664 |
|
| ProductQueryFilters.php | File | 9.25 KB | 0664 |
|
| QuantityLimits.php | File | 10.11 KB | 0664 |
|
| RateLimits.php | File | 6.14 KB | 0664 |
|
| SanitizationUtils.php | File | 794 B | 0664 |
|
| ValidationUtils.php | File | 1.73 KB | 0664 |
|