Plugin Directory

Changeset 3449868


Ignore:
Timestamp:
01/29/2026 05:32:55 PM (2 months ago)
Author:
sumanbiswas013
Message:

Plugin Security update

Location:
custom-top-bar
Files:
9 added
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • custom-top-bar/trunk/readme.txt

    r3449021 r3449868  
    55Requires at least: 3.0.1
    66Tested up to: 6.9
    7 Stable tag: 5.5
     7Stable tag: 2.1
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • custom-top-bar/trunk/setting.php

    r1240039 r3449868  
     1<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
    12<script>
    23(function( $ ) {
     
    1314if(isset($_POST['update_option_setting']))
    1415{
    15     $enable_top_bar = sanitize_text_field($_POST['enable_top_bar']);
    16     $fixed_top_bar = sanitize_text_field($_POST['fixed_top_bar']);
    17     $display_contact_number = sanitize_text_field($_POST['display_contact_number']);
    18     $display_email_address = sanitize_text_field($_POST['display_email_address']);
    19     $top_bar_height = sanitize_text_field($_POST['top_bar_height']);
    20     $top_bar_color = sanitize_text_field($_POST['top_bar_color']);
    21     $contact_number = sanitize_text_field($_POST['contact_number']);
    22     $contact_email = sanitize_text_field($_POST['contact_email']); 
    23     $text_color = sanitize_text_field($_POST['text_color']);
    24     $show_admin_bar = sanitize_text_field($_POST['show_admin_bar']);   
    25     $button_text = sanitize_text_field($_POST['button_text']);
    26     $acction_link = sanitize_text_field($_POST['acction_link']);
    27    
     16    // Check nonce exists
     17    $nonce_field = array_key_exists('cpt_form_nonce', $_POST) ? wp_unslash($_POST['cpt_form_nonce']) : '';
     18    if ( ! isset( $nonce_field) || empty( $nonce_field ) ) {
     19        wp_die( 'Nonce missing.' );
     20    }
     21
     22    // Verify nonce
     23    if ( ! wp_verify_nonce( $nonce_field, 'cpt_save_setting' ) ) {
     24        wp_die( 'Nonce verification failed.' );
     25    }
     26
     27    $enable_top_bar = array_key_exists('enable_top_bar', $_POST) ? sanitize_text_field(wp_unslash($_POST['enable_top_bar'])) : '';
     28    $fixed_top_bar = array_key_exists('fixed_top_bar', $_POST) ? sanitize_text_field(wp_unslash($_POST['fixed_top_bar'])) : '';
     29    $display_contact_number = array_key_exists('display_contact_number', $_POST) ? sanitize_text_field(wp_unslash($_POST['display_contact_number'])) : '';
     30    $display_email_address = array_key_exists('display_email_address', $_POST) ? sanitize_text_field(wp_unslash($_POST['display_email_address'])) : '';
     31    $top_bar_height = array_key_exists('top_bar_height', $_POST) ? sanitize_text_field(wp_unslash($_POST['top_bar_height'])) : '';
     32    $top_bar_color = array_key_exists('top_bar_color', $_POST) ? sanitize_text_field(wp_unslash($_POST['top_bar_color'])) : '';
     33    $contact_number = array_key_exists('contact_number', $_POST) ? sanitize_text_field(wp_unslash($_POST['contact_number'])) : '';
     34    $contact_email = array_key_exists('contact_email', $_POST) ? sanitize_text_field(wp_unslash($_POST['contact_email'])) : '';
     35    $text_color = array_key_exists('text_color', $_POST) ? sanitize_text_field(wp_unslash($_POST['text_color'])) : '';
     36    $show_admin_bar = array_key_exists('show_admin_bar', $_POST) ? sanitize_text_field(wp_unslash($_POST['show_admin_bar'])) : ''; 
     37    $button_text = array_key_exists('button_text', $_POST) ? sanitize_text_field(wp_unslash($_POST['button_text'])) : '';
     38    $acction_link = array_key_exists('acction_link', $_POST) ? sanitize_text_field(wp_unslash($_POST['acction_link'])) : '';
     39
    2840    update_option('enable_top_bar',$enable_top_bar);
    2941    update_option('fixed_top_bar',$fixed_top_bar);
     
    6375        <div id="post-body" class="metabox-holder columns-2">
    6476        <form method="post">
     77            <?php wp_nonce_field( 'cpt_save_setting', 'cpt_form_nonce' ); ?>
    6578            <table class="widefat">
    6679                <tr>
     
    8497                <tr>
    8598                    <td class="row-title"><label for="top_bar_height">Top Bar Height : </label></td>
    86                     <td><input type="text" name="top_bar_height" id="top_bar_height" value="<?php echo $top_bar_height; ?>"  />  <span>( in px) </span></td>
     99                    <td><input type="text" name="top_bar_height" id="top_bar_height" value="<?php echo esc_html($top_bar_height); ?>"  />  <span>( in px) </span></td>
    87100                </tr>
    88101                <tr class="alternate">
    89102                    <td class="row-title"><label for="top_bar_color">Top Bar Background Color :</label></td>
    90                     <td><input type="text" name="top_bar_color" id="top_bar_color" value="<?php echo $top_bar_color; ?>"  />  </td>
     103                    <td><input type="text" name="top_bar_color" id="top_bar_color" value="<?php echo esc_html($top_bar_color); ?>"  />  </td>
    91104                </tr>
    92105               
    93106                <tr>
    94107                    <td class="row-title"><label for="text_color">Text color : </label></td>
    95                     <td><input type="text" name="text_color" id="text_color" value="<?php echo $text_color; ?>"  /></td>
     108                    <td><input type="text" name="text_color" id="text_color" value="<?php echo esc_html($text_color); ?>"  /></td>
    96109                </tr>
    97110                <tr class="alternate">
     
    102115                <tr>
    103116                    <td class="row-title"><label for="contact_number">Contact Number : </label></td>
    104                     <td><input type="text" name="contact_number" id="contact_number" value="<?php echo $contact_number; ?>"  /></td>
     117                    <td><input type="text" name="contact_number" id="contact_number" value="<?php echo esc_html($contact_number); ?>"  /></td>
    105118                </tr>
    106119                <tr class="alternate">
    107120                    <td class="row-title"><label for="contact_email">Email Address :</label></td>
    108                     <td><input type="text" name="contact_email" id="contact_email" value="<?php echo $contact_email; ?>"  /></td>
     121                    <td><input type="text" name="contact_email" id="contact_email" value="<?php echo esc_html($contact_email); ?>"  /></td>
    109122                </tr>
    110123               
    111124                <tr>
    112125                    <td class="row-title"><label for="button_text">Button Text : </label></td>
    113                     <td><input type="text" name="button_text" id="button_text" value="<?php echo $button_text; ?>"  /></td>
     126                    <td><input type="text" name="button_text" id="button_text" value="<?php echo esc_html($button_text); ?>"  /></td>
    114127                </tr>
    115128                <tr class="alternate">
    116129                    <td class="row-title"><label for="acction_link">Link :</label></td>
    117                     <td><input type="text" name="acction_link" id="acction_link" value="<?php echo $acction_link; ?>"  /></td>
     130                    <td><input type="text" name="acction_link" id="acction_link" value="<?php echo esc_html($acction_link); ?>"  /></td>
    118131                </tr>
    119132               
    120133                <tr>
    121134                    <td class="row-title">&nbsp;</td>
    122                     <td><input class="button-primary" type="submit" name="update_option_setting" value="<?php _e( 'Save' ); ?>" /></td>
     135                    <td><input class="button-primary" type="submit" name="update_option_setting" value="<?php esc_attr_e( 'Save', 'custom-top-bar' ); ?>" /></td>
    123136                </tr>
    124137            </table>
  • custom-top-bar/trunk/top-bar.php

    r3449021 r3449868  
    11<?php
     2if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    23/*
    34Plugin Name: Custom top bar
     
    56Description: You can easily customize page top bar with background color,contact number social links and a custom buttom
    67Author: Suman Biswas
    7 Version: 2.0.3.1
     8Version: 2.1
     9Text Domain: custom-top-bar
    810License: GPLv2 or later
    911License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    3133add_action( 'add_meta_boxes', 'ctb_social_post_meta_box' );
    3234add_action( 'save_post', 'ctb_save_social_link_meta_vale',10,3 );
    33 add_action('do_meta_boxes', 'ctb_change_image_box');
    3435add_action('admin_head-post-new.php','ctb_change_thumbnail_html');
    3536add_action('admin_head-post.php','ctb_change_thumbnail_html');
    3637add_action('admin_menu', 'ctb_register_fallback_page');
    3738add_action('admin_enqueue_scripts', 'ctb_include_Colorpicker');
     39define( 'CTB_JS_CSS_VER', 2.1 );
    3840
    3941function ctb_include_styles()
    4042{
    41     wp_enqueue_style( 'style', plugins_url( 'css/bar.css', __FILE__ ));
     43    wp_enqueue_style( 'style', plugins_url( 'css/bar.css', __FILE__ ),array(), CTB_JS_CSS_VER, 'all' );
    4244}
    4345
     
    5254        array(
    5355            'labels' => array(
    54                 'name' => __( 'Top Bar Section' ),
    55                 'singular_name' => __( 'Social Link' ),
    56                 'add_new' => __( 'Add New Social Link' ),
    57                 'add_new_item' => __( 'Add New Social Link' ),
    58                 'edit' => __( 'Edit' ),
    59                 'edit_item' => __( 'Edit Social Link' ),
    60                 'new_item' => __( 'New Social Link' ),
    61                 'view' => __( 'View Social Link' ),
    62                 'view_item' => __( 'View Social Link' ),
    63                 'search_items' => __( 'Search Social Link' ),
    64                 'not_found' => __( 'No Social Link found' ),
    65                 'not_found_in_trash' => __( 'No Social Link found in Trash' ),
    66                 'parent' => __( 'Parent Social Link' ),
     56                'name' => __( 'Top Bar Section', 'custom-top-bar' ),
     57                'singular_name' => __( 'Social Link', 'custom-top-bar' ),
     58                'add_new' => __( 'Add New Social Link', 'custom-top-bar' ),
     59                'add_new_item' => __( 'Add New Social Link', 'custom-top-bar' ),
     60                'edit' => __( 'Edit', 'custom-top-bar' ),
     61                'edit_item' => __( 'Edit Social Link', 'custom-top-bar' ),
     62                'new_item' => __( 'New Social Link', 'custom-top-bar' ),
     63                'view' => __( 'View Social Link', 'custom-top-bar' ),
     64                'view_item' => __( 'View Social Link', 'custom-top-bar' ),
     65                'search_items' => __( 'Search Social Link', 'custom-top-bar' ),
     66                'not_found' => __( 'No Social Link found', 'custom-top-bar' ),
     67                'not_found_in_trash' => __( 'No Social Link found in Trash', 'custom-top-bar' ),
     68                'parent' => __( 'Parent Social Link', 'custom-top-bar' ),
    6769            ),
    6870            'public' => true,
     
    8284function ctb_social_post_meta_box()
    8385{
    84     add_meta_box( 'ctb_slug', __( 'Social Link', 'ctb_code_domain' ),'ctb_inner_custom','social-post');
     86    add_meta_box( 'ctb_slug', __( 'Social Link', 'custom-top-bar' ),'ctb_inner_custom','social-post');
    8587}
    8688
     
    9294            <tr>
    9395                <td>Link : </td>
    94                 <td><input type="text" name="social_link" id="social_link" value="<?php echo $social_link; ?>" style="width:350px;"  /></td>
     96                <td><input type="text" name="social_link" id="social_link" value="<?php echo esc_url($social_link); ?>" style="width:350px;"  /></td>
    9597            </tr>
    9698        </table>
     
    100102function ctb_save_social_link_meta_vale($postID,$post,$update)
    101103{
    102     global $devices;
    103104    if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
    104105        return;
    105106
    106107    if ( 'social-post' == $post->post_type ) {
    107        
    108         $code = sanitize_text_field( $_POST['social_link'] );
     108
     109        $code = array_key_exists('social_link', $_POST) ? sanitize_text_field( wp_unslash($_POST['social_link'] ) ) : '';
    109110        update_post_meta($postID, 'social_link', $code);
    110111    }
     
    112113}
    113114
    114 function ctb_change_image_box()
    115 {
    116     remove_meta_box( 'postimagediv', 'social-post', 'side' );
    117     add_meta_box('ct_postimagediv', __('Social Icon'), 'post_thumbnail_meta_box', 'social-post', 'normal', 'high');
    118 }
    119115
    120116
    121117function ctb_change_thumbnail_html( $content ) {
    122118    if ('social-post' == $GLOBALS['post_type'])
    123       add_filter('admin_post_thumbnail_html',ctb_do_thumb);
     119      add_filter('admin_post_thumbnail_html','ctb_do_thumb');
    124120}
    125121function ctb_do_thumb($content){
    126      return str_replace(__('Set featured image'), __('Social Icon'),$content);
     122     return str_replace(__('Set featured image','custom-top-bar'), __('Social Icon','custom-top-bar'),$content);
    127123}
    128124
  • custom-top-bar/trunk/top_bar.php

    r1240039 r3449868  
    11<?php
     2if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
     3
    24$enable_top_bar = get_option('enable_top_bar');
    35$fixed_top_bar = get_option('fixed_top_bar');
     
    2123<?php if($enable_top_bar) { ?>
    2224<div id="page">
    23 <div id="header"  style=" <?php if($fixed_top_bar == 1 ) { ?> position:fixed; <?php } ?> <?php echo 'height:'.$top_bar_height.'px;'; ?> <?php echo 'background:'.$top_bar_color; ?> " >
     25<div id="header"  style=" <?php if($fixed_top_bar == 1 ) { ?> position:fixed; <?php } ?> <?php echo 'height:'.esc_html($top_bar_height).'px;'; ?> <?php echo 'background:'.esc_html($top_bar_color); ?> " >
    2426    <div class="wrapper">
    2527      <div class="col-lf-1">
    26         <span class="txt" style=" margin-top:<?php echo $textMargin;?>%; color: <?php echo $text_color; ?>">
     28        <span class="txt" style=" margin-top:<?php echo esc_html($textMargin);?>%; color: <?php echo esc_html($text_color); ?>">
    2729        <?php if($display_contact_number) { ?>
    28         <?php echo $contact_number; ?>
     30        <?php echo esc_html($contact_number); ?>
    2931        <?php } ?>
    3032        </span>
    3133       
    3234        <?php if($display_email_address && $display_contact_number) {?>
    33         <span class="txt" style=" margin-top:<?php echo $textMargin;?>%;">|</span>
     35        <span class="txt" style=" margin-top:<?php echo esc_html($textMargin);?>%;">|</span>
    3436        <?php } ?>
    35        
    36         <span class="txt" style=" margin-top:<?php echo $textMargin;?>%;color: <?php echo $text_color; ?>">
     37
     38        <span class="txt" style=" margin-top:<?php echo esc_html($textMargin);?>%;color: <?php echo esc_html($text_color); ?>">
    3739        <?php if($display_email_address) { ?>
    38         <a href="mailto:<?php echo $contact_email; ?>" style="color: <?php echo $text_color; ?>"><?php echo $contact_email; ?></a>
     40        <a href="mailto:<?php echo esc_html($contact_email); ?>" style="color: <?php echo esc_html($text_color); ?>"><?php echo esc_html($contact_email); ?></a>
    3941        <?php } ?>
    4042        </span>
     
    4547            while($theQuery->have_posts()){
    4648            $theQuery->the_post();
    47             $src = wp_get_attachment_image_src( get_post_thumbnail_id(get_the_ID()),'social_image_medium');
    48             $social_link = get_post_meta( get_the_ID(), $key = 'social_link', $single = true );
     49                  $src = wp_get_attachment_image_src( get_post_thumbnail_id(get_the_ID()),'social_image_medium');
     50                  $social_link = get_post_meta( get_the_ID(), $key = 'social_link', $single = true );
    4951        ?>
    50         <a href="<?php echo $social_link; ?>" target="_blank"><img src="<?php echo $src[0];?>" alt="" title="<?php echo get_the_title(); ?>" /></a>
    51         <?php } } wp_reset_query(); ?>
     52        <a href="<?php echo esc_url($social_link); ?>" target="_blank"><img src="<?php echo esc_html($src[0]);?>" alt="" title="<?php echo esc_html(get_the_title()); ?>" /></a>
     53        <?php } } wp_reset_postdata(); ?>
    5254      </div>
    53       <a href="<?php echo $acction_link; ?>" class="btn"><?php echo $button_text; ?></a>
     55
     56      <?php if($button_text !='' && $acction_link !='') { ?>
     57        <a href="<?php echo esc_url($acction_link); ?>" class="btn"><?php echo esc_html($button_text); ?></a>
     58      <?php } ?>
    5459    </div>
    5560  </div>
Note: See TracChangeset for help on using the changeset viewer.