This commit is contained in:
Javier Casares 2026-01-27 09:55:38 +00:00
commit 68c95af0a0
16 changed files with 1360 additions and 1001 deletions

1346
LICENSE

File diff suppressed because it is too large Load diff

View file

@ -1,26 +1,29 @@
= 1.1.2 =
* Raised the minimum WordPress requirement to 6.5 and PHP to 8.2 so the plugin complies with the AGENTS development guidelines.
= 1.1.1 =
* Added compiled translation catalogs for supported locales (Catalan, German, Spanish, Basque, French, Galician, Italian, Polish, Portuguese) so localized greetings render without requiring manual compilation.
= 1.1.0 =
* DID Support
= 1.0.5 =
* Expanded the translation catalog to cover 202 locales with updated greetings.
= 1.0.4 =
* Documented the plugin internals with PHPDoc blocks and loaded the text domain to ensure translations are available in WordPress.
= 1.0.3 =
* Added translation files for 50 locales to improve WordPress i18n coverage.
= 1.0.2 =
* Confirmed compatibility with PHP 5.6 through PHP 8.4 via PHPCompatibilityWP checks.
= 1.0.1 =
* Broadened compatibility to cover WordPress 4.7+ and PHP 5.6+ while keeping the Hello admin page unchanged.
= 1.0.0 =
* Added the Hello admin page and menu entry.
= 1.2.0 =
* Added generic JSON-based Auto-Updater system. Plugin now updates automatically from git.robotstxt.es without depending on WordPress.org repository.
= 1.1.2 =
* Raised the minimum WordPress requirement to 6.5 and PHP to 8.2 so the plugin complies with the AGENTS development guidelines.
= 1.1.1 =
* Added compiled translation catalogs for supported locales (Catalan, German, Spanish, Basque, French, Galician, Italian, Polish, Portuguese) so localized greetings render without requiring manual compilation.
= 1.1.0 =
* DID Support
= 1.0.5 =
* Expanded the translation catalog to cover 202 locales with updated greetings.
= 1.0.4 =
* Documented the plugin internals with PHPDoc blocks and loaded the text domain to ensure translations are available in WordPress.
= 1.0.3 =
* Added translation files for 50 locales to improve WordPress i18n coverage.
= 1.0.2 =
* Confirmed compatibility with PHP 5.6 through PHP 8.4 via PHPCompatibilityWP checks.
= 1.0.1 =
* Broadened compatibility to cover WordPress 4.7+ and PHP 5.6+ while keeping the Hello admin page unchanged.
= 1.0.0 =
* Added the Hello admin page and menu entry.

View file

