Skip to Content
Menu

has_business_hours()

Check if business hours Nebula option has data.

PHP April 27, 2017

Usage

PHP
nebula()->has_business_hours()

Parameters

This function does not accept any parameters. Is this incorrect?

Source File

Located in /libs/Functions.php on line 1921.

No Hooks

This function does not have any filters or actions available. Request one?
PHP
        public function has_business_hours(){
            //Check object cache first so the loop logic does not need to run more than once
            $has_business_hours = wp_cache_get('has_business_hours');
            if ( is_string($has_business_hours) ){
                if ( strtolower($has_business_hours) === 'true' ){
                    return true;
                }

                return false;
            }

            foreach ( array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday') as $weekday ){
                if ( $this->get_option('business_hours_' . $weekday . '_enabled') || $this->get_option('business_hours_' . $weekday . '_open') || $this->get_option('business_hours_' . $weekday . '_close') ){
                    wp_cache_set('has_business_hours', 'true');
                    return true;
                }
            }

            wp_cache_set('has_business_hours', 'false');
            return false;
        }

Override

This function can not be short-circuited with an override filter. Request one?