Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/export-woocommerce/export-woocommerce.php
+++ b/export-woocommerce/export-woocommerce.php
@@ -3,7 +3,7 @@
* Plugin Name: Export Products, Orders & Customers for WooCommerce
* Plugin URI: https://wpfactory.com/item/export-woocommerce/
* Description: Advanced export tools for all your WooCommerce store data: Orders, Products Customers & More, export to XML or CSV in one click.
- * Version: 2.4.3
+ * Version: 2.4.4
* Author: WPFactory
* Author URI: https://wpfactory.com
* Requires PHP: 7.4
@@ -51,7 +51,7 @@
* @version 1.0.0
* @since 1.0.0
*/
-defined( 'ALG_WC_EXPORT_VERSION' ) || define( 'ALG_WC_EXPORT_VERSION', '2.4.3' );
+defined( 'ALG_WC_EXPORT_VERSION' ) || define( 'ALG_WC_EXPORT_VERSION', '2.4.4' );
/**
* Plugin file.
--- a/export-woocommerce/includes/class-alg-wc-export-core.php
+++ b/export-woocommerce/includes/class-alg-wc-export-core.php
@@ -2,7 +2,7 @@
/**
* Export WooCommerce - Core Class
*
- * @version 2.4.0
+ * @version 2.4.4
* @since 1.0.0
*
* @author WPFactory
@@ -17,7 +17,7 @@
/**
* Alg_WC_Export_Core class.
*
- * @version 2.4.0
+ * @version 2.4.4
* @since 1.0.0
*/
class Alg_WC_Export_Core {
@@ -335,7 +335,7 @@
/**
* Get allowed HTML for `wp_kses()`.
*
- * @version 2.4.0
+ * @version 2.4.4
* @since 2.4.0
*
* @return array Allowed HTML tags and attributes.
@@ -343,6 +343,11 @@
public function get_allowed_html() {
$allowed_html = wp_kses_allowed_html( 'post' ); // Allowed in the `wp_kses_post()`.
+ $allowed_html['form'] = array(
+ 'method' => true,
+ 'action' => true,
+ );
+
$allowed_html['option'] = array(
'value' => true,
'selected' => true,
@@ -367,7 +372,6 @@
'min' => true,
'max' => true,
'disabled' => true,
- 'onclick' => true,
);
return $allowed_html;
@@ -400,7 +404,7 @@
/**
* Export date fields.
*
- * @version 2.4.0
+ * @version 2.4.4
* @since 1.1.0
*/
public function export_date_fields() {
@@ -409,13 +413,13 @@
$predefined_ranges = array();
$predefined_ranges[] = '<a' .
- ' href="' . esc_url( add_query_arg( 'range', 'all_time', remove_query_arg( array( 'start_date', 'end_date' ) ) ) ) . '"' .
+ ' href="' . esc_url( add_query_arg( 'range', 'all_time', remove_query_arg( array( 'start_date', 'end_date' ) ) ) ) . '"' .
(
(
empty( $_GET['start_date'] ) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
empty( $_GET['end_date'] ) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
isset( $_GET['range'] ) && // phpcs:ignore WordPress.Security.NonceVerification.Recommended
- 'all_time' === $_GET['range'] // phpcs:ignore WordPress.Security.NonceVerification.Recommended
+ 'all_time' === sanitize_text_field( wp_unslash( $_GET['range'] ) ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended
) ?
' style="font-weight:bold;color:black;"' :
''
@@ -446,9 +450,9 @@
$predefined_ranges = implode( ' | ', $predefined_ranges );
$date_input_fields = (
'<strong>' . __( 'Custom:', 'export-woocommerce' ) . '</strong> ' .
- '<input name="start_date" id="start_date" type="text" display="date" value="' . $current_start_date . '">' .
+ '<input name="start_date" id="start_date" type="text" display="date" value="' . esc_attr( $current_start_date ) . '">' .
'<strong> - </strong>' .
- '<input name="end_date" id="end_date" type="text" display="date" value="' . $current_end_date . '">' .
+ '<input name="end_date" id="end_date" type="text" display="date" value="' . esc_attr( $current_end_date ) . '">' .
' ' .
'<button class="button-primary" name="range" id="range" type="submit" value="custom">' . __( 'Go', 'export-woocommerce' ) . '</button>'
);
@@ -462,7 +466,7 @@
/**
* Create export tool.
*
- * @version 2.4.0
+ * @version 2.4.4
* @since 1.0.0
*
* @param string $tool_id The ID of the export tool.
@@ -474,18 +478,24 @@
* @todo (dev) `alg_export` and `alg_export_xml` - `$date_args` and `$filter_args` should be updated if changed?
*/
public function create_export_tool( $tool_id, $tool_title, $tool_desc ) {
- $html = '<h1>' . $tool_title . '</h1>';
+ $html = '<h1>' . $tool_title . '</h1>';
+
$html .= '<p><em>' . $tool_desc . '</em></p>';
+
$html .= '<form action="" method="get">';
+
$html .= '<input type="hidden" value="alg-wc-export-tools" name="page">';
$html .= '<input type="hidden" value="' . $tool_id . '" name="alg_wc_export_tool">';
- $html .= '<input type="hidden" value="' . ( isset( $_GET['range'] ) ? sanitize_text_field( wp_unslash( $_GET['range'] ) ) : '' ) . '" name="range">'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
+ $html .= '<input type="hidden" value="' . esc_attr( isset( $_GET['range'] ) ? sanitize_text_field( wp_unslash( $_GET['range'] ) ) : '' ) . '" name="range">'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
+
$html .= '<p>';
+
$html .= $this->export_date_fields();
if ( ! isset( $_GET['range'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
return $html;
}
+
$html .= alg_wc_export_get_settings_button_html( $tool_id ) . ' ';
$date_args = ( isset( $_GET['start_date'] ) ? '&start_date=' . sanitize_text_field( wp_unslash( $_GET['start_date'] ) ) : '' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
@@ -493,13 +503,25 @@
$filter_args = ( isset( $_GET['alg_export_filter_all_columns'] ) ? '&alg_export_filter_all_columns=' . sanitize_text_field( wp_unslash( $_GET['alg_export_filter_all_columns'] ) ) : '' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
- $html .= '<a class="button-primary" href="' . home_url( '/?alg_export=' . $tool_id . $date_args . $filter_args ) . '">' . __( 'Download CSV', 'export-woocommerce' ) . '</a> ';
- $html .= '<a class="button-primary" href="' . home_url( '/?alg_export_xml=' . $tool_id . $date_args . $filter_args ) . '">' . __( 'Download XML', 'export-woocommerce' ) . '</a>';
- $html .= '<button style="float:right;margin-right:10px;" class="button-primary" type="submit" name="alg_export_filter" value="' . $tool_id . '">' . __( 'Filter by All Fields', 'export-woocommerce' ) . '</button>';
- $html .= '<input style="float:right;margin-right:10px;" type="text" name="alg_export_filter_all_columns" value="' . ( isset( $_GET['alg_export_filter_all_columns'] ) ? sanitize_text_field( wp_unslash( $_GET['alg_export_filter_all_columns'] ) ) : '' ) . '">'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
+ $html .= '<a class="button-primary" href="' . esc_url( home_url( '/?alg_export=' . esc_attr( $tool_id . $date_args . $filter_args ) ) ) . '">' .
+ __( 'Download CSV', 'export-woocommerce' ) .
+ '</a> ';
+
+ $html .= '<a class="button-primary" href="' . esc_url( home_url( '/?alg_export_xml=' . esc_attr( $tool_id . $date_args . $filter_args ) ) ) . '">' .
+ __( 'Download XML', 'export-woocommerce' ) .
+ '</a>';
+
+ $html .= '<button style="float:right;margin-right:10px;" class="button-primary" type="submit" name="alg_export_filter" value="' . $tool_id . '">' .
+ __( 'Filter by All Fields', 'export-woocommerce' ) .
+ '</button>';
+ $html .= '<input style="float:right;margin-right:10px;" type="text" name="alg_export_filter_all_columns" value="' . esc_attr( isset( $_GET['alg_export_filter_all_columns'] ) ? sanitize_text_field( wp_unslash( $_GET['alg_export_filter_all_columns'] ) ) : '' ) . '">'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
+
$html .= '</p>';
+
$html .= '</form>';
- $data = $this->export( $tool_id );
+
+ $data = $this->export( $tool_id );
+
$html .= ( is_array( $data ) ) ? alg_wc_export_get_table_html( $data, array( 'table_class' => 'widefat striped' ) ) : $data;
return $html;
--- a/export-woocommerce/vendor/autoload.php
+++ b/export-woocommerce/vendor/autoload.php
@@ -14,7 +14,10 @@
echo $err;
}
}
- throw new RuntimeException($err);
+ trigger_error(
+ $err,
+ E_USER_ERROR
+ );
}
require_once __DIR__ . '/composer/autoload_real.php';
--- a/export-woocommerce/vendor/composer/InstalledVersions.php
+++ b/export-woocommerce/vendor/composer/InstalledVersions.php
@@ -27,23 +27,12 @@
class InstalledVersions
{
/**
- * @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
- * @internal
- */
- private static $selfDir = null;
-
- /**
* @var mixed[]|null
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
*/
private static $installed;
/**
- * @var bool
- */
- private static $installedIsLocalDir;
-
- /**
* @var bool|null
*/
private static $canGetVendors;
@@ -320,24 +309,6 @@
{
self::$installed = $data;
self::$installedByVendor = array();
-
- // when using reload, we disable the duplicate protection to ensure that self::$installed data is
- // always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
- // so we have to assume it does not, and that may result in duplicate data being returned when listing
- // all installed packages for example
- self::$installedIsLocalDir = false;
- }
-
- /**
- * @return string
- */
- private static function getSelfDir()
- {
- if (self::$selfDir === null) {
- self::$selfDir = strtr(__DIR__, '\', '/');
- }
-
- return self::$selfDir;
}
/**
@@ -351,27 +322,19 @@
}
$installed = array();
- $copiedLocalDir = false;
if (self::$canGetVendors) {
- $selfDir = self::getSelfDir();
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
- $vendorDir = strtr($vendorDir, '\', '/');
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require $vendorDir.'/composer/installed.php';
- self::$installedByVendor[$vendorDir] = $required;
- $installed[] = $required;
- if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
- self::$installed = $required;
- self::$installedIsLocalDir = true;
+ $installed[] = self::$installedByVendor[$vendorDir] = $required;
+ if (null === self::$installed && strtr($vendorDir.'/composer', '\', '/') === strtr(__DIR__, '\', '/')) {
+ self::$installed = $installed[count($installed) - 1];
}
}
- if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
- $copiedLocalDir = true;
- }
}
}
@@ -387,7 +350,7 @@
}
}
- if (self::$installed !== array() && !$copiedLocalDir) {
+ if (self::$installed !== array()) {
$installed[] = self::$installed;
}
--- a/export-woocommerce/vendor/composer/autoload_classmap.php
+++ b/export-woocommerce/vendor/composer/autoload_classmap.php
@@ -11,7 +11,13 @@
'WPFactory\WPFactory_Admin_Menu\Singleton' => $vendorDir . '/wpfactory/wpfactory-admin-menu/src/php/trait-singleton.php',
'WPFactory\WPFactory_Admin_Menu\WC_Settings_Menu_Item_Swapper' => $vendorDir . '/wpfactory/wpfactory-admin-menu/src/php/class-wc-settings-menu-item-swapper.php',
'WPFactory\WPFactory_Admin_Menu\WPFactory_Admin_Menu' => $vendorDir . '/wpfactory/wpfactory-admin-menu/src/php/class-wpfactory-admin-menu.php',
- 'WPFactory\WPFactory_Cross_Selling\Banners' => $vendorDir . '/wpfactory/wpfactory-cross-selling/src/php/class-banners.php',
+ 'WPFactory\WPFactory_Cross_Selling\My_Plugins\Catalog' => $vendorDir . '/wpfactory/wpfactory-cross-selling/src/php/my-plugins/class-catalog.php',
+ 'WPFactory\WPFactory_Cross_Selling\My_Plugins\Installer' => $vendorDir . '/wpfactory/wpfactory-cross-selling/src/php/my-plugins/class-installer.php',
+ 'WPFactory\WPFactory_Cross_Selling\My_Plugins\Page' => $vendorDir . '/wpfactory/wpfactory-cross-selling/src/php/my-plugins/class-page.php',
+ 'WPFactory\WPFactory_Cross_Selling\My_Plugins\Plugin' => $vendorDir . '/wpfactory/wpfactory-cross-selling/src/php/my-plugins/class-plugin.php',
+ 'WPFactory\WPFactory_Cross_Selling\My_Plugins\Rules_Engine' => $vendorDir . '/wpfactory/wpfactory-cross-selling/src/php/my-plugins/class-rules-engine.php',
+ 'WPFactory\WPFactory_Cross_Selling\My_Plugins\Signals' => $vendorDir . '/wpfactory/wpfactory-cross-selling/src/php/my-plugins/class-signals.php',
+ 'WPFactory\WPFactory_Cross_Selling\My_Plugins\Site_State' => $vendorDir . '/wpfactory/wpfactory-cross-selling/src/php/my-plugins/class-site-state.php',
'WPFactory\WPFactory_Cross_Selling\Product_Categories' => $vendorDir . '/wpfactory/wpfactory-cross-selling/src/php/class-product-categories.php',
'WPFactory\WPFactory_Cross_Selling\Products' => $vendorDir . '/wpfactory/wpfactory-cross-selling/src/php/class-products.php',
'WPFactory\WPFactory_Cross_Selling\Recommendation_Box_Tags' => $vendorDir . '/wpfactory/wpfactory-cross-selling/src/php/class-recommendation-box-tags.php',
--- a/export-woocommerce/vendor/composer/autoload_files.php
+++ b/export-woocommerce/vendor/composer/autoload_files.php
@@ -0,0 +1,10 @@
+<?php
+
+// autoload_files.php @generated by Composer
+
+$vendorDir = dirname(__DIR__);
+$baseDir = dirname($vendorDir);
+
+return array(
+ 'c8d460c769879e4903cad859e3e806fc' => $vendorDir . '/wpfactory/wpfactory-cross-selling/src/php/my-plugins/loader.php',
+);
--- a/export-woocommerce/vendor/composer/autoload_real.php
+++ b/export-woocommerce/vendor/composer/autoload_real.php
@@ -31,6 +31,18 @@
$loader->register(true);
+ $filesToLoad = ComposerAutoloadComposerStaticInitWPFactoryExportWooCommerce::$files;
+ $requireFile = Closure::bind(static function ($fileIdentifier, $file) {
+ if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
+ $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
+
+ require $file;
+ }
+ }, null, null);
+ foreach ($filesToLoad as $fileIdentifier => $file) {
+ $requireFile($fileIdentifier, $file);
+ }
+
return $loader;
}
}
--- a/export-woocommerce/vendor/composer/autoload_static.php
+++ b/export-woocommerce/vendor/composer/autoload_static.php
@@ -6,13 +6,23 @@
class ComposerStaticInitWPFactoryExportWooCommerce
{
+ public static $files = array (
+ 'c8d460c769879e4903cad859e3e806fc' => __DIR__ . '/..' . '/wpfactory/wpfactory-cross-selling/src/php/my-plugins/loader.php',
+ );
+
public static $classMap = array (
'Composer\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
'WPFactory\WPFactory_Admin_Menu\Plugin_Icon' => __DIR__ . '/..' . '/wpfactory/wpfactory-admin-menu/src/php/class-plugin-icon.php',
'WPFactory\WPFactory_Admin_Menu\Singleton' => __DIR__ . '/..' . '/wpfactory/wpfactory-admin-menu/src/php/trait-singleton.php',
'WPFactory\WPFactory_Admin_Menu\WC_Settings_Menu_Item_Swapper' => __DIR__ . '/..' . '/wpfactory/wpfactory-admin-menu/src/php/class-wc-settings-menu-item-swapper.php',
'WPFactory\WPFactory_Admin_Menu\WPFactory_Admin_Menu' => __DIR__ . '/..' . '/wpfactory/wpfactory-admin-menu/src/php/class-wpfactory-admin-menu.php',
- 'WPFactory\WPFactory_Cross_Selling\Banners' => __DIR__ . '/..' . '/wpfactory/wpfactory-cross-selling/src/php/class-banners.php',
+ 'WPFactory\WPFactory_Cross_Selling\My_Plugins\Catalog' => __DIR__ . '/..' . '/wpfactory/wpfactory-cross-selling/src/php/my-plugins/class-catalog.php',
+ 'WPFactory\WPFactory_Cross_Selling\My_Plugins\Installer' => __DIR__ . '/..' . '/wpfactory/wpfactory-cross-selling/src/php/my-plugins/class-installer.php',
+ 'WPFactory\WPFactory_Cross_Selling\My_Plugins\Page' => __DIR__ . '/..' . '/wpfactory/wpfactory-cross-selling/src/php/my-plugins/class-page.php',
+ 'WPFactory\WPFactory_Cross_Selling\My_Plugins\Plugin' => __DIR__ . '/..' . '/wpfactory/wpfactory-cross-selling/src/php/my-plugins/class-plugin.php',
+ 'WPFactory\WPFactory_Cross_Selling\My_Plugins\Rules_Engine' => __DIR__ . '/..' . '/wpfactory/wpfactory-cross-selling/src/php/my-plugins/class-rules-engine.php',
+ 'WPFactory\WPFactory_Cross_Selling\My_Plugins\Signals' => __DIR__ . '/..' . '/wpfactory/wpfactory-cross-selling/src/php/my-plugins/class-signals.php',
+ 'WPFactory\WPFactory_Cross_Selling\My_Plugins\Site_State' => __DIR__ . '/..' . '/wpfactory/wpfactory-cross-selling/src/php/my-plugins/class-site-state.php',
'WPFactory\WPFactory_Cross_Selling\Product_Categories' => __DIR__ . '/..' . '/wpfactory/wpfactory-cross-selling/src/php/class-product-categories.php',
'WPFactory\WPFactory_Cross_Selling\Products' => __DIR__ . '/..' . '/wpfactory/wpfactory-cross-selling/src/php/class-products.php',
'WPFactory\WPFactory_Cross_Selling\Recommendation_Box_Tags' => __DIR__ . '/..' . '/wpfactory/wpfactory-cross-selling/src/php/class-recommendation-box-tags.php',
--- a/export-woocommerce/vendor/composer/installed.php
+++ b/export-woocommerce/vendor/composer/installed.php
@@ -3,7 +3,7 @@
'name' => '__root__',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
- 'reference' => '794e3c8b6022099355a97100ddb9e61739849245',
+ 'reference' => '0650b10028600692981452a8fe7fdc838dea38f3',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -13,7 +13,7 @@
'__root__' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
- 'reference' => '794e3c8b6022099355a97100ddb9e61739849245',
+ 'reference' => '0650b10028600692981452a8fe7fdc838dea38f3',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -29,9 +29,9 @@
'dev_requirement' => false,
),
'wpfactory/wpfactory-cross-selling' => array(
- 'pretty_version' => 'v1.1.7',
- 'version' => '1.1.7.0',
- 'reference' => '0fb1b6ddca7956b1608275dc8ff5e2e7f7bbd495',
+ 'pretty_version' => 'v1.2.3',
+ 'version' => '1.2.3.0',
+ 'reference' => 'b36614afd61e0c77e2c5b58e5161c0daac680bea',
'type' => 'library',
'install_path' => __DIR__ . '/../wpfactory/wpfactory-cross-selling',
'aliases' => array(),
--- a/export-woocommerce/vendor/wpfactory/wpfactory-cross-selling/src/php/class-banners.php
+++ b/export-woocommerce/vendor/wpfactory/wpfactory-cross-selling/src/php/class-banners.php
@@ -1,465 +0,0 @@
-<?php
-/**
- * WPFactory Cross-Selling - Banners
- *
- * @version 1.0.8
- * @since 1.0.7
- * @author WPFactory
- */
-
-namespace WPFactoryWPFactory_Cross_Selling;
-
-use WPFactoryWPFactory_Admin_MenuWPFactory_Admin_Menu;
-
-if ( ! defined( 'ABSPATH' ) ) {
- exit;
-} // Exit if accessed directly
-
-if ( ! class_exists( 'WPFactoryWPFactory_Cross_SellingBanners' ) ) {
-
- /**
- * Banners.
- *
- * @version 1.0.7
- * @since 1.0.7
- */
- class Banners {
-
- /**
- * WPFactory_Cross_Selling_Injector.
- *
- * @since 1.0.7
- */
- use WPFactory_Cross_Selling_Injector;
-
- /**
- * Initialized.
- *
- * @since 1.0.7
- *
- * @var bool
- */
- protected static $initialized = false;
-
- /**
- * $get_dashboard_banner_ajax_action.
- *
- * @since 1.0.7
- *
- * @var string
- */
- protected $get_dashboard_banner_ajax_action = 'wpfcs_get_dashboard_banner';
-
- /**
- * $close_dashboard_banner_ajax_action.
- *
- * @since 1.0.7
- *
- * @var string
- */
- protected $close_dashboard_banner_ajax_action = 'wpfcs_close_dashboard_banner';
-
- /**
- * Initializes the class.
- *
- * @version 1.0.7
- * @since 1.0.7
- *
- * @return void
- */
- function init() {
- $setup_args = $this->get_wpfactory_cross_selling()->get_setup_args();
- if (
- $setup_args['banners']['enable'] &&
- ! self::$initialized
- ) {
- self::$initialized = true;
- add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_dynamic_style' ), 11 );
- add_filter( 'wpfcs_enqueue_admin_css', array( $this, 'enqueue_cross_selling_admin_css' ) );
- add_action( 'admin_notices', array( $this, 'display_dashboard_banner_wrapper' ) );
- add_action( 'wp_ajax_' . $this->get_dashboard_banner_ajax_action, array( $this, 'get_dashboard_banner_ajax_action' ) );
- add_action( 'wp_ajax_' . $this->close_dashboard_banner_ajax_action, array( $this, 'close_dashboard_banner_ajax_action' ) );
- }
- }
-
- /**
- * enqueue_dynamic_style.
- *
- * @version 1.0.7
- * @since 1.0.7
- *
- * @return void
- */
- function enqueue_dynamic_style() {
- if (
- $this->can_display_banner_at_current_location() &&
- ! $this->dashboard_banner_should_remain_closed()
- ) {
- $close_btn_right_or_left = true === is_rtl() ? 'left' : 'right';
- $right_or_left_style = $close_btn_right_or_left . ': -12px;';
- $css = "
- .wpfcs-dashboard-banner-close-btn {
- {$right_or_left_style};
- }
- ";
- wp_add_inline_style( 'wpfactory-cross-selling', $css );
- }
- }
-
- /**
- * enqueue_cross_selling_admin_css.
- *
- * @version 1.0.7
- * @since 1.0.7
- *
- * @param $enqueue
- *
- * @return true
- */
- function enqueue_cross_selling_admin_css( $enqueue ) {
- if (
- $this->can_display_banner_at_current_location() &&
- ! $this->dashboard_banner_should_remain_closed()
- ) {
- $enqueue = true;
- }
-
- return $enqueue;
- }
-
- /**
- * get_advanced_ads_group.
- *
- * @version 1.0.7
- * @since 1.0.7
- *
- * @return mixed|void|null
- */
- function get_advanced_ads_group( $group_name ) {
- $response = wp_remote_get( 'https://wpfactory.com/wp-json/advanced-ads/v1/groups' );
- if ( ! is_wp_error( $response ) ) {
- $body = wp_remote_retrieve_body( $response );
- $data = json_decode( $body, true );
- $result = wp_list_filter( $data, [
- 'name' => $group_name
- ] );
- if ( empty( $result ) ) {
- return null;
- }
-
- return array_shift( $result );
- }
-
- return null;
- }
-
- /**
- * get_banners_from_advanced_ads_group.
- *
- * @version 1.0.7
- * @since 1.0.7
- *
- * @return mixed|void
- */
- function get_banners_from_advanced_ads_group( $advaced_ads_group ) {
- $setup_args = $this->get_wpfactory_cross_selling()->get_setup_args();
- $content = array();
-
- $advaced_ads_group_sanitized = sanitize_key( $advaced_ads_group );
- $transient_name = "wpfcs_banners_from_advanced_ads_group_{$advaced_ads_group_sanitized}";
-
- if ( 'advanced_ads' === $setup_args['banners']['get_banner_method'] ) {
- if ( false !== $setup_args['banners']['banner_cache_duration'] && false !== ( $cached_content = get_transient( $transient_name ) ) ) {
- return $cached_content;
- }
- $group = $this->get_advanced_ads_group( $advaced_ads_group );
- if ( ! is_null( $group ) && isset( $group['ads'] ) ) {
- if ( ! empty( $ads = $group['ads'] ) && is_array( $ads ) ) {
- foreach ( $ads as $ad_id ) {
- $response = wp_remote_get( 'https://wpfactory.com/wp-json/advanced-ads/v1/ads/' . $ad_id );
-
- if ( ! is_wp_error( $response ) ) {
- $body = wp_remote_retrieve_body( $response );
- $data = json_decode( $body, true );
- if ( isset( $data['expiration_date'] ) && ! empty( $expiration_date = $data['expiration_date'] ) ) {
- if ( $expiration_date < current_time( 'timestamp' ) ) {
- continue;
- }
- }
- if ( isset( $data['content'] ) && ! empty( $data['content'] ) ) {
- $content[] = $data['content'];
- }
- }
- }
- }
-
- if ( false !== $setup_args['banners']['banner_cache_duration'] ) {
- set_transient( $transient_name, $content, $setup_args['banners']['banner_cache_duration'] );
- }
-
- return $content;
- }
- }
-
- return null;
- }
-
- /**
- * display_dashboard_banner.
- *
- * @version 1.0.7
- * @since 1.0.7
- *
- * @return void
- */
- function display_dashboard_banner_wrapper() {
- if (
- ! $this->can_display_banner_at_current_location() ||
- $this->dashboard_banner_should_remain_closed()
- ) {
- return;
- }
- $banner = '<div class="wpfcs-dashboard-banner-wrapper"></div>';
- echo wp_kses_post( $banner );
- echo $this->get_dashboard_banner_js();
- }
-
- /**
- * get_dashboard_banner_ajax_action.
- *
- * @version 1.0.7
- * @since 1.0.7
- *
- * @return void
- */
- function get_dashboard_banner_ajax_action() {
- if ( false !== check_ajax_referer( 'wpfcs-get-dashboard-banner', 'banner_nonce' ) ) {
- $setup_args = $this->get_wpfactory_cross_selling()->get_setup_args();
- $banners = $this->get_banners_from_advanced_ads_group( $setup_args['banners']['advanced_ads_setup']['dashboard_banner_group_name'] );
- if ( ! is_null( $banners ) ) {
- if ( isset( $_REQUEST['is_recommendations_page'] ) && true === filter_var( $_REQUEST['is_recommendations_page'], FILTER_VALIDATE_BOOLEAN ) ) {
- $output = $this->render_dashboard_banner( $banners, false );
- } else {
- $output = $this->dashboard_banner_should_remain_closed() ? '' : $this->render_dashboard_banner( $banners );
- }
- } else {
- $output = '';
- }
- wp_send_json_success( array(
- 'banner_data' => wp_kses_post( $output ),
- ) );
- }
- }
-
- /**
- * render_dashboard_banner.
- *
- * @version 1.0.8
- * @since 1.0.7
- *
- * @param $banners_arr
- *
- * @return string
- */
- function render_dashboard_banner( $banners_arr, $add_close_button = true ) {
- $banners_html = '';
- if ( ! empty( $banners_arr ) ) {
- $banners_html .= '<div class="wrap">';
- foreach ( $banners_arr as $banner ) {
- $close_button = $add_close_button ? '<button type="button" aria-label="' . __( 'Close', 'wpfactory-cross-selling' ) . '" class="wpfcs-dashboard-banner-close-btn"><div class="dashicons-before dashicons-no"></div></button>' : '';
- $banners_html .= '<div class="wpfcs-dashboard-banner"><div class="wpfcs-dashboard-banner-inner">' . wp_kses_post( $this->force_target_blank_on_html( $banner ) ) . $close_button . '</div></div>';
- break;
- }
- $banners_html .= '</div>';
- }
-
- return $banners_html;
- }
-
- /**
- * dashboard_banner_should_remain_closed.
- *
- * @version 1.0.7
- * @since 1.0.7
- *
- * @return bool
- */
- function dashboard_banner_should_remain_closed() {
- if ( $this->is_recommendations_page() ) {
- return false;
- }
-
- $user_id = get_current_user_id();
- $setup_args = $this->get_wpfactory_cross_selling()->get_setup_args();
-
- if ( ! $user_id ) {
- return false;
- }
-
- $closed_at = (int) get_user_meta( $user_id, 'wpfcs_dashboard_banner_closed_time', true );
-
- if ( ! $closed_at ) {
- return false;
- }
-
- return ( time() - $closed_at ) < $setup_args['banners']['banner_dismiss_duration'];
- }
-
- /**
- * close_dashboard_banner_ajax_action.
- *
- * @version 1.0.7
- * @since 1.0.7
- *
- * @return void
- */
- function close_dashboard_banner_ajax_action() {
- if ( false !== check_ajax_referer( 'wpfcs-get-dashboard-banner', 'banner_nonce' ) ) {
- update_user_meta( get_current_user_id(), 'wpfcs_dashboard_banner_closed_time', time() );
- wp_send_json_success();
- }
- }
-
- /**
- * can_display_banner_at_this_location.
- *
- * @version 1.0.7
- * @since 1.0.7
- *
- * @return false|void
- */
- function can_display_banner_at_current_location() {
- return true;
- }
-
- /**
- * is_recommendations_page.
- *
- * @version 1.0.7
- * @since 1.0.7
- *
- * @return bool
- */
- function is_recommendations_page() {
- return is_admin() && filter_input( INPUT_GET, 'page' ) === 'wpfactory-cross-selling';
- }
-
- /**
- * get_dashboard_banner_js.
- *
- * @version 1.0.7
- * @since 1.0.7
- *
- * @return false|string
- */
- function get_dashboard_banner_js() {
- ob_start();
- $php_to_js = array(
- 'banner_nonce' => wp_create_nonce( 'wpfcs-get-dashboard-banner' ),
- 'get_banner_action' => $this->get_dashboard_banner_ajax_action,
- 'close_banner_action' => $this->close_dashboard_banner_ajax_action,
- 'banner_wrapper_selector' => '.wpfcs-dashboard-banner-wrapper',
- 'close_button_selector' => '.wpfcs-dashboard-banner-close-btn',
- 'is_recommendations_page' => $this->is_recommendations_page()
- );
- ?>
- <script>
- // Gets banner.
- jQuery( function ( $ ) {
- let dataFromPHP = <?php echo wp_json_encode( $php_to_js );?>;
- dataFromPHP.action = dataFromPHP.get_banner_action;
- $.post( ajaxurl, dataFromPHP ).done( res => {
- if ( res.data.banner_data?.trim() ) {
- jQuery( dataFromPHP.banner_wrapper_selector ).html( res.data.banner_data )
- }
- } );
- } );
-
- // Closes banner.
- jQuery( function ( $ ) {
- let dataFromPHP = <?php echo wp_json_encode( $php_to_js );?>;
- dataFromPHP.action = dataFromPHP.close_banner_action;
- $( document ).on( 'click', dataFromPHP.close_button_selector, function () {
- $( dataFromPHP.banner_wrapper_selector ).fadeOut( 300, function () {
- $( this ).remove();
- } );
- $.post( ajaxurl, dataFromPHP );
- } );
- } );
- </script>
- <?php
- return ob_get_clean();
- }
-
- /**
- * get_products.
- *
- * @version 1.0.7
- * @since 1.0.7
- *
- * @return array[]
- */
- function get_recommendation_tab_banners() {
- $setup_args = $this->get_wpfactory_cross_selling()->get_setup_args();
- $banners = $this->get_banners_from_advanced_ads_group( $setup_args['banners']['advanced_ads_setup']['recommendations_group_name'] );
-
- return $banners;
- }
-
- /**
- * render_recommendation_tab_banners.
- *
- * @version 1.0.7
- * @since 1.0.7
- *
- * @param $banners
- *
- * @return false|string
- */
- function render_recommendation_tab_banners( $banners ) {
- if ( empty( $banners ) || ! is_array( $banners ) ) {
- return '';
- }
- ob_start();
- ?>
- <?php foreach ( $banners as $banner ): ?>
- <div class="wpfcs-banner">
- <?php echo wp_kses_post( $this->force_target_blank_on_html( $banner ) ); ?>
- </div>
- <?php endforeach; ?>
- <?php
- $output = ob_get_contents();
- ob_end_clean();
-
- return $output;
- }
-
- /**
- * force_target_blank_on_html.
- *
- * @version 1.0.7
- * @since 1.0.7
- *
- * @param $raw_string
- *
- * @return false|string
- */
- function force_target_blank_on_html( $raw_string ) {
- $html = html_entity_decode( $raw_string, ENT_QUOTES, 'UTF-8' );
- libxml_use_internal_errors( true );
-
- $dom = new DOMDocument();
- $dom->loadHTML( $html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD );
-
- foreach ( $dom->getElementsByTagName( 'a' ) as $a ) {
- $a->setAttribute( 'target', '_blank' );
- $a->setAttribute( 'rel', 'noopener noreferrer' );
- }
-
- $html = $dom->saveHTML();
-
- return $html;
- }
-
- }
-}
No newline at end of file
--- a/export-woocommerce/vendor/wpfactory/wpfactory-cross-selling/src/php/class-recommendations-box.php
+++ b/export-woocommerce/vendor/wpfactory/wpfactory-cross-selling/src/php/class-recommendations-box.php
@@ -114,9 +114,6 @@
$box_tags_class = new Recommendation_Box_Tags();
$box_tags = $box_tags_class->get_tags();
- // Banners.
- $banners = $this->get_wpfactory_cross_selling()->banners->get_recommendation_tab_banners();
-
?>
<div class="wpfcs-recommendations-box">
<h3 class="wpfcs-recommendation-box-title">
@@ -147,9 +144,6 @@
</div>
<?php endforeach; ?>
</div>
- <div class="wpfcs-banners">
- <?php echo $this->get_wpfactory_cross_selling()->banners->render_recommendation_tab_banners( $banners ) ?>
- </div>
</div>
<?php
$this->add_recommendation_box_js();
--- a/export-woocommerce/vendor/wpfactory/wpfactory-cross-selling/src/php/class-recommendations-page.php
+++ b/export-woocommerce/vendor/wpfactory/wpfactory-cross-selling/src/php/class-recommendations-page.php
@@ -75,6 +75,18 @@
}
/**
+ * my_plugins_booted.
+ *
+ * @version 1.2.0
+ * @since 1.2.0
+ *
+ * @return bool
+ */
+ function my_plugins_booted() {
+ return defined( 'WPFACTORY_MY_PLUGINS_DIR' );
+ }
+
+ /**
* enqueue_wcfcs_css_on_recommendations_page.
*
* @version 1.0.4
@@ -107,7 +119,7 @@
$setup_args = $this->get_wpfactory_cross_selling()->get_setup_args();
$action_link = $setup_args['recommendations_page']['action_link'] ?? '';
$label = $action_link['label'] ?? '';
- $link = admin_url( 'admin.php?page=' . $this->recommendations_page_slug );
+ $link = admin_url( 'admin.php?page=' . ( $this->my_plugins_booted() ? 'wpfactory-my-plugins' : $this->recommendations_page_slug ) );
$target = '_self';
$custom_links[] = sprintf( '<a href="%s" target="%s">%s</a>', esc_url( $link ), sanitize_text_field( $target ), sanitize_text_field( $label ) );
$links = array_merge( $links, $custom_links );
@@ -124,7 +136,9 @@
* @return void
*/
function create_recommendations_submenu() {
- if ( self::$recommendations_submenu_initialized ) {
+ // Since 1.2.0 the My Plugins page replaces this one. It is only registered
+ // when My Plugins could not boot (its loader is missing from this plugin's autoload).
+ if ( self::$recommendations_submenu_initialized || $this->my_plugins_booted() ) {
return;
}
self::$recommendations_submenu_initialized = true;
--- a/export-woocommerce/vendor/wpfactory/wpfactory-cross-selling/src/php/class-wpfactory-cross-selling.php
+++ b/export-woocommerce/vendor/wpfactory/wpfactory-cross-selling/src/php/class-wpfactory-cross-selling.php
@@ -32,7 +32,7 @@
*
* @var string
*/
- protected $version = '1.1.7';
+ protected $version = '1.2.3';
/**
* Setup args.
@@ -53,15 +53,6 @@
public $products;
/**
- * Banners.
- *
- * @since 1.0.4
- *
- * @var Banners
- */
- public $banners;
-
- /**
* Product categories.
*
* @since 1.0.0
@@ -96,22 +87,22 @@
'plugin_file_path' => '',
'recommendations_page' => array(),
'recommendations_box' => array(),
- 'banners' => array()
) );
- // Recommendations page.
+ // Recommendations page. Since 1.2.0 the My Plugins page replaces it; these args are only
+ // used when My Plugins could not boot (see Recommendations_Page).
$args['recommendations_page'] = wp_parse_args( $args['recommendations_page'], array(
- 'page_title' => __( 'WPFactory Recommendations', 'wpfactory-cross-selling' ),
- 'menu_title' => __( 'Recommendations', 'wpfactory-cross-selling' ),
+ 'page_title' => __( 'My Plugins', 'wpfactory-cross-selling' ),
+ 'menu_title' => __( 'My Plugins', 'wpfactory-cross-selling' ),
'menu_capability' => '',
'menu_position' => 2,
'action_link' => array()
) );
- // Recommendations page action link.
+ // Plugins screen action link.
$args['recommendations_page']['action_link'] = wp_parse_args( $args['recommendations_page']['action_link'], array(
'enable' => true,
- 'label' => __( 'Recommendations', 'wpfactory-cross-selling' ),
+ 'label' => __( 'My Plugins', 'wpfactory-cross-selling' ),
) );
// Recommendations box.
@@ -121,17 +112,6 @@
'wc_settings_tab_id' => '',
) );
- $args['banners'] = wp_parse_args( $args['banners'], array(
- 'enable' => true,
- 'get_banner_method' => 'advanced_ads',
- 'banner_cache_duration' => HOUR_IN_SECONDS, // `false` to not cache results.
- 'banner_dismiss_duration' => WEEK_IN_SECONDS, // `false` to always display it.
- 'advanced_ads_setup' => array(
- 'dashboard_banner_group_name' => 'CS - Dashboard',
- 'recommendations_group_name' => 'CS - Recommendations'
- )
- ) );
-
// Library file path.
$args['library_file_path'] = __FILE__;
$args['library_root_path'] = plugin_dir_path( dirname( __FILE__ ) );
@@ -169,11 +149,6 @@
$recommendations_box->set_wpfactory_cross_selling( $this );
$recommendations_box->init();
- // Banners.
- $this->banners = new Banners();
- $this->banners->set_wpfactory_cross_selling( $this );
- $this->banners->init();
-
// Enqueues admin syles.
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_styles' ) );
}
--- a/export-woocommerce/vendor/wpfactory/wpfactory-cross-selling/src/php/my-plugins/bootstrap.php
+++ b/export-woocommerce/vendor/wpfactory/wpfactory-cross-selling/src/php/my-plugins/bootstrap.php
@@ -0,0 +1,24 @@
+<?php
+/**
+ * WPFactory Cross-Selling - My Plugins - Bootstrap.
+ *
+ * Loaded by loader.php from the newest copy only. The classes are required here,
+ * before anything can autoload an older copy of them (their guards skip autoload).
+ *
+ * @version 1.2.0
+ * @since 1.2.0
+ * @author WPFactory
+ */
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+}
+
+foreach ( array( 'class-catalog.php', 'class-site-state.php', 'class-signals.php', 'class-rules-engine.php', 'class-installer.php', 'class-page.php', 'class-plugin.php' ) as $wpfactory_my_plugins_file ) {
+ require_once __DIR__ . '/' . $wpfactory_my_plugins_file;
+}
+unset( $wpfactory_my_plugins_file );
+
+// The loader's path, not __DIR__: PHP resolves symlinks and junctions in __DIR__, which would
+// point outside the plugins folder and break plugins_url().
+WPFactoryWPFactory_Cross_SellingMy_PluginsPlugin::boot( dirname( defined( 'WPFACTORY_MY_PLUGINS_DIR' ) ? WPFACTORY_MY_PLUGINS_DIR : __DIR__, 3 ) );
--- a/export-woocommerce/vendor/wpfactory/wpfactory-cross-selling/src/php/my-plugins/class-catalog.php
+++ b/export-woocommerce/vendor/wpfactory/wpfactory-cross-selling/src/php/my-plugins/class-catalog.php
@@ -0,0 +1,887 @@
+<?php
+/**
+ * WPFactory Cross-Selling - My Plugins - Catalog.
+ *
+ * Every WPFactory (and WBW) plugin the My Plugins page knows about.
+ * The catalog is bundled with the library and only changes with a release
+ * (no remote catalog, wp.org guideline 7).
+ *
+ * Sources (checked 2026-11-24):
+ * - wp.org slugs, names and icons: api.wordpress.org, authors "wpcodefactory" and "woobewoo".
+ * - Main file names: "Plugin Name" headers in the github.com/wpcodefactory repos.
+ * - Pro links: live product pages listed by wpfactory.com/wp-json/wp/v2/product.
+ *
+ * @version 1.2.0
+ * @since 1.2.0
+ * @author WPFactory
+ */
+
+namespace WPFactoryWPFactory_Cross_SellingMy_Plugins;
+
+if ( ! defined( 'ABSPATH' ) ) {
+ exit;
+} // Exit if accessed directly
+
+if ( ! class_exists( 'WPFactoryWPFactory_Cross_SellingMy_PluginsCatalog', false ) ) {
+
+ /**
+ * Catalog.
+ *
+ * @version 1.2.0
+ * @since 1.2.0
+ */
+ class Catalog {
+
+ /**
+ * Catalog version. Bump only when a new plugin is added (drives the menu dot).
+ *
+ * @since 1.2.0
+ */
+ const CATALOG_VERSION = 1;
+
+ /**
+ * "Top plugins" tab: catalog ids, in the order they are listed.
+ *
+ * 9 top WPFactory plugins plus Product Filter by WBW, by wordpress.org active installs
+ * (checked 2026-11-24). To change the tab, edit this list.
+ *
+ * @since 1.2.0
+ */
+ const TOP = array(
+ 'product-filter', // 50,000+ active installs.
+ 'download-plugins', // 30,000+.
+ 'ean', // 10,000+.
+ 'order-min-max-amount', // 10,000+.
+ 'cost-of-goods', // 8,000+.
+ 'email-verification', // 8,000+.
+ 'eu-vat', // 7,000+.
+ 'payment-methods', // 4,000+.
+ 'min-max-quantity', // 3,000+.
+ 'wishlist', // 2,000+.
+ );
+
+ /**
+ * Item defaults.
+ *
+ * - name, desc: short display copy (no em or en dashes).
+ * - job: tab id from get_jobs() (any tab but "top", which comes from TOP).
+ * - top: computed, not set here: the id is in TOP.
+ * - store: needs WooCommerce (hidden when WooCommerce is not active).
+ * - vendor: "wpfactory" or "wbw".
+ * - wporg: wp.org slug, so the free version can be installed. Empty for Pro-only.
+ * - free_file: free plugin file as WordPress stores it ("folder/file.php").
+ * - pro_file: Pro plugin file. Matching also accepts the same file name in another folder.
+ * - pro_url: Pro product page, no tracking params. Empty when there is no Pro.
+ * - icon_url: wp.org icon (ps.w.org).
+ * - icon_file: bundled icon, relative to the library's assets/img/icons/ (plugins without a wp.org listing).
+ * - abbr: two letters for the fallback badge when there is no icon.
+ *
+ * @since 1.2.0
+ *
+ * @var array
+ */
+ protected static $defaults = array(
+ 'name' => '',
+ 'desc' => '',
+ 'job' => '',
+ 'store' => true,
+ 'vendor' => 'wpfactory',
+ 'wporg' => '',
+ 'free_file' => '',
+ 'pro_file' => '',
+ 'pro_url' => '',
+ 'icon_url' => '',
+ 'icon_file' => '',
+ 'abbr' => '',
+ );
+
+ /**
+ * Cached items (per request, per locale).
+ *
+ * @since 1.2.0
+ *
+ * @var array|null
+ */
+ protected static $items = null;
+
+ /**
+ * get_jobs.
+ *
+ * Tab ids and labels, in display order. "top" is a tab, not a job.
+ *
+ * @version 1.2.0
+ * @since 1.2.0
+ *
+ * @return array
+ */
+ static function get_jobs() {
+ return array(
+ 'top' => __( 'Top plugins', 'wpfactory-cross-selling' ),
+ 'sell' => __( 'Sell more per order', 'wpfactory-cross-selling' ),
+ 'display' => __( 'Store display', 'wpfactory-cross-selling' ),
+ 'rules' => __( 'Set order rules', 'wpfactory-cross-selling' ),
+ 'numbers' => __( 'Know your numbers', 'wpfactory-cross-selling' ),
+ 'support' => __( 'Support customers', 'wpfactory-cross-selling' ),
+ 'tidy' => __( 'Tidy up WordPress', 'wpfactory-cross-selling' ),
+ 'manage' => __( 'Manage your store', 'wpfactory-cross-selling' ),
+ );
+ }
+
+ /**
+ * get_items.
+ *
+ * @version 1.2.0
+ * @since 1.2.0
+ *
+ * @return array Items keyed by catalog id, in display order.
+ */
+ static function get_items() {
+ if ( null === self::$items ) {
+ $items = array();
+ foreach ( self::get_raw_items() as $id => $item ) {
+ $item = array_merge( self::$defaults, $item, array( 'id' => $id ) );
+ $item['top'] = in_array( $id, self::TOP, true );
+ $items[ $id ] = $item;
+ }
+ self::$items = $items;
+ }
+ return self::$items;
+ }
+
+ /**
+ * get_item.
+ *
+ * @version 1.2.0
+ * @since 1.2.0
+ *
+ * @param string $id Catalog id.
+ *
+ * @return array|null
+ */
+ static function get_item( $id ) {
+ $items = self::get_items();
+ return isset( $items[ $id ] ) ? $items[ $id ] : null;
+ }
+
+ /**
+ * is_available.
+ *
+ * An item can be offered only if it can be installed from wp.org or bought.
+ *
+ * @version 1.2.0
+ * @since 1.2.0
+ *
+ * @param array $item Catalog item.
+ *
+ * @return bool
+ */
+ static function is_available( $item ) {
+ return ( '' !== $item['wporg'] || '' !== $item['pro_url'] );
+ }
+
+ /**
+ * is_pro_only.
+ *
+ * @version 1.2.0
+ * @since 1.2.0
+ *
+ * @param array $item Catalog item.
+ *
+ * @return bool
+ */
+ static function is_pro_only( $item ) {
+ return ( '' === $item['wporg'] && '' !== $item['pro_url'] );
+ }
+
+ /**
+ * reset.
+ *
+ * Drops the per-request cache (after a locale switch, and in tests).
+ *
+ * @version 1.2.0
+ * @since 1.2.0
+ */
+ static function reset() {
+ self::$items = null;
+ }
+
+ /**
+ * get_raw_items.
+ *
+ * @version 1.2.0
+ * @since 1.2.0
+ *
+ * @return array
+ */
+ protected static function get_raw_items() {
+ $wpf = 'https://wpfactory.com/item/';
+ $psw = 'https://ps.w.org/';
+
+ return array(
+
+ 'ai-image' => array(
+ 'name' => __( 'AI Product Image Generator', 'wpfactory-cross-selling' ),
+ 'desc' => __( 'Turn plain product photos into professional images with AI, in bulk.', 'wpfactory-cross-selling' ),
+ 'job' => 'manage',
+ 'pro_file' => 'ai-product-image-generator/ai-product-image-generator.php',
+ 'pro_url' => $wpf . 'ai-product-image-generator-for-woocommerce/',
+ 'icon_file' => 'ai-image.png',
+ 'abbr' => 'AI',
+ ),
+ 'helpdesk' => array(
+ 'name' => __( 'Helpdesk Support Tickets', 'wpfactory-cross-selling' ),
+ 'desc' => __( 'Let customers open support tickets from their account, linked to their orders.', 'wpfactory-cross-selling' ),
+ 'job' => 'support',
+ 'wporg' => 'support-ticket-system-for-woocommerce',
+ 'free_file' => 'support-ticket-system-for-woocommerce/support-ticket-system-for-woocommerce.php',
+ 'pro_file' => 'helpdesk-support-ticket-system-for-woocommerce-pro/support-ticket-system-woocommerce-pro.php',
+ 'pro_url' => $wpf . 'helpdesk-support-ticketing-system-for-woocommerce/',
+ 'icon_url' => $psw . 'support-ticket-system-for-woocommerce/assets/icon.svg?rev=3309458',
+ 'abbr' => 'HD',
+ ),
+ // Not on wp.org yet and no live product page: kept for detection, not offered (is_available() is false).
+ // free_file follows the wpf-pro-to-free naming (X-pro.php becomes X.php), not confirmed.
+ 'ai-assistant' => array(
+ 'name' => __( 'AI Assistant and MCP Server', 'wpfactory-cross-selling' ),
+ 'desc' => __( 'Run site tasks in plain language, or connect Claude and ChatGPT.', 'wpfactory-cross-selling' ),
+ 'job' => 'manage',
+ 'store' => false,
+ 'free_file' => 'ai-assistant-mcp/ai-assistant-mcp.php',
+ 'pro_file' => 'ai-assistant-mcp-pro/ai-assistant-mcp-pro.php',
+ 'abbr' => 'AA',
+ ),
+ 'product-filter' => array(
+ 'name' => __( 'Product Filter by WBW', 'wpfactory-cross-selling' ),
+ 'desc' => __( 'Product filters that work with any theme and are built for mobile.', 'wpfactory-cross-selling' ),
+ 'job' => 'sell',
+ 'vendor' => 'wbw',
+ 'wporg' => 'woo-product-filter',
+ 'free_file' => 'woo-product-filter/woo-product-filter.php',
+ 'pro_file' => 'woofilter-pro/woofilter-pro.php',
+ 'pro_url' => 'https://woobewoo.com/woocommerce-product-filter/',
+ 'icon_url' => $psw . 'woo-product-filter/assets/icon-256x256.png?rev=3326294',
+ 'abbr' => 'PF',
+ ),
+
+ // Sell more per order.
+ 'wishlist' => array(
+ 'name' => __( 'Wishlist', 'wpfactory-cross-selling' ),
+ 'desc' => __( 'Let customers save products to multiple named wishlists and share them.', 'wpfactory-cross-selling' ),
+ 'job' => 'sell',
+ 'wporg' => 'wish-list-for-woocommerce',
+ 'free_file' => 'wish-list-for-woocommerce/wish-list-for-woocommerce.php',
+ 'pro_file' => 'wish-list-for-woocommerce-pro/wish-list-for-woocommerce-pro.php',
+ 'pro_url' => $wpf . 'wish-list-woocommerce/',
+ 'icon_url' => $psw . 'wish-list-for-woocommerce/assets/icon.svg?rev=3078494',
+ 'abbr' => 'WL',
+ ),
+ 'free-shipping-bar' => array(
+ 'name' => __( 'Free Shipping Bar', 'wpfactory-cross-selling' ),
+ 'desc' => __( 'Show shoppers how much more to spend to get free shipping.', 'wpfactory-cross-selling' ),
+ 'job' => 'sell',
+ 'wporg' => 'amount-left-free-shipping-woocommerce',
+ 'free_file' => 'amount-left-free-shipping-woocommerce/left-to-free-shipping-for-woocommerce.php',
+ 'pro_file' => 'left-to-free-shipping-for-woocommerce-pro/left-to-free-shipping-for-woocommerce-pro.php',
+ 'pro_url' => $wpf . 'amount-left-free-shipping-woocommerce/',
+ 'icon_url' => $psw . 'amount-left-free-shipping-woocommerce/assets/icon.svg?rev=2971497',
+ 'abbr' => 'FS',
+ ),
+ 'popups' => array(
+ 'name' => __( 'Popups for Notices', 'wpfactory-cross-selling' ),
+ 'desc' => __( 'Turn cart, add to cart and checkout notices into popups shoppers notice.', 'wpfactory-cross-selling' ),
+ 'job' => 'sell',
+ 'wporg' => 'popup-notices-for-woocommerce',
+ 'free_file' => 'popup-notices-for-woocommerce/popup-notices-for-woocommerce.php',
+ 'pro_file' => 'popup-notices-for-woocommerce-pro/popup-notices-for-woocommerce-pro.php',
+ 'pro_url' => $wpf . 'popup-notices-for-woocommerce/',
+ 'icon_url' => $psw . 'popup-notices-for-woocommerce/assets/icon.svg?rev=2971612',
+ 'abbr' => 'PU',
+ ),
+ 'msrp' => array(
+ 'name' => __( 'MSRP Pricing', 'wpfactory-cross-selling' ),
+ 'desc' => __( 'Show the MSRP or RRP next to your price so the saving is clear.', 'wpfactory-cross-selling' ),
+ 'job' => 'sell',
+ 'wporg' => 'msrp-for-woocommerce',
+ 'free_file' => 'msrp-for-woocommerce/msrp-for-woocommerce.php',
+ 'pro_file' => 'msrp-for-woocommerce-pro/msrp-for-woocommerce-pro.php',
+ 'pro_url' => $wpf . 'msrp-for-woocommerce/',
+ 'icon_url' => $psw . 'msrp-for-woocommerce/assets/icon.svg?rev=2971599',
+ 'abbr' => 'MS',
+ ),
+ 'coupons-by-url' => array(
+ 'name' => __( 'Coupons and Add to Cart by URL', 'wpfactory-cross-selling' ),
+ 'desc' => __( 'Apply a coupon and add products to the cart from one link.', 'wpfactory-cross-selling' ),
+ 'job' => 'sell',
+ 'wporg' => 'url-coupons-for-woocommerce-by-algoritmika',
+ 'free_file' => 'url-coupons-for-woocommerce-by-algoritmika/url-coupons-woocommerce.php',
+ 'pro_file' => 'url-coupons-woocommerce-pro/url-coupons-woocommerce-pro.php',
+ 'pro_url' => $wpf . 'url-coupons-woocommerce/',
+ 'icon_url' => $psw . 'url-coupons-for-woocommerce-by-algoritmika/assets/icon.svg?rev=2970932',
+ 'abbr' => 'CU',
+ ),
+ 'price-by-quantity' => array(
+ 'name' => __( 'Price by Quantity', 'wpfactory-cross-selling' ),
+ 'desc' => __( 'Set tiered bulk prices by quantity, per product, category or user role.', 'wpfactory-cross-selling' ),
+ 'job' => 'sell',
+ 'wporg' => 'wholesale-pricing-woocommerce',
+ 'free_file' => 'wholesale-pricing-woocommerce/wholesale-pricing-woocommerce.php',
+ 'pro_file' => 'wholesale-pricing-woocommerce-pro/wholesale-pricing-woocommerce-pro.php',
+ 'pro_url' => $wpf . 'product-price-by-quantity-for-woocommerce/',
+ 'icon_url' => $psw . 'wholesale-pricing-woocommerce/assets/icon.svg?rev=2971455',
+ 'abbr' => 'PQ',
+ ),
+ 'name-your-price' => array(
+ 'name' => __( 'Name Your Price', 'wpfactory-cross-selling' ),
+ 'desc' => __( 'Let shoppers make an offer, then accept, reject or counter it.', 'wpfactory-cross-selling' ),
+ 'job' => 'sell',
+ 'wporg' => 'price-offerings-for-woocommerce',
+ 'free_file' => 'price-offerings-for-woocommerce/price-offerings-for-woocommerce.php',
+ 'pro_file' => 'price-offerings-for-woocommerce-pro/price-offerings-for-woocommerce-pro.php',
+ 'pro_url' => $wpf . 'price-offers-for-woocommerce/',
+ 'icon_url' => $psw . 'price-offerings-for-woocommerce/assets/icon.svg?rev=2971616',
+ 'abbr' => 'NP',
+ ),
+ 'sitewide-discount' => array(
+ 'name' => __( 'Sitewide Discount', 'wpfactory-cross-selling' ),
+ 'desc' => __( 'Run scheduled store-wide discounts with the old price struck through.', 'wpfactory-cross-selling' ),
+ 'job' => 'sell',
+ 'wporg' => 'global-shop-discount-for-woocommerce',
+ 'free_file' => 'global-shop-discount-for-woocommerce/global-shop-discount-for-woocommerce.php',
+ 'pro_file' => 'global-shop-discount-for-woocommerce-pro/global-shop-discount-for-woocommerce-pro.php',
+ 'pro_url' => $wpf . 'global-shop-discount-for-woocommerce/',
+ 'icon_url' => $psw . 'global-shop-discount-for-woocommerce/assets/icon.svg?rev=2971516',
+ 'abbr' => 'SD',
+ ),
+ 'coupon-by-user-role' => array(
+ 'name' => __( 'Coupons by User Role', 'wpfactory-cross-selling' ),
+ 'desc' => __( 'Limit coupons to certain user roles, or give each role its own discount.', 'wpfactory-cross-selling' ),
+ 'job' => 'sell',
+ 'wporg' => 'coupon-by-user-role-for-woocommerce',
+ 'free_file' => 'coupon-by-user-role-for-woocommerce/coupon-by-user-role-for-woocommerce.php',
+ 'pro_file' => 'coupon-by-user-role-for-woocommerce-pro/coupon-by-user-role-for-woocommerce-pro.php',
+ 'pro_url' => $wpf . 'coupon-by-user-role-for-woocommerce/',
+ 'icon_url' => $psw . 'coupon-by-user-role-for-woocommerce/assets/icon.svg?rev=2970923',
+ 'abbr' => 'CR',
+ ),
+ 'sales-bump' => array(
+ 'name' => __( 'Sales Bump Popup', 'wpfactory-cross-selling' ),
+ 'desc' => __( 'Show upsells and cross-sells in a popup on product, cart and checkout pages.', 'wpfactory-cross-selling' ),
+ 'job' => 'sell',
+ 'pro_file' => 'upsell-cross-sell-related-products-popup-for-woocommerce-pro/webd-woocommerce-crosell-popup-pro.php',
+ 'pro_url' => $wpf . 'woocommerce-upsell-cross-sell-related-products-popup/',
+ 'icon_file' => 'sales-bump.png',
+ 'abbr' => 'SB',
+ ),
+ 'variation-swatches' => array(
+ 'name' => __( 'Variation Swatches', 'wpfactory-cross-selling' ),
+ 'desc' => __( 'Replace variation dropdowns with color and image swatches.', 'wpfactory-cross-selling' ),
+ 'job' => 'display',
+ 'wporg' => 'color-or-image-variation-swatches-for-woocommerce',
+ 'free_file' => 'color-or-image-variation-swatches-for-woocommerce/color-or-image-variation-swatches-for-woocommerce.php',
+ 'pro_file' => 'color-or-image-variation-swatches-for-woocommerce-pro/color-or-image-variation-swatches-for-woocommerce-pro.php',
+ 'pro_url' => $wpf . 'color-or-image-variation-swatches-for-woocommerce/',
+ 'icon_url' => $psw . 'color-or-image-variation-swatches-for-woocommerce/assets/icon.svg?rev=2969964',
+ 'abbr' => 'VS',
+ ),
+ 'related-categories' => array(
+ 'name' => __( 'Related Categories', 'wpfactory-cross-selling' ),
+ 'desc' => __( 'Show related categories on product and shop pages.', 'wpfactory-cross-selling' ),
+ 'job' => 'display',
+ 'wporg' => 'related-categories-for-woocommerce',
+ 'free_file' => 'related-categories-for-woocommerce/related-categories-for-woocommerce.php',
+ 'pro_file' => 'related-categories-for-woocommerce-pro/related-categories-for-woocommerce-pro.php',
+ 'pro_url' => $wpf . 'related-categories-for-woocommerce/',
+ 'icon_url' => $psw . 'related-categories-for-woocommerce/assets/icon.svg?rev=2971949',
+ 'abbr' => 'RC',
+ ),
+ 'add-to-cart-labels' => array(
+ 'name' => __( 'Add to Cart Button Labels', 'wpfactory-cross-selling' ),
+ 'desc' => __( 'Change the Add to Cart text per product, user role or language.', 'wpfactory-cross-selling' ),
+ 'job' => 'display',
+ 'wporg' => 'add-to-cart-button-labels-for-woocommerce',
+ 'free_file' => 'add-to-cart-button-labels-for-woocommerce/add-to-cart-button-labels-for-woocommerce.php',
+ 'pro_file' => 'add-to-cart-button-labels-for-woocommerce-pro/add-to-cart-button-labels-for-woocommerce-pro.php',
+ 'pro_url' => $wpf . 'add-to-cart-button-labels-woocommerce/',
+ 'icon_url' => $psw . 'add-to-cart-button-labels-for-woocommerce/assets/icon.svg?rev=2969902',
+ 'abbr' => 'AC',
+ ),
+ 'product-tabs' => array(
+ 'name' => __( 'Custom Product Tabs', 'wpfactory-cross-selling' ),
+ 'desc' => __( 'Add custom tabs to product pages, for all products or just one.', 'wpfactory-cross-selling' ),
+ 'job' => 'display',
+ 'wporg' => 'product-tabs-for-woocommerce',
+ 'free_file' => 'product-tabs-for-woocommerce/product-tabs-for-woocommerce.php',
+ 'pro_file' => 'product-tabs-for-woocommerce-pro/product-tabs-for-woocommerce-pro.php',
+ 'pro_url' => $wpf . 'product-tabs-for-woocommerce/',
+ 'icon_url' => $psw . 'product-tabs-for-woocommerce/assets/icon.svg?rev=2971447',
+ 'abbr' => 'PT',
+ ),
+ 'products-per-page' => array(
+ 'name' => __( 'Products per Page', 'wpfactory-cross-selling' ),
+ 'desc' => __( 'Let shoppers choose how many products show on each page.', 'wpfactory-cross-selling' ),
+ 'job' => 'display',
+ 'wporg' => 'products-per-page-for-woocommerce',
+ 'free_file' => 'products-per-page-for-woocommerce/products-per-page-for-woocommerce.php',
+ 'pro_file' => 'products-per-page-for-woocommerce-pro/products-per-page-for-woocommerce-pro.php',
+ 'pro_url' => $wpf . 'products-per-page-woocommerce/',
+ 'icon_url' => $psw . 'products-per-page-for-woocommerce/assets/icon.svg?rev=2971631',
+ 'abbr' => 'PP',
+ ),
+ 'external-products' => array(
+ 'name' => __( 'External Products URLs and Currencies', 'wpfactory-cross-selling' ),
+ 'desc' => __( 'Add several buy links and a custom currency to external and affiliate products.', 'wpfactory-cross-selling' ),
+ 'job' => 'sell',
+ 'wporg' => 'external-products-currency-for-woocommerce',
+ 'free_file' => 'external-products-currency-for-woocommerce/external-products-currency-for-woocommerce.php',
+ 'pro_file' => 'external-products-currency-for-woocommerce-pro/external-products-currency-for-woocommerce-pro.php',
+ 'pro_url' => $wpf . 'advanced-external-products-for-woocommerce/',
+ 'icon_url' => $psw . 'external-products-currency-for-woocommerce/assets/icon.svg?rev=2970734',
+ 'abbr' => 'EP',
+ ),
+ // WBW Pro-only (free versions are