Changeset 3385393
- Timestamp:
- 10/27/2025 05:30:58 PM (5 months ago)
- Location:
- festival-banner/trunk
- Files:
-
- 4 edited
-
admin/partials/meta-box-behavior.php (modified) (1 diff)
-
includes/class-festival-banner-query.php (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
-
uninstall.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
festival-banner/trunk/admin/partials/meta-box-behavior.php
r3384808 r3385393 18 18 19 19 // Default to true. 20 if ( '' === $is_dismissible ) {21 $is_dismissible = true;22 }20 // if ( '' === $is_dismissible ) { 21 // $is_dismissible = true; 22 // } 23 23 24 24 // Check if modal (always dismissible). -
festival-banner/trunk/includes/class-festival-banner-query.php
r3384808 r3385393 77 77 78 78 // Cache for 1 hour. 79 // set_transient( $cache_key, $banners, HOUR_IN_SECONDS ); 79 80 set_transient( $cache_key, $banners, HOUR_IN_SECONDS ); 80 81 … … 133 134 $banner->cta_bg_color = $banner->cta_bg_color ? $banner->cta_bg_color : '#ffffff'; 134 135 $banner->cta_text_color = $banner->cta_text_color ? $banner->cta_text_color : '#000000'; 135 $banner->is_dismissible = ( '' === $banner->is_dismissible ) ? true : $banner->is_dismissible;136 // $banner->is_dismissible = ( '' === $banner->is_dismissible ) ? true : $banner->is_dismissible; 136 137 137 138 return $banner; -
festival-banner/trunk/readme.txt
r3384808 r3385393 73 73 * Initial release with customizable banner options, scheduling, and responsive layout. 74 74 75 = 1.1.0 (Date: Oct 27, 2025) = 76 * Clear cache when uninstall 77 * Remove all data when delete plugin 78 * Fix: Default dismissable behavior 79 80 75 81 == Upgrade Notice == 76 82 -
festival-banner/trunk/uninstall.php
r3384808 r3385393 1 1 <?php 2 /** 3 * Fired when the plugin is uninstalled. 4 * 5 * When populating this file, consider the following flow 6 * of control: 7 * 8 * - This method should be static 9 * - Check if the $_REQUEST content actually is the plugin name 10 * - Run an admin referrer check to make sure it goes through authentication 11 * - Verify the output of $_GET makes sense 12 * - Repeat with other user roles. Best directly by using the links/query string parameters. 13 * - Repeat things for multisite. Once for a single site in the network, once sitewide. 14 * 15 * @since 1.0.0 16 * 17 * @package Festival_Banner 18 */ 19 2 20 // If uninstall not called from WordPress, then exit. 3 21 if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { 4 22 exit; 5 23 } 24 25 /** 26 * Delete all festival banner posts. 27 */ 28 function festival_banner_delete_all_posts() { 29 global $wpdb; 30 31 // Get all banner post IDs. 32 $banner_ids = $wpdb->get_col( 33 $wpdb->prepare( 34 "SELECT ID FROM {$wpdb->posts} WHERE post_type = %s", 35 'festival_banner' 36 ) 37 ); 38 39 // Delete each banner and its meta data. 40 foreach ( $banner_ids as $banner_id ) { 41 // Delete all post meta. 42 $wpdb->delete( 43 $wpdb->postmeta, 44 array( 'post_id' => $banner_id ), 45 array( '%d' ) 46 ); 47 48 // Delete the post. 49 $wpdb->delete( 50 $wpdb->posts, 51 array( 'ID' => $banner_id ), 52 array( '%d' ) 53 ); 54 } 55 } 56 57 /** 58 * Delete all plugin options. 59 */ 60 function festival_banner_delete_options() { 61 // Delete plugin options. 62 delete_option( 'festival_banner_version' ); 63 delete_option( 'festival_banner_activated_time' ); 64 delete_option( 'festival_banner_deactivated_time' ); 65 delete_option( 'festival_banner_options' ); 66 } 67 68 /** 69 * Delete all plugin transients. 70 */ 71 function festival_banner_delete_transients() { 72 global $wpdb; 73 74 // Delete all festival banner transients. 75 $wpdb->query( 76 $wpdb->prepare( 77 "DELETE FROM {$wpdb->options} 78 WHERE option_name LIKE %s 79 OR option_name LIKE %s", 80 $wpdb->esc_like( '_transient_festival_banner_' ) . '%', 81 $wpdb->esc_like( '_transient_timeout_festival_banner_' ) . '%' 82 ) 83 ); 84 } 85 86 /** 87 * Multisite uninstall. 88 */ 89 function festival_banner_uninstall_multisite() { 90 global $wpdb; 91 92 // Get all blog IDs. 93 $blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" ); 94 95 foreach ( $blog_ids as $blog_id ) { 96 switch_to_blog( $blog_id ); 97 festival_banner_uninstall_single_site(); 98 restore_current_blog(); 99 } 100 } 101 102 /** 103 * Single site uninstall. 104 */ 105 function festival_banner_uninstall_single_site() { 106 // Delete all posts. 107 festival_banner_delete_all_posts(); 108 109 // Delete all options. 110 festival_banner_delete_options(); 111 112 // Delete all transients. 113 festival_banner_delete_transients(); 114 115 // Clear any cached data. 116 wp_cache_flush(); 117 } 118 119 /** 120 * Main uninstall function. 121 */ 122 if ( is_multisite() ) { 123 // Multisite installation. 124 festival_banner_uninstall_multisite(); 125 } else { 126 // Single site installation. 127 festival_banner_uninstall_single_site(); 128 }
Note: See TracChangeset
for help on using the changeset viewer.