@ -1,80 +1,80 @@
<?php
/**
* Main plugin class responsible for registering the Hello admin page.
*
* @package Robotstxt_Hello
*/
if ( ! class_exists( 'Robotstxt_Hello_Plugin' ) ) {
/**
* Handles registration of the Hello menu and page.
*
* @since 1.0.0
*/
final class Robotstxt_Hello_Plugin {
/**
* Stores the menu slug used when registering the admin page.
*
* @since 1.0.4
*
* @var string
*/
const MENU_SLUG = 'robotstxt-hello';
/**
* Registers WordPress hooks required by the plugin.
*
* @since 1.0.0
*
* @return void
*/
public function register() {
add_action( 'init', array( $this, 'load_textdomain' ) );
add_action( 'admin_menu', array( $this, 'register_admin_menu' ) );
}
/**
* Loads the plugin text domain to make translations available.
*
* @since 1.0.4
*
* @return void
*/
public function load_textdomain() {
load_plugin_textdomain( 'robotstxt-hello', false, dirname( plugin_basename( __DIR__ ) ) . '/languages/' );
}
/**
* Adds the Hello admin menu entry at the bottom of the menu list.
*
* @since 1.0.0
*
* @return void
*/
public function register_admin_menu() {
add_menu_page(
esc_html__( 'Hello', 'robotstxt-hello' ),
esc_html__( 'Hello', 'robotstxt-hello' ),
'manage_options',
self::MENU_SLUG,
array( $this, 'render_admin_page' ),
'dashicons-admin-site',
PHP_INT_MAX
);
}
/**
* Renders the Hello admin page content.
*
* @since 1.0.0
*
* @return void
*/
public function render_admin_page() {
echo '<div class="wrap">';
echo '<h1>' . esc_html__( 'Hello', 'robotstxt-hello' ) . '</h1>';
echo '</div>';
}
}
}
<?php
/**
* Main plugin class responsible for registering the Hello admin page.
*
* @package Robotstxt_Hello
*/
if ( ! class_exists( 'Robotstxt_Hello_Plugin' ) ) {
/**
* Handles registration of the Hello menu and page.
*
* @since 1.0.0
*/
final class Robotstxt_Hello_Plugin {
/**
* Stores the menu slug used when registering the admin page.
*
* @since 1.0.4
*
* @var string
*/
const MENU_SLUG = 'robotstxt-hello';
/**
* Registers WordPress hooks required by the plugin.
*
* @since 1.0.0
*
* @return void
*/
public function register() {
add_action( 'init', array( $this, 'load_textdomain' ) );
add_action( 'admin_menu', array( $this, 'register_admin_menu' ) );
}
/**
* Loads the plugin text domain to make translations available.
*
* @since 1.0.4
*
* @return void
*/
public function load_textdomain() {
load_plugin_textdomain( 'robotstxt-hello', false, dirname( plugin_basename( __DIR__ ) ) . '/languages/' );
}
/**
* Adds the Hello admin menu entry at the bottom of the menu list.
*
* @since 1.0.0
*
* @return void
*/
public function register_admin_menu() {
add_menu_page(
esc_html__( 'Hello', 'robotstxt-hello' ),
esc_html__( 'Hello', 'robotstxt-hello' ),
'manage_options',
self::MENU_SLUG,
array( $this, 'render_admin_page' ),
'dashicons-admin-site',
PHP_INT_MAX
);
}
/**
* Renders the Hello admin page content.
*
* @since 1.0.0
*
* @return void
*/
public function render_admin_page() {
echo '<div class="wrap">';
echo '<h1>' . esc_html__( 'Hello', 'robotstxt-hello' ) . '</h1>';
echo '</div>';
}
}
}

View file

@ -1,17 +1,17 @@
msgid ""
msgstr ""
"Project-Id-Version: ROBOTSTXT Hello 1.0.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-11-01 08:04+0000\n"
"PO-Revision-Date: 2025-11-01 08:04+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: includes/class-robotstxt-hello-plugin.php:57 includes/class-robotstxt-hello-plugin.php:58 includes/class-robotstxt-hello-plugin.php:76
msgid "Hello"
msgstr "Hola"
msgid ""
msgstr ""
"Project-Id-Version: ROBOTSTXT Hello 1.0.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-11-01 08:04+0000\n"
"PO-Revision-Date: 2025-11-01 08:04+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: includes/class-robotstxt-hello-plugin.php:57 includes/class-robotstxt-hello-plugin.php:58 includes/class-robotstxt-hello-plugin.php:76
msgid "Hello"
msgstr "Hola"

View file

@ -1,17 +1,17 @@
msgid ""
msgstr ""
"Project-Id-Version: ROBOTSTXT Hello 1.0.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-11-01 08:04+0000\n"
"PO-Revision-Date: 2025-11-01 08:04+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: de_DE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: includes/class-robotstxt-hello-plugin.php:57 includes/class-robotstxt-hello-plugin.php:58 includes/class-robotstxt-hello-plugin.php:76
msgid "Hello"
msgstr "Hallo"
msgid ""
msgstr ""
"Project-Id-Version: ROBOTSTXT Hello 1.0.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-11-01 08:04+0000\n"
"PO-Revision-Date: 2025-11-01 08:04+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: de_DE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: includes/class-robotstxt-hello-plugin.php:57 includes/class-robotstxt-hello-plugin.php:58 includes/class-robotstxt-hello-plugin.php:76
msgid "Hello"
msgstr "Hallo"

View file

@ -1,17 +1,17 @@
msgid ""
msgstr ""
"Project-Id-Version: ROBOTSTXT Hello 1.0.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-11-01 08:04+0000\n"
"PO-Revision-Date: 2025-11-01 08:04+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es_ES\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: includes/class-robotstxt-hello-plugin.php:57 includes/class-robotstxt-hello-plugin.php:58 includes/class-robotstxt-hello-plugin.php:76
msgid "Hello"
msgstr "Hola"
msgid ""
msgstr ""
"Project-Id-Version: ROBOTSTXT Hello 1.0.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-11-01 08:04+0000\n"
"PO-Revision-Date: 2025-11-01 08:04+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es_ES\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: includes/class-robotstxt-hello-plugin.php:57 includes/class-robotstxt-hello-plugin.php:58 includes/class-robotstxt-hello-plugin.php:76
msgid "Hello"
msgstr "Hola"

