/** * Returns the validate callback for a given field. * * @param array $field The field. * @param DocumentObject|null $document_object The document object. * @return callable The validate callback. *//** * Sanitize an additional field against any custom sanitization rules. * * @since 8.7.0 * @param string $field_key The key of the field. * @param mixed $field_value The value of the field. * @return mixed *//** * Copies additional fields from an order to a customer. * * @param WC_Order $order The order to sync the fields for. * @param WC_Customer $customer The customer to sync the fields for. */D`D/** * Copies additional fields from a customer to an order. * * @param WC_Order $order The order to sync the fields for. * @param WC_Customer $customer The customer to sync the fields for. */E`@R/** * Filter fields for order confirmation. * * @param array $fields The fields to filter. * @param array $context Additional context for the filter. * @return array The filtered fields. */`GG`/** * Get the file modified time as a cache buster if we're in dev mode. * * @param string $file Local path to the file. * @return string The cache buster value to use for the given file. */`/** * Check if the current page contains any of the tracked blocks. * Checks post content, widget areas, and template parts (header) for blocks. * * @return bool True if page has tracked blocks. */ 'VPw? 'VxE 'VPPxB 'V`x< 'V`x>ܜ 'VPy>``J`m 'VP? 'VP` 'V`@+ğ 'VPpĢ 'VP>ܜ 'V@>B`w`0m/** * Add async to script tags with defined handles. * * @param string $tag HTML for the script tag. * @param string $handle Handle of script. * @param string $src Src of script. * @return string */ 'VP? 'Vi'VP" 'Vٝp p 'V <ܜ 'VP!> :`p1>'Vp1>'V`/** * Validates and saves additional address fields to the customer object on the My Account page. * * Customer is not provided by this hook so we handle save here. * * @param integer $user_id User ID. *//** * Returns pattern slugs with their localized labels for categorization. * * Each key represents a unique pattern slug, while the value is the localized label. * * @return array *//** * Re-fetch the patterns when the WooCommerce plugin is updated. * * @param WP_Upgrader $upgrader_object WP_Upgrader instance. * @param array $options Array of bulk item update data. * * @return void *//** * Change the categories of the patterns to match the ones used in the CYS flow * * @param array $patterns The patterns to map categories for. * @return array The patterns with the categories mapped. */ƫ`/** * Add data- attributes to blocks when rendered if the block is under the woocommerce/ namespace. * * @param string $content Block content. * @param array $block Parsed block data. * @return string */ = $action_data['meta'][ $this->action_meta ]; $meta_pairs = json_decode( $action_data['meta']['SPMETA_PAIRS'], true ); if ( ! empty( $meta_pairs ) ) { foreach ( $meta_pairs as $pair ) { $meta_key = $this->sanitize_text_field( Automator()->parse->text( $pair['KEY'], $recipe_id, $user_id, $args ) ); $meta_value = $this->sanitize_text_field( Automator()->parse->text( $pair['VALUE'], $recipe_id, $user_id, $args ) ); // If data is already serialized, unserialize it. if ( is_serialized( $meta_value, true ) ) { // Once we have the array back, assign it as meta value so it will be stored as a serialize string. // This will fix double serialization by WordPress. $meta_value = maybe_unserialize( $meta_value ); } update_post_meta( $post_id, $meta_key, $meta_value ); } } Automator()->complete_action( $user_id, $action_data, $recipe_id ); } /** * Wrapper method for WordPress' built-in function called sanitize_text_field. * * Added a filter to disable sanitation. * * @param mixed $value * * @return mixed The sanitized value. */ private function sanitize_text_field( $value = '' ) { // Only sanitize if its a string. if ( ! is_string( $value ) ) { return $value; } if ( apply_filters( 'automator_wp_set_post_meta_should_sanitize_fields', true, $value, $this ) ) { return sanitize_text_field( $value ); } return $value; } }