Changeset 3449868
- Timestamp:
- 01/29/2026 05:32:55 PM (2 months ago)
- Location:
- custom-top-bar
- Files:
-
- 9 added
- 1 deleted
- 4 edited
-
tags/2.1 (added)
-
tags/2.1/css (added)
-
tags/2.1/css/bar.css (added)
-
tags/2.1/css/index.php (added)
-
tags/2.1/index.php (added)
-
tags/2.1/readme.txt (added)
-
tags/2.1/setting.php (added)
-
tags/2.1/top-bar.php (added)
-
tags/2.1/top_bar.php (added)
-
tags/5.5 (deleted)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/setting.php (modified) (5 diffs)
-
trunk/top-bar.php (modified) (8 diffs)
-
trunk/top_bar.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
custom-top-bar/trunk/readme.txt
r3449021 r3449868 5 5 Requires at least: 3.0.1 6 6 Tested up to: 6.9 7 Stable tag: 5.57 Stable tag: 2.1 8 8 License: GPLv2 or later 9 9 License 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 ?> 1 2 <script> 2 3 (function( $ ) { … … 13 14 if(isset($_POST['update_option_setting'])) 14 15 { 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 28 40 update_option('enable_top_bar',$enable_top_bar); 29 41 update_option('fixed_top_bar',$fixed_top_bar); … … 63 75 <div id="post-body" class="metabox-holder columns-2"> 64 76 <form method="post"> 77 <?php wp_nonce_field( 'cpt_save_setting', 'cpt_form_nonce' ); ?> 65 78 <table class="widefat"> 66 79 <tr> … … 84 97 <tr> 85 98 <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> 87 100 </tr> 88 101 <tr class="alternate"> 89 102 <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> 91 104 </tr> 92 105 93 106 <tr> 94 107 <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> 96 109 </tr> 97 110 <tr class="alternate"> … … 102 115 <tr> 103 116 <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> 105 118 </tr> 106 119 <tr class="alternate"> 107 120 <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> 109 122 </tr> 110 123 111 124 <tr> 112 125 <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> 114 127 </tr> 115 128 <tr class="alternate"> 116 129 <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> 118 131 </tr> 119 132 120 133 <tr> 121 134 <td class="row-title"> </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> 123 136 </tr> 124 137 </table> -
custom-top-bar/trunk/top-bar.php
r3449021 r3449868 1 1 <?php 2 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 2 3 /* 3 4 Plugin Name: Custom top bar … … 5 6 Description: You can easily customize page top bar with background color,contact number social links and a custom buttom 6 7 Author: Suman Biswas 7 Version: 2.0.3.1 8 Version: 2.1 9 Text Domain: custom-top-bar 8 10 License: GPLv2 or later 9 11 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 31 33 add_action( 'add_meta_boxes', 'ctb_social_post_meta_box' ); 32 34 add_action( 'save_post', 'ctb_save_social_link_meta_vale',10,3 ); 33 add_action('do_meta_boxes', 'ctb_change_image_box');34 35 add_action('admin_head-post-new.php','ctb_change_thumbnail_html'); 35 36 add_action('admin_head-post.php','ctb_change_thumbnail_html'); 36 37 add_action('admin_menu', 'ctb_register_fallback_page'); 37 38 add_action('admin_enqueue_scripts', 'ctb_include_Colorpicker'); 39 define( 'CTB_JS_CSS_VER', 2.1 ); 38 40 39 41 function ctb_include_styles() 40 42 { 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' ); 42 44 } 43 45 … … 52 54 array( 53 55 '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' ), 67 69 ), 68 70 'public' => true, … … 82 84 function ctb_social_post_meta_box() 83 85 { 84 add_meta_box( 'ctb_slug', __( 'Social Link', 'c tb_code_domain' ),'ctb_inner_custom','social-post');86 add_meta_box( 'ctb_slug', __( 'Social Link', 'custom-top-bar' ),'ctb_inner_custom','social-post'); 85 87 } 86 88 … … 92 94 <tr> 93 95 <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> 95 97 </tr> 96 98 </table> … … 100 102 function ctb_save_social_link_meta_vale($postID,$post,$update) 101 103 { 102 global $devices;103 104 if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) 104 105 return; 105 106 106 107 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'] ) ) : ''; 109 110 update_post_meta($postID, 'social_link', $code); 110 111 } … … 112 113 } 113 114 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 }119 115 120 116 121 117 function ctb_change_thumbnail_html( $content ) { 122 118 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'); 124 120 } 125 121 function 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); 127 123 } 128 124 -
custom-top-bar/trunk/top_bar.php
r1240039 r3449868 1 1 <?php 2 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 3 2 4 $enable_top_bar = get_option('enable_top_bar'); 3 5 $fixed_top_bar = get_option('fixed_top_bar'); … … 21 23 <?php if($enable_top_bar) { ?> 22 24 <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); ?> " > 24 26 <div class="wrapper"> 25 27 <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); ?>"> 27 29 <?php if($display_contact_number) { ?> 28 <?php echo $contact_number; ?>30 <?php echo esc_html($contact_number); ?> 29 31 <?php } ?> 30 32 </span> 31 33 32 34 <?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> 34 36 <?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); ?>"> 37 39 <?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> 39 41 <?php } ?> 40 42 </span> … … 45 47 while($theQuery->have_posts()){ 46 48 $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 ); 49 51 ?> 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(); ?> 52 54 </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 } ?> 54 59 </div> 55 60 </div>
Note: See TracChangeset
for help on using the changeset viewer.