View file

@ -1,17 +1,17 @@
msgid ""
msgstr ""
"Project-Id-Version: ROBOTSTXT Hello 1.0.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-11-01 08:04+0000\n"
"PO-Revision-Date: 2025-11-01 08:04+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: eu\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: includes/class-robotstxt-hello-plugin.php:57 includes/class-robotstxt-hello-plugin.php:58 includes/class-robotstxt-hello-plugin.php:76
msgid "Hello"
msgstr "Kaixo"
msgid ""
msgstr ""
"Project-Id-Version: ROBOTSTXT Hello 1.0.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-11-01 08:04+0000\n"
"PO-Revision-Date: 2025-11-01 08:04+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: eu\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: includes/class-robotstxt-hello-plugin.php:57 includes/class-robotstxt-hello-plugin.php:58 includes/class-robotstxt-hello-plugin.php:76
msgid "Hello"
msgstr "Kaixo"

View file

@ -1,17 +1,17 @@
msgid ""
msgstr ""
"Project-Id-Version: ROBOTSTXT Hello 1.0.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-11-01 08:04+0000\n"
"PO-Revision-Date: 2025-11-01 08:04+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr_FR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: includes/class-robotstxt-hello-plugin.php:57 includes/class-robotstxt-hello-plugin.php:58 includes/class-robotstxt-hello-plugin.php:76
msgid "Hello"
msgstr "Bonjour"
msgid ""
msgstr ""
"Project-Id-Version: ROBOTSTXT Hello 1.0.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-11-01 08:04+0000\n"
"PO-Revision-Date: 2025-11-01 08:04+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr_FR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: includes/class-robotstxt-hello-plugin.php:57 includes/class-robotstxt-hello-plugin.php:58 includes/class-robotstxt-hello-plugin.php:76
msgid "Hello"
msgstr "Bonjour"

View file

@ -1,17 +1,17 @@
msgid ""
msgstr ""
"Project-Id-Version: ROBOTSTXT Hello 1.0.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-11-01 08:04+0000\n"
"PO-Revision-Date: 2025-11-01 08:04+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: gl_ES\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: includes/class-robotstxt-hello-plugin.php:57 includes/class-robotstxt-hello-plugin.php:58 includes/class-robotstxt-hello-plugin.php:76
msgid "Hello"
msgstr "Ola"
msgid ""
msgstr ""
"Project-Id-Version: ROBOTSTXT Hello 1.0.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-11-01 08:04+0000\n"
"PO-Revision-Date: 2025-11-01 08:04+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: gl_ES\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: includes/class-robotstxt-hello-plugin.php:57 includes/class-robotstxt-hello-plugin.php:58 includes/class-robotstxt-hello-plugin.php:76
msgid "Hello"
msgstr "Ola"

View file

@ -1,17 +1,17 @@
msgid ""
msgstr ""
"Project-Id-Version: ROBOTSTXT Hello 1.0.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-11-01 08:04+0000\n"
"PO-Revision-Date: 2025-11-01 08:04+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: it_IT\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: includes/class-robotstxt-hello-plugin.php:57 includes/class-robotstxt-hello-plugin.php:58 includes/class-robotstxt-hello-plugin.php:76
msgid "Hello"
msgstr "Ciao"
msgid ""
msgstr ""
"Project-Id-Version: ROBOTSTXT Hello 1.0.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-11-01 08:04+0000\n"
"PO-Revision-Date: 2025-11-01 08:04+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: it_IT\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: includes/class-robotstxt-hello-plugin.php:57 includes/class-robotstxt-hello-plugin.php:58 includes/class-robotstxt-hello-plugin.php:76
msgid "Hello"
msgstr "Ciao"

View file

