Plugin Directory

Changeset 3451226


Ignore:
Timestamp:
02/01/2026 04:48:40 AM (3 weeks ago)
Author:
anand_kumar
Message:

fix: Resolve script saving and CodeMirror rendering issues, improve English copy, and add Hindi translation support.

Location:
header-and-footer-scripts/trunk
Files:
5 added
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • header-and-footer-scripts/trunk/inc/meta.php

    r3444257 r3451226  
    1616 <div class="jamify_hfs_meta_control">
    1717
    18     <p><?php esc_html_e('The script in the following textbox will be inserted to the &lt;head&gt; section', 'header-and-footer-scripts'); ?>.</p>
     18    <p><?php esc_html_e('The code below will be inserted into the &lt;head&gt; section of this specific page/post.', 'header-and-footer-scripts'); ?></p>
    1919    <p>
    2020        <textarea id="jamify_hfs_inpost_head_script" name="_inpost_head_script[synth_header_script]" rows="5" style="width:98%;font-family:monospace;"><?php if(!empty($meta['synth_header_script'])) echo esc_textarea( $meta['synth_header_script'] ); ?></textarea>
  • header-and-footer-scripts/trunk/inc/options.php

    r3444257 r3451226  
    2626            <?php settings_fields( 'header-and-footer-scripts' ); ?>
    2727
    28             <h3 class="shfs-labels"><?php esc_html_e( 'Who can insert scripts?', 'header-and-footer-scripts'); ?></h3>
    29             <p><?php esc_html_e( 'By default, only Administrators can add scripts. You can grant this ability to other roles below.', 'header-and-footer-scripts'); ?></p>
     28            <h3 class="shfs-labels"><?php esc_html_e( 'Permissions', 'header-and-footer-scripts'); ?></h3>
     29            <p><?php esc_html_e( 'By default, only Administrators can add scripts. Use the options below to grant access to other roles.', 'header-and-footer-scripts'); ?></p>
    3030           
    3131            <fieldset>
    3232                <label for="jamify_hfs_allow_author">
    3333                    <input type="checkbox" name="jamify_hfs_allow_author" id="jamify_hfs_allow_author" value="yes" <?php checked( 'yes', get_option( 'jamify_hfs_allow_author' ) ); ?>>
    34                     <?php esc_html_e( 'Allow Authors to add scripts (Grants unfiltered_html capability)', 'header-and-footer-scripts'); ?>
     34                    <?php esc_html_e( 'Allow Authors to add scripts', 'header-and-footer-scripts'); ?>
    3535                </label>
    3636                <br>
    3737                <label for="jamify_hfs_allow_contributor">
    3838                    <input type="checkbox" name="jamify_hfs_allow_contributor" id="jamify_hfs_allow_contributor" value="yes" <?php checked( 'yes', get_option( 'jamify_hfs_allow_contributor' ) ); ?>>
    39                     <?php esc_html_e( 'Allow Contributors to add scripts (Grants unfiltered_html capability)', 'header-and-footer-scripts'); ?>
     39                    <?php esc_html_e( 'Allow Contributors to add scripts', 'header-and-footer-scripts'); ?>
    4040                </label>
    4141            </fieldset>
    4242
    4343            <p class="description" style="color: #ea580c; font-weight: bold;">
    44                 <?php esc_html_e( 'Caution: Enabling these options grants the "unfiltered_html" capability, allowing users to execute arbitrary JavaScript on your site. Only enable for trusted users.', 'header-and-footer-scripts'); ?>
     44                <?php esc_html_e( 'Security Warning: Enabling these options grants the "unfiltered_html" capability. This allows users to execute arbitrary JavaScript. Only enable this for trusted users.', 'header-and-footer-scripts'); ?>
    4545            </p>
    4646            <hr />
    4747
    48             <h3 class="shfs-labels" for="jamify_hfs_insert_header"><?php esc_html_e( 'Scripts in header:', 'header-and-footer-scripts'); ?></h3>
    49             <p><?php esc_html_e( 'The following script, if any, will be inserted into the &lt;head&gt; section using wp_head hook.', 'header-and-footer-scripts'); ?></p>
     48            <h3 class="shfs-labels" for="jamify_hfs_insert_header"><?php esc_html_e( 'Head Scripts (&lt;head&gt;)', 'header-and-footer-scripts'); ?></h3>
     49            <p><?php esc_html_e( 'Scripts entered here will be output in the &lt;head&gt; section.', 'header-and-footer-scripts'); ?></p>
    5050            <textarea style="width:98%;font-family:monospace;" rows="10" cols="57" id="jamify_hfs_insert_header" name="jamify_hfs_insert_header"><?php echo esc_html( get_option( 'jamify_hfs_insert_header' ) ); ?></textarea>
    5151
     
    5353            <input type="number" value="<?php echo \esc_html( \get_option( 'jamify_hfs_insert_header_priority', 10 ) ); ?>" name="jamify_hfs_insert_header_priority" id="jamify_hfs_insert_header_priority" style="width:6em;" /> <?php \esc_html_e('Default', 'header-and-footer-scripts'); ?>: 10</p><hr />
    5454
    55             <h3 class="shfs-labels" for="jamify_hfs_insert_body"><?php esc_html_e( 'Scripts in body:', 'header-and-footer-scripts'); ?></h3>
    56             <p><?php esc_html_e( 'The following script, if any, will be inserted immediately after the &lt;body&gt; tag using wp_body_open hook.', 'header-and-footer-scripts'); ?></p>
     55            <h3 class="shfs-labels" for="jamify_hfs_insert_body"><?php esc_html_e( 'Body Scripts (After &lt;body&gt;)', 'header-and-footer-scripts'); ?></h3>
     56            <p><?php esc_html_e( 'Scripts entered here will be output immediately after the opening &lt;body&gt; tag.', 'header-and-footer-scripts'); ?></p>
    5757            <textarea style="width:98%;font-family:monospace;" rows="10" cols="57" id="jamify_hfs_insert_body" name="jamify_hfs_insert_body"><?php echo esc_html( get_option( 'jamify_hfs_insert_body' ) ); ?></textarea>
    5858
     
    6060            <input type="number" value="<?php echo \esc_html( \get_option( 'jamify_hfs_insert_body_priority', 10 ) ); ?>" name="jamify_hfs_insert_body_priority" id="jamify_hfs_insert_body_priority" style="width:6em;" /> <?php \esc_html_e('Default', 'header-and-footer-scripts'); ?>: 10</p><hr />
    6161
    62             <h3 class="shfs-labels footerlabel" for="jamify_hfs_insert_footer"><?php esc_html_e( 'Scripts in footer:', 'header-and-footer-scripts'); ?></h3>
    63             <p><?php esc_html_e( 'The following script, if any, will be inserted before &lt;/body&gt; tag using wp_footer hook.', 'header-and-footer-scripts'); ?></p>
     62            <h3 class="shfs-labels footerlabel" for="jamify_hfs_insert_footer"><?php esc_html_e( 'Footer Scripts (Before &lt;/body&gt;)', 'header-and-footer-scripts'); ?></h3>
     63            <p><?php esc_html_e( 'Scripts entered here will be output immediately before the closing &lt;/body&gt; tag.', 'header-and-footer-scripts'); ?></p>
    6464            <textarea style="width:98%;font-family:monospace;" rows="10" cols="57" id="jamify_hfs_insert_footer" name="jamify_hfs_insert_footer"><?php echo esc_html( get_option( 'jamify_hfs_insert_footer' ) ); ?></textarea>
    6565
     
    6767            <input type="number" value="<?php echo \esc_html( \get_option( 'jamify_hfs_insert_footer_priority', 10 ) ); ?>" name="jamify_hfs_insert_footer_priority" id="jamify_hfs_insert_footer_priority" style="width:6em;" /> <?php \esc_html_e('Default', 'header-and-footer-scripts'); ?>: 10</p><hr />
    6868
    69             <h3 class="shfs-labels"><?php esc_html_e( 'Uninstall Settings', 'header-and-footer-scripts'); ?></h3>
     69            <h3 class="shfs-labels"><?php esc_html_e( 'Uninstall Code Cleanup', 'header-and-footer-scripts'); ?></h3>
    7070            <fieldset>
    7171                <label for="jamify_hfs_clean_on_uninstall">
     
    7575            </fieldset>
    7676            <p class="description" style="color: #ea580c; font-weight: bold;">
    77                 <?php esc_html_e( 'Warning: If checked, all scripts and settings will be permanently deleted when you delete this plugin. This cannot be undone.', 'header-and-footer-scripts'); ?>
     77                <?php esc_html_e( 'Warning: If checked, all saved scripts and settings will be permanently erased when you delete the plugin. This action cannot be undone.', 'header-and-footer-scripts'); ?>
    7878            </p>
    7979
  • header-and-footer-scripts/trunk/inc/sidebar.php

    r3444257 r3451226  
    1818    <h3 class="hndle"><?php esc_html_e( 'Need Help?', 'header-and-footer-scripts'); ?></h3>
    1919    <div class="inside">
    20       <p><?php esc_html_e( 'Read plugin documentation for clarification or how to use it. OR just ask your query.', 'header-and-footer-scripts'); ?></p>
     20      <p><?php esc_html_e( 'Check the documentation for usage instructions, or ask a question if you need help.', 'header-and-footer-scripts'); ?></p>
    2121      <p><strong><a href="<?php echo esc_url( "https://github.com/anandkumar/header-and-footer-scripts/wiki" ); ?>" class="button"><?php esc_html_e('Explore Docs and Support', 'header-and-footer-scripts'); ?></a></strong></p>
    2222    </div>
  • header-and-footer-scripts/trunk/readme.txt

    r3450432 r3451226  
    66Requires at least: 4.6
    77Tested up to: 6.9
    8 Stable tag: 2.4.1
     8Stable tag: 2.4.2
    99Requires PHP: 5.6
    1010License: GPLv2 or later
     
    1414
    1515== Description ==
    16 If you are running a WordPress site then sooner or later you need to insert some kind of code to your website. It is most likley a web analytics code like Google Analytics or may be social media script or some CSS stylesheet or may be Custom fonts. This plugin will do all the magic. Even if you want to insert those codes in a custom post type.
     16An essential WordPress plugin to easily insert scripts and styles (like Google Analytics, CSS, etc.) into your website's header and footer.
    1717
    18 **Note:** Although this plugin requires a minimum PHP version of 5.6, it is highly recommended to update to the latest PHP stack for better security and performance.
     18Looking for a way to add Google Analytics, Facebook Pixel, or custom tracking code to your website's header or footer?
    1919
    20 All you have to do is adding appropriate html code.
     20Header and Footer Scripts is a simple yet powerful plugin that lets you inject code—such as Google Analytics, custom CSS, Facebook Pixel, and chat widgets—directly into your site's header (`<head>`) or footer.
     21
     22No bloat, no ads. This lightweight plugin simply does what it says: inserts code into your header and footer efficiently.
     23
     24All you have to do is add the appropriate HTML code.
    2125
    2226Don't forget to wrap your code with proper tags.
     
    3337
    3438= Why use this plugin: =
    35 * To insert CSS and JavaScript codes to `<head>` or before `</body>`.
    36 * To insert code to `<head>` of any single page or post.
     39* Insert scripts globally into the header and footer of your entire website.
     40* Supports all script types including HTML, JavaScript, and CSS.
     41* Add specific scripts to the header of individual posts or pages.
    3742* To insert code to Custom Post Type [New Feature].
    3843
     
    4247* You can't insert/execute PHP codes.
    4348
    44 Almost all WordPress theme do support this "Header and Footer Scripts" plugin. If the codes are not appearing in your site [ask for support] or look at your theme file if they have standard `wp_head` and `wp_footer` hooks.
     49Almost all WordPress themes support this "Header and Footer Scripts" plugin. If the codes are not appearing in your site [ask for support] or look at your theme file if they have standard `wp_head` and `wp_footer` hooks.
    4550
    4651= Important Links =
    47 For furhter information you are welcomed to follow these links:
     52For further information you are welcomed to follow these links:
    4853
    4954* **[Read Documentation][1]**
     
    6065Upload the plugin to `/wp-content/plugins` and activate. OR Search "Header and Footer Scripts" from `WP Dashbard --> Plugins --> Add New` then hit Install and then activate.
    6166
    62 Once the plugin is activated you will see "Header and Footer Scripts" menu item under setting of WordPress dashboard. Also a meta box on Post and Page edit page.
     67Once the plugin is activated you will see "Header and Footer Scripts" menu item under settings of WordPress dashboard. Also a meta box on Post and Page edit page.
    6368
    6469== Screenshots ==
     
    7782
    7883== Changelog ==
     84
     85= 2.4.2 =
     86* Fix: Resolved critical issue where scripts added to per-post meta box were not saving.
     87* Fix: Corrected CodeMirror editor rendering (borders, height) and gutter visibility (line numbers) in meta box.
     88* Improvement: Updated English copy throughout the plugin for better clarity and professionalism.
     89* New: Added Hindi (hi_IN) translation.
     90* New: Included language template (.pot) and translation files.
    7991
    8092= 2.4.1 =
  • header-and-footer-scripts/trunk/shfs.php

    r3444257 r3451226  
    44 * Plugin URI: https://github.com/anandkumar/header-and-footer-scripts
    55 * Description: Essential WordPress plugin for almost every website to insert codes like Javascript and CSS. Inserting script to your wp_head and wp_footer made easy.
    6  * Version: 2.4.1
     6 * Version: 2.4.2
    77 * Author: Anand Kumar
    88 * Author URI: http://www.anandkumar.net
     
    131131            $settings = wp_enqueue_code_editor( array( 'type' => 'text/html' ) );
    132132
     133            // Enqueue admin styles
     134            wp_enqueue_style( 'jamify-hfs-admin-css', plugins_url( 'css/jamify-hfs-admin.css', __FILE__ ), array(), '2.4.2' );
     135
    133136            // If the code editor is enabled, we need to initialize it.
    134137            if ( false !== $settings ) {
     
    137140                    sprintf(
    138141                        'jQuery( function() {
    139                             if ( jQuery("#jamify_hfs_insert_header").length ) { wp.codeEditor.initialize( "jamify_hfs_insert_header", %1$s ); }
    140                             if ( jQuery("#jamify_hfs_insert_body").length ) { wp.codeEditor.initialize( "jamify_hfs_insert_body", %1$s ); }
    141                             if ( jQuery("#jamify_hfs_insert_footer").length ) { wp.codeEditor.initialize( "jamify_hfs_insert_footer", %1$s ); }
    142                             if ( jQuery("#jamify_hfs_inpost_head_script").length ) { wp.codeEditor.initialize( "jamify_hfs_inpost_head_script", %1$s ); }
    143                         } );',
     142                            if ( jQuery( "#jamify_hfs_insert_header" ).length ) { wp.codeEditor.initialize( "jamify_hfs_insert_header", %1$s ); }
     143                            if ( jQuery( "#jamify_hfs_insert_body" ).length ) { wp.codeEditor.initialize( "jamify_hfs_insert_body", %1$s ); }
     144                            if ( jQuery( "#jamify_hfs_insert_footer" ).length ) { wp.codeEditor.initialize( "jamify_hfs_insert_footer", %1$s ); }
     145                            if ( jQuery( "#jamify_hfs_inpost_head_script" ).length ) {
     146                                var inpostSettings = wp.codeEditor.initialize( "jamify_hfs_inpost_head_script", %1$s );
     147                                var cm = inpostSettings.codemirror;
     148                                // Fallback for some WP versions where initialize returns jQuery object or structure differs.
     149                                if ( ! cm && jQuery( "#jamify_hfs_inpost_head_script" ).next( ".CodeMirror" ).length ) {
     150                                    cm = jQuery( "#jamify_hfs_inpost_head_script" ).next( ".CodeMirror" ).get( 0 ).CodeMirror;
     151                                }
     152                                if ( cm ) {
     153                                    cm.on( "change", function() {
     154                                        cm.save();
     155                                        jQuery( "#jamify_hfs_inpost_head_script" ).trigger( "change" );
     156                                    } );
     157                                    // Refresh to ensure gutter renders correctly
     158                                    setTimeout( function() { cm.refresh(); }, 1 );
     159                                }
     160                            }
     161                        } );',
    144162                        wp_json_encode( $settings )
    145163                    )
     
    280298            // make sure data came from our meta box
    281299            if ( ! isset( $_POST['jamify_hfs_post_meta_noncename'] )
    282                  || ! wp_verify_nonce( sanitize_key( $_POST['jamify_hfs_post_meta_noncename'] ), 'jamify_hfs_post_meta_save' ) ) {
     300                 || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['jamify_hfs_post_meta_noncename'] ) ), 'jamify_hfs_post_meta_save' ) ) {
    283301                return $post_id;
    284302            }
Note: See TracChangeset for help on using the changeset viewer.