=== EfeOEM ===
Contributors: efemed, freemius
Tags: oem, spare parts, search, cross reference, catalog
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.4.8
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Match products by OEM code, your own stock code, competitor cross-reference codes, and superseded numbers, all through one smart search box.

== Description ==

EfeOEM is a WordPress plugin for businesses that sell spare parts, industrial equipment, or any product catalog that needs cross-reference code matching.

**Key features:**

* Add unlimited OEM codes per product
* Cross-reference / competitor brand code matching
* Superseded (old) number tracking
* Hierarchical Brand > Model compatibility taxonomy
* Single search box that matches all code types plus the product title
* Automatic SEO description enrichment when Rank Math is active
* No dependency on Advanced Custom Fields or any other plugin — works right after activation
* Bulk CSV import tool for migrating existing catalogs
* Live search product previews with configurable image, title, OEM, stock code, brand, compatibility, price, stock status, and button fields
* Customizable preview heading, field labels, and automatic hiding of empty values
* English source interface with an included Turkish translation and a POT template for additional languages
* Separator-insensitive code matching: dots, dashes, spaces, slashes, underscores, and common punctuation can be ignored when searching codes
* Relevance ranking that prioritizes exact stock/OEM/cross-reference/previous-number matches over partial and title matches
* Live preview shows which code type and exact product code matched the search

**How to use:**

1. Install and activate the plugin.
2. Go to the "EfeOEM Products" menu to start adding products.
3. For each product, enter the OEM codes, cross-reference codes, and compatible brands/models.
4. Add the `[efeoem_search]` shortcode to any page to publish the smart search box.

== External Services ==

EfeOEM includes the Freemius SDK to provide licensing, account/upgrade screens, paid-plan features, and optional usage diagnostics. Premium builds may also use Freemius for premium update delivery.

When an administrator chooses to connect/opt in, the plugin may send site and environment information such as the site URL, WordPress/PHP/plugin versions, and administrator/account information required by Freemius. The permissions requested are shown on the Freemius opt-in screen before consent. If the administrator skips the opt-in, optional usage tracking is not enabled. Paid-license, billing, account, and update operations may still communicate with Freemius when those features are used.

This service is provided by Freemius Inc.:
* Terms of Service: https://freemius.com/terms/
* Privacy Policy: https://freemius.com/privacy/

== Installation ==

1. Upload the plugin files to the `/wp-content/plugins/efeoem` directory, or install the plugin directly through the WordPress plugins screen.
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. Start adding products from the "EfeOEM Products" menu.

== Frequently Asked Questions ==

= Do I need Advanced Custom Fields (ACF)? =

No. EfeOEM uses its own data structure and does not require any additional plugin.

= Is Rank Math required? =

No. If Rank Math is active, the integration is enabled automatically; if not, the plugin continues to work normally.


= Is EfeOEM translatable? =

Yes. English is the canonical source language. A complete Turkish translation is included, and the plugin ships with a POT template for additional languages.

= How do I add the search box? =

Add the `[efeoem_search]` shortcode to any page or post.

= Can I import products in bulk? =

Yes. Use the "Import" screen under the EfeOEM Products menu to upload a CSV file with your product codes.

== Screenshots ==

1. Front-end smart search box with brand filter — a code search returns matching products instantly.
2. Product edit screen — the code matching meta box with OEM codes, cross-reference codes, and superseded numbers.
3. Bulk CSV import screen for migrating an existing catalog.
4. Products list with automatic Rank Math SEO integration.
5. Brand / Compatibility taxonomy screen (hierarchical brand > model structure).
6. Settings page — results per page, URL slugs, native search integration, and live preview field controls.

== Changelog ==

= 1.4.7 =
* Fixed the EfeOEM brand icon shown on Settings and Import screens.
* Added a cache-safe brand icon asset filename while keeping the legacy icon synchronized.
* Corrected the internal EFEOEM_VERSION constant to match the plugin release.

= 1.4.6 =
* Fixed WordPress admin menu icon sizing.
* Moved Freemius account and upgrade navigation into tabs to reduce sidebar clutter.
* Improved Freemius redirects to open the EfeOEM settings page directly.

= 1.4.4 =
* Fixed Freemius admin menu routing for the EfeOEM custom post type settings page.
* Prefixed result-card template variables to comply with WordPress coding standards.
* Plugin Check cleanup and maintenance improvements.

= 1.4.1 =
* Added keyboard navigation for live search results (Arrow Up/Down and Enter).
* Added visible result counts to live search.
* Added separator-aware highlighting for matched OEM and part codes.
* Improved accessibility with search/list ARIA attributes and keyboard-friendly result navigation.
* Added Search Engine 2.0 with separator-insensitive OEM, stock, cross-reference, and previous-number matching.
* Searches such as 81.50804.6075, 81-50804-6075, 81 50804 6075, and 81508046075 can now resolve to the same stored code without rewriting existing product data.
* Added relevance scoring so exact stock-code and OEM matches are placed before partial code and product-title matches in live search.
* Added a configurable “Matched by” row to live preview cards showing the matched code type and original stored code.
* Added a reusable code normalizer for future import, API, and lookup-index features.

= 1.3.2 =
* Switched all plugin source UI strings to English as the canonical source language.
* Added a complete Turkish translation and a POT template for future community/local translations.
* Added bundled translation loading from the standard /languages directory while preserving WordPress language-pack precedence.
* Standardized live-preview defaults, labels, and new-install URL slug defaults for international installations.