@ -1,17 +1,17 @@
msgid ""
msgstr ""
"Project-Id-Version: ROBOTSTXT Hello 1.0.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-11-01 08:04+0000\n"
"PO-Revision-Date: 2025-11-01 08:04+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: pl_PL\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: includes/class-robotstxt-hello-plugin.php:57 includes/class-robotstxt-hello-plugin.php:58 includes/class-robotstxt-hello-plugin.php:76
msgid "Hello"
msgstr "Cześć"
msgid ""
msgstr ""
"Project-Id-Version: ROBOTSTXT Hello 1.0.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-11-01 08:04+0000\n"
"PO-Revision-Date: 2025-11-01 08:04+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: pl_PL\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: includes/class-robotstxt-hello-plugin.php:57 includes/class-robotstxt-hello-plugin.php:58 includes/class-robotstxt-hello-plugin.php:76
msgid "Hello"
msgstr "Cześć"

View file

@ -1,17 +1,17 @@
msgid ""
msgstr ""
"Project-Id-Version: ROBOTSTXT Hello 1.0.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-11-01 08:04+0000\n"
"PO-Revision-Date: 2025-11-01 08:04+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: pt_PT\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: includes/class-robotstxt-hello-plugin.php:57 includes/class-robotstxt-hello-plugin.php:58 includes/class-robotstxt-hello-plugin.php:76
msgid "Hello"
msgstr "Olá"
msgid ""
msgstr ""
"Project-Id-Version: ROBOTSTXT Hello 1.0.5\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-11-01 08:04+0000\n"
"PO-Revision-Date: 2025-11-01 08:04+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: pt_PT\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: includes/class-robotstxt-hello-plugin.php:57 includes/class-robotstxt-hello-plugin.php:58 includes/class-robotstxt-hello-plugin.php:76
msgid "Hello"
msgstr "Olá"

View file

@ -1,39 +1,46 @@
=== Hello (by ROBOTSTXT) ===
Contributors: javiercasares
Requires at least: 6.5
Tested up to: 6.9
Stable tag: 1.1.2
Requires PHP: 8.2
License: GPL-3.0-or-later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
== Description ==
Provides a minimal Hello admin page for demonstration purposes.
== Changelog ==
= 1.1.2 =
* Raised the minimum WordPress requirement to 6.5 and PHP to 8.2 so the plugin matches the AGENTS development guidelines while keeping the Hello admin page untouched.
= 1.1.1 =
* Added compiled translation catalogs for supported locales (Catalan, German, Spanish, Basque, French, Galician, Italian, Polish, Portuguese) so localized greetings render without requiring manual compilation.
= 1.1.0 =
* DID Support
= 1.0.5 =
* Expanded the translation catalog to cover 202 locales with updated greetings.
= 1.0.4 =
* Documented the plugin internals with PHPDoc blocks and loaded the text domain to ensure translations are available in WordPress.
= 1.0.3 =
* Added translation files for 50 locales to improve WordPress i18n coverage.
= 1.0.2 =
* Confirmed compatibility with PHP 5.6 through PHP 8.4 via PHPCompatibilityWP checks.
= 1.0.1 =
* Broadened compatibility to cover WordPress 4.7+ and PHP 5.6+ while keeping the Hello admin page unchanged.
= 1.0.0 =
* Added the Hello admin page and menu entry.
=== Hello (by ROBOTSTXT) ===
Contributors: javiercasares
Tags: hello-world
Requires at least: 6.5
Tested up to: 6.9
Stable tag: 1.2.0
Requires PHP: 8.2
Version: 1.2.0
License: GPL-3.0-or-later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Provides a minimal Hello admin page for demonstration purposes.
== Description ==
Provides a minimal Hello admin page for demonstration purposes.
== Changelog ==
= 1.2.0 =
* Added generic JSON-based Auto-Updater system. Plugin now updates automatically from git.robotstxt.es without depending on WordPress.org repository.
= 1.1.2 =
* Raised the minimum WordPress requirement to 6.5 and PHP to 8.2 so the plugin matches the AGENTS development guidelines while keeping the Hello admin page untouched.
= 1.1.1 =
* Added compiled translation catalogs for supported locales (Catalan, German, Spanish, Basque, French, Galician, Italian, Polish, Portuguese) so localized greetings render without requiring manual compilation.
= 1.1.0 =
* DID Support
= 1.0.5 =
* Expanded the translation catalog to cover 202 locales with updated greetings.
= 1.0.4 =
* Documented the plugin internals with PHPDoc blocks and loaded the text domain to ensure translations are available in WordPress.
= 1.0.3 =
* Added translation files for 50 locales to improve WordPress i18n coverage.
= 1.0.2 =
* Confirmed compatibility with PHP 5.6 through PHP 8.4 via PHPCompatibilityWP checks.
= 1.0.1 =
* Broadened compatibility to cover WordPress 4.7+ and PHP 5.6+ while keeping the Hello admin page unchanged.
= 1.0.0 =
* Added the Hello admin page and menu entry.

