=== Entesharyar – WordPress Social Sharing and Telegram Publishing ===
Contributors: alikhakpash
Tags: share, social, popup, article, telegram
Requires at least: 5.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.6.1
License: GPLv2 or later

A free WordPress plugin for sharing posts and articles on social networks and messaging platforms, with one-click publishing of WordPress posts to your Telegram channel.

Entesharyar is a lightweight WordPress social sharing plugin designed to add a customizable share button and popup to your posts and articles.

Using a simple shortcode, you can place a social sharing button anywhere inside your content. When clicked, the button opens a popup displaying the featured image, post title, and article excerpt, along with sharing buttons for popular social networks and messaging platforms.

Supported platforms include Telegram, WhatsApp, Bale, Eitaa, Rubika, X (Twitter), and Facebook.

In addition to social sharing, Entesharyar allows site administrators and authorized editors to publish WordPress posts directly to a Telegram channel with one click.

= Key Features =

* **WordPress social sharing shortcode:** Add `[entshryr_share_popup]` anywhere inside your content. You can also specify a post ID using `[entshryr_share_popup id="123"]`.
* **Accessible sharing popup:** The modal follows accessibility principles, including the dialog role, focus management, closing with the Escape key, and closing by clicking the background.
* **RTL support:** The sharing button and popup have a fixed right-to-left layout and remain readable and functional regardless of the theme's default text direction.
* **Automatic post excerpt:** If a manual excerpt is not available, the plugin automatically generates an excerpt from the post content, removing shortcodes and HTML tags. The excerpt length can be configured by word count.
* **One-click Telegram publishing:** Publish the post title, excerpt, link, and featured image directly to your Telegram channel through the Telegram Bot API.
* **Two Telegram publishing locations:** Publish from a dedicated meta box on the post editing screen or from the sharing popup when viewing the post as an authenticated user with permission to edit that post.
* **Simple WordPress settings:** Configure the sharing button text, automatic excerpt length, enabled social networks, and Telegram bot and channel information from Settings → Entesharyar.
* **Optional developer proxy:** Sites hosted on servers where direct access to the Telegram Bot API is unavailable can optionally use a free proxy service operated by the plugin developer. This option is disabled by default.
* **WordPress security practices:** Output is escaped using WordPress functions such as `esc_html`, `esc_attr`, and `esc_url`. Settings use the WordPress Settings API and custom sanitization callbacks, while Telegram publishing requests are protected with nonces and capability checks.

== Installation ==

1. Upload the `entshryr` plugin folder to the `/wp-content/plugins/` directory.
2. Activate the plugin from the **Plugins** screen in the WordPress admin area.
3. To enable Telegram channel publishing, go to **Settings → Entesharyar** and enter your Telegram bot token and channel ID.
4. Make sure the Telegram bot has been added to your channel as an administrator with permission to post messages.

== Usage ==

Entesharyar does not automatically insert the sharing button into your posts.

To display the sharing button, add the following shortcode anywhere inside your post content:

`[entshryr_share_popup]`

To display the sharing button for a specific post other than the current post, specify the post ID:

`[entshryr_share_popup id="123"]`

For example, this can be useful when the shortcode is used inside a widget or custom template.

To publish a post to your Telegram channel, open the post editing screen and use the **Publish to Telegram Channel** meta box.

If you are viewing the post on your website and have permission to edit that post, you can also use the **Publish to Telegram** button inside the sharing popup.

== External services ==

Entesharyar connects to the **Telegram Bot API (`api.telegram.org`)** for its optional Telegram channel publishing feature.

This connection is made only when:

* The site administrator has entered a Telegram bot token and channel ID in the plugin settings.
* A user with permission to edit the relevant post clicks the **Publish to Telegram** button, either from the post editing screen or from the sharing popup.

When this happens, the post title, excerpt, URL, and featured image are sent to `api.telegram.org` so they can be published to the configured Telegram channel.

No visitor data or other posts are sent to this service, and no Telegram request is made unless an authorized user explicitly initiates the publishing action.

The Telegram Bot API is provided by Telegram FZ-LLC:

* Terms of Service: https://telegram.org/tos
* Privacy Policy: https://telegram.org/privacy

= Optional Developer Proxy =

If the site administrator explicitly enables the **Developer Proxy** option in the plugin settings, Telegram publishing requests are routed through a Cloudflare Worker relay operated by the plugin developer instead of connecting directly to `api.telegram.org`.

This option is disabled by default.

When enabled, the Telegram bot token, channel ID, and the post title, excerpt, and featured image pass through the relay service before being forwarded to the Telegram Bot API.

The relay service does not store or log this information and only forwards the request to `api.telegram.org`.

== Frequently Asked Questions ==

= How do I add a social sharing button to a WordPress post? =

Add the `[entshryr_share_popup]` shortcode anywhere inside your post content.

= Can I share WordPress posts on Telegram and other social networks? =

Yes. Entesharyar supports sharing posts through Telegram, WhatsApp, Bale, Eitaa, Rubika, X (Twitter), and Facebook.

= Can I publish a WordPress post directly to a Telegram channel? =

Yes. After connecting a Telegram bot to your channel, an authorized user can publish the post title, excerpt, URL, and featured image directly to the configured Telegram channel with one click.

= Does Entesharyar automatically publish posts to Telegram? =

No. Telegram publishing is manually initiated by an authorized user. The plugin does not automatically send posts to Telegram without an explicit publishing action.

= Does the Telegram publishing feature require a Telegram bot? =

Yes. You need to create a Telegram bot through `@BotFather`, add the bot as an administrator of your Telegram channel with permission to post messages, and enter the bot token and channel ID in the plugin settings.

= Why doesn't the Rubika button open a sharing URL? =

Rubika does not provide a standard documented web sharing URL for this purpose. Therefore, the Rubika button copies the post title, excerpt, and URL to the clipboard so the user can paste and send the content in the Rubika application.

= Does the plugin support RTL websites? =

Yes. The sharing button and popup use a fixed RTL layout and are designed to work correctly on Persian and other right-to-left websites.

= Can I choose which social networks appear in the popup? =

Yes. You can enable or disable the supported social networks from the plugin settings.

== Changelog ==

= 1.6.1 =

* Removed the custom proxy URL setting.
* The Telegram connection now has two modes: direct connection and developer proxy.

= 1.6.0 =

* Added the optional Developer Proxy using a Cloudflare Worker.
* The proxy is disabled by default.
* Added clear information about data passing through the relay when the proxy is enabled.

= 1.5.1 =

* Changed the proxy/relay communication method from PATH_INFO to query string and HTTP headers for improved compatibility with Nginx and LiteSpeed hosting environments.

= 1.5.0 =

* Added a configurable API base URL for Telegram publishing.
* Added support for using a proxy or relay on hosting environments where direct access to Telegram is unavailable.

= 1.4.0 =

* Changed the plugin name and slug to comply with WordPress directory naming requirements.
* Added unique prefixes to functions, constants, actions, and storage identifiers to prevent conflicts with other plugins.
* Removed the disabled LinkedIn checkbox from the settings.
* Added documentation for the Telegram Bot API external service according to WordPress Plugin Directory requirements.

= 1.0.0 =
Initial release. Includes:

* Social sharing popup using the `[entshryr_share_popup]` shortcode.
* Sharing support for Telegram, Bale, Eitaa, WhatsApp, Rubika, X (Twitter), and Facebook.
* Automatic post excerpt generation when no manual excerpt is available.
* RTL sharing button and popup independent of the active theme's text direction.
* Direct WordPress post publishing to a Telegram channel from both the post editing screen and the sharing popup for authorized users.
