This commit is contained in:
Javier Casares 2026-06-08 12:31:51 +00:00
commit 7dd3eeaa8a
97 changed files with 4912 additions and 1581 deletions

View file

@ -3,9 +3,9 @@
* Plugin Name: Documentation Markdown (by ROBOTSTXT)
* Plugin URI: https://git.robotstxt.es/ROBOTSTXT/robotstxt-documentation-markdown
* Description: Synchronizes Markdown documentation from GitHub repositories to WordPress pages and posts automatically.
* Version: 1.1.0
* Version: 1.1.1
* Requires at least: 6.7
* Requires PHP: 8.2
* Requires PHP: 8.0
* Security: robotstxt@robotstxt.es
* Author: ROBOTSTXT
* Author URI: https://www.robotstxt.es/
@ -26,7 +26,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
// Define plugin constants.
define( 'ROBOTSTXT_DOCMD_VERSION', '1.1.0' );
define( 'ROBOTSTXT_DOCMD_VERSION', '1.1.1' );
define( 'ROBOTSTXT_DOCMD_PLUGIN_FILE', __FILE__ );
define( 'ROBOTSTXT_DOCMD_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'ROBOTSTXT_DOCMD_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
@ -74,7 +74,9 @@ function robotstxt_docmd_activate() {
array(
'github_url' => '',
'github_token' => '',
)
),
'',
false // Do not autoload — contains encrypted token.
);
}
}
@ -909,9 +911,26 @@ function robotstxt_docmd_render_admin_notices() {
// Check for regular message parameter.
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
$message = sanitize_key( wp_unslash( robotstxt_docmd_input_string( $_GET, 'message' ) ) );
if ( 'settings_saved' === $message ) {
$success_messages = array(
'settings_saved' => __( 'Settings saved successfully.', 'robotstxt-documentation-markdown' ),
'mapping_created' => __( 'Mapping created successfully.', 'robotstxt-documentation-markdown' ),
'mapping_updated' => __( 'Mapping updated successfully.', 'robotstxt-documentation-markdown' ),
'mapping_deleted' => __( 'Mapping deleted.', 'robotstxt-documentation-markdown' ),
'sync_complete' => __( 'Sync completed successfully.', 'robotstxt-documentation-markdown' ),
);
if ( isset( $success_messages[ $message ] ) ) {
echo '<div class="notice notice-success is-dismissible"><p>';
esc_html_e( 'Settings saved successfully.', 'robotstxt-documentation-markdown' );
echo esc_html( $success_messages[ $message ] );
echo '</p></div>';
}
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
$error_text = sanitize_text_field( wp_unslash( robotstxt_docmd_input_string( $_GET, 'error' ) ) );
if ( '' !== $error_text ) {
echo '<div class="notice notice-error is-dismissible"><p>';
echo esc_html( $error_text );
echo '</p></div>';
}
@ -1159,7 +1178,7 @@ function robotstxt_docmd_handle_save_settings() {
// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
$settings['delete_on_uninstall'] = ! empty( $_POST['delete_on_uninstall'] ) ? 1 : 0;
update_option( 'robotstxt_docmd_settings', $settings );
update_option( 'robotstxt_docmd_settings', $settings, false );
wp_safe_redirect( add_query_arg( 'message', 'settings_saved', admin_url( 'admin.php?page=robotstxt-docmd-settings' ) ) );
exit;
@ -1589,5 +1608,5 @@ function robotstxt_docmd_debug_fix_crons() {
}
// Initialize ROBOTSTXT updater (auto-configures from plugin headers).
require_once __DIR__ . '/robotstxt-updater.php';
require_once __DIR__ . '/class-robotstxt-updater.php';
Robotstxt_Updater::init( __FILE__ );