Submit
Path:
~
/
home
/
getwphos
/
www
/
new-cytogenx
/
wp-content
/
plugins
/
woocommerce
/
src
/
Admin
/
RemoteInboxNotifications
/
File Content:
RemoteInboxNotificationsDataSourcePoller.php
<?php /** * Handles polling and storage of specs */ namespace Automattic\WooCommerce\Admin\RemoteInboxNotifications; defined( 'ABSPATH' ) || exit; use Automattic\WooCommerce\Admin\RemoteSpecs\DataSourcePoller; use Automattic\WooCommerce\Admin\RemoteSpecs\RuleProcessors\GetRuleProcessor; /** * Specs data source poller class. * This handles polling specs from JSON endpoints, and * stores the specs in to the database as an option. */ class RemoteInboxNotificationsDataSourcePoller extends DataSourcePoller { const ID = 'remote_inbox_notifications'; const DATA_SOURCES = array( 'https://woocommerce.com/wp-json/wccom/inbox-notifications/2.0/notifications.json', ); /** * Class instance. * * @var Analytics instance */ protected static $instance = null; /** * Get class instance. */ public static function get_instance() { if ( ! self::$instance ) { self::$instance = new self( self::ID, self::DATA_SOURCES, array( 'spec_key' => 'slug', ) ); } return self::$instance; } /** * Validate the spec. * * @param object $spec The spec to validate. * @param string $url The url of the feed that provided the spec. * * @return bool The result of the validation. */ protected function validate_spec( $spec, $url ) { $logger = self::get_logger(); $logger_context = array( 'source' => $url ); if ( ! isset( $spec->slug ) ) { $logger->error( 'Spec is invalid because the slug is missing in feed', $logger_context ); // phpcs:ignore $logger->error( print_r( $spec, true ), $logger_context ); return false; } if ( ! isset( $spec->status ) ) { $logger->error( 'Spec is invalid because the status is missing in feed', $logger_context ); // phpcs:ignore $logger->error( print_r( $spec, true ), $logger_context ); return false; } if ( ! isset( $spec->locales ) || ! is_array( $spec->locales ) ) { $logger->error( 'Spec is invalid because the status is missing or empty in feed', $logger_context ); // phpcs:ignore $logger->error( print_r( $spec, true ), $logger_context ); return false; } if ( null === SpecRunner::get_locale( $spec->locales ) ) { $logger->error( 'Spec is invalid because the locale could not be retrieved in feed', $logger_context ); // phpcs:ignore $logger->error( print_r( $spec, true ), $logger_context ); return false; } if ( ! isset( $spec->type ) ) { $logger->error( 'Spec is invalid because the type is missing in feed', $logger_context ); // phpcs:ignore $logger->error( print_r( $spec, true ), $logger_context ); return false; } if ( isset( $spec->actions ) && is_array( $spec->actions ) ) { foreach ( $spec->actions as $action ) { if ( ! $this->validate_action( $action, $url ) ) { $logger->error( 'Spec is invalid because an action is invalid in feed', $logger_context ); // phpcs:ignore $logger->error( print_r( $spec, true ), $logger_context ); return false; } } } if ( isset( $spec->rules ) && is_array( $spec->rules ) ) { foreach ( $spec->rules as $rule ) { if ( ! isset( $rule->type ) ) { $logger->error( 'Spec is invalid because a rule type is empty in feed', $logger_context ); // phpcs:ignore $logger->error( print_r( $rule, true ), $logger_context ); // phpcs:ignore $logger->error( print_r( $spec, true ), $logger_context ); return false; } $processor = GetRuleProcessor::get_processor( $rule->type ); if ( ! $processor->validate( $rule ) ) { $logger->error( 'Spec is invalid because a rule is invalid in feed', $logger_context ); // phpcs:ignore $logger->error( print_r( $rule, true ), $logger_context ); // phpcs:ignore $logger->error( print_r( $spec, true ), $logger_context ); return false; } } } return true; } /** * Validate the action. * * @param object $action The action to validate. * @param string $url The url of the feed containing the action (for error reporting). * * @return bool The result of the validation. */ private function validate_action( $action, $url ) { $logger = self::get_logger(); $logger_context = array( 'source' => $url ); if ( ! isset( $action->locales ) || ! is_array( $action->locales ) ) { $logger->error( 'Action is invalid because it has empty or missing locales in feed', $logger_context ); // phpcs:ignore $logger->error( print_r( $action, true ), $logger_context ); return false; } if ( null === SpecRunner::get_action_locale( $action->locales ) ) { $logger->error( 'Action is invalid because the locale could not be retrieved in feed', $logger_context ); // phpcs:ignore $logger->error( print_r( $action, true ), $logger_context ); return false; } if ( ! isset( $action->name ) ) { $logger->error( 'Action is invalid because the name is missing in feed', $logger_context ); // phpcs:ignore $logger->error( print_r( $action, true ), $logger_context ); return false; } if ( ! isset( $action->status ) ) { $logger->error( 'Action is invalid because the status is missing in feed', $logger_context ); // phpcs:ignore $logger->error( print_r( $action, true ), $logger_context ); return false; } return true; } }
Edit
Rename
Chmod
Delete
FILE
FOLDER
Name
Size
Permission
Action
Transformers
---
0755
BaseLocationCountryRuleProcessor.php
829 bytes
0644
BaseLocationStateRuleProcessor.php
821 bytes
0644
ComparisonOperation.php
723 bytes
0644
EvaluateAndGetStatus.php
703 bytes
0644
EvaluationLogger.php
662 bytes
0644
FailRuleProcessor.php
669 bytes
0644
GetRuleProcessor.php
726 bytes
0644
IsEcommerceRuleProcessor.php
832 bytes
0644
IsWooExpressRuleProcessor.php
906 bytes
0644
NotRuleProcessor.php
735 bytes
0644
NoteStatusRuleProcessor.php
870 bytes
0644
OnboardingProfileRuleProcessor.php
837 bytes
0644
OptionRuleProcessor.php
773 bytes
0644
OrRuleProcessor.php
785 bytes
0644
OrderCountRuleProcessor.php
749 bytes
0644
OrdersProvider.php
711 bytes
0644
PassRuleProcessor.php
756 bytes
0644
PluginVersionRuleProcessor.php
839 bytes
0644
PluginsActivatedRuleProcessor.php
775 bytes
0644
ProductCountRuleProcessor.php
805 bytes
0644
PublishAfterTimeRuleProcessor.php
751 bytes
0644
PublishBeforeTimeRuleProcessor.php
755 bytes
0644
RemoteInboxNotificationsDataSourcePoller.php
5462 bytes
0644
RemoteInboxNotificationsEngine.php
7065 bytes
0644
RuleEvaluator.php
805 bytes
0644
RuleProcessorInterface.php
657 bytes
0644
SpecRunner.php
4957 bytes
0644
StoredStateRuleProcessor.php
827 bytes
0644
TotalPaymentsVolumeProcessor.php
807 bytes
0644
TransformerInterface.php
801 bytes
0644
TransformerService.php
740 bytes
0644
WCAdminActiveForProvider.php
689 bytes
0644
WCAdminActiveForRuleProcessor.php
845 bytes
0644
WooCommerceAdminUpdatedRuleProcessor.php
789 bytes
0644
N4ST4R_ID | Naxtarrr