Changeset 2969045
- Timestamp:
- 09/20/2023 07:39:55 AM (3 years ago)
- Location:
- astro-sticky-buttons/trunk
- Files:
-
- 5 edited
-
astro-sticky-buttons-common.php (modified) (4 diffs)
-
astro-sticky-buttons.php (modified) (2 diffs)
-
includes/tabs/tab-settings.php (modified) (3 diffs)
-
js/astro-sticky-buttons-admin.js (modified) (1 diff)
-
readme.txt (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
astro-sticky-buttons/trunk/astro-sticky-buttons-common.php
r2968398 r2969045 26 26 switch ($tab) { 27 27 case 'settings' : 28 $option_names_enable = array(); 29 30 $args = array( 'public' => true ); 31 $post_types = get_post_types( $args ); 32 foreach ($post_types as $post_type) { 33 $option_names_enable[ASTRO_SB_PREFIX . 'enable_' . $post_type] = ASTRO_SB_PREFIX . 'enable_' . $post_type; 34 } 35 36 $args = array( 'public' => true ); 37 $taxonomies = get_taxonomies( $args ); 38 foreach ($taxonomies as $taxonomy) { 39 $option_names_enable[ASTRO_SB_PREFIX . 'enable_' . $taxonomy] = ASTRO_SB_PREFIX . 'enable_' . $taxonomy; 40 } 41 28 42 $option_names = array( 29 43 ASTRO_SB_PREFIX . 'email' => ASTRO_SB_PREFIX . 'email', … … 40 54 ASTRO_SB_PREFIX . 'pinterest' => ASTRO_SB_PREFIX . 'pinterest', 41 55 ); 56 57 $option_names = array_merge($option_names_enable, $option_names); 42 58 break; 43 59 … … 82 98 */ 83 99 function astro_sb_shortcode_output() { 100 84 101 // Get the Template 85 102 $template_file = plugin_dir_path(__FILE__) . 'templates/astro-sticky-buttons.php'; … … 175 192 return $str; 176 193 } 194 195 /** 196 * Check the current page/post type. 197 */ 198 function astro_sb_get_current_post_type() { 199 global $post; 200 201 //Default value 202 $enable = false; 203 204 if ( is_singular() || is_single() || is_page() ) { 205 $option_value = get_option('astro_sb_enable_' . $post->post_type); 206 if ($option_value == 1) { 207 $enable = true; 208 } 209 } 210 211 if ( is_category() || is_tax() || is_tag() ) { 212 $obj = get_queried_object(); 213 if ($obj) { 214 $term_taxonomy = $obj->taxonomy; 215 $option_value = get_option('astro_sb_enable_' . $term_taxonomy); 216 if ($option_value == 1) { 217 $enable = true; 218 } 219 } 220 } 221 222 if ( is_archive() ) { 223 $enable = true; 224 } 225 226 if ($enable) { 227 echo astro_sb_shortcode_output(); 228 }else{ 229 return false; 230 } 231 } 232 add_action('wp_footer', 'astro_sb_get_current_post_type'); -
astro-sticky-buttons/trunk/astro-sticky-buttons.php
r2968398 r2969045 4 4 * Plugin URI: https://wordpress.org/plugins/astro-sticky-buttons 5 5 * Description: Display your favourite sticky buttons to get in touch with your visitors and share your social channels. 6 * Version: 1. 0.16 * Version: 1.1.0 7 7 * Requires at least: 5.2 8 8 * Requires PHP: 7.2 … … 89 89 return $links; 90 90 } 91 92 /** 93 * Activation check. 94 */ 95 register_activation_hook( __FILE__, 'astro_sb_check_plugin_version' ); 96 function astro_sb_check_plugin_version() { 97 $plugin_version = astro_sb_plugin_data('Version'); 98 if ($plugin_version < '1.0.2') { 99 if (!isset($astro_sb_enable_all)) { 100 add_option('astro_sb_enable_post', 1); 101 add_option('astro_sb_enable_page', 1); 102 add_option('astro_sb_enable_attachment', 1); 103 return true; 104 } 105 } 106 } -
astro-sticky-buttons/trunk/includes/tabs/tab-settings.php
r2968398 r2969045 11 11 ?> 12 12 <div class="<?php echo $astro_sb_prefix . 'wrapper'; ?> <?php echo esc_attr( $option_group ); ?>"> 13 14 <div class="section-wrapper">15 <div class="section-wrapper-inner">16 <h2 id="settings" class="title"><?php _e('Settings', 'astro-sticky-buttons' ); ?></h2>17 <p><?php echo esc_html('Astro Sticky Buttons displays the sticky buttons using the shortcode:', 'astro-sticky-buttons'); ?> <strong>[astro-sticky-buttons]</strong><br>18 <?php echo esc_html('To display the sticky buttons on all pages of the site, it is recommended to insert the shortcode in the header or footer of the site.', 'astro-sticky-buttons'); ?><br>19 <?php echo esc_html('The shortcode can also be inserted via text widget.', 'astro-sticky-buttons'); ?></p>20 </div>21 </div>22 13 23 14 <form method="post" action="options.php" class="<?php echo esc_attr($option_group); ?>_form"> … … 30 21 <div class="section-wrapper-inner"> 31 22 32 <h2 id="buttons" class="title"><?php _e('Buttons', 'astro-sticky-buttons' ); ?></h2> 23 <p><?php echo esc_html('The sticky buttons can be displayed in two different methods:', 'astro-sticky-buttons'); ?> 24 <ol> 25 <li><?php echo esc_html('Choose where to display the sticky buttons', 'astro-sticky-buttons'); ?> (<strong><?php echo esc_html('recommended', 'astro-sticky-buttons'); ?></strong>)</li> 26 <li><?php echo esc_html('Using the shortcode [astro-sticky-buttons] in your website content/widget/header/footer', 'astro-sticky-buttons'); ?></li> 27 </ol> 28 <p><strong><?php echo esc_html('It is recommended to use only one method!', 'astro-sticky-buttons'); ?></strong> 33 29 34 30 <hr> 35 31 36 <h3 id="buttons-communication" class="title"><?php _e('Chat/Communication', 'astro-sticky-buttons' ); ?></h3> 32 <h2 id="where-display" class="title"><?php _e('Choose where to display the Astro Sticky Buttons', 'astro-sticky-buttons' ); ?></h2> 33 <table class="form-table astro_sb_enable_disable_post_types"> 34 <?php 35 $field_label = esc_html__( 'Check/Uncheck All', 'astro-sticky-buttons' ); 36 $field_description = ''; 37 $field_name = $astro_sb_prefix.'enable_disable_all'; 38 $field_value = 1; 39 ?> 40 <tr> 41 <th scope="row"></th> 42 <td> 43 <input id="<?php echo esc_attr($field_name); ?>" 44 name="<?php echo esc_attr($field_name); ?>" 45 type="checkbox" 46 class="<?php echo esc_attr($astro_sb_prefix) . 'checkbox_enable'; ?>" 47 48 ><label for="<?php echo esc_attr($field_name); ?>"><?php echo esc_html($field_label); ?></label> 49 </td> 50 </tr> 51 52 <?php 53 // Posts 54 $args = array( 'public' => true ); 55 $post_types = get_post_types( $args ); 56 57 foreach ( $post_types as $post_type ) { 58 $post_type = get_post_type_object($post_type); 59 60 $field_label = esc_html__( 'Display in ' . $post_type->labels->name, 'astro-sticky-buttons' ); 61 $field_description = ''; 62 $field_name = $astro_sb_prefix.'enable_'.$post_type->name; 63 $field_value = get_option($field_name); 64 ?> 65 <tr> 66 <th scope="row"><label for="<?php echo esc_attr($field_name); ?>"><?php echo esc_html($field_label); ?></label></th> 67 <td> 68 <fieldset> 69 <legend class="screen-reader-text"><span><?php echo esc_html($field_label); ?></span></legend> 70 <label for="<?php echo esc_attr($field_name); ?>"><input id="<?php echo esc_attr($field_name); ?>" 71 name="<?php echo esc_attr($field_name); ?>" 72 type="checkbox" 73 class="<?php echo esc_attr($astro_sb_prefix) . 'checkbox_enable'; ?>" 74 value="1" <?php if ($field_value == "1") { 75 echo 'checked="checked"'; 76 } ?>><?php echo esc_html($field_description); ?></label> 77 </fieldset> 78 </td> 79 </tr> 80 <?php 81 } 82 83 // Taxonomies 84 $args = array( 'public' => true ); 85 $taxonomies = get_taxonomies( $args ); 86 87 foreach ( $taxonomies as $taxonomy ) { 88 $taxonomy = get_taxonomy($taxonomy); 89 90 $field_label = esc_html__( 'Display in ' . $taxonomy->labels->name, 'astro-sticky-buttons' ); 91 $field_description = ''; 92 $field_name = $astro_sb_prefix.'enable_'.$taxonomy->name; 93 $field_value = get_option($field_name); 94 ?> 95 <tr> 96 <th scope="row"><label for="<?php echo esc_attr($field_name); ?>"><?php echo esc_html($field_label); ?></label></th> 97 <td> 98 <fieldset> 99 <legend class="screen-reader-text"><span><?php echo esc_html($field_label); ?></span></legend> 100 <label for="<?php echo esc_attr($field_name); ?>"><input id="<?php echo esc_attr($field_name); ?>" 101 name="<?php echo esc_attr($field_name); ?>" 102 type="checkbox" 103 class="<?php echo esc_attr($astro_sb_prefix) . 'checkbox_enable'; ?>" 104 value="1" <?php if ($field_value == "1") { 105 echo 'checked="checked"'; 106 } ?>><?php echo esc_html($field_description); ?></label> 107 </fieldset> 108 </td> 109 </tr> 110 <?php 111 } 112 ?> 113 </table> 114 115 <hr> 116 117 <h2 id="buttons-communication" class="title"><?php _e('Chat/Communication buttons', 'astro-sticky-buttons' ); ?></h2> 37 118 <table class="form-table"> 38 119 <?php … … 120 201 <hr> 121 202 122 <h 3 id="buttons-communication" class="title"><?php _e('Social', 'astro-sticky-buttons' ); ?></h3>203 <h2 id="buttons-communication" class="title"><?php _e('Social buttons', 'astro-sticky-buttons' ); ?></h2> 123 204 <table class="form-table"> 124 205 -
astro-sticky-buttons/trunk/js/astro-sticky-buttons-admin.js
r2967221 r2969045 7 7 $('.colorpicker').wpColorPicker(); 8 8 9 // Check/Uncheck to show/hide the sticky bar in post/taxonomy 10 $("#astro_sb_enable_disable_all").click(function () { 11 $(".astro_sb_checkbox_enable").prop('checked', $(this).prop('checked')); 12 }); 13 14 $(".astro_sb_checkbox_enable").change(function(){ 15 if (!$(this).prop("checked")){ 16 $("#astro_sb_enable_disable_all").prop("checked",false); 17 } 18 }); 19 9 20 }); -
astro-sticky-buttons/trunk/readme.txt
r2968398 r2969045 4 4 Requires at least: 5.2 5 5 Tested up to: 6.3.1 6 Stable tag: 1. 0.16 Stable tag: 1.1.0 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later … … 12 12 Display your favourite sticky buttons to get in touch with your visitors and share your social channels. 13 13 14 Chat/Communication buttons: 14 <strong>Chat/Communication buttons:</strong> 15 15 <ul> 16 16 <li>Email</li> … … 21 21 </ul> 22 22 23 Social buttons: 23 <strong>Social buttons:</strong> 24 24 <ul> 25 25 <li>Facebook</li> … … 32 32 </ul> 33 33 34 <strong>Layout:</strong> 35 <ul> 36 <li>Position: it is possible to choose the position where to display the floating buttons bar: right, bottom-right, bottom, bottom-left, left</li> 37 <li>Icons: choose the distance beetween the icons, dimension, border and shape (squared and rounded) and box shadow</li> 38 </ul> 39 34 40 == Installation == 35 41 1. Upload the entire `astro-sticky-buttons` folder to the `/wp-content/plugins/` directory. … … 37 43 38 44 == Changelog == 45 = 1.1.0 = 46 * Added new settings: it is possible to choose which post type or taxonomy as well as custom post type and custom taxonomy to display the sticky buttons bar (recommended method). Don't need to use the shortcode [astro-sticky-buttons] to display the sticky buttons bar. 47 39 48 = 1.0.1 = 40 49 * Fix TikTok
Note: See TracChangeset
for help on using the changeset viewer.