View file

@ -1,30 +1,34 @@
<?php
/**
* Plugin Name: Hello (by ROBOTSTXT)
* Plugin URI: https://git.robotstxt.es/ROBOTSTXT/robotstxt-hello
* Description: Adds a Hello admin page for demonstration purposes.
* Version: 1.1.2
* Requires at least: 6.5
* Requires PHP: 8.2
* Network: true
* Security: robotstxt@robotstxt.es
* Author: ROBOTSTXT
* Author URI: https://www.robotstxt.es/
* Text Domain: robotstxt-hello
* Domain Path: /languages
* License: GPL-3.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Gitea Plugin URI: ROBOTSTXT/robotstxt-hello
* Gitea Plugin URI: https://git.robotstxt.es/ROBOTSTXT/robotstxt-hello
* Plugin ID: did:plc:7umwjtio3qenfqiai2m5gsgg
*
* @package ROBOTSTXT_Hello
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
require_once __DIR__ . '/includes/class-robotstxt-hello-plugin.php';
( new Robotstxt_Hello_Plugin() )->register();
<?php
/**
* Plugin Name: Hello (by ROBOTSTXT)
* Plugin URI: https://git.robotstxt.es/ROBOTSTXT/robotstxt-hello
* Description: Adds a Hello admin page for demonstration purposes.
* Version: 1.2.0
* Requires at least: 6.5
* Requires PHP: 8.2
* Network: true
* Security: robotstxt@robotstxt.es
* Author: ROBOTSTXT
* Author URI: https://www.robotstxt.es/
* Text Domain: robotstxt-hello
* Domain Path: /languages
* License: GPL-3.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Gitea Plugin URI: https://git.robotstxt.es/ROBOTSTXT/robotstxt-hello
* Primary Branch: main
* Plugin ID: did:plc:7umwjtio3qenfqiai2m5gsgg
*
* @package ROBOTSTXT_Hello
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
require_once __DIR__ . '/includes/class-robotstxt-hello-plugin.php';
( new Robotstxt_Hello_Plugin() )->register();
// Initialize ROBOTSTXT updater (auto-configures from plugin headers).
require_once __DIR__ . '/robotstxt-updater.php';
Robotstxt_Updater::init( __FILE__ );

332
robotstxt-updater.php Normal file
View file

@ -0,0 +1,332 @@
<?php
/**
* Generic JSON-based updater for ROBOTSTXT plugins.
*
* This file is designed to be copied to any ROBOTSTXT plugin.
* It auto-configures itself by reading the plugin headers.
*
* @package ROBOTSTXT
* @version 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class Robotstxt_Updater
*
* Generic updater that works with any plugin.
* Reads plugin headers and constructs update URL automatically.
*/
class Robotstxt_Updater {
/**
* Plugin file path.
*
* @var string
*/
private string $plugin_file_path;
/**
* Plugin basename (e.g., 'my-plugin/my-plugin.php').
*
* @var string
*/
private string $plugin_basename;
/**
* Plugin slug (directory name).
*
* @var string
*/
private string $plugin_slug;
/**
* Remote JSON URL.
*
* @var string
*/
private string $json_url;
/**
* Cache key.
*
* @var string
*/
private string $cache_key;
/**
* Plugin headers.
*
* @var array
*/
private array $plugin_data;
/**
* Initialize the updater.
*
* Usage in your main plugin file:
* require_once __DIR__ . '/robotstxt-updater.php';
* Robotstxt_Updater::init( __FILE__ );
*
* @param string $plugin_file_path Absolute path to the main plugin file.
*/
public static function init( string $plugin_file_path ): void {
$instance = new self( $plugin_file_path );
$instance->register();
}
/**
* Constructor.
*
* @param string $plugin_file_path Absolute path to the main plugin file.
*/
private function __construct( string $plugin_file_path ) {
$this->plugin_file_path = $plugin_file_path;
$this->plugin_basename = plugin_basename( $plugin_file_path );
$this->plugin_slug = dirname( $this->plugin_basename );
$this->plugin_data = $this->get_plugin_data();
$this->json_url = $this->build_json_url();
$this->cache_key = 'robotstxt_updater_' . md5( $this->plugin_basename );
}
/**
* Register WordPress hooks.
*/
private function register(): void {
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'inject_update_info' ) );
add_filter( 'plugins_api', array( $this, 'provide_plugin_details' ), 10, 3 );
add_action( 'admin_init', array( $this, 'handle_cache_clear' ) );
add_action( 'robotstxt_updater_clear_cache', array( $this, 'clear_cache' ) );
}
/**
* Get plugin headers.
*
* @return array Plugin data.
*/
private function get_plugin_data(): array {
if ( ! function_exists( 'get_plugin_data' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
return get_plugin_data( $this->plugin_file_path, false, false );
}
/**
* Build JSON URL from plugin headers.
*
* Tries to use "Gitea Plugin URI" header to construct the URL.
* Falls back to Plugin URI if Gitea URI is not available.
*
* @return string JSON URL.
*/
private function build_json_url(): string {
// Try Gitea Plugin URI (format: "OWNER/REPO" or full URL).
if ( ! empty( $this->plugin_data['Gitea Plugin URI'] ) ) {
$gitea_uri = $this->plugin_data['Gitea Plugin URI'];
// If it's already a full URL, use it.
if ( str_starts_with( $gitea_uri, 'http' ) ) {
// Extract base URL and construct JSON path.
return rtrim( $gitea_uri, '/' ) . '/raw/branch/main/update.json';
}
// If it's in format "OWNER/REPO", construct full URL.
if ( preg_match( '#^[^/]+/[^/]+$#', $gitea_uri ) ) {
return "https://git.robotstxt.es/{$gitea_uri}/raw/branch/main/update.json";
}
}
// Fallback: try to extract from Plugin URI.
if ( ! empty( $this->plugin_data['PluginURI'] ) ) {
$plugin_uri = $this->plugin_data['PluginURI'];
if ( str_contains( $plugin_uri, 'git.robotstxt.es' ) ) {
return rtrim( $plugin_uri, '/' ) . '/raw/branch/main/update.json';
}
}
// Last resort: construct from plugin slug.
return "https://git.robotstxt.es/ROBOTSTXT/{$this->plugin_slug}/raw/branch/main/update.json";
}
/**
* Inject update info into WP's plugin update transient.
*
* @param object|mixed $transient The update_plugins transient.
*
* @return object The modified transient.
*/
public function inject_update_info( $transient ) {
if ( ! is_object( $transient ) ) {
$transient = new stdClass();
}
if ( empty( $transient->checked ) || ! is_array( $transient->checked ) ) {
return $transient;
}
if ( empty( $transient->checked[ $this->plugin_basename ] ) ) {
return $transient;
}
$current_version = $transient->checked[ $this->plugin_basename ];
$remote = $this->get_remote_data();
if ( empty( $remote['version'] ) || empty( $remote['download_url'] ) ) {
return $transient;
}
if ( ! $this->is_compatible( $remote ) ) {
return $transient;
}
if ( version_compare( $remote['version'], $current_version, '>' ) ) {
$update = (object) array(
'slug' => $remote['slug'] ?? $this->plugin_slug,
'plugin' => $this->plugin_basename,
'new_version' => $remote['version'],
'url' => $remote['homepage'] ?? $this->plugin_data['PluginURI'] ?? '',
'package' => $remote['download_url'],
'tested' => $remote['tested'] ?? '',
'requires' => $remote['requires'] ?? '',
'requires_php' => $remote['requires_php'] ?? '',
);
$transient->response[ $this->plugin_basename ] = $update;
}
return $transient;
}
/**
* Provide "View details" modal content.
*
* @param false|object|array $result The result object or array.
* @param string $action The type of information being requested.
* @param object $args Plugin API arguments.
*
* @return false|object The plugin information object or false.
*/
public function provide_plugin_details( $result, string $action, object $args ) {
if ( 'plugin_information' !== $action ) {
return $result;
}
if ( empty( $args->slug ) || $args->slug !== $this->plugin_slug ) {
return $result;
}
$remote = $this->get_remote_data();
if ( empty( $remote['version'] ) ) {
return $result;
}
return (object) array(
'name' => $remote['name'] ?? $this->plugin_data['Name'] ?? $this->plugin_slug,
'slug' => $remote['slug'] ?? $this->plugin_slug,
'version' => $remote['version'],
'author' => $remote['author'] ?? $this->plugin_data['Author'] ?? '',
'homepage' => $remote['homepage'] ?? $this->plugin_data['PluginURI'] ?? '',
'requires' => $remote['requires'] ?? '',
'tested' => $remote['tested'] ?? '',
'requires_php' => $remote['requires_php'] ?? '',
'sections' => array(
'description' => $remote['description'] ?? $this->plugin_data['Description'] ?? '',
'changelog' => $remote['changelog'] ?? '',
),
'download_link' => $remote['download_url'] ?? '',
);
}
/**
* Get remote data with caching.
*
* @return array Remote data.
*/
private function get_remote_data(): array {
$remote = get_site_transient( $this->cache_key );
if ( false === $remote ) {
$remote = $this->fetch_json();
set_site_transient( $this->cache_key, $remote ?: array(), 6 * HOUR_IN_SECONDS );
}
return is_array( $remote ) ? $remote : array();
}
/**
* Fetch JSON from remote URL.
*
* @return array Decoded JSON data.
*/
private function fetch_json(): array {
$response = wp_remote_get(
$this->json_url,
array(
'timeout' => 10,
'headers' => array(
'Accept' => 'application/json',
),
)
);
if ( is_wp_error( $response ) ) {
return array();
}
$code = (int) wp_remote_retrieve_response_code( $response );
if ( $code < 200 || $code >= 300 ) {
return array();
}
$body = wp_remote_retrieve_body( $response );
$data = json_decode( $body, true );
return is_array( $data ) ? $data : array();
}
/**
* Check compatibility.
*
* @param array $remote Remote data.
*
* @return bool True if compatible.
*/
private function is_compatible( array $remote ): bool {
if ( ! empty( $remote['requires_php'] ) ) {
if ( version_compare( PHP_VERSION, $remote['requires_php'], '<' ) ) {
return false;
}
}
if ( ! empty( $remote['requires'] ) ) {
if ( version_compare( get_bloginfo( 'version' ), $remote['requires'], '<' ) ) {
return false;
}
}
return true;
}
/**
* Handle manual cache clear via URL parameter.
*/
public function handle_cache_clear(): void {
if ( isset( $_GET['robotstxt_clear_update_cache'] ) && current_user_can( 'update_plugins' ) ) {
$this->clear_cache();
wp_safe_redirect( remove_query_arg( 'robotstxt_clear_update_cache' ) );
exit;
}
}
/**
* Clear update cache.
*/
public function clear_cache(): void {
delete_site_transient( $this->cache_key );
delete_site_transient( 'update_plugins' );
}
}

13
update.json Normal file
View file

@ -0,0 +1,13 @@
{
"name": "Hello (by ROBOTSTXT)",
"slug": "robotstxt-hello",
"version": "1.2.0",
"requires": "6.5",
"tested": "6.7",
"requires_php": "8.2",
"homepage": "https://git.robotstxt.es/ROBOTSTXT/robotstxt-hello",
"download_url": "https://git.robotstxt.es/ROBOTSTXT/robotstxt-hello/releases/download/1.2.0/robotstxt-hello-1.2.0.zip",
"author": "ROBOTSTXT",
"description": "Adds a Hello admin page for demonstration purposes. This plugin provides a simple admin interface example for WordPress development.",
"changelog": "<ul><li><strong>1.2.0</strong> Added generic JSON-based Auto-Updater system. Plugin now updates automatically from git.robotstxt.es without depending on WordPress.org repository.</li><li><strong>1.1.2</strong> Maintenance release.</li><li><strong>1.1.1</strong> Bug fixes and improvements.</li><li><strong>1.1.0</strong> Enhanced admin interface.</li><li><strong>1.0.0</strong> Initial release.</li></ul>"
}