Plugin Directory

Changeset 3440837


Ignore:
Timestamp:
01/16/2026 08:35:26 AM (3 months ago)
Author:
noricku
Message:

Deploy version 1.15.0

  • Updated to version 1.15.0
  • Package created via automated build process
  • Validated package contents and size

🤖 Automated deployment via wporg-deploy.sh

Location:
markdown-renderer-for-github/trunk
Files:
13 added
4 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • markdown-renderer-for-github/trunk/changelog.txt

    r3440078 r3440837  
    77
    88## [Unreleased]
     9
     10## [1.15.0] - 2026-01-16
     11### Added
     12- Add Pro version packaging script
     13### Changed
     14- Separate Pro plugin and enhance extension system
     15### Maintenance
     16- Add automatic cleanup of release ZIP files
    917
    1018## [1.14.1] - 2026-01-15
  • markdown-renderer-for-github/trunk/includes/class-gfmr-asset-manager.php

    r3439929 r3440837  
    9090        // Localization setup
    9191        $this->setup_localization( $version );
     92
     93        /**
     94         * Fires after frontend assets are enqueued
     95         *
     96         * Allows addons to enqueue their own frontend scripts and styles.
     97         *
     98         * @since 2.0.0
     99         *
     100         * @param string $context Asset context ('frontend')
     101         */
     102        do_action( 'gfmr_enqueue_assets', 'frontend' );
    92103    }
    93104
     
    194205        $version     = $plugin_data['Version'] ?? '1.0.0';
    195206
     207        /**
     208         * Filters available Shiki languages
     209         *
     210         * Allows addons to add custom language support for syntax highlighting.
     211         *
     212         * @since 2.0.0
     213         *
     214         * @param array $languages Array of language identifiers
     215         */
     216        $supported_languages = apply_filters( 'gfmr_shiki_languages', $this->get_default_languages() );
     217
    196218        return array(
    197219            'translation_data' => array(
    198                 'loading'         => __( 'Loading...', 'markdown-renderer-for-github' ),
    199                 'error'           => __( 'Error occurred', 'markdown-renderer-for-github' ),
    200                 'pluginUrl'       => $plugin_url,
    201                 'version'         => $version,
    202                 'debug'           => defined( 'WP_DEBUG' ) && WP_DEBUG,
    203                 'timestamp'       => time(),
     220                'loading'            => __( 'Loading...', 'markdown-renderer-for-github' ),
     221                'error'              => __( 'Error occurred', 'markdown-renderer-for-github' ),
     222                'pluginUrl'          => $plugin_url,
     223                'version'            => $version,
     224                'debug'              => defined( 'WP_DEBUG' ) && WP_DEBUG,
     225                'timestamp'          => time(),
    204226                // AJAX configuration for SSR client
    205                 'ajaxUrl'         => function_exists( 'admin_url' ) ? admin_url( 'admin-ajax.php' ) : '',
    206                 'mermaidSsrNonce' => ( function_exists( 'is_user_logged_in' ) && is_user_logged_in() ) ? wp_create_nonce( 'gfmr_mermaid_ssr' ) : '',
     227                'ajaxUrl'            => function_exists( 'admin_url' ) ? admin_url( 'admin-ajax.php' ) : '',
     228                'mermaidSsrNonce'    => ( function_exists( 'is_user_logged_in' ) && is_user_logged_in() ) ? wp_create_nonce( 'gfmr_mermaid_ssr' ) : '',
     229                // Supported languages for syntax highlighting
     230                'supportedLanguages' => $supported_languages,
    207231                // UI translations for gfmr-ui.js.
    208                 'translations'    => array(
     232                'translations'       => array(
    209233                    'copy'        => __( 'Copy', 'markdown-renderer-for-github' ),
    210234                    'copied'      => __( 'Copied!', 'markdown-renderer-for-github' ),
     
    224248
    225249    /**
     250     * Get default supported languages for Shiki
     251     *
     252     * Returns a comprehensive list of programming languages supported by default.
     253     * Addons can extend this list using the 'gfmr_shiki_languages' filter.
     254     *
     255     * @since 2.0.0
     256     * @return array Array of language identifiers
     257     */
     258    private function get_default_languages() {
     259        return array(
     260            'javascript',
     261            'typescript',
     262            'jsx',
     263            'tsx',
     264            'php',
     265            'python',
     266            'ruby',
     267            'java',
     268            'c',
     269            'cpp',
     270            'csharp',
     271            'go',
     272            'rust',
     273            'swift',
     274            'kotlin',
     275            'scala',
     276            'sql',
     277            'html',
     278            'css',
     279            'scss',
     280            'sass',
     281            'less',
     282            'json',
     283            'yaml',
     284            'xml',
     285            'markdown',
     286            'bash',
     287            'shell',
     288            'powershell',
     289            'dockerfile',
     290            'makefile',
     291            'graphql',
     292            'vue',
     293            'svelte',
     294            'astro',
     295        );
     296    }
     297
     298    /**
    226299     * Determine if TOC assets should be loaded.
    227300     *
     
    411484     */
    412485    private function get_theme_config( $settings ) {
     486        /**
     487         * Filters available Shiki themes
     488         *
     489         * Allows addons to add custom Shiki themes.
     490         *
     491         * @since 2.0.0
     492         *
     493         * @param array $themes Available themes array ['light' => 'github-light', ...]
     494         */
     495        $available_themes = apply_filters( 'gfmr_shiki_themes', GFMR_Settings::AVAILABLE_THEMES );
     496
    413497        return array(
    414498            'theme' => array(
     
    416500                'shiki_theme' => $settings->get_shiki_theme(),
    417501                'system_auto' => $settings->is_system_theme_enabled(),
    418                 'available'   => GFMR_Settings::AVAILABLE_THEMES,
     502                'available'   => $available_themes,
    419503            ),
    420504        );
     
    488572        // Setup localization for admin preview
    489573        $this->setup_admin_localization( $version );
     574
     575        /**
     576         * Fires after admin assets are enqueued
     577         *
     578         * Allows addons to enqueue their own admin scripts and styles.
     579         *
     580         * @since 2.0.0
     581         *
     582         * @param string $context Asset context ('admin')
     583         */
     584        do_action( 'gfmr_enqueue_assets', 'admin' );
    490585    }
    491586
  • markdown-renderer-for-github/trunk/includes/class-gfmr-block-registry.php

    r3440078 r3440837  
    3535    /** Register blocks */
    3636    public function register_blocks() {
    37         // デバッグ: 関数呼び出しを記録(WordPress環境でのみ実行)
    38         if ( function_exists( 'current_filter' ) ) {
    39             $debug_log = get_transient( 'gfmr_debug_log' );
    40             if ( ! $debug_log ) {
    41                 $debug_log = array();
    42             }
    43             $debug_log[] = array(
    44                 'time'     => current_time( 'mysql' ),
    45                 'action'   => 'register_blocks called',
    46                 'hook'     => current_filter(),
    47                 'wp_debug' => defined( 'WP_DEBUG' ) && WP_DEBUG ? 'true' : 'false',
    48             );
    49             set_transient( 'gfmr_debug_log', $debug_log, HOUR_IN_SECONDS );
    50 
    51             // ファイルベースログ(絶対に記録される)
    52             $log_file = plugin_dir_path( GFMR_PLUGIN_FILE ) . 'debug.log';
    53             // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents -- Debug logging only
    54             file_put_contents(
    55                 $log_file,
    56                 '[' . current_time( 'mysql' ) . '] register_blocks() called on hook: ' . current_filter() . "\n",
    57                 FILE_APPEND
    58             );
    59         }
    60 
    6137        try {
    6238            // Block registration based on block.json (MD-34: Fixed with manual editorScript registration)
     
    129105            error_log( 'GFMR Block Registry: Scripts and styles registered' );
    130106
     107            // Load block.json to allow attribute customization
     108            // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Reading block.json configuration
     109            $block_json_content = file_get_contents( $block_json_path );
     110            $block_config       = json_decode( $block_json_content, true );
     111
     112            // Get default attributes from block.json
     113            $attributes = $block_config['attributes'] ?? array();
     114
     115            /**
     116             * Filters block attributes
     117             *
     118             * Allows addons to add custom attributes to the Markdown block.
     119             *
     120             * @since 2.0.0
     121             *
     122             * @param array $attributes Block attribute definitions
     123             */
     124            $attributes = apply_filters( 'gfmr_block_attributes', $attributes );
     125
    131126            // WordPress standard block.json registration
    132127            // block.json now uses file: path for editorScript, so WordPress handles registration automatically
     
    135130                array(
    136131                    'render_callback' => array( $this, 'render_markdown_block' ),
     132                    'attributes'      => $attributes,
    137133                )
    138134            );
     
    528524        $output .= '</div>';
    529525
     526        /**
     527         * Filters the block render output
     528         *
     529         * Allows addons to modify the rendered output of the Markdown block.
     530         *
     531         * @since 2.0.0
     532         *
     533         * @param string $output     The rendered HTML output
     534         * @param array  $attributes Block attributes
     535         * @param string $content    Original Markdown content
     536         */
     537        $output = apply_filters( 'gfmr_block_render_output', $output, $attributes, $content );
     538
    530539        return $output;
    531540    }
  • markdown-renderer-for-github/trunk/includes/class-gfmr-renderer.php

    r3439929 r3440837  
    160160        register_activation_hook( GFMR_PLUGIN_FILE, array( $this, 'activate' ) );
    161161        register_deactivation_hook( GFMR_PLUGIN_FILE, array( $this, 'deactivate' ) );
    162         // デバッグ用:管理画面にブロック登録状態を表示
    163         if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
    164             add_action( 'admin_notices', array( $this, 'display_debug_notice' ) );
    165         }
    166162    }
    167163
     
    558554        $this->log_debug( 'Processing Markdown content with patterns detected' );
    559555
     556        // Build context for extension hooks
     557        $context = array(
     558            'post_id'     => get_the_ID(),
     559            'block_attrs' => array(),
     560        );
     561
     562        /**
     563         * Filters Markdown content before rendering
     564         *
     565         * Allows addons to modify the Markdown content before it's processed.
     566         *
     567         * @since 2.0.0
     568         *
     569         * @param string $content The original Markdown content
     570         * @param array  $context Context information
     571         */
     572        $content = apply_filters( 'gfmr_pre_render_markdown', $content, $context );
     573
    560574        // Create container structure for JavaScript processing
    561575        $output  = '<div class="gfmr-markdown-container">';
     
    563577        $output .= '<div class="gfmr-markdown-rendered">' . wp_kses_post( $content ) . '</div>';
    564578        $output .= '</div>';
     579
     580        /**
     581         * Filters the rendered Markdown HTML output
     582         *
     583         * Allows addons to modify the final HTML output after rendering.
     584         *
     585         * @since 2.0.0
     586         *
     587         * @param string $output   The rendered HTML output
     588         * @param string $content  The original Markdown content
     589         * @param array  $context  Context information
     590         */
     591        $output = apply_filters( 'gfmr_render_markdown', $output, $content, $context );
     592
     593        /**
     594         * Fires after Markdown rendering is complete
     595         *
     596         * Allows addons to perform actions after rendering.
     597         *
     598         * @since 2.0.0
     599         *
     600         * @param string $output   The rendered HTML output
     601         * @param string $content  The original Markdown content
     602         * @param array  $context  Context information
     603         */
     604        do_action( 'gfmr_after_render', $output, $content, $context );
    565605
    566606        return $output;
     
    747787
    748788    /**
    749      * Display debug notice in admin area
    750      *
    751      * Shows block and script registration status for debugging purposes.
    752      * Only visible to administrators when WP_DEBUG is enabled.
    753      */
    754     public function display_debug_notice() {
    755         if ( ! current_user_can( 'manage_options' ) ) {
    756             return;
    757         }
    758 
    759         $debug_log = get_transient( 'gfmr_debug_log' );
    760         if ( ! $debug_log ) {
    761             $debug_log = array();
    762         }
    763         $block_types = \WP_Block_Type_Registry::get_instance()->get_all_registered();
    764         $our_block   = isset( $block_types['gfm-renderer/markdown'] );
    765 
    766         $script_registered = wp_script_is( 'gfmr-renderer-editor', 'registered' );
    767         $script_enqueued   = wp_script_is( 'gfmr-renderer-editor', 'enqueued' );
    768 
    769         echo '<div class="notice notice-info"><p>';
    770         echo '<strong>GFMR Debug:</strong><br>';
    771         echo 'Block registered: ' . ( $our_block ? '✅ YES' : '❌ NO' ) . '<br>';
    772         echo 'Script registered: ' . ( $script_registered ? '✅ YES' : '❌ NO' ) . '<br>';
    773         echo 'Script enqueued: ' . ( $script_enqueued ? '✅ YES' : '❌ NO' ) . '<br>';
    774         echo 'Debug log entries: ' . count( $debug_log ) . '<br>';
    775         if ( ! empty( $debug_log ) ) {
    776             echo 'Last entry: ' . esc_html( print_r( end( $debug_log ), true ) );
    777         }
    778         echo '</p></div>';
    779     }
    780 
    781     /**
    782789     * Create instance for testing with injected dependencies.
    783790     *
  • markdown-renderer-for-github/trunk/includes/class-gfmr-settings.php

    r3439929 r3440837  
    5454        add_action( 'wp_ajax_gfmr_preview_theme', array( $this, 'ajax_preview_theme' ) );
    5555        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ) );
    56 
    57         // License AJAX handlers
    58         add_action( 'wp_ajax_gfmr_activate_license', array( $this, 'ajax_activate_license' ) );
    59         add_action( 'wp_ajax_gfmr_deactivate_license', array( $this, 'ajax_deactivate_license' ) );
    6056    }
    6157
     
    213209        );
    214210
    215         // License management section.
    216         add_settings_section(
    217             'gfmr_license_section',
    218             __( 'Pro License Management', 'markdown-renderer-for-github' ),
    219             array( $this, 'render_license_section' ),
    220             self::SETTINGS_SLUG
    221         );
    222 
    223         add_settings_field(
    224             'license_key',
    225             __( 'License Key', 'markdown-renderer-for-github' ),
    226             array( $this, 'render_license_field' ),
    227             self::SETTINGS_SLUG,
    228             'gfmr_license_section'
    229         );
    230 
    231         add_settings_field(
    232             'license_status',
    233             __( 'License Status', 'markdown-renderer-for-github' ),
    234             array( $this, 'render_license_status_field' ),
    235             self::SETTINGS_SLUG,
    236             'gfmr_license_section'
    237         );
    238 
    239211        // Table of Contents (TOC) section.
    240212        add_settings_section(
     
    291263            self::SETTINGS_SLUG,
    292264            'gfmr_toc_section'
     265        );
     266
     267        // Extensions section.
     268        add_settings_section(
     269            'gfmr_extensions_section',
     270            __( 'Extensions', 'markdown-renderer-for-github' ),
     271            array( $this, 'render_extensions_section' ),
     272            self::SETTINGS_SLUG
    293273        );
    294274    }
     
    385365     */
    386366    private function get_tabs() {
    387         return array(
     367        $tabs = array(
    388368            'code-block' => array(
    389369                'title'    => __( 'Code Block', 'markdown-renderer-for-github' ),
     
    402382                'sections' => array( 'gfmr_schema_section' ),
    403383            ),
    404             'license'    => array(
    405                 'title'    => __( 'License', 'markdown-renderer-for-github' ),
    406                 'sections' => array( 'gfmr_license_section' ),
     384            'extensions' => array(
     385                'title'    => __( 'Extensions', 'markdown-renderer-for-github' ),
     386                'sections' => array( 'gfmr_extensions_section' ),
    407387            ),
    408388        );
     389
     390        /**
     391         * Filters the settings tabs list
     392         *
     393         * Allows addons to add their own settings tabs.
     394         *
     395         * @since 2.0.0
     396         *
     397         * @param array $tabs Tabs configuration array
     398         */
     399        return apply_filters( 'gfmr_settings_tabs_list', $tabs );
    409400    }
    410401
     
    10911082
    10921083    /**
    1093      * Render license section description
    1094      */
    1095     public function render_license_section() {
    1096         echo '<p>' . esc_html__( 'Manage your Pro license key to unlock premium features.', 'markdown-renderer-for-github' ) . '</p>';
    1097     }
    1098 
    1099     /**
    1100      * Render license key field
    1101      */
    1102     public function render_license_field() {
    1103         $license_manager = GFMR_License_Manager::get_instance();
    1104         $license_status  = $license_manager->get_license_status();
    1105         $license_data    = $this->get_license_option();
    1106 
    1107         // Get the license key (masked if active)
    1108         $license_key = $license_status['license_key'] ?? '';
    1109 
    1110         // Show input field if no active license
    1111         if ( 'inactive' === $license_status['status'] ) {
    1112             ?>
    1113             <input type="text"
    1114                     id="gfmr-license-key"
    1115                     class="regular-text"
    1116                     placeholder="<?php esc_attr_e( 'e.g.: a1b2c3d4-e5f6-4a7b-8c9d-e0f1a2b3c4d5', 'markdown-renderer-for-github' ); ?>"
    1117                     maxlength="36" />
    1118             <button type="button"
    1119                     id="gfmr-activate-license"
    1120                     class="button button-secondary">
    1121                 <?php esc_html_e( 'Activate License', 'markdown-renderer-for-github' ); ?>
    1122             </button>
    1123             <span id="gfmr-license-spinner" class="spinner" style="display: none;"></span>
    1124             <p class="description">
    1125                 <?php esc_html_e( 'Enter your license key to activate Pro features.', 'markdown-renderer-for-github' ); ?>
    1126             </p>
    1127             <?php
     1084     * Render Extensions section
     1085     *
     1086     * Displays information about extensions and lists registered addons.
     1087     */
     1088    public function render_extensions_section() {
     1089        // Get extension API instance
     1090        $extension_api = new \Wakalab\WpGfmRenderer\GFMR_Extension_API();
     1091        $addons        = $extension_api->get_registered_addons();
     1092
     1093        echo '<p>';
     1094        echo esc_html__( 'Extend the functionality of Markdown Renderer for GitHub by installing addons.', 'markdown-renderer-for-github' );
     1095        echo '</p>';
     1096
     1097        /**
     1098         * Fires before the extensions section content
     1099         *
     1100         * Allows addons to add content at the top of the extensions tab.
     1101         *
     1102         * @since 2.0.0
     1103         *
     1104         * @param string $page_slug Settings page slug
     1105         * @param array  $tabs      Available tabs
     1106         */
     1107        do_action( 'gfmr_settings_tabs', self::SETTINGS_SLUG, $this->get_tabs() );
     1108
     1109        if ( empty( $addons ) ) {
     1110            echo '<p>';
     1111            echo esc_html__( 'No addons are currently installed. Install addons to add new features and capabilities.', 'markdown-renderer-for-github' );
     1112            echo '</p>';
    11281113        } else {
    1129             // Show masked license key with deactivate button
    1130             ?>
    1131             <div class="gfmr-license-active">
    1132                 <input type="text"
    1133                         class="regular-text"
    1134                         value="<?php echo esc_attr( $license_key ); ?>"
    1135                         readonly
    1136                         disabled />
    1137                 <button type="button"
    1138                         id="gfmr-deactivate-license"
    1139                         class="button button-secondary">
    1140                     <?php esc_html_e( 'Deactivate License', 'markdown-renderer-for-github' ); ?>
    1141                 </button>
    1142                 <span id="gfmr-license-spinner" class="spinner" style="display: none;"></span>
    1143             </div>
    1144             <?php
    1145         }
    1146 
    1147         // Add nonce field for AJAX requests
    1148         wp_nonce_field( 'gfmr_license_nonce', 'gfmr_license_nonce' );
    1149     }
    1150 
    1151     /**
    1152      * Render license status field
    1153      */
    1154     public function render_license_status_field() {
    1155         $license_manager = GFMR_License_Manager::get_instance();
    1156         $license_status  = $license_manager->get_license_status();
    1157 
    1158         $status_class = 'active' === $license_status['status'] ? 'valid' : 'invalid';
    1159         $status_text  = $license_status['message'] ?? '';
    1160         ?>
    1161         <div id="gfmr-license-status-display" class="gfmr-license-status <?php echo esc_attr( $status_class ); ?>">
    1162             <span class="dashicons dashicons-<?php echo 'valid' === $status_class ? 'yes-alt' : 'no-alt'; ?>"></span>
    1163             <?php echo esc_html( $status_text ); ?>
    1164         </div>
    1165         <?php
    1166     }
    1167 
    1168     /**
    1169      * Get license data from storage
    1170      *
    1171      * @return array License data
    1172      */
    1173     private function get_license_option(): array {
    1174         $data = $this->get_option( 'gfmr_license_data', array() );
    1175         return is_array( $data ) ? $data : array();
    1176     }
    1177 
    1178     /**
    1179      * Get option (multisite aware)
    1180      *
    1181      * @param string $option Option name
    1182      * @param mixed $default_value Default value
    1183      * @return mixed Option value
    1184      */
    1185     private function get_option( string $option, $default_value = false ) {
    1186         if ( is_multisite() ) {
    1187             return get_site_option( $option, $default_value );
    1188         }
    1189         return get_option( $option, $default_value );
    1190     }
    1191 
    1192     /**
    1193      * AJAX: Activate license key
    1194      */
    1195     public function ajax_activate_license() {
    1196         // Verify nonce
    1197         if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gfmr_license_nonce' ) ) {
    1198             wp_send_json_error(
    1199                 array(
    1200                     'message' => __( 'Security check failed.', 'markdown-renderer-for-github' ),
    1201                 )
    1202             );
    1203         }
    1204 
    1205         // Check permissions
    1206         if ( ! $this->can_manage_license() ) {
    1207             wp_send_json_error(
    1208                 array(
    1209                     'message' => __( 'You do not have permission to manage licenses.', 'markdown-renderer-for-github' ),
    1210                 )
    1211             );
    1212         }
    1213 
    1214         // Get and validate license key
    1215         $license_key = sanitize_text_field( $_POST['license_key'] ?? '' );
    1216 
    1217         if ( empty( $license_key ) ) {
    1218             wp_send_json_error(
    1219                 array(
    1220                     'message' => __( 'Please enter a license key.', 'markdown-renderer-for-github' ),
    1221                 )
    1222             );
    1223         }
    1224 
    1225         // Activate license
    1226         $license_manager = GFMR_License_Manager::get_instance();
    1227         $result          = $license_manager->activate_license( $license_key );
    1228 
    1229         if ( $result['success'] ) {
    1230             wp_send_json_success(
    1231                 array(
    1232                     'message' => $result['message'],
    1233                     'status'  => $license_manager->get_license_status(),
    1234                 )
    1235             );
    1236         } else {
    1237             wp_send_json_error(
    1238                 array(
    1239                     'message' => $result['message'],
    1240                 )
    1241             );
    1242         }
    1243     }
    1244 
    1245     /**
    1246      * AJAX: Deactivate license
    1247      */
    1248     public function ajax_deactivate_license() {
    1249         // Verify nonce
    1250         if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gfmr_license_nonce' ) ) {
    1251             wp_send_json_error(
    1252                 array(
    1253                     'message' => __( 'Security check failed.', 'markdown-renderer-for-github' ),
    1254                 )
    1255             );
    1256         }
    1257 
    1258         // Check permissions
    1259         if ( ! $this->can_manage_license() ) {
    1260             wp_send_json_error(
    1261                 array(
    1262                     'message' => __( 'You do not have permission to manage licenses.', 'markdown-renderer-for-github' ),
    1263                 )
    1264             );
    1265         }
    1266 
    1267         // Deactivate license
    1268         $license_manager = GFMR_License_Manager::get_instance();
    1269         $result          = $license_manager->deactivate_license();
    1270 
    1271         if ( $result['success'] ) {
    1272             wp_send_json_success(
    1273                 array(
    1274                     'message' => $result['message'],
    1275                     'status'  => $license_manager->get_license_status(),
    1276                 )
    1277             );
    1278         } else {
    1279             wp_send_json_error(
    1280                 array(
    1281                     'message' => $result['message'],
    1282                 )
    1283             );
    1284         }
    1285     }
    1286 
    1287     /**
    1288      * Check if current user can manage license
    1289      *
    1290      * @return bool True if user has permission
    1291      */
    1292     private function can_manage_license(): bool {
    1293         if ( is_multisite() ) {
    1294             return current_user_can( 'manage_network_options' );
    1295         }
    1296         return current_user_can( 'manage_options' );
     1114            echo '<h3>' . esc_html__( 'Installed Addons', 'markdown-renderer-for-github' ) . '</h3>';
     1115            echo '<table class="widefat striped">';
     1116            echo '<thead><tr>';
     1117            echo '<th>' . esc_html__( 'Name', 'markdown-renderer-for-github' ) . '</th>';
     1118            echo '<th>' . esc_html__( 'Version', 'markdown-renderer-for-github' ) . '</th>';
     1119            echo '<th>' . esc_html__( 'Author', 'markdown-renderer-for-github' ) . '</th>';
     1120            echo '</tr></thead>';
     1121            echo '<tbody>';
     1122
     1123            foreach ( $addons as $addon_id => $addon_info ) {
     1124                echo '<tr>';
     1125                echo '<td>' . esc_html( $addon_info['name'] ?? $addon_id ) . '</td>';
     1126                echo '<td>' . esc_html( $addon_info['version'] ?? 'N/A' ) . '</td>';
     1127                echo '<td>' . esc_html( $addon_info['author'] ?? 'N/A' ) . '</td>';
     1128                echo '</tr>';
     1129            }
     1130
     1131            echo '</tbody>';
     1132            echo '</table>';
     1133        }
     1134
     1135        /**
     1136         * Fires in the extensions section
     1137         *
     1138         * Allows addons to add their own settings sections.
     1139         *
     1140         * @since 2.0.0
     1141         *
     1142         * @param string $page_slug  Settings page slug
     1143         * @param string $active_tab Currently active tab ID
     1144         */
     1145        do_action( 'gfmr_settings_sections', self::SETTINGS_SLUG, 'extensions' );
    12971146    }
    12981147}
  • markdown-renderer-for-github/trunk/markdown-renderer-for-github.php

    r3440078 r3440837  
    44 * Plugin URI:        https://github.com/wakalab/markdown-renderer-for-github
    55 * Description:       Renders GFM (GitHub Flavored Markdown) content beautifully on the front end using JavaScript libraries. It supports syntax highlighting for code blocks and diagram rendering with Mermaid.js.
    6  * Version:           1.14.1
    7  * Requires at least: 6.0
     6 * Version:           1.15.0
     7 * Requires at least: 6.5
    88 * Requires PHP:      8.1
    99 * Tested up to:      6.9
     
    2424
    2525// Define new prefixed constants (WordPress.org requirement compliance)
     26define( 'GFMR_VERSION', '1.14.1' );
     27define( 'GFMR_MIN_PRO_VERSION', '1.0.0' );
    2628define( 'GFMR_PLUGIN_FILE', __FILE__ );
    2729define( 'GFMR_SLUG', 'markdown-renderer-for-github' );
     
    4244require_once __DIR__ . '/includes/class-gfmr-settings.php';
    4345
     46// Load extension API class
     47require_once __DIR__ . '/includes/class-gfmr-extension-api.php';
     48
    4449// Load WP-CLI commands (only when running in CLI mode)
    4550if ( defined( 'WP_CLI' ) && WP_CLI ) {
    4651    require_once __DIR__ . '/includes/class-gfmr-cli.php';
    4752}
    48 
    49 // Load license management classes
    50 require_once __DIR__ . '/includes/class-gfmr-license-security.php';
    51 require_once __DIR__ . '/includes/class-gfmr-license-manager.php';
    52 
    53 // Load Pro feature management
    54 require_once __DIR__ . '/includes/class-gfmr-pro-features.php';
    55 require_once __DIR__ . '/includes/trait-gfmr-premium-feature-gate.php';
    5653
    5754// Initialize plugin instance
     
    6259// Execute plugin initialization
    6360gfmr_init();
     61
     62// Initialize extension API
     63$gfmr_extension_api = new \Wakalab\WpGfmRenderer\GFMR_Extension_API();
     64$gfmr_extension_api->init();
     65
     66/**
     67 * Public API Functions
     68 *
     69 * These functions provide a stable API for addons to interact with
     70 * the plugin's core features.
     71 */
     72
     73/**
     74 * Get plugin version
     75 *
     76 * @return string Plugin version
     77 */
     78function gfmr_get_version() {
     79    return GFMR_VERSION;
     80}
     81
     82/**
     83 * Get default feature flags
     84 *
     85 * @return array Default feature flags
     86 */
     87function gfmr_get_default_flags() {
     88    return array(
     89        'syntax_highlight' => true,
     90        'mermaid'          => true,
     91        'toc'              => false,
     92        'line_numbers'     => false,
     93    );
     94}
     95
     96/**
     97 * Check if a feature is enabled
     98 *
     99 * This function allows addons to check if a specific feature is enabled.
     100 * Addons can modify feature flags using the 'gfmr_feature_flags' filter.
     101 *
     102 * @param string $flag_name Feature flag name
     103 * @return bool True if feature is enabled, false otherwise
     104 */
     105function gfmr_is_feature_enabled( $flag_name ) {
     106    /**
     107     * Filters feature flags
     108     *
     109     * Addons can use this filter to enable or disable features.
     110     *
     111     * @since 2.0.0
     112     *
     113     * @param array $flags Feature flags array
     114     */
     115    $flags = apply_filters( 'gfmr_feature_flags', gfmr_get_default_flags() );
     116    return isset( $flags[ $flag_name ] ) && $flags[ $flag_name ];
     117}
  • markdown-renderer-for-github/trunk/phpstan.neon

    r3432409 r3440837  
    77        - includes/
    88        - markdown-renderer-for-github.php
     9        - plugins/pro/markdown-renderer-for-github-pro/includes/
     10        - plugins/pro/markdown-renderer-for-github-pro/markdown-renderer-for-github-pro.php
    911    excludePaths:
    1012        - vendor/
  • markdown-renderer-for-github/trunk/readme.txt

    r3440078 r3440837  
    33Donate link: https://wakalab.dev/
    44Tags: markdown, github, gfm, syntax-highlighting, mermaid
    5 Requires at least: 6.0
     5Requires at least: 6.5
    66Tested up to: 6.9
    77Requires PHP: 8.1
    8 Stable tag: 1.14.1
     8Stable tag: 1.15.0
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    126126
    127127== Changelog ==
     128
     129= 1.15.0 =
     130* Add Pro version packaging script
     131* Separate Pro plugin and enhance extension system
     132* Add automatic cleanup of release ZIP files
    128133
    129134= 1.14.1 =
     
    235240* Stabilize E2E tests by improving Docker environment and Mermaid detection
    236241
    237 = 1.7.7 =
    238 * Fix editor preview visibility for code blocks and Mermaid diagrams
    239 * E2E test timeout for empty code blocks and Mermaid-only content
    240 
    241242== Upgrade Notice ==
    242243
  • markdown-renderer-for-github/trunk/vendor/composer/autoload_classmap.php

    r3438558 r3440837  
    2626    'Wakalab\\WpGfmRenderer\\GFMR_Code_Highlighter' => $baseDir . '/includes/class-gfmr-code-highlighter.php',
    2727    'Wakalab\\WpGfmRenderer\\GFMR_Content_Analyzer' => $baseDir . '/includes/class-gfmr-content-analyzer.php',
     28    'Wakalab\\WpGfmRenderer\\GFMR_Extension_API' => $baseDir . '/includes/class-gfmr-extension-api.php',
    2829    'Wakalab\\WpGfmRenderer\\GFMR_Frontmatter_Parser' => $baseDir . '/includes/class-gfmr-frontmatter-parser.php',
    29     'Wakalab\\WpGfmRenderer\\GFMR_License_Manager' => $baseDir . '/includes/class-gfmr-license-manager.php',
    30     'Wakalab\\WpGfmRenderer\\GFMR_License_Security' => $baseDir . '/includes/class-gfmr-license-security.php',
    3130    'Wakalab\\WpGfmRenderer\\GFMR_Mermaid_SSR_Handler' => $baseDir . '/includes/class-gfmr-mermaid-ssr-handler.php',
    3231    'Wakalab\\WpGfmRenderer\\GFMR_Metadata_Handler' => $baseDir . '/includes/class-gfmr-metadata-handler.php',
    33     'Wakalab\\WpGfmRenderer\\GFMR_Premium_Feature_Gate' => $baseDir . '/includes/trait-gfmr-premium-feature-gate.php',
    34     'Wakalab\\WpGfmRenderer\\GFMR_Pro_Features' => $baseDir . '/includes/class-gfmr-pro-features.php',
    3532    'Wakalab\\WpGfmRenderer\\GFMR_Renderer' => $baseDir . '/includes/class-gfmr-renderer.php',
    3633    'Wakalab\\WpGfmRenderer\\GFMR_SSR_Renderer' => $baseDir . '/includes/class-gfmr-ssr-renderer.php',
  • markdown-renderer-for-github/trunk/vendor/composer/autoload_static.php

    r3438558 r3440837  
    4545        'Wakalab\\WpGfmRenderer\\GFMR_Code_Highlighter' => __DIR__ . '/../..' . '/includes/class-gfmr-code-highlighter.php',
    4646        'Wakalab\\WpGfmRenderer\\GFMR_Content_Analyzer' => __DIR__ . '/../..' . '/includes/class-gfmr-content-analyzer.php',
     47        'Wakalab\\WpGfmRenderer\\GFMR_Extension_API' => __DIR__ . '/../..' . '/includes/class-gfmr-extension-api.php',
    4748        'Wakalab\\WpGfmRenderer\\GFMR_Frontmatter_Parser' => __DIR__ . '/../..' . '/includes/class-gfmr-frontmatter-parser.php',
    48         'Wakalab\\WpGfmRenderer\\GFMR_License_Manager' => __DIR__ . '/../..' . '/includes/class-gfmr-license-manager.php',
    49         'Wakalab\\WpGfmRenderer\\GFMR_License_Security' => __DIR__ . '/../..' . '/includes/class-gfmr-license-security.php',
    5049        'Wakalab\\WpGfmRenderer\\GFMR_Mermaid_SSR_Handler' => __DIR__ . '/../..' . '/includes/class-gfmr-mermaid-ssr-handler.php',
    5150        'Wakalab\\WpGfmRenderer\\GFMR_Metadata_Handler' => __DIR__ . '/../..' . '/includes/class-gfmr-metadata-handler.php',
    52         'Wakalab\\WpGfmRenderer\\GFMR_Premium_Feature_Gate' => __DIR__ . '/../..' . '/includes/trait-gfmr-premium-feature-gate.php',
    53         'Wakalab\\WpGfmRenderer\\GFMR_Pro_Features' => __DIR__ . '/../..' . '/includes/class-gfmr-pro-features.php',
    5451        'Wakalab\\WpGfmRenderer\\GFMR_Renderer' => __DIR__ . '/../..' . '/includes/class-gfmr-renderer.php',
    5552        'Wakalab\\WpGfmRenderer\\GFMR_SSR_Renderer' => __DIR__ . '/../..' . '/includes/class-gfmr-ssr-renderer.php',
Note: See TracChangeset for help on using the changeset viewer.