r_remove_shop' => $this->getOption('br_remove_shop'), )); } public function suffixSection() { $this->fileManager->includeTemplate('admin/section/suffix.php', array( 'suffix' => $this->getOption('suffix', ''), 'enable_suffix_products' => $this->getOption('enable_suffix_products', 'no'), 'enable_suffix_categories' => $this->getOption('enable_suffix_categories', 'no'), 'product' => $this->getOption('product'), 'category' => $this->getOption('category') )); } /** * Update Settings * * @param mixed $settings * @return void */ public function updateSettings($settings) { $this->fixWPWCSettings($settings); if (! empty($settings['suffix'])) { esc_url_raw($settings['suffix']); } return $settings; } /** * Fix WP WC Settings * * @param mixed $options * @return void */ private function fixWPWCSettings($options) { if (isset($options['product']) && !empty($options['product']) || isset($options['category']) && !empty($options['category'])) { if (! get_option('permalink_structure')) { update_option('permalink_structure', self::PERMALINK_STRUCTURE); }; } if (isset($options['product']) && !empty($options['product'])) { if ('slug' === $options['product']) { $wc['product_base'] = self::PERMALINK_WC_PRODUCT; } if (in_array($options['product'], array( 'category_slug', 'hierarchical' ))) { $wc['product_base'] = self::PERMALINK_WC_PRODUCT_CAT; } update_option('woocommerce_permalinks', $wc); } } /** * Get Option * * @param string $key * @param mixed|null $default * * @return mixed|null */ public function getOption($key, $default = null) { if (! isset($this->options)) { $this->options = get_option(self::OPTIONS); } return isset($this->options[ $key ]) ? $this->options[ $key ] : $default; } }