Current Path: > home > codekrsu > > ameliagraphics.com > wp-content > plugins > pinterest-for-woocommerce > > src >
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 ]
Name | Type | Size | Last Modified | Actions |
---|---|---|---|---|
API | Directory | - | - | |
Admin | Directory | - | - | |
Exception | Directory | - | - | |
MultichannelMarketing | Directory | - | - | |
Notes | Directory | - | - | |
Product | Directory | - | - | |
Tracking | Directory | - | - | |
Utilities | Directory | - | - | |
View | Directory | - | - | |
AdCredits.php | File | 8406 bytes | August 26 2024 16:35:44. | |
AdCreditsCoupons.php | File | 1461 bytes | August 26 2024 16:35:44. | |
AdsCreditCurrency.php | File | 1946 bytes | May 20 2025 15:25:46. | |
Billing.php | File | 4901 bytes | August 26 2024 16:35:44. | |
CommerceIntegration.php | File | 7185 bytes | December 04 2024 18:47:06. | |
Compat.php | File | 952 bytes | November 16 2021 18:14:38. | |
Crypto.php | File | 3718 bytes | June 23 2025 21:16:30. | |
FeedFileOperations.php | File | 4680 bytes | August 26 2024 16:35:44. | |
FeedGenerator.php | File | 22733 bytes | August 26 2024 16:35:44. | |
FeedRegistration.php | File | 7230 bytes | December 04 2024 18:47:06. | |
FeedStatusService.php | File | 20815 bytes | March 18 2025 17:31:36. | |
Feeds.php | File | 13838 bytes | December 04 2024 18:47:06. | |
Heartbeat.php | File | 1882 bytes | October 23 2024 17:23:10. | |
LocalFeedConfigs.php | File | 3327 bytes | September 24 2024 11:32:30. | |
LocaleMapper.php | File | 3167 bytes | March 18 2025 17:31:36. | |
Logger.php | File | 3132 bytes | August 26 2024 16:35:44. | |
Merchants.php | File | 6575 bytes | September 24 2024 11:32:30. | |
PinterestApiException.php | File | 2767 bytes | December 04 2024 18:47:06. | |
PinterestShippingZone.php | File | 7161 bytes | February 16 2022 03:57:48. | |
PinterestSyncSettings.php | File | 3016 bytes | August 26 2024 16:35:44. | |
PluginActivate.php | File | 785 bytes | June 18 2022 00:23:22. | |
PluginHelper.php | File | 2537 bytes | October 11 2022 17:51:18. | |
PluginUpdate.php | File | 11166 bytes | May 29 2025 17:27:42. | |
ProductFeedStatus.php | File | 4453 bytes | August 26 2024 16:35:44. | |
ProductSync.php | File | 6351 bytes | September 24 2024 11:32:30. | |
ProductsXmlFeed.php | File | 17527 bytes | February 11 2025 16:39:50. | |
RefreshToken.php | File | 3769 bytes | August 26 2024 16:35:44. | |
RichPins.php | File | 9177 bytes | August 26 2024 16:35:44. | |
SaveToPinterest.php | File | 3525 bytes | April 26 2023 13:47:12. | |
Shipping.php | File | 8372 bytes | February 16 2022 03:57:48. | |
TrackerSnapshot.php | File | 2574 bytes | August 26 2024 16:35:44. | |
Tracking.php | File | 7488 bytes | August 29 2024 22:54:16. | |
WPConsentAPI.php | File | 1178 bytes | June 16 2025 21:44:24. | |
error_log | File | 260 bytes | June 23 2025 21:16:32. |
<?php /** * Pinterest for WooCommerce Merchants related helper methods * * @package Pinterest_For_WooCommerce/Classes/ * @version 1.0.0 */ namespace Automattic\WooCommerce\Pinterest; if ( ! defined( 'ABSPATH' ) ) { exit; } use Automattic\WooCommerce\Pinterest\API\Base; use Automattic\WooCommerce\Pinterest\Exception\PinterestApiLocaleException; use \Exception; use \Throwable; /** * Class Handling registration & generation of the XML product feed. */ class Merchants { /** * Returns the merchant object for the current user. * If a merchant already exists, either saved to the database, or is * returned by the Advertisers endpoint, it will be used, otherwise an * attempt to create a new one is made. * * @return array * * @throws Throwable PHP Exception. * @throws Exception PHP Exception. */ public static function get_merchant() { $merchant = false; $saved_merchant_id = Pinterest_For_Woocommerce()::get_data( 'merchant_id' ); $merchant_id = $saved_merchant_id; if ( empty( $merchant_id ) ) { // Get merchant from advertiser object. try { $merchant_id = self::get_merchant_id_from_advertiser(); } catch ( Throwable $th ) { if ( 404 !== $th->getCode() ) { throw $th; } $merchant = false; } } if ( ! empty( $merchant_id ) ) { // Get merchant if a merchant id was found. try { $merchant = Base::get_merchant( $merchant_id ); } catch ( Throwable $th ) { $merchant = false; } } if ( ! $merchant || ( 'success' !== $merchant['status'] && 650 === $merchant['code'] ) ) { // https://developers.pinterest.com/docs/redoc/#tag/API-Response-Codes Merchant not found 650. // Try creating one. $response = self::update_or_create_merchant(); if ( ! $response['merchant_id'] ) { throw new Exception( __( 'Wrong response when trying to create or update merchant.', 'pinterest-for-woocommerce' ), 400 ); } $merchant_id = $response['merchant_id']; try { $merchant = Base::get_merchant( $merchant_id ); } catch ( Throwable $th ) { throw new Exception( __( 'There was an error trying to get the merchant object.', 'pinterest-for-woocommerce' ), 400 ); } } if ( ! $merchant || 'success' !== $merchant['status'] || ! $merchant['data'] ) { throw new Exception( __( 'Response error when trying to create a merchant or update the existing one.', 'pinterest-for-woocommerce' ), 400 ); } // Update merchant id if it is different from the stored in DB. if ( $saved_merchant_id !== $merchant['data']->id ) { Pinterest_For_Woocommerce()::save_data( 'merchant_id', $merchant['data']->id ); } return $merchant; } /** * Gets the merchant ID of the authenticated user from the data returned on the Advertisers endpoint. * * @return string * * @throws Exception PHP exception. */ private static function get_merchant_id_from_advertiser() { $advertisers = Base::get_advertisers(); if ( 'success' !== $advertisers['status'] ) { throw new Exception( __( 'Response error when trying to get advertisers.', 'pinterest-for-woocommerce' ), 400 ); } $advertiser = reset( $advertisers['data'] ); // All advertisers assigned to a user share the same merchant_id. if ( empty( $advertiser->merchant_id ) ) { throw new Exception( __( "No merchant returned in the advertiser's response.", 'pinterest-for-woocommerce' ), 404 ); } return $advertiser->merchant_id; } /** * Creates a merchant for the authenticated user or updates the existing one. * Returns an array with the merchant_id and the registered feed_id. * * @return array * * @throws Exception PHP Exception. */ public static function update_or_create_merchant() { $configs = LocalFeedConfigs::get_instance()->get_configurations(); $config = reset( $configs ); /** * Filters the default merchant name: pinterest_for_woocommerce_default_merchant_name. This vale appears in the * feed configuration page in Pinterest. * * @param string $merchant_name The default merchant name. * phpcs:disable WooCommerce.Commenting.CommentHooks.MissingSinceComment */ $merchant_name = apply_filters( 'pinterest_for_woocommerce_default_merchant_name', esc_html__( 'Auto-created by Pinterest for WooCommerce', 'pinterest-for-woocommerce' ) ); // Check if the feed location is a full URL or a relative path and build the feed location accordingly. $feed_location = parse_url( $config['feed_url'] ); $feed_location = ! empty( $feed_location['host'] ) ? $config['feed_url'] : get_home_url() . $feed_location['path']; try { $locale = LocaleMapper::get_locale_for_api(); } catch ( PinterestApiLocaleException $e ) { $locale = LocaleMapper::PINTEREST_DEFAULT_LOCALE; } $args = array( 'merchant_domains' => get_home_url(), 'feed_location' => $feed_location, 'feed_format' => 'XML', 'country' => Pinterest_For_Woocommerce()::get_base_country(), 'locale' => $locale, 'currency' => get_woocommerce_currency(), 'merchant_name' => $merchant_name, ); $cache_key = PINTEREST_FOR_WOOCOMMERCE_PREFIX . '_request_' . md5( wp_json_encode( $args ) ); $cache = get_transient( $cache_key ); if ( false !== $cache ) { throw new Exception( __( 'There was a previous error trying to create or update merchant.', 'pinterest-for-woocommerce' ), (int) $cache ); } try { $response = Base::update_or_create_merchant( $args ); } catch ( Throwable $th ) { $delay = Pinterest_For_Woocommerce()::get_data( 'create_merchant_delay' ) ?? MINUTE_IN_SECONDS; set_transient( $cache_key, $th->getCode(), $delay ); // Double the delay. Pinterest_For_Woocommerce()::save_data( 'create_merchant_delay', min( $delay * 2, 6 * HOUR_IN_SECONDS ) ); throw new Exception( $th->getMessage(), $th->getCode() ); } if ( 'success' !== $response['status'] ) { throw new Exception( __( 'Response error when trying to create a merchant or update the existing one.', 'pinterest-for-woocommerce' ), 400 ); } $merchant_id = $response['data']; try { $feed_id = Feeds::match_local_feed_configuration_to_registered_feeds( $response['data'] ); } catch ( Throwable $th ) { $feed_id = ''; } // Clean the cached delay. Pinterest_For_Woocommerce()::save_data( 'create_merchant_delay', false ); // Update the registered feed id setting. Pinterest_For_Woocommerce()::save_data( 'feed_registered', $feed_id ); return array( 'merchant_id' => $merchant_id, 'feed_id' => $feed_id, ); } }
SILENT KILLER Tool