/** * Method to get WR MegaMenu settings. * * @param boolean $update_options Whether to update options array with real value or not? * * @return array */ public static function get($update_options = false) { if (!isset(self::$settings)) { // Get current settings $settings = get_option('wr_megamenu_settings', array()); // Apply default settings if neccessary if (!$update_options && !count($settings)) { foreach (self::$options['fields'] as $name => $value) { if (isset($value['default'])) { $settings[$name] = $value['default']; } } } self::$settings = $settings; } // Update options array if requested if ($update_options) { // Set current settings to field values if (count(self::$settings)) { foreach (self::$settings as $name => $value) { self::$options['fields'][$name]['value'] = $value; } } // Get WooRockets customer account $customer_account = get_option('wr_mm_customer_account', null); if (!empty($customer_account)) { foreach (array('username', 'password') as $field) { self::$options['fields']["customer-{$field}"]['value'] = $customer_account[$field]; } } } return self::$settings; }