HEX
Server: LiteSpeed
System: Linux sarajevo.maychu.cloud 5.14.0-503.40.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Mon May 5 06:06:04 EDT 2025 x86_64
User: inqua407 (1189)
PHP: 8.3.17
Disabled: exec,execl,system,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,ini_alter,proc_open,dl,popen,show_source,posix_getpwuid,getpwuid,posix_geteuid,posix_getegid,posix_getgrgid,open_basedir,safe_mode_include_dir,pcntl_exec,pcntl_fork,proc_get_status,proc_nice,proc_terminate,pclose,virtual,openlog,popen,pclose,virtual,openlog,escapeshellcmd,escapeshellarg,dl,show_source,symlink,mail
Upload Files
File: /home/inqua407/public_html/wp-content/plugins/wpseo-woocommerce/classes/woocommerce-slack.php
<?php
/**
 * WooCommerce Yoast SEO plugin file.
 *
 * @package WPSEO/WooCommerce
 */

use Yoast\WP\SEO\Presentations\Indexable_Presentation;

/**
 * Class WPSEO_WooCommerce_Slack
 */
class WPSEO_WooCommerce_Slack {

	/**
	 * Registers the hooks.
	 *
	 * @return void
	 */
	public function register_hooks() {
		add_filter( 'wpseo_enhanced_slack_data', [ $this, 'filter_enhanced_data' ], 10, 2 );
	}

	/**
	 * Replaces the default enhanced data (author, reading time) with custom data.
	 *
	 * @param array                  $data         The array of labels => value.
	 * @param Indexable_Presentation $presentation The indexable presentation.
	 *
	 * @return array The filtered array.
	 */
	public function filter_enhanced_data( $data, $presentation ) {
		$object  = $presentation->model;
		$product = wc_get_product( $object->object_id );

		if ( $product ) {
			$data         = [];
			$product_type = WPSEO_WooCommerce_Utils::get_product_type( $product );
			// Omit the price amount for variable and grouped products.
			$show_price = apply_filters( 'Yoast\WP\Woocommerce\og_price', true ) && ! ( $product_type === 'variable' || $product_type === 'grouped' );

			$availability = __( 'Out of stock', 'yoast-woo-seo' );

			// Should be checked before backorder because it's true for both cases.
			if ( $product->is_in_stock() ) {
				$availability = __( 'In stock', 'yoast-woo-seo' );
			}

			if ( $product->is_on_backorder() ) {
				$availability = __( 'On backorder', 'yoast-woo-seo' );
			}

			if ( $show_price ) {
				// We're recreating the WC_Product::get_price_html() but with the logic of the products on sale removed.
				if ( $product->get_price() === '' ) {
					// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals -- Using WooCommerce hook.
					$price = apply_filters( 'woocommerce_empty_price_html', '', $product );
				}
				else {
					$price = wc_price( wc_get_price_to_display( $product ) ) . $product->get_price_suffix();
				}

				$data[ __( 'Price', 'yoast-woo-seo' ) ] = wp_strip_all_tags( $price );
			}
			$data[ __( 'Availability', 'yoast-woo-seo' ) ] = $availability;
		}

		return $data;
	}
}