Changeset 2816182
- Timestamp:
- 11/10/2022 06:29:24 PM (3 years ago)
- Location:
- super-simple-site-alert/trunk
- Files:
-
- 6 edited
-
README.txt (modified) (1 diff)
-
admin/partials/site-alert-admin-manage.php (modified) (5 diffs)
-
public/class-site-alert-public.php (modified) (1 diff)
-
public/css/site-alert-public.css (modified) (1 diff)
-
public/partials/site-alert-public-display.php (modified) (5 diffs)
-
site-alert.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
super-simple-site-alert/trunk/README.txt
r2791424 r2816182 5 5 Requires at least: 5.7 6 6 Tested up to: 5.9 7 Stable tag: 1. 27 Stable tag: 1.3 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
super-simple-site-alert/trunk/admin/partials/site-alert-admin-manage.php
r2728652 r2816182 44 44 $option_all_sites = isset($_POST['allsites']) ? intval($_POST['allsites']) : ''; 45 45 $option_is_static = isset($_POST['isstatic']) ? intval($_POST['isstatic']) : ''; 46 $option_is_sticky_footer = isset($_POST['isstickyfooter']) ? intval($_POST['isstickyfooter']) : ''; 46 47 $option_is_popup = isset($_POST['ispopup']) ? intval($_POST['ispopup']) : ''; 47 48 $publish_date = isset($_POST['publish-date']) ? sanitize_text_field($_POST['publish-date']) : ''; … … 96 97 add_post_meta($post_id, 'exclude_by_group', $exclude_by_group); 97 98 add_post_meta($post_id, 'isstatic', $option_is_static); 99 add_post_meta($post_id, 'isstickyfooter', $option_is_sticky_footer); 98 100 add_post_meta($post_id, 'ispopup', $option_is_popup); 99 101 add_post_meta($post_id, 'publish-date', $publish_date); … … 119 121 update_post_meta($post_id, 'exclude_by_group', $exclude_by_group); 120 122 update_post_meta($post_id, 'isstatic', $option_is_static); 123 update_post_meta($post_id, 'isstickyfooter', $option_is_sticky_footer); 121 124 update_post_meta($post_id, 'ispopup', $option_is_popup); 122 125 update_post_meta($post_id, 'publish-date', $publish_date); … … 147 150 $exclude_by_group = get_post_meta($post_id, 'exclude_by_group', true); 148 151 $option_is_static = get_post_meta($post_id, 'isstatic', true); 152 $option_is_sticky_footer = get_post_meta($post_id, 'isstickyfooter', true); 149 153 $option_is_popup = get_post_meta($post_id, 'ispopup', true); 150 154 $publish_date = get_post_meta($post_id, 'publish-date', true); … … 307 311 </div> 308 312 <div> 313 <input type="checkbox" name="isstickyfooter" value="1" <?PHP print $option_is_sticky_footer == 1 ? "checked" : "";?>> Sticky Footer 314 </div> 315 <div> 309 316 <input type="checkbox" name="ispopup" value="1" <?PHP print $option_is_popup == 1 ? "checked" : "";?>> Pop-Up 310 317 <?PHP if($action == "edit"){?><a href="javascript: void(0)" class="reset-popup small" data-id="<?PHP print esc_attr($post_id);?>">[Reset suppressed window]</a><?PHP } ?> -
super-simple-site-alert/trunk/public/class-site-alert-public.php
r2728652 r2816182 61 61 public function show_alert() { 62 62 //suppress the alert from showing up in Elementor editor 63 require_once plugin_dir_path(__DIR__) . '/includes/utilities.php'; 63 64 if ( class_exists('Elementor\Plugin') ) { 64 65 if ( \Elementor\Plugin::$instance->preview->is_preview_mode() ) { -
super-simple-site-alert/trunk/public/css/site-alert-public.css
r2728652 r2816182 55 55 } 56 56 57 .site-alert.sticky-footer { 58 position: fixed; 59 bottom: 10px; 60 left: 10px; 61 padding: 10px 20px; 62 width: initial; 63 height: 50px; 64 font-size: initial; 65 margin: 0; 66 display: flex; 67 overflow: hidden; 68 max-width: 50%; 69 z-index: 999; 70 } 71 72 .site-alert.sticky-footer.expand { 73 height: initial; 74 z-index: 9999; 75 } 76 77 .site-alert.sticky-footer.truncate { 78 padding: 0 !important; 79 z-index: 999; 80 } 81 82 .site-alert.sticky-footer.truncate i.sa-closed { 83 padding: 20px; 84 display: flex; 85 align-items: center; 86 justify-content: center; 87 } 88 89 .site-alert.sticky-footer.truncate::before, 90 .site-alert.sticky-footer.truncate .site-alert-content, 91 .site-alert.sticky-footer i.sa-closed { 92 display: none; 93 } 94 95 .site-alert.sticky-footer i.sa-close { 96 position: absolute; 97 top: 0; 98 right: 0; 99 opacity: 0.2; 100 } 101 102 .site-alert.sticky-footer i.sa-close:hover { 103 opacity: 0.5; 104 } 105 106 .site-alert.sticky-footer .site-alert-content .short-length { 107 display: block; 108 } 109 110 .site-alert.sticky-footer.expand .site-alert-content .short-length { 111 display: none; 112 } 113 114 .site-alert.sticky-footer.expand .site-alert-content .full-length { 115 display: block; 116 } 117 118 .site-alert.sticky-footer .site-alert-content .full-length { 119 display: none; 120 } 121 57 122 .site-alert.ispopup { 58 123 width: 100%; -
super-simple-site-alert/trunk/public/partials/site-alert-public-display.php
r2728698 r2816182 83 83 $excluded_sites = explode(',', get_post_meta($post_id, 'exclude', true)); 84 84 $option_is_static = get_post_meta($post_id, 'isstatic', true) == 1 ? 'isstatic' : ''; 85 $option_is_sticky_footer = get_post_meta($post_id, 'isstickyfooter', true) == 1 ? 'isstickyfooter' : ''; 85 86 $option_is_popup = get_post_meta($post_id, 'ispopup', true) == 1 ? 'ispopup' : ''; 86 87 $publish_date = get_post_meta($post_id, 'publish-date', true); … … 95 96 </div> 96 97 <?PHP 97 }98 } 98 99 if($option_is_popup){ 99 100 ?> … … 113 114 </div> 114 115 </div> 116 </div> 117 </div> 118 <?PHP 119 } 120 if($option_is_sticky_footer){ 121 ?> 122 <div class="site-alert sticky-footer <?PHP print esc_attr($priority_class);?>" style="border-color: <?PHP print esc_attr($priority_color_border);?>; background: <?PHP print esc_attr($priority_color_bg);?>; color: <?PHP print esc_attr($priority_color_text);?>" data-id="<?PHP print esc_attr($post_id);?>"> 123 <i class="sa-closed dashicons dashicons-warning" alt="Alert Notification" title="Alert Notification"></i> 124 <div class="site-alert-content"> 125 <i class="sa-close dashicons dashicons-no"></i> 126 <?PHP 127 $full_message = wp_kses_post($message); 128 $length = 50; 129 $short_message = sssa_truncate_html($full_message, $length)."..."; 130 ?> 131 <div class="short-length"><?PHP print $short_message;?></div> 132 <div class="full-length"><?PHP print $full_message;?></div> 115 133 </div> 116 134 </div> … … 154 172 }); 155 173 } 174 175 handleStickyFooterAlert(); 156 176 }); 157 177 … … 192 212 } 193 213 214 //handle sticky footer 215 function handleStickyFooterAlert() { 216 $('.site-alert.sticky-footer').each(function(i, e){ 217 var alert = $(e); 218 var id = alert.data('id'); 219 var storageId = sssa_getHost() + "___" + id; 220 if(storage.getItem(storageId)){ 221 //if alert is set as 'do not show' by the browser 222 alert.addClass('truncate'); 223 } 224 225 var offset = 5; 226 var height = alert.outerHeight(); 227 var pos = 10 + (height * i) + (i * 5); 228 alert.css('bottom', pos); 229 230 //while is open 231 alert.find('i.sa-close').on('click', function(e){ 232 e.stopPropagation(); 233 alert.addClass('truncate'); 234 alert.removeClass('expand'); 235 storage.setItem(storageId, Date.now()); 236 }); 237 238 alert.on('click', function(){ 239 if(!alert.hasClass('truncate')) { 240 if(!alert.hasClass('expand')) { 241 $('.site-alert.sticky-footer').removeClass('expand'); 242 alert.addClass('expand'); 243 alert.removeClass('truncate'); 244 }else{ 245 alert.addClass('truncate'); 246 alert.removeClass('expand'); 247 } 248 }else{ 249 alert.addClass('expand'); 250 alert.removeClass('truncate'); 251 storage.removeItem(storageId); 252 } 253 }); 254 }); 255 } 256 194 257 function siteAlertCheckDom(e, name, insertion){ 195 258 var _tag = $(name); -
super-simple-site-alert/trunk/site-alert.php
r2791424 r2816182 13 13 * Plugin URI: 14 14 * Description: Broadcast simple, important alerts across your multisite network. Also great for single sites. 15 * Version: 1. 215 * Version: 1.3 16 16 * Requires at least: 5.7 17 17 * Requires PHP: 7.3 … … 32 32 * Rename this for your plugin and update it as you release new versions. 33 33 */ 34 define( 'SITE_ALERT_VERSION', '1. 2' );34 define( 'SITE_ALERT_VERSION', '1.3' ); 35 35 36 36 /**
Note: See TracChangeset
for help on using the changeset viewer.