golden hour
/home/godaofbq/hardchambers.com/wp-content/plugins/quicker-pro/utils
⬆️ Go Up
Upload
File/Folder
Size
Actions
helper.php
2.59 KB
Del
OK
singleton.php
312 B
Del
OK
Edit: helper.php
<?php namespace QuickerPro\Utils; defined( 'ABSPATH' ) || exit; /** * Helper function */ class Helper { use Singleton; /** * Show Notices */ public static function push( $notice ) { $defaults = array( 'id' => '', 'type' => 'info', 'show_if' => true, 'message' => '', 'class' => 'active-notice', 'dismissible' => false, 'btn' => array(), 'dismissible-meta' => 'user', 'dismissible-time' => WEEK_IN_SECONDS, 'data' => '', ); $notice = wp_parse_args( $notice, $defaults ); $classes = array( 'notice', 'notice' ); $classes[] = $notice['class']; if ( isset( $notice['type'] ) ) { $classes[] = 'notice-' . $notice['type']; } // Is notice dismissible? if ( true === $notice['dismissible'] ) { $classes[] = 'is-dismissible'; // Dismissable time. $notice['data'] = ' dismissible-time=' . esc_attr( $notice['dismissible-time'] ) . ' '; } // Notice ID. $notice_id = 'sites-notice-id-' . $notice['id']; $notice['id'] = $notice_id; if ( ! isset( $notice['id'] ) ) { $notice_id = 'sites-notice-id-' . $notice['id']; $notice['id'] = $notice_id; } else { $notice_id = $notice['id']; } $notice['classes'] = implode( ' ', $classes ); // User meta. $notice['data'] .= ' dismissible-meta=' . esc_attr( $notice['dismissible-meta'] ) . ' '; if ( 'user' === $notice['dismissible-meta'] ) { $expired = get_user_meta( get_current_user_id(), $notice_id, true ); } elseif ( 'transient' === $notice['dismissible-meta'] ) { $expired = get_transient( $notice_id ); } // Notice visible after transient expire. if ( isset( $notice['show_if'] ) ) { if ( true === $notice['show_if'] ) { // Is transient expired? if ( false === $expired || empty( $expired ) ) { self::markup( $notice ); } } } else { self::markup( $notice ); } } /** * Markup Notice. */ public static function markup( $notice = [] ) { ?> <div id="<?php echo esc_attr( $notice['id'] ); ?>" class="<?php echo esc_attr( $notice['classes'] ); ?>" <?php echo esc_html( $notice['data'] ); ?>> <p> <?php echo esc_html($notice['message']); ?> </p> <?php if ( !empty( $notice['btn'] ) ): ?> <p> <a href="<?php echo esc_url( $notice['btn']['url'] ); ?>" class="button-primary"><?php echo esc_html( $notice['btn']['label'] ); ?></a> </p> <?php endif;?> </div> <?php } /** * Admin pages array */ public static function admin_pages_id( ) { $admin_pages = array('quicker_page_quicker-license'); return $admin_pages; } }
Save