Plugin Directory

Changeset 2748759 for anrghg


Ignore:
Timestamp:
06/27/2022 09:40:47 PM (4 years ago)
Author:
anrghg
Message:

1.2.0.0

1.2.0 (2022-06-27)

  • Import: Templates: Clarify the interface.
  • Import: Custom: Check if provided option name does exist.
  • Import: Fix bug in exit statement display.
Location:
anrghg
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • anrghg/tags/1.2.0/admin/anrghg-admin.php

    r2748691 r2748759  
    22982298                }
    22992299
     2300                h3 {
     2301                    margin: 10px 2px;
     2302                    padding-top: 10px;
     2303                    font-size: 20px;
     2304                    line-height: 1em;
     2305                    z-index: 99;
     2306                }
     2307
     2308                h3.border {
     2309                    border-top: 1px solid #006EBF;
     2310                }
     2311
    23002312                .info p {
    23012313                    margin-left: 32px;
    23022314                    margin-right: 32px;
     2315                    font-size: 14px;
     2316                    font-style: italic;
     2317                    font-weight: bold;
    23032318                }
    23042319
     
    23582373
    23592374    /**
    2360      * Import form for templates.
     2375     * Import form for adding templates.
    23612376     */
    2362     $l_s_output  = '<div class="h2"><h2>' . __( 'Templates' ) . '</h2></div>';
     2377    $l_s_output  = '<div class="h2"><h2>' . __( 'Templates', 'anrghg' ) . _x( ' — ', 'Space-padded em dash', 'anrghg' ) . __( 'Add new ones', 'anrghg' ) . '</h2></div>';
    23632378    $l_s_output .= '<div class="info">';
    23642379    $l_s_output .= '<p>';
    23652380    $l_s_output .= __( 'Importing a templates file will add the new templates to the existing templates.', 'anrghg' ) . ' ';
    23662381    $l_s_output .= __( 'Only valid template files can be imported.', 'anrghg' ) . ' ';
    2367     $l_s_output .= __( 'Non-conformant or empty files will be rejected.', 'anrghg' ) . ' ';
     2382    $l_s_output .= __( 'Non-conformant or empty files will be dismissed.', 'anrghg' ) . ' ';
    23682383    $l_s_output .= '</p>';
    23692384    $l_s_output .= '<p>';
    23702385    $l_s_output .= __( 'To add templates in bulk, please fill a file with the new templates in JSON format following the same scheme, and import.', 'anrghg' ) . ' ';
    2371     $l_s_output .= __( 'ASCII double quotes in the content must be escaped with a backslash.', 'anrghg' ) . ' ';
     2386    $l_s_output .= __( 'ASCII double quotes that are not part of JSON must be escaped with a leading backslash.', 'anrghg' ) . ' ';
    23722387    $l_s_output .= __( 'The JSON format prohibits trailing commas.', 'anrghg' ) . ' ';
    23732388    $l_s_output .= '</p>';
     
    23772392    anrghg_import_form( 'import_templates', __( 'Import' ) );
    23782393
    2379     $l_s_output  = '<div class="info">';
     2394    /**
     2395     * Import form for overwriting templates.
     2396     */
     2397    $l_s_output  = '<div class="h2"><h2>' . __( 'Templates', 'anrghg' ) . _x( ' — ', 'Space-padded em dash', 'anrghg' ) . __( 'Change existing', 'anrghg' ) . '</h2></div>';
     2398    $l_s_output .= '<div class="info">';
    23802399    $l_s_output .= '<p>';
    23812400    // Translators: %1$s: link start tag to the import page; %2$s: link end tag.
     
    24952514        if ( ! isset( $_FILES['import_file']['tmp_name'] ) || empty( $l_o_import_file ) ) {
    24962515            wp_die(
    2497                 wp_kses( __( 'There is no file. Please choose the desired file.', 'anrghg' ) ),
     2516                anrghg_kses( __( 'There is no file. Please choose the desired file.', 'anrghg' ) ),
    24982517                '',
    24992518                array(
     
    25042523
    25052524        // Retrieve the data from the file and convert the json object to an array.
    2506         $l_a_data = (array) json_decode( wp_remote_get( $l_o_import_file ) );
     2525        // Cannot use wp_remote_get() here.
     2526        // phpcs:ignore
     2527        $l_a_data = (array) json_decode( file_get_contents( $l_o_import_file ) );
    25072528
    25082529        if ( 'import_settings' === sanitize_key( $_POST['anrghg_action'] ) ) {
     
    25122533            if ( isset( $_POST['option'] ) ) {
    25132534                $l_s_name = sanitize_text_field( sanitize_key( $_POST['option'] ) );
     2535                $l_a_all  = wp_load_alloptions();
     2536                if ( ! is_array( $l_a_all ) || ! array_key_exists( $l_s_name, $l_a_all ) ) {
     2537                    wp_die(
     2538                        anrghg_kses( __( 'Cannot find the specified option; importing its data is not possible.', 'anrghg' ) ),
     2539                        '',
     2540                        array(
     2541                            'back_link' => true,
     2542                        )
     2543                    );
     2544                }
    25142545            } else {
    25152546                wp_die(
    2516                     wp_kses( __( 'The option name needs to be specified.', 'anrghg' ) ),
     2547                    anrghg_kses( __( 'The option name needs to be specified.', 'anrghg' ) ),
    25172548                    '',
    25182549                    array(
     
    25322563                $l_s_output .= __( 'If it does match, then it may contain trailing commas, prohibited in JSON.', 'anrghg' );
    25332564                wp_die(
    2534                     wp_kses(
     2565                    anrghg_kses(
    25352566                        $l_s_output,
    25362567                        array( 'br' => true )
  • anrghg/tags/1.2.0/includes/helpers.php

    r2748691 r2748759  
    9090
    9191/**
    92  * Escapes and echoes outside Settings and Post Meta box.
     92 * Escapes and echoes also outside Settings and Post Meta box.
    9393 *
    9494 * @since 0.81.5
     
    108108        anrghg_get_public_whitelist()
    109109    );
     110}
     111
     112/**
     113 * Escapes and returns also outside Settings and Post Meta box.
     114 *
     115 * @since 1.1.2
     116 * @param  string $p_s_output HTML.
     117 * @return string $l_s_output HTML.
     118 */
     119function anrghg_kses( $p_s_output ) {
     120    $l_s_output = wp_kses(
     121        $p_s_output,
     122        anrghg_get_public_whitelist()
     123    );
     124    return $l_s_output;
    110125}
    111126
  • anrghg/tags/1.2.0/readme.txt

    r2748691 r2748759  
    3737
    3838* Protect your WordPress websites against password leak effectiveness, by deactivating the login dialog depending on the value of a constant in `wp-config.php`;
    39 * Allow to configure that constant so that in multisite networks, individual sites may be toggled independently;
    40 * Make authentication cookies then last longer for a configurable period of time, e.g. until the day after the next scheduled login rush.
     39* Make that constant configurable so that in multisite networks, individual sites may be toggled independently;
     40* Extend authentication cookie lifespans to a configurable period of time, e.g. until the day after the next scheduled login rush.
    4141* Blank the login dialog out permanently if it is convenient to access the WordPress Admin area through the hosting platform exclusively.
    4242
    4343
    44 = Thank You message =
    45 
    46 * Display a configurable message after your posts, and optionally another message at the bottom of your pages;
    47 * Activate, deactivate and configure the display of a message in the post editor Meta box;
    48 * Configure standard messages in rich text in the Template editor and insert them by their name;
    49 * Configure in rich text and position one or more messages in the Block editor, using the ‘Thank You message’ block.
     44= Thank You messages =
     45
     46* Display a configurable message after your posts, and optionally another one at the bottom of your pages;
     47* Display a message depending on activation, deactivation and configuration in the post editor Meta box;
     48* Help with configuring rich text messages in the Template editor;
     49* Provide a block to configure messages right in your posts and pages.
    5050
    5151
     
    505505== Changelog ==
    506506
     507= 1.2.0 (2022-06-27) =
     508
     509* Import: Templates: Clarify the interface.
     510* Import: Custom: Check if provided option name does exist.
     511* Import: Fix bug in exit statement display.
     512
    507513= 1.1.1 (2022-06-27) =
    508514
  • anrghg/tags/1.2.0/svn-revs.txt

    r2748691 r2748759  
    1111Previous revisions:
    1212
     131.1.1.0        2748691  2022-06-27 18:48:00 +0000 (Mon, 27 Jun 2022)
    13141.1.0.0        2747832  2022-06-25 03:03:42 +0000 (Sat, 25 Jun 2022)
    14151.0.4.0        2747340  2022-06-23 23:31:07 +0000 (Thu, 23 Jun 2022)
  • anrghg/trunk/admin/anrghg-admin.php

    r2748691 r2748759  
    22982298                }
    22992299
     2300                h3 {
     2301                    margin: 10px 2px;
     2302                    padding-top: 10px;
     2303                    font-size: 20px;
     2304                    line-height: 1em;
     2305                    z-index: 99;
     2306                }
     2307
     2308                h3.border {
     2309                    border-top: 1px solid #006EBF;
     2310                }
     2311
    23002312                .info p {
    23012313                    margin-left: 32px;
    23022314                    margin-right: 32px;
     2315                    font-size: 14px;
     2316                    font-style: italic;
     2317                    font-weight: bold;
    23032318                }
    23042319
     
    23582373
    23592374    /**
    2360      * Import form for templates.
     2375     * Import form for adding templates.
    23612376     */
    2362     $l_s_output  = '<div class="h2"><h2>' . __( 'Templates' ) . '</h2></div>';
     2377    $l_s_output  = '<div class="h2"><h2>' . __( 'Templates', 'anrghg' ) . _x( ' — ', 'Space-padded em dash', 'anrghg' ) . __( 'Add new ones', 'anrghg' ) . '</h2></div>';
    23632378    $l_s_output .= '<div class="info">';
    23642379    $l_s_output .= '<p>';
    23652380    $l_s_output .= __( 'Importing a templates file will add the new templates to the existing templates.', 'anrghg' ) . ' ';
    23662381    $l_s_output .= __( 'Only valid template files can be imported.', 'anrghg' ) . ' ';
    2367     $l_s_output .= __( 'Non-conformant or empty files will be rejected.', 'anrghg' ) . ' ';
     2382    $l_s_output .= __( 'Non-conformant or empty files will be dismissed.', 'anrghg' ) . ' ';
    23682383    $l_s_output .= '</p>';
    23692384    $l_s_output .= '<p>';
    23702385    $l_s_output .= __( 'To add templates in bulk, please fill a file with the new templates in JSON format following the same scheme, and import.', 'anrghg' ) . ' ';
    2371     $l_s_output .= __( 'ASCII double quotes in the content must be escaped with a backslash.', 'anrghg' ) . ' ';
     2386    $l_s_output .= __( 'ASCII double quotes that are not part of JSON must be escaped with a leading backslash.', 'anrghg' ) . ' ';
    23722387    $l_s_output .= __( 'The JSON format prohibits trailing commas.', 'anrghg' ) . ' ';
    23732388    $l_s_output .= '</p>';
     
    23772392    anrghg_import_form( 'import_templates', __( 'Import' ) );
    23782393
    2379     $l_s_output  = '<div class="info">';
     2394    /**
     2395     * Import form for overwriting templates.
     2396     */
     2397    $l_s_output  = '<div class="h2"><h2>' . __( 'Templates', 'anrghg' ) . _x( ' — ', 'Space-padded em dash', 'anrghg' ) . __( 'Change existing', 'anrghg' ) . '</h2></div>';
     2398    $l_s_output .= '<div class="info">';
    23802399    $l_s_output .= '<p>';
    23812400    // Translators: %1$s: link start tag to the import page; %2$s: link end tag.
     
    24952514        if ( ! isset( $_FILES['import_file']['tmp_name'] ) || empty( $l_o_import_file ) ) {
    24962515            wp_die(
    2497                 wp_kses( __( 'There is no file. Please choose the desired file.', 'anrghg' ) ),
     2516                anrghg_kses( __( 'There is no file. Please choose the desired file.', 'anrghg' ) ),
    24982517                '',
    24992518                array(
     
    25042523
    25052524        // Retrieve the data from the file and convert the json object to an array.
    2506         $l_a_data = (array) json_decode( wp_remote_get( $l_o_import_file ) );
     2525        // Cannot use wp_remote_get() here.
     2526        // phpcs:ignore
     2527        $l_a_data = (array) json_decode( file_get_contents( $l_o_import_file ) );
    25072528
    25082529        if ( 'import_settings' === sanitize_key( $_POST['anrghg_action'] ) ) {
     
    25122533            if ( isset( $_POST['option'] ) ) {
    25132534                $l_s_name = sanitize_text_field( sanitize_key( $_POST['option'] ) );
     2535                $l_a_all  = wp_load_alloptions();
     2536                if ( ! is_array( $l_a_all ) || ! array_key_exists( $l_s_name, $l_a_all ) ) {
     2537                    wp_die(
     2538                        anrghg_kses( __( 'Cannot find the specified option; importing its data is not possible.', 'anrghg' ) ),
     2539                        '',
     2540                        array(
     2541                            'back_link' => true,
     2542                        )
     2543                    );
     2544                }
    25142545            } else {
    25152546                wp_die(
    2516                     wp_kses( __( 'The option name needs to be specified.', 'anrghg' ) ),
     2547                    anrghg_kses( __( 'The option name needs to be specified.', 'anrghg' ) ),
    25172548                    '',
    25182549                    array(
     
    25322563                $l_s_output .= __( 'If it does match, then it may contain trailing commas, prohibited in JSON.', 'anrghg' );
    25332564                wp_die(
    2534                     wp_kses(
     2565                    anrghg_kses(
    25352566                        $l_s_output,
    25362567                        array( 'br' => true )
  • anrghg/trunk/includes/helpers.php

    r2748691 r2748759  
    9090
    9191/**
    92  * Escapes and echoes outside Settings and Post Meta box.
     92 * Escapes and echoes also outside Settings and Post Meta box.
    9393 *
    9494 * @since 0.81.5
     
    108108        anrghg_get_public_whitelist()
    109109    );
     110}
     111
     112/**
     113 * Escapes and returns also outside Settings and Post Meta box.
     114 *
     115 * @since 1.1.2
     116 * @param  string $p_s_output HTML.
     117 * @return string $l_s_output HTML.
     118 */
     119function anrghg_kses( $p_s_output ) {
     120    $l_s_output = wp_kses(
     121        $p_s_output,
     122        anrghg_get_public_whitelist()
     123    );
     124    return $l_s_output;
    110125}
    111126
  • anrghg/trunk/readme.txt

    r2748691 r2748759  
    3737
    3838* Protect your WordPress websites against password leak effectiveness, by deactivating the login dialog depending on the value of a constant in `wp-config.php`;
    39 * Allow to configure that constant so that in multisite networks, individual sites may be toggled independently;
    40 * Make authentication cookies then last longer for a configurable period of time, e.g. until the day after the next scheduled login rush.
     39* Make that constant configurable so that in multisite networks, individual sites may be toggled independently;
     40* Extend authentication cookie lifespans to a configurable period of time, e.g. until the day after the next scheduled login rush.
    4141* Blank the login dialog out permanently if it is convenient to access the WordPress Admin area through the hosting platform exclusively.
    4242
    4343
    44 = Thank You message =
    45 
    46 * Display a configurable message after your posts, and optionally another message at the bottom of your pages;
    47 * Activate, deactivate and configure the display of a message in the post editor Meta box;
    48 * Configure standard messages in rich text in the Template editor and insert them by their name;
    49 * Configure in rich text and position one or more messages in the Block editor, using the ‘Thank You message’ block.
     44= Thank You messages =
     45
     46* Display a configurable message after your posts, and optionally another one at the bottom of your pages;
     47* Display a message depending on activation, deactivation and configuration in the post editor Meta box;
     48* Help with configuring rich text messages in the Template editor;
     49* Provide a block to configure messages right in your posts and pages.
    5050
    5151
     
    505505== Changelog ==
    506506
     507= 1.2.0 (2022-06-27) =
     508
     509* Import: Templates: Clarify the interface.
     510* Import: Custom: Check if provided option name does exist.
     511* Import: Fix bug in exit statement display.
     512
    507513= 1.1.1 (2022-06-27) =
    508514
  • anrghg/trunk/svn-revs.txt

    r2748691 r2748759  
    1111Previous revisions:
    1212
     131.1.1.0        2748691  2022-06-27 18:48:00 +0000 (Mon, 27 Jun 2022)
    13141.1.0.0        2747832  2022-06-25 03:03:42 +0000 (Sat, 25 Jun 2022)
    14151.0.4.0        2747340  2022-06-23 23:31:07 +0000 (Thu, 23 Jun 2022)
Note: See TracChangeset for help on using the changeset viewer.