= 1.3.1 =
* Added optional manual Price and Stock Status fields for standalone EfeOEM products so enabled preview fields have a native data source.
* Preview list headings are now shown only when products are found.
* Corrected and expanded the readme documentation for the Live Search & Product Preview feature.

= 1.3.0 =
* Added Live Search & Product Preview cards with compact product thumbnails and configurable result fields.
* Added per-field visibility controls for product image, product name, OEM code, stock code, brand, compatibility, price, stock status, and the product link button.
* Added customizable preview heading, field labels, button text, empty-field hiding, and minimum search character settings.
* Added responsive preview-card styling and helper functions for compatibility, price, and stock summaries.

= 1.2.4 =
* Replaced the dynamically interpolated SQL placeholder list in OEM code search with explicit prepared placeholders for all fixed EfeOEM meta keys, resolving WordPress.DB.PreparedSQL.InterpolatedNotPrepared.

= 1.2.3 =
* Updated the WordPress.org contributor username to match the plugin owner account.
* Maintenance release for WordPress.org ownership verification and review readiness.

= 1.2.2 =
* Hardened CSV uploads by routing files through WordPress's standard upload handler, validating file errors, extension, and size, and removing temporary imported files after reading.
* Added an explicit CSV upload size limit with a filter for developers.
* Updated CSV parsing for PHP 8.4 by explicitly setting the escape argument in str_getcsv().
* Reworked code-search SQL extension to use a prepared EXISTS clause instead of building an ID list into the search SQL.
* Fixed Elementor/page-builder shortcode asset loading by registering/localizing assets when the shortcode actually renders.
* Isolated AJAX/debounce state per search box so multiple EfeOEM search widgets can coexist on the same page.
* Rewrite rules now flush only when URL slugs change instead of on every settings save.
* Added the required External Services disclosure for the bundled Freemius SDK.

= 1.2.1 =
* Documentation fix: the efeoem_is_pro() helper now uses can_use_premium_code__premium_only() (checks license validity, not just build type) and is annotated to clarify it must not be relied on for the actual code-stripping mechanism used when Freemius generates the WordPress.org free build.

= 1.2.0 =
* Restructured the main plugin file per Freemius's official recommendation: all plugin logic now runs inside an else-branch guarded by function_exists('efeoem_fs'), preventing fatal errors if both the free and premium versions are ever active on the same site simultaneously.

= 1.1.9 =
* Freemius SDK fully integrated with real product credentials (Plugin ID and Public Key). This is the "master" (premium) source build used for Freemius Deployment — the WordPress.org-hosted free version is generated separately by Freemius, not built manually.

= 1.1.8 =
* Reduced $_POST access in the repeatable field save routine to a single point (was three separate token occurrences on one line, which a single phpcs:ignore comment did not fully cover).

= 1.1.7 =
* Fixed a phpcs:ignore comment placement issue — the suppression comment only covered the first line of a multi-line statement, so the $_POST access on the following line still triggered a nonce-verification warning. Collapsed to a single line to fully resolve it.

= 1.1.6 =
* Fixed the last remaining Plugin Check warning: sanitization now happens directly at the point of accessing $_POST in the repeatable field save routine.

= 1.1.5 =
* WordPress.org submission compliance fixes: replaced direct file system calls (fopen/fread/fclose) with the WP_Filesystem API in the CSV importer.
* Removed the discouraged load_plugin_textdomain() call (translations are loaded automatically for WordPress.org-hosted plugins).
* Escaped thumbnail output in the result card template and prefixed its local variables.
* Fixed nonce/unslash handling in the meta box save routine.
* Rewrote readme.txt in English per WordPress.org guidelines.
* Removed the .distignore file from the distributed package (hidden files are not permitted).

= 1.1.4 =
* Updated Plugin URI to the live efendimedya.com domain instead of the not-yet-published magaza.efendimedya.com subdomain.

= 1.1.3 =
* Prepared for WordPress.org submission: simplified the Plugin Name for a clean slug, updated "Tested up to", added a .distignore file.

= 1.1.2 =
* The brand icon now actually appears in the admin menu and on the Settings/Import page headers.

= 1.1.1 =
* CSV import now auto-detects the delimiter (comma or semicolon) from the file itself — a fix for Excel's inconsistent CSV behaviour depending on regional settings.
* UTF-8 BOM in CSV files is now stripped correctly (prevents the first column header from being corrupted).

= 1.1.0 =
* Added a bulk CSV import tool (Products → Import).
* Added brand-based filtering to the search box (dropdown, includes child models).
* Added a Settings page (Products → Settings): results per page, URL slugs, native search integration toggle.
* Added a Freemius integration skeleton (inactive until SDK files are added).

= 1.0.5 =
* Removed the temporary debug mode.
* Clearer result card display for products without a title.

= 1.0.4 =
* Added a temporary debug mode.
* Critical fix: the is_admin() check treated admin-ajax.php requests as admin requests, so code matching never ran for front-end AJAX searches. Added a wp_doing_ajax() check.

= 1.0.2 =
* Added the brand icon (WordPress.org listing assets).

= 1.0.1 =
* Moved the search engine to a more robust mechanism (native meta_query); code matching in AJAX search now works reliably.

= 1.0.0 =
* Initial release.
