=== Short Links for M8C — لینک کوتاه ===

Contributors: m8c
Tags: short link, url shortener, link shortener, m8c, api, woocommerce
Requires at least: 5.9
Tested up to: 6.9
Stable tag: 1.0.1
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Create short links from WordPress using the M8C link shortener service (m8c.ir). Not affiliated with M8C; for use with the M8C API. Works with posts, pages, and WooCommerce products.

== Description ==

**Short Links for M8C** connects your WordPress site to the [M8C](https://m8c.ir) link shortener service. This plugin is not officially affiliated with M8C. Create short links directly from the WordPress admin, or generate a short link for any post, page, or WooCommerce product with one click from the editor.

**Features:**

* **Create short links from the admin menu** — Go to *Short Links for M8C → Create Short Link*, enter any URL, and get a short link.
* **Metabox on posts, pages, and products** — When editing a post, page, or WooCommerce product, a "Short Links for M8C" metabox appears in the sidebar. One click creates a short link for that content’s URL and saves it so it’s shown on the next visit.
* **My Links** — View all short links created via this site (via the API) in a paginated list with copy buttons and click counts, fetched live from the M8C server.
* **Simple setup** — Enter the M8C API base URL and your API token (from the M8C panel → Developers) in *Short Links for M8C → Settings*.

**Requirements:**

* A free account on the M8C service (m8c.ir).
* An API token from M8C (Panel → Developers).

**WooCommerce:** If WooCommerce is active, the short-link metabox is also available on product edit screens.

= Multilingual =

The plugin uses the `short-links-for-m8c` text domain. The admin interface is in Persian (Farsi) by default; you can add translations via the `/languages` folder or a translation plugin.

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/mak-wp-plugin/`, or install the plugin through the WordPress *Plugins → Add New → Upload* screen.
2. Activate the plugin through the *Plugins* menu in WordPress.
3. Go to **Short Links for M8C → Settings**.
4. Enter your **API base URL** (e.g. `https://m8c.ir/api` — no trailing slash).
5. Enter your **API token** (copy it from the M8C panel at m8c.ir → Developers).
6. Save settings. You can now create short links from *Short Links for M8C → Create Short Link* or from the metabox on posts, pages, and products.

= Getting an API token =

1. Register or log in at [m8c.ir](https://m8c.ir).
2. In the M8C panel, open **Developers** (توسعه‌دهندگان).
3. Create or copy your API token and paste it into the plugin settings.

== Frequently Asked Questions ==

= Do I need an M8C account? =

Yes. The plugin uses the M8C service to create short links. Sign up for free at m8c.ir.

= Is the plugin free? =

Yes. The plugin is free. The M8C service also offers a free tier; check m8c.ir for current limits.

= Does it work with WooCommerce? =

Yes. When WooCommerce is active, the short-link metabox appears on product edit screens so you can create a short link for each product URL.

= Where are my short links stored? =

Short links are created on the M8C server. Links created from this site are associated with your M8C account and can be viewed in *Short Links for M8C → My Links* or in the M8C panel at m8c.ir.

== Screenshots ==

1. Create short link from the admin menu.
2. Short-link metabox on post/page/product edit screen.
3. My Links — list of short links created via this site.
4. Settings — API URL and token.

== Changelog ==

= 1.0.1 =
* PHP 7.4 compatibility (removed PHP 8.0-only syntax).
* Compatibility note in plugin header.

= 1.0.0 =
* Initial release.
* Create short links from admin menu.
* Metabox on posts, pages, and WooCommerce products.
* Save short link in post meta and show on next visit.
* My Links page with pagination (live from API).
* Settings for API base URL and token.

== Upgrade Notice ==

= 1.0.1 =
Improves compatibility with PHP 7.4. Recommended update if you run PHP 7.4.
