feature key => human label. */ public static function pro_features() { return array( 'exchanges' => __( 'Exchanges for another size, color or product, with the price difference handled', 'returnkit' ), 'credit' => __( 'Store credit with an optional bonus, so refunds stay in the store', 'returnkit' ), 'labels' => __( 'Return labels customers download from the portal', 'returnkit' ), 'insights' => __( 'Return reasons, rates and top-returned products, with CSV export', 'returnkit' ), 'flags' => __( 'Frequent-returner flags, including CardFence signals', 'returnkit' ), 'rules' => __( 'Automatic approval rules', 'returnkit' ), ); } /** * Is premium code allowed to run at all? * * @return bool */ public static function is_premium() { $fs = rtkt_fs(); return $fs && method_exists( $fs, 'can_use_premium_code' ) && $fs->can_use_premium_code(); } /** * Is the Pro code present? False in the free build Freemius generates, * where includes/Pro/ has been stripped. * * @return bool */ public static function has_pro_code() { return class_exists( '\ReturnKit\Pro\Pro' ); } /** * Does the site have Pro features: Pro code present plus a valid license * (or a dev unlock)? * * @return bool */ public static function is_pro() { return self::has_pro_code() && ( self::is_premium() || self::dev_unlocked() ); } /** * Can the site use a specific Pro feature? * * @param string $feature Feature key. * @return bool */ public static function can( $feature ) { if ( ! in_array( $feature, self::PRO_KEYS, true ) ) { return true; } return self::is_pro(); } /** * Whether Pro is unlocked for local development without a license: an * explicit RTKT_DEV_UNLOCK on a site already running in debug mode. There * is intentionally no filter. * * @return bool */ public static function dev_unlocked() { return defined( 'RTKT_DEV_UNLOCK' ) && RTKT_DEV_UNLOCK && defined( 'WP_DEBUG' ) && WP_DEBUG; } /** * Plan label for the header badge. * * @return string */ public static function plan_label() { return self::is_pro() ? __( 'Pro', 'returnkit' ) : __( 'Free', 'returnkit' ); } /** * Upgrade URL. * * @return string */ public static function upgrade_url() { $fs = rtkt_fs(); if ( $fs && method_exists( $fs, 'get_upgrade_url' ) && ! ( $fs instanceof Stub ) ) { $url = $fs->get_upgrade_url(); if ( $url ) { return $url; } } return admin_url( 'admin.php?page=' . RTKT_MENU_SLUG . '-pro' ); } }