Plugin Directory

Changeset 3440458


Ignore:
Timestamp:
01/15/2026 03:08:41 PM (6 weeks ago)
Author:
pluxo
Message:

Release prep: 1.0.1 bug fixes (icon, markdown, cleanup)

Location:
pluxo-blueprint/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pluxo-blueprint/trunk/includes/class-pluxo-blueprint.php

    r3440360 r3440458  
    213213        exit;
    214214    }
     215   
     216    /**
     217     * Sanitize a value for safe use inside a Markdown table cell.
     218     *
     219     * Confluence and some Markdown parsers may not respect backslash-escaped pipes,
     220     * so we replace literal pipes with an HTML entity.
     221     *
     222     * @param mixed $value Cell value.
     223     * @return string
     224     */
     225    private function sanitize_markdown_cell( $value ) {
     226        // Normalise to string.
     227        if ( is_bool( $value ) ) {
     228            $value = $value ? 'true' : 'false';
     229        } elseif ( is_array( $value ) || is_object( $value ) ) {
     230            $value = wp_json_encode( $value );
     231        }
     232
     233        $value = (string) $value;
     234
     235        // Replace pipes with HTML entity to avoid breaking table columns.
     236        $value = str_replace( '|', '|', $value );
     237
     238        // Replace newlines/tabs with spaces (tables don't like them).
     239        $value = preg_replace( '/\r\n|\r|\n|\t/', ' ', $value );
     240
     241        // Trim excessive whitespace.
     242        $value = trim( preg_replace( '/\s+/', ' ', $value ) );
     243
     244        return $value;
     245    }
    215246
    216247    /**
     
    290321                }
    291322
    292                 $value = (string) $value;
    293 
    294                 // Escape pipes to avoid breaking the table.
    295                 $value = str_replace( '|', '\|', $value );
    296 
    297                 // Replace newlines with spaces (Markdown table cells do not like raw newlines).
    298                 $value = preg_replace( '/\r\n|\r|\n/', ' ', $value );
    299 
    300                 $row_values[] = $value;
     323                $row_values[] = $this->sanitize_markdown_cell( $value );
     324               
    301325            }
    302326
     
    470494        ?>
    471495
    472         <?php
     496<?php
    473497        $logo_url = PLUXO_BLUEPRINT_PLUGIN_URL . 'assets/images/logo.png';
    474498        ?>
    475499
    476         <div class="wrap pluxo-blueprint-wrap">
    477             <div class="pluxo-blueprint-logo-wrapper">
    478                 <img
    479                     class="pluxo-blueprint-logo"
    480                     src="<?php echo esc_url( $logo_url ); ?>"
    481                     alt="<?php esc_attr_e( 'Pluxo Blueprint logo', 'pluxo-blueprint' ); ?>"
    482                 >
    483                 <div class="pluxo-blueprint-title">
    484                     <h1 class="wp-heading-inline">
    485                     <?php echo esc_html__( 'Pluxo Blueprint', 'pluxo-blueprint' ); ?>
    486                     </h1>
    487                     <p class="pluxo-blueprint-description">
    488                         <?php
     500<div class="wrap pluxo-blueprint-wrap">
     501    <div class="pluxo-blueprint-logo-wrapper">
     502        <img class="pluxo-blueprint-logo" src="<?php echo esc_url( $logo_url ); ?>" alt="<?php esc_attr_e( 'Pluxo Blueprint logo', 'pluxo-blueprint' ); ?>">
     503        <div class="pluxo-blueprint-title">
     504            <h1 class="wp-heading-inline">
     505                <?php echo esc_html__( 'Pluxo Blueprint', 'pluxo-blueprint' ); ?>
     506            </h1>
     507            <p class="pluxo-blueprint-description">
     508                <?php
    489509                        echo wp_kses_post(
    490510                            sprintf(
     
    499519                        );
    500520                        ?>
    501                     </p>
    502                 </div>
    503             </div>
    504             <div class="pluxo-blueprint-card">
    505                 <div class="pluxo-blueprint-card-header">
    506                     <h2><?php echo esc_html__( 'Export Settings', 'pluxo-blueprint' ); ?></h2><br>
    507                     <p><?php echo esc_html__( 'Select which columns should be available for export and display.', 'pluxo-blueprint' ); ?></p>
    508                 </div>
    509 
    510                 <div class="pluxo-blueprint-card-body">
    511                     <p class="description">
    512                     <?php echo esc_html__( 'Tick the boxes for the columns you want to keep in your exports. You can adjust these settings at any time and Pluxo Blueprint will remember your choices.', 'pluxo-blueprint' ); ?>
    513                     </p>
    514 
    515                     <form method="post">
    516                         <?php wp_nonce_field( 'pluxo_blueprint_save_columns', 'pluxo_blueprint_columns_nonce' ); ?>
    517 
    518                     <table class="form-table" role="presentation">
    519                         <tbody>
    520                             <tr>
    521                                 <th scope="row">
    522                                     <label><?php echo esc_html__( 'Columns to export', 'pluxo-blueprint' ); ?></label>
    523                                 </th>
    524                                 <td>
    525                                     <?php foreach ( $available_columns as $column_key => $column ) : ?>
    526                                         <?php
     521            </p>
     522        </div>
     523    </div>
     524    <div class="pluxo-blueprint-card">
     525        <div class="pluxo-blueprint-card-header">
     526            <h2><?php echo esc_html__( 'Export Settings', 'pluxo-blueprint' ); ?></h2><br>
     527            <p><?php echo esc_html__( 'Select which columns should be available for export and display.', 'pluxo-blueprint' ); ?></p>
     528        </div>
     529
     530        <div class="pluxo-blueprint-card-body">
     531            <p class="description">
     532                <?php echo esc_html__( 'Tick the boxes for the columns you want to keep in your exports. You can adjust these settings at any time and Pluxo Blueprint will remember your choices.', 'pluxo-blueprint' ); ?>
     533            </p>
     534
     535            <form method="post">
     536                <?php wp_nonce_field( 'pluxo_blueprint_save_columns', 'pluxo_blueprint_columns_nonce' ); ?>
     537
     538                <table class="form-table" role="presentation">
     539                    <tbody>
     540                        <tr>
     541                            <th scope="row">
     542                                <label><?php echo esc_html__( 'Columns to export', 'pluxo-blueprint' ); ?></label>
     543                            </th>
     544                            <td>
     545                                <?php foreach ( $available_columns as $column_key => $column ) : ?>
     546                                <?php
    527547                                        $is_required = ( 'name' === $column_key );
    528548                                        $is_checked  = in_array( $column_key, $selected_columns, true );
    529549                                        ?>
    530550
    531                                         <?php if ( $is_required ) : ?>
    532                                             <!-- Hidden input to ensure the "name" column is always submitted -->
    533                                             <input type="hidden" name="pluxo_blueprint_columns[]" value="name" />
    534                                         <?php endif; ?>
    535 
    536                                         <label class="pluxo-blueprint-column-option">
    537                                             <input
    538                                                 type="checkbox"
    539                                                 name="pluxo_blueprint_columns[]"
    540                                                 value="<?php echo esc_attr( $column_key ); ?>"
    541                                                 <?php checked( $is_checked ); ?>
    542                                                 <?php disabled( $is_required ); ?>
    543                                             />
    544                                             <?php echo esc_html( $column['label'] ); ?>
    545                                         </label>
    546                                     <?php endforeach; ?>
    547                                 </td>
    548                             </tr>
    549                         </tbody>
    550                     </table>
    551                        
    552                         <p>
    553                             <button type="submit" name="pluxo_blueprint_save_columns" class="button button-primary">
    554                                 <?php echo esc_html__( 'Refresh plugins table below', 'pluxo-blueprint' ); ?>
    555                             </button>
    556                         </p>
    557                     </form>
    558                 </div>
    559             </div>
    560 
    561                 <div class="pluxo-blueprint-card">
    562                     <div class="pluxo-blueprint-card-header">
    563                         <h2><?php esc_html_e( 'Installed Plugins', 'pluxo-blueprint' ); ?></h2><br>
    564                         <p><?php esc_html_e( 'Review the detected plugins and export them as CSV, JSON or Markdown.', 'pluxo-blueprint' ); ?></p><br>
    565                         <p class="description">
    566                             <?php echo esc_html__( 'Choose the format that best fits your workflow:', 'pluxo-blueprint' ); ?>
    567                         </p>
    568                         <ul class="pluxo-blueprint-help-list pluxo-blueprint-help-list--compact">
    569                             <li>
    570                                 <strong><?php echo esc_html__( 'CSV', 'pluxo-blueprint' ); ?></strong>
    571                                 <?php echo esc_html__( '– Ideal for spreadsheets or importing into other tools.', 'pluxo-blueprint' ); ?>
    572                             </li>
    573                             <li>
    574                                 <strong><?php echo esc_html__( 'JSON', 'pluxo-blueprint' ); ?></strong>
    575                                 <?php echo esc_html__( '– Good for developers and automation workflows.', 'pluxo-blueprint' ); ?>
    576                             </li>
    577                             <li>
    578                                 <strong><?php echo esc_html__( 'Markdown', 'pluxo-blueprint' ); ?></strong>
    579                                 <?php echo esc_html__( '– Perfect for documentation, tickets or README files.', 'pluxo-blueprint' ); ?>
    580                             </li>
    581                         </ul>
    582                     </div>
    583 
    584                     <div class="pluxo-blueprint-card-body">
    585                         <div class="pluxo-blueprint-actions">
    586                             <form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
    587                                 <?php
     551                                <?php if ( $is_required ) : ?>
     552                                <!-- Hidden input to ensure the "name" column is always submitted -->
     553                                <input type="hidden" name="pluxo_blueprint_columns[]" value="name" />
     554                                <?php endif; ?>
     555
     556                                <label class="pluxo-blueprint-column-option">
     557                                    <input type="checkbox" name="pluxo_blueprint_columns[]" value="<?php echo esc_attr( $column_key ); ?>" <?php checked( $is_checked ); ?> <?php disabled( $is_required ); ?> />
     558                                    <?php echo esc_html( $column['label'] ); ?>
     559                                </label>
     560                                <?php endforeach; ?>
     561                            </td>
     562                        </tr>
     563                    </tbody>
     564                </table>
     565
     566                <p>
     567                    <button type="submit" name="pluxo_blueprint_save_columns" class="button button-primary">
     568                        <?php echo esc_html__( 'Refresh plugins table below', 'pluxo-blueprint' ); ?>
     569                    </button>
     570                </p>
     571            </form>
     572        </div>
     573    </div>
     574
     575    <div class="pluxo-blueprint-card">
     576        <div class="pluxo-blueprint-card-header">
     577            <h2><?php esc_html_e( 'Installed Plugins', 'pluxo-blueprint' ); ?></h2><br>
     578            <p><?php esc_html_e( 'Review the detected plugins and export them as CSV, JSON or Markdown.', 'pluxo-blueprint' ); ?></p><br>
     579            <p class="description">
     580                <?php echo esc_html__( 'Choose the format that best fits your workflow:', 'pluxo-blueprint' ); ?>
     581            </p>
     582            <ul class="pluxo-blueprint-help-list pluxo-blueprint-help-list--compact">
     583                <li>
     584                    <strong><?php echo esc_html__( 'CSV', 'pluxo-blueprint' ); ?></strong>
     585                    <?php echo esc_html__( '– Ideal for spreadsheets or importing into other tools.', 'pluxo-blueprint' ); ?>
     586                </li>
     587                <li>
     588                    <strong><?php echo esc_html__( 'JSON', 'pluxo-blueprint' ); ?></strong>
     589                    <?php echo esc_html__( '– Good for developers and automation workflows.', 'pluxo-blueprint' ); ?>
     590                </li>
     591                <li>
     592                    <strong><?php echo esc_html__( 'Markdown', 'pluxo-blueprint' ); ?></strong>
     593                    <?php echo esc_html__( '– Perfect for documentation, tickets or README files.', 'pluxo-blueprint' ); ?>
     594                </li>
     595            </ul>
     596        </div>
     597
     598        <div class="pluxo-blueprint-card-body">
     599            <div class="pluxo-blueprint-actions">
     600                <form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
     601                    <?php
    588602                                wp_nonce_field( 'pluxo_blueprint_export_csv', 'pluxo_blueprint_export_csv_nonce' );
    589603                                ?>
    590                                 <input type="hidden" name="action" value="pluxo_blueprint_export_csv" />
    591                                 <?php submit_button( __( 'Export CSV', 'pluxo-blueprint' ), 'secondary', 'pluxo_blueprint_export_csv_button', false ); ?>
    592                             </form>
    593 
    594                             <form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
    595                                 <?php wp_nonce_field( 'pluxo_blueprint_export_json', 'pluxo_blueprint_export_json_nonce' ); ?>
    596                                 <input type="hidden" name="action" value="pluxo_blueprint_export_json" />
    597                                 <?php submit_button( __( 'Export JSON', 'pluxo-blueprint' ), 'secondary', 'pluxo_blueprint_export_json_button', false ); ?>
    598                             </form>
    599 
    600                             <form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
    601                                 <?php wp_nonce_field( 'pluxo_blueprint_export_markdown', 'pluxo_blueprint_export_markdown_nonce' ); ?>
    602                                 <input type="hidden" name="action" value="pluxo_blueprint_export_markdown" />
    603                                 <?php submit_button( __( 'Export Markdown', 'pluxo-blueprint' ), 'secondary', 'pluxo_blueprint_export_markdown_button', false ); ?>
    604                             </form>
    605                         </div><br>
    606 
    607                         <table class="widefat fixed striped pluxo-blueprint-table">
    608                             <thead>
    609                                 <tr>
    610                                     <?php foreach ( $selected_columns as $column_key ) : ?>
    611                                         <th scope="col">
    612                                             <?php
     604                    <input type="hidden" name="action" value="pluxo_blueprint_export_csv" />
     605                    <?php submit_button( __( 'Export CSV', 'pluxo-blueprint' ), 'secondary', 'pluxo_blueprint_export_csv_button', false ); ?>
     606                </form>
     607
     608                <form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
     609                    <?php wp_nonce_field( 'pluxo_blueprint_export_json', 'pluxo_blueprint_export_json_nonce' ); ?>
     610                    <input type="hidden" name="action" value="pluxo_blueprint_export_json" />
     611                    <?php submit_button( __( 'Export JSON', 'pluxo-blueprint' ), 'secondary', 'pluxo_blueprint_export_json_button', false ); ?>
     612                </form>
     613
     614                <form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
     615                    <?php wp_nonce_field( 'pluxo_blueprint_export_markdown', 'pluxo_blueprint_export_markdown_nonce' ); ?>
     616                    <input type="hidden" name="action" value="pluxo_blueprint_export_markdown" />
     617                    <?php submit_button( __( 'Export Markdown', 'pluxo-blueprint' ), 'secondary', 'pluxo_blueprint_export_markdown_button', false ); ?>
     618                </form>
     619            </div><br>
     620
     621            <table class="widefat fixed striped pluxo-blueprint-table">
     622                <thead>
     623                    <tr>
     624                        <?php foreach ( $selected_columns as $column_key ) : ?>
     625                        <th scope="col">
     626                            <?php
    613627                                            if ( isset( $available_columns[ $column_key ]['label'] ) ) {
    614628                                                echo esc_html( $available_columns[ $column_key ]['label'] );
     
    617631                                            }
    618632                                            ?>
    619                                         </th>
    620                                     <?php endforeach; ?>
    621                                 </tr>
    622                             </thead>
    623                             <tbody>
    624                                 <?php if ( empty( $inventory ) ) : ?>
    625                                     <tr>
    626                                         <td colspan="<?php echo esc_attr( max( 1, count( $selected_columns ) ) ); ?>">
    627                                             <?php echo esc_html__( 'No plugins found.', 'pluxo-blueprint' ); ?>
    628                                         </td>
    629                                     </tr>
    630                                 <?php else : ?>
    631                                     <?php foreach ( $inventory as $plugin ) : ?>
    632                                         <tr>
    633                                             <?php foreach ( $selected_columns as $column_key ) : ?>
    634                                                 <td>
    635                                                     <?php
     633                        </th>
     634                        <?php endforeach; ?>
     635                    </tr>
     636                </thead>
     637                <tbody>
     638                    <?php if ( empty( $inventory ) ) : ?>
     639                    <tr>
     640                        <td colspan="<?php echo esc_attr( max( 1, count( $selected_columns ) ) ); ?>">
     641                            <?php echo esc_html__( 'No plugins found.', 'pluxo-blueprint' ); ?>
     642                        </td>
     643                    </tr>
     644                    <?php else : ?>
     645                    <?php foreach ( $inventory as $plugin ) : ?>
     646                    <tr>
     647                        <?php foreach ( $selected_columns as $column_key ) : ?>
     648                        <td>
     649                            <?php
    636650                                                    switch ( $column_key ) {
    637651                                                        case 'name':
     
    665679                                                    }
    666680                                                    ?>
    667                                                 </td>
    668                                             <?php endforeach; ?>
    669                                         </tr>
    670                                     <?php endforeach; ?>
    671                                 <?php endif; ?>
    672                             </tbody>
    673                         </table>
    674                     </div>
    675                 </div>
    676             <div class="pluxo-blueprint-footer">
    677                 <p>
    678                     <?php esc_html_e( 'Made by', 'pluxo-blueprint' ); ?>
    679                     <a href="https://pluxo.dev/" target="_blank" rel="noopener noreferrer"><strong>Pluxo</strong></a>
    680                 </p>
    681             </div>
    682         </div>
    683         <?php
     681                        </td>
     682                        <?php endforeach; ?>
     683                    </tr>
     684                    <?php endforeach; ?>
     685                    <?php endif; ?>
     686                </tbody>
     687            </table>
     688        </div>
     689    </div>
     690    <div class="pluxo-blueprint-footer">
     691        <p>
     692            <?php esc_html_e( 'Made by', 'pluxo-blueprint' ); ?>
     693            <a href="https://pluxo.dev/" target="_blank" rel="noopener noreferrer"><strong>Pluxo</strong></a>
     694        </p>
     695    </div>
     696</div>
     697<?php
    684698    }
    685699
  • pluxo-blueprint/trunk/pluxo-blueprint.php

    r3440360 r3440458  
    44 * Plugin URI:        https://pluxo.dev/#pluxo-blueprint
    55 * Description:       Document and export your WordPress plugin inventory to CSV, JSON, or Markdown.
    6  * Version:           1.0.0
     6 * Version:           1.0.1
    77 * Requires at least: 6.0
    88 * Requires PHP:      7.4
     
    4242}
    4343
    44 /**
    45  * Customise the plugin row meta links (under the plugin description).
    46  *
    47  * Replace the default "Visit plugin site" link with a "View details" modal.
    48  *
    49  * @param string[] $links Existing meta links.
    50  * @param string   $file  Plugin file.
    51  * @return string[] Modified meta links.
    52  */
    53 function pluxo_blueprint_plugin_row_meta( $links, $file ) {
    54     if ( plugin_basename( __FILE__ ) !== $file ) {
    55         return $links;
    56     }
    57 
    58     // URL for the WordPress.org plugin details modal.
    59     // This assumes the plugin slug on WordPress.org will be "pluxo-blueprint".
    60     $details_url = network_admin_url(
    61         'plugin-install.php?tab=plugin-information&plugin=pluxo-blueprint&TB_iframe=true&width=600&height=550'
    62     );
    63 
    64     $details_link = sprintf(
    65         '<a href="%1$s" class="thickbox open-plugin-details-modal">%2$s</a>',
    66         esc_url( $details_url ),
    67         esc_html__( 'View details', 'pluxo-blueprint' )
    68     );
    69 
    70     // Append our "View details" link at the end, like Jetpack.
    71     $links[] = $details_link;
    72 
    73     return $links;
    74 }
    75 add_filter( 'plugin_row_meta', 'pluxo_blueprint_plugin_row_meta', 10, 2 );
    76 
    7744add_filter(
    7845    'plugin_action_links_' . plugin_basename( __FILE__ ),
     
    9663
    9764if ( ! defined( 'PLUXO_BLUEPRINT_VERSION' ) ) {
    98     define( 'PLUXO_BLUEPRINT_VERSION', '1.0.0' );
     65    define( 'PLUXO_BLUEPRINT_VERSION', '1.0.1' );
    9966}
    10067
  • pluxo-blueprint/trunk/readme.txt

    r3440360 r3440458  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 1.0.0
     7Stable tag: 1.0.1
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    3636
    3737== Changelog ==
     38= 1.0.1 =
     39* Fix: Admin menu icon now displays correctly on WordPress.org installs.
     40* Fix: Markdown export now safely handles pipe characters (|) for Confluence compatibility.
     41* Remove: Custom plugin row meta to prevent duplicate "View details" links.
     42
    3843= 1.0.0 =
    3944* Initial release
    4045
    4146== Upgrade Notice ==
    42 = 1.0.0 =
    43 Initial release.
     47= 1.0.1 =
     48Maintenance update with bug fixes and improved Markdown export compatibility.
Note: See TracChangeset for help on using the changeset viewer.