Server IP : 104.21.14.103 / Your IP : 18.227.72.172 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/thread-self/root/proc/self/root/proc/self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/woocommerce/src/Admin/Features/ShippingPartnerSuggestions/ |
Upload File : |
<?php namespace Automattic\WooCommerce\Admin\Features\ShippingPartnerSuggestions; use Automattic\WooCommerce\Admin\RemoteInboxNotifications\RuleEvaluator; /** * Class ShippingPartnerSuggestions */ class ShippingPartnerSuggestions { /** * Go through the specs and run them. * * @param array|null $specs shipping partner suggestion spec array. * @return array */ public static function get_suggestions( $specs = null ) { $suggestions = array(); if ( null === $specs ) { $specs = self::get_specs_from_datasource(); } $rule_evaluator = new RuleEvaluator(); foreach ( $specs as &$spec ) { $spec = is_array( $spec ) ? (object) $spec : $spec; if ( isset( $spec->is_visible ) ) { $is_visible = $rule_evaluator->evaluate( $spec->is_visible ); if ( $is_visible ) { $spec->is_visible = true; $suggestions[] = $spec; } } } return $suggestions; } /** * Get specs or fetch remotely if they don't exist. */ public static function get_specs_from_datasource() { if ( 'no' === get_option( 'woocommerce_show_marketplace_suggestions', 'yes' ) ) { /** * It can be used to modify shipping partner suggestions spec. * * @since 7.4.1 */ return apply_filters( 'woocommerce_admin_shipping_partner_suggestions_specs', DefaultShippingPartners::get_all() ); } $specs = ShippingPartnerSuggestionsDataSourcePoller::get_instance()->get_specs_from_data_sources(); // Fetch specs if they don't yet exist. if ( false === $specs || ! is_array( $specs ) || 0 === count( $specs ) ) { /** * It can be used to modify shipping partner suggestions spec. * * @since 7.4.1 */ return apply_filters( 'woocommerce_admin_shipping_partner_suggestions_specs', DefaultShippingPartners::get_all() ); } /** * It can be used to modify shipping partner suggestions spec. * * @since 7.4.1 */ return apply_filters( 'woocommerce_admin_shipping_partner_suggestions_specs', $specs ); } }