From 9e4aab2dbaaf56bbbab95d30b887f2c6e8ae8b28 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:22:21 +0100 Subject: [PATCH 01/45] Update composer.json --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index f1085055..dd878075 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,7 @@ { "require": { "php": "^8.1.0", + "rrze/wp": "^2.0", "johngrogg/ics-parser": "^3.3.1", "rlanvin/php-rrule": "^2.4.1", "cmb2/cmb2": "^2.10.1" From 0668760b35b3a268efe66dcdf39013cea6fe6ccf Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:22:25 +0100 Subject: [PATCH 02/45] Delete Builder.php --- includes/Options/Builder.php | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 includes/Options/Builder.php diff --git a/includes/Options/Builder.php b/includes/Options/Builder.php deleted file mode 100644 index 999f11cd..00000000 --- a/includes/Options/Builder.php +++ /dev/null @@ -1,27 +0,0 @@ -enqueued[$handle] = $callback; - } - - public function remove($handle) - { - unset($this->enqueued[$handle]); - } - - public function enqueue() - { - foreach ($this->enqueued as $enqueue) { - $enqueue(); - } - } -} From b4d83596a50dc6f6d7fc8251c96486fc83ee8b07 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:22:28 +0100 Subject: [PATCH 03/45] Delete Encryption.php --- includes/Options/Encryption.php | 102 -------------------------------- 1 file changed, 102 deletions(-) delete mode 100644 includes/Options/Encryption.php diff --git a/includes/Options/Encryption.php b/includes/Options/Encryption.php deleted file mode 100644 index 5ac10a75..00000000 --- a/includes/Options/Encryption.php +++ /dev/null @@ -1,102 +0,0 @@ - Date: Mon, 19 Feb 2024 15:22:31 +0100 Subject: [PATCH 04/45] Delete Error.php --- includes/Options/Error.php | 45 -------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 includes/Options/Error.php diff --git a/includes/Options/Error.php b/includes/Options/Error.php deleted file mode 100644 index 7439b778..00000000 --- a/includes/Options/Error.php +++ /dev/null @@ -1,45 +0,0 @@ -error = new \WP_Error; - $this->settings = $settings; - } - - public function getAll() - { - global $wp_settings_error; - - return $wp_settings_error[$this->settings->optionName] ?? false; - } - - public function get($key) - { - $errors = $this->getAll(); - - if (! is_wp_error($errors)) { - return; - } - - return $errors->get_error_message($key); - } - - public function add($key, $message) - { - global $wp_settings_error; - - $this->error->add($key, $message); - - $wp_settings_error[$this->settings->optionName] = $this->error; - } -} From 77d31cac7b147b3b84f8a40f1c7c8184594d46a2 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:22:33 +0100 Subject: [PATCH 05/45] Delete ButtonLink.php --- includes/Options/Fields/ButtonLink.php | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 includes/Options/Fields/ButtonLink.php diff --git a/includes/Options/Fields/ButtonLink.php b/includes/Options/Fields/ButtonLink.php deleted file mode 100644 index 9d683bd9..00000000 --- a/includes/Options/Fields/ButtonLink.php +++ /dev/null @@ -1,10 +0,0 @@ - Date: Mon, 19 Feb 2024 15:22:46 +0100 Subject: [PATCH 06/45] Delete Checkbox.php --- includes/Options/Fields/Checkbox.php | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 includes/Options/Fields/Checkbox.php diff --git a/includes/Options/Fields/Checkbox.php b/includes/Options/Fields/Checkbox.php deleted file mode 100644 index 9b756c40..00000000 --- a/includes/Options/Fields/Checkbox.php +++ /dev/null @@ -1,20 +0,0 @@ - Date: Mon, 19 Feb 2024 15:22:49 +0100 Subject: [PATCH 07/45] Delete CheckboxMultiple.php --- includes/Options/Fields/CheckboxMultiple.php | 22 -------------------- 1 file changed, 22 deletions(-) delete mode 100644 includes/Options/Fields/CheckboxMultiple.php diff --git a/includes/Options/Fields/CheckboxMultiple.php b/includes/Options/Fields/CheckboxMultiple.php deleted file mode 100644 index e8a6792b..00000000 --- a/includes/Options/Fields/CheckboxMultiple.php +++ /dev/null @@ -1,22 +0,0 @@ - Date: Mon, 19 Feb 2024 15:22:51 +0100 Subject: [PATCH 08/45] Delete Choices.php --- includes/Options/Fields/Choices.php | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 includes/Options/Fields/Choices.php diff --git a/includes/Options/Fields/Choices.php b/includes/Options/Fields/Choices.php deleted file mode 100644 index c8a788f9..00000000 --- a/includes/Options/Fields/Choices.php +++ /dev/null @@ -1,10 +0,0 @@ - Date: Mon, 19 Feb 2024 15:22:53 +0100 Subject: [PATCH 09/45] Delete Field.php --- includes/Options/Fields/Field.php | 107 ------------------------------ 1 file changed, 107 deletions(-) delete mode 100644 includes/Options/Fields/Field.php diff --git a/includes/Options/Fields/Field.php b/includes/Options/Fields/Field.php deleted file mode 100644 index fae68661..00000000 --- a/includes/Options/Fields/Field.php +++ /dev/null @@ -1,107 +0,0 @@ -section = $section; - $this->args = $args; - } - - public function render() - { - return Template::include('fields/' . $this->template, ['option' => $this]); - } - - public function hasError() - { - return $this->section->tab->settings->errors->get($this->getArg('name')); - } - - public function sanitize($value) - { - return sanitize_text_field($value); - } - - public function validate($value) - { - return true; - } - - public function getArg($key, $fallback = null) - { - if (empty($this->args[$key])) { - return $fallback; - } - - if (is_callable($this->args[$key])) { - return $this->args[$key](); - } - - return $this->args[$key]; - } - - public function getLabel() - { - return esc_attr($this->getArg('label')); - } - - public function getIdAttribute() - { - return $this->getArg('id', sanitize_title(str_replace('[', '_', $this->getNameAttribute()))); - } - - public function getName() - { - return $this->getArg('name'); - } - - public function getPlaceholderAttribute() - { - $placeholder = $this->getArg('placeholder') ?? false; - return $placeholder ?: null; - } - - public function getCss() - { - return $this->getArg('css', []); - } - - public function getInputClassAttribute() - { - $class = $this->getCss()['input_class'] ?? null; - - return !empty($class) ? esc_attr($class) : null; - } - - public function getLabelClassAttribute() - { - $class = $this->getCss()['label_class'] ?? null; - - return !empty($class) ? esc_attr($class) : null; - } - - public function getNameAttribute() - { - return $this->section->tab->settings->optionName . '[' . $this->getArg('name') . ']'; - } - - public function getValueAttribute() - { - $value = get_option($this->section->tab->settings->optionName)[$this->getArg('name')] ?? false; - - return $value ? $value : $this->args['default'] ?? null; - } -} From 9ac2dd4bc1581ca9a7a3410a31f626faabe170a2 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:22:56 +0100 Subject: [PATCH 10/45] Delete Password.php --- includes/Options/Fields/Password.php | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 includes/Options/Fields/Password.php diff --git a/includes/Options/Fields/Password.php b/includes/Options/Fields/Password.php deleted file mode 100644 index 4fb89c2e..00000000 --- a/includes/Options/Fields/Password.php +++ /dev/null @@ -1,24 +0,0 @@ -section->tab->settings->optionName)[$this->getArg('name')] ?? false; - - return $value ? Encryption::decrypt($value) : null; - } - - public function sanitize($value) - { - return Encryption::encrypt($value); - } -} From a8d74f9092b85bf0171780f42c3b2bd1e5ec7603 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:22:59 +0100 Subject: [PATCH 11/45] Delete Select.php --- includes/Options/Fields/Select.php | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 includes/Options/Fields/Select.php diff --git a/includes/Options/Fields/Select.php b/includes/Options/Fields/Select.php deleted file mode 100644 index b9ba5f8a..00000000 --- a/includes/Options/Fields/Select.php +++ /dev/null @@ -1,10 +0,0 @@ - Date: Mon, 19 Feb 2024 15:23:02 +0100 Subject: [PATCH 12/45] Delete SelectMultiple.php --- includes/Options/Fields/SelectMultiple.php | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 includes/Options/Fields/SelectMultiple.php diff --git a/includes/Options/Fields/SelectMultiple.php b/includes/Options/Fields/SelectMultiple.php deleted file mode 100644 index e700be0a..00000000 --- a/includes/Options/Fields/SelectMultiple.php +++ /dev/null @@ -1,22 +0,0 @@ - Date: Mon, 19 Feb 2024 15:23:04 +0100 Subject: [PATCH 13/45] Delete Text.php --- includes/Options/Fields/Text.php | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 includes/Options/Fields/Text.php diff --git a/includes/Options/Fields/Text.php b/includes/Options/Fields/Text.php deleted file mode 100644 index 9df6a93d..00000000 --- a/includes/Options/Fields/Text.php +++ /dev/null @@ -1,10 +0,0 @@ - Date: Mon, 19 Feb 2024 15:23:07 +0100 Subject: [PATCH 14/45] Delete Textarea.php --- includes/Options/Fields/Textarea.php | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 includes/Options/Fields/Textarea.php diff --git a/includes/Options/Fields/Textarea.php b/includes/Options/Fields/Textarea.php deleted file mode 100644 index a5e98fad..00000000 --- a/includes/Options/Fields/Textarea.php +++ /dev/null @@ -1,15 +0,0 @@ - Date: Mon, 19 Feb 2024 15:23:10 +0100 Subject: [PATCH 15/45] Delete TextSecure.php --- includes/Options/Fields/TextSecure.php | 28 -------------------------- 1 file changed, 28 deletions(-) delete mode 100644 includes/Options/Fields/TextSecure.php diff --git a/includes/Options/Fields/TextSecure.php b/includes/Options/Fields/TextSecure.php deleted file mode 100644 index c441e7f4..00000000 --- a/includes/Options/Fields/TextSecure.php +++ /dev/null @@ -1,28 +0,0 @@ -section->tab->settings->optionName)[$this->getArg('name')] ?? false; - - return $value ? Encryption::decrypt($value) : null; - } - - public function sanitize($value) - { - if (false !== stripos($value, '***')) { - $value = $this->getValueAttribute(); - } - $value = sanitize_text_field($value); - return Encryption::encrypt($value); - } -} From f30b08783bc8483d37700b7a5aaf3a1126ea835a Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:23:13 +0100 Subject: [PATCH 16/45] Delete Flash.php --- includes/Options/Flash.php | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 includes/Options/Flash.php diff --git a/includes/Options/Flash.php b/includes/Options/Flash.php deleted file mode 100644 index 643ba925..00000000 --- a/includes/Options/Flash.php +++ /dev/null @@ -1,29 +0,0 @@ -settings = $settings; - } - - public function has() - { - global $wp_settings_flash; - - return $wp_settings_flash[$this->settings->optionName] ?? null; - } - - public function set($status, $message) - { - global $wp_settings_flash; - - $wp_settings_flash[$this->settings->optionName] = compact('status', 'message'); - } -} From 095f35fede80f1494ea0d0ee1cb115ec6e29753b Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:23:15 +0100 Subject: [PATCH 17/45] Delete Option.php --- includes/Options/Option.php | 107 ------------------------------------ 1 file changed, 107 deletions(-) delete mode 100644 includes/Options/Option.php diff --git a/includes/Options/Option.php b/includes/Options/Option.php deleted file mode 100644 index 463f2442..00000000 --- a/includes/Options/Option.php +++ /dev/null @@ -1,107 +0,0 @@ -section = $section; - $this->type = $type; - $this->args = $args; - - $typeMap = [ - 'text' => Text::class, - 'checkbox' => Checkbox::class, - 'checkbox-multiple' => CheckboxMultiple::class, - 'choices' => Choices::class, - 'textarea' => Textarea::class, - 'password' => Password::class, - 'select' => Select::class, - 'select-multiple' => SelectMultiple::class, - 'text-secure' => TextSecure::class, - 'button-link' => ButtonLink::class - ]; - - $this->implementation = new $typeMap[$this->type]($section, $args); - } - - public function getArg($key, $fallback = null) - { - return $this->args[$key] ?? $fallback; - } - - public function sanitize($value) - { - if (is_callable($this->getArg('sanitize'))) { - return $this->getArg('sanitize')($value); - } - - return $this->implementation->sanitize($value); - } - - public function validate($value) - { - if (is_array($this->getArg('validate'))) { - foreach ($this->getArg('validate') as $validate) { - if (!is_callable($validate['callback'])) { - continue; - } - - $valid = $validate['callback']($value); - - if (!$valid) { - $this->section->tab->settings->errors->add($this->getArg('name'), $validate['feedback']); - - return false; - } - } - - return true; - } - - if (is_callable($this->getArg('validate'))) { - return $this->getArg('validate')($value); - } - - return $this->implementation->validate($value); - } - - public function render() - { - if (is_callable($this->getArg('visible')) && $this->getArg('visible')() === false) { - return; - } - - if (is_callable($this->getArg('render'))) { - echo $this->getArg('render')($this->implementation); - - return; - } - - echo $this->implementation->render(); - } -} From 4c2cae2fe3e2504c07c77ffc238c992d725ca6b9 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:23:19 +0100 Subject: [PATCH 18/45] Delete Section.php --- includes/Options/Section.php | 41 ------------------------------------ 1 file changed, 41 deletions(-) delete mode 100644 includes/Options/Section.php diff --git a/includes/Options/Section.php b/includes/Options/Section.php deleted file mode 100644 index dd3f8610..00000000 --- a/includes/Options/Section.php +++ /dev/null @@ -1,41 +0,0 @@ -tab = $tab; - $this->title = $title; - $this->args = $args; - $this->slug = $this->args['slug'] ?? sanitize_title($title); - $this->description = $this->args['description'] ?? null; - $this->as_link = $this->args['as_link'] ?? false; - } - - public function addOption($type, $args = []) - { - $option = new Option($this, $type, $args); - - $this->options[] = $option; - - return $option; - } -} From 1f6c4b2dc00b0c4e8d6b75b492f4b1acdf2fd018 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:23:22 +0100 Subject: [PATCH 19/45] Delete Settings.php --- includes/Options/Settings.php | 330 ---------------------------------- 1 file changed, 330 deletions(-) delete mode 100644 includes/Options/Settings.php diff --git a/includes/Options/Settings.php b/includes/Options/Settings.php deleted file mode 100644 index 54624636..00000000 --- a/includes/Options/Settings.php +++ /dev/null @@ -1,330 +0,0 @@ -title = $title; - $this->optionName = strtolower(str_replace('-', '_', sanitize_title($this->title))); - $this->slug = $slug; - - if ($this->slug === null) { - $this->slug = sanitize_title($title); - } - } - - public function setMenuParentSlug($slug) - { - $this->parentSlug = $slug; - return $this; - } - - public function setMenuTitle($title) - { - $this->menuTitle = $title; - return $this; - } - - public function getMenuTitle() - { - return $this->menuTitle ?? $this->title; - } - - public function setCapability($capability) - { - $this->capability = $capability; - return $this; - } - - public function setOptionName($name) - { - $this->optionName = $name; - return $this; - } - - public function setMenuIcon($icon) - { - $this->menuIcon = $icon; - return $this; - } - - public function setMenuPosition($position) - { - $this->menuPosition = $position; - return $this; - } - - public function addToMenu() - { - if ($this->parentSlug) { - add_submenu_page( - $this->parentSlug, - $this->title, - $this->getMenuTitle(), - $this->capability, - $this->slug, - [$this, 'render'], - $this->menuPosition - ); - } else { - add_menu_page( - $this->title, - $this->getMenuTitle(), - $this->capability, - $this->slug, - [$this, 'render'], - $this->menuIcon, - $this->menuPosition - ); - } - } - - public function build() - { - $this->errors = new Error($this); - $this->flash = new Flash($this); - - add_action('admin_init', [$this, 'save'], 20); - add_action('admin_menu', [$this, 'addToMenu'], 20); - add_action('admin_head', [$this, 'styling'], 20); - } - - public function isOnSettingsPage() - { - $screen = get_current_screen(); - if (is_null($screen)) { - return false; - } - - if ($screen->base === 'settings_page_' . $this->slug) { - return true; - } - - return false; - } - - public function styling() - { - if (!$this->isOnSettingsPage()) { - return; - } - - echo ''; - } - - public function getTabBySlug($slug) - { - foreach ($this->tabs as $tab) { - if ($tab->slug === $slug) { - return $tab; - } - } - - return false; - } - - public function getActiveTab() - { - $default = $this->tabs[0] ?? false; - - if (isset($_GET['tab'])) { - return in_array($_GET['tab'], array_map(function ($tab) { - return $tab->slug; - }, $this->tabs)) ? $this->getTabBySlug($_GET['tab']) : $default; - } - - return $default; - } - - public function addTab($title, $slug = null) - { - $tab = new Tab($this, $title, $slug); - - $this->tabs[] = $tab; - - return $tab; - } - - public function addSection($title, $args = []) - { - if (empty($this->tabs)) { - $tab = $this->addTab('Unnamed tab'); - } else { - $tab = end($this->tabs); - } - - return $tab->addSection($title, $args); - } - - public function addOption($type, $args = []) - { - $tab = end($this->tabs); - - if (!$tab instanceof Tab) { - return false; - } - - $section = end($tab->sections); - - if (!$section instanceof Section) { - return false; - } - - return $section->addOption($type, $args); - } - - public function shouldMakeTabs() - { - return count($this->tabs) > 1; - } - - public function getUrl() - { - if ($this->parentSlug && strpos($this->parentSlug, '.php') !== false) { - return add_query_arg('page', $this->slug, admin_url($this->parentSlug)); - } - - return admin_url("admin.php?page=$this->slug"); - } - - public function getFullUrl() - { - $params = []; - - if ($active_tab = $this->getActiveTab()) { - $params['tab'] = $active_tab->slug; - - if ($active_section = $active_tab->getActiveSection()) { - $params['section'] = $active_section->slug; - } - } - - return add_query_arg($params, $this->getUrl()); - } - - public function renderTabMenu() - { - if (!$this->shouldMakeTabs()) { - return; - } - - Template::include('tab-menu', ['settings' => $this]); - } - - public function renderActiveSections() - { - Template::include('sections', ['settings' => $this]); - } - - public function render() - { - Worker::setBuilder(new Builder); - - Worker::enqueue(); - - Template::include('settings-page', ['settings' => $this]); - } - - public function save() - { - if ( - !isset($_POST['rrze_calendar_settings_save']) - || !wp_verify_nonce( - $_POST['rrze_calendar_settings_save'], - 'rrze_calendar_settings_save_' . $this->optionName - ) - ) { - return; - } - - if (!current_user_can($this->capability)) { - wp_die(__('You do not have enough permissions to do that.', 'rrze-calendar')); - } - - $currentOptions = $this->getOptions(); - $submittedOptions = $_POST[$this->optionName] ?? []; - $newOptions = $currentOptions; - - foreach ($this->getActiveTab()->getActiveSections() as $section) { - foreach ($section->options as $option) { - $value = $submittedOptions[$option->implementation->getName()] ?? null; - - $valid = $option->validate($value); - - if (!$valid) { - continue; - } - - $value = $option->sanitize($value); - - $newOptions[$option->implementation->getName()] = $value; - } - } - - $this->updateOptions($newOptions); - - $this->flash->set('success', __('Settings saved.', 'rrze-calendar')); - } - - public function defaultOptions() - { - $options = []; - foreach ($this->tabs as $tab) { - foreach ($tab->sections as $section) { - foreach ($section->options as $option) { - $options[$option->args['name']] = $option->args['default'] ?? null; - } - } - } - - return $options; - } - - public function getOptions() - { - $defaults = $this->defaultOptions(); - $options = get_option($this->optionName, []); - $options = wp_parse_args($options, $defaults); - $options = array_intersect_key($options, $defaults); - - return $options; - } - - public function getOption($option) - { - $options = $this->getOptions(); - return $options[$option] ?? null; - } - - public function updateOptions($options) - { - update_option($this->optionName, $options); - do_action('rrze_calendar_post_update_option', $options); - } -} From 674dd3ed251dc873672d7caa2899454104ed9279 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:23:26 +0100 Subject: [PATCH 20/45] Delete Tab.php --- includes/Options/Tab.php | 88 ---------------------------------------- 1 file changed, 88 deletions(-) delete mode 100644 includes/Options/Tab.php diff --git a/includes/Options/Tab.php b/includes/Options/Tab.php deleted file mode 100644 index 54531262..00000000 --- a/includes/Options/Tab.php +++ /dev/null @@ -1,88 +0,0 @@ -title = $title; - $this->settings = $settings; - - if ($this->slug === null) { - $this->slug = sanitize_title($title); - } - } - - public function addSection($title, $args = []) - { - $section = new Section($this, $title, $args); - - $this->sections[] = $section; - - return $section; - } - - public function getSectionLinks() - { - return array_filter($this->sections, function ($section) { - return $section->as_link; - }); - } - - public function containsOnlySectionLinks() - { - return count($this->getSectionLinks()) === count($this->sections); - } - - public function getSectionByName($name) - { - foreach ($this->sections as $section) { - if ($section->slug == $name) { - return $section; - } - } - - return false; - } - - public function getActiveSection() - { - if (empty($this->getSectionLinks())) { - return; - } - - if (isset($_REQUEST['section'])) { - return $this->getSectionByName($_REQUEST['section']); - } - - if ($this->containsOnlySectionLinks()) { - return $this->sections[0]; - } - } - - public function getActiveSections() - { - if (!isset($_REQUEST['section']) && $this->containsOnlySectionLinks()) { - return [$this->sections[0]]; - } - - return \array_filter($this->sections, function ($section) { - if (isset($_REQUEST['section'])) { - return $section->as_link && $_REQUEST['section'] == $section->slug; - } - - return !$section->as_link; - }); - } -} From 34e7b346d4eb76900b2e0f2d48b1b56a5feb1184 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:23:28 +0100 Subject: [PATCH 21/45] Delete Template.php --- includes/Options/Template.php | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 includes/Options/Template.php diff --git a/includes/Options/Template.php b/includes/Options/Template.php deleted file mode 100644 index 5a1858d4..00000000 --- a/includes/Options/Template.php +++ /dev/null @@ -1,26 +0,0 @@ - $value) { - ${$name} = $value; - } - - $path = __DIR__ . "/templates/{$file}.php"; - if (!file_exists($path)) { - return; - } - - ob_start(); - - include $path; - - echo ob_get_clean(); - } -} From f3fd29fe21ccad898622e6146ec9727c9c01a517 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:23:31 +0100 Subject: [PATCH 22/45] Delete button-link.php --- .../Options/templates/fields/button-link.php | 23 ------------------- 1 file changed, 23 deletions(-) delete mode 100644 includes/Options/templates/fields/button-link.php diff --git a/includes/Options/templates/fields/button-link.php b/includes/Options/templates/fields/button-link.php deleted file mode 100644 index bdcffabb..00000000 --- a/includes/Options/templates/fields/button-link.php +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - getArg('text')); ?> - - getArg('description')) { ?> -

- - hasError()) { ?> -
- - - \ No newline at end of file From 404252bdcc02f20f4be04843fcd5a8f9236cb91e Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:23:33 +0100 Subject: [PATCH 23/45] Delete checkbox-multiple.php --- .../templates/fields/checkbox-multiple.php | 25 ------------------- 1 file changed, 25 deletions(-) delete mode 100644 includes/Options/templates/fields/checkbox-multiple.php diff --git a/includes/Options/templates/fields/checkbox-multiple.php b/includes/Options/templates/fields/checkbox-multiple.php deleted file mode 100644 index 147ceb8e..00000000 --- a/includes/Options/templates/fields/checkbox-multiple.php +++ /dev/null @@ -1,25 +0,0 @@ - - - getLabel(); ?> - -
- Standardeinstellungen für Beiträge - getArg('options', []) as $key => $label) : ?> -
- - getArg('description')) : ?> -

- hasError()) : ?> -
- - -
- - \ No newline at end of file From f38bf7c40d92091b7c9411f51817c95910652620 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:23:37 +0100 Subject: [PATCH 24/45] Delete checkbox.php --- .../Options/templates/fields/checkbox.php | 23 ------------------- 1 file changed, 23 deletions(-) delete mode 100644 includes/Options/templates/fields/checkbox.php diff --git a/includes/Options/templates/fields/checkbox.php b/includes/Options/templates/fields/checkbox.php deleted file mode 100644 index 4fe14eec..00000000 --- a/includes/Options/templates/fields/checkbox.php +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - hasError()) { ?> -
- - - \ No newline at end of file From f13a63b5f108efa275314e200bd7fc9488f77be0 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:23:39 +0100 Subject: [PATCH 25/45] Delete choices.php --- includes/Options/templates/fields/choices.php | 27 ------------------- 1 file changed, 27 deletions(-) delete mode 100644 includes/Options/templates/fields/choices.php diff --git a/includes/Options/templates/fields/choices.php b/includes/Options/templates/fields/choices.php deleted file mode 100644 index 49d0242f..00000000 --- a/includes/Options/templates/fields/choices.php +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - getArg('options', []) as $key => $label) { ?> -
- -
- - getArg('description')) { ?> -

- - hasError()) { ?> -
- - - \ No newline at end of file From cd509aecfe2e560e01e30309d4f45a356dddac14 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:23:41 +0100 Subject: [PATCH 26/45] Delete password.php --- .../Options/templates/fields/password.php | 21 ------------------- 1 file changed, 21 deletions(-) delete mode 100644 includes/Options/templates/fields/password.php diff --git a/includes/Options/templates/fields/password.php b/includes/Options/templates/fields/password.php deleted file mode 100644 index f28c3066..00000000 --- a/includes/Options/templates/fields/password.php +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - getArg('description')) { ?> -

- - hasError()) { ?> -
- - - \ No newline at end of file From 3132ef14901ae4adcde0109cfdf196954ed1aec2 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:23:43 +0100 Subject: [PATCH 27/45] Delete select-multiple.php --- .../templates/fields/select-multiple.php | 25 ------------------- 1 file changed, 25 deletions(-) delete mode 100644 includes/Options/templates/fields/select-multiple.php diff --git a/includes/Options/templates/fields/select-multiple.php b/includes/Options/templates/fields/select-multiple.php deleted file mode 100644 index c60031d8..00000000 --- a/includes/Options/templates/fields/select-multiple.php +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - getArg('description')) { ?> -

- - - hasError()) { ?> -
- - - \ No newline at end of file From c838fe38acf3f5d3a6b5f2e491898c86ef99b9b3 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:23:45 +0100 Subject: [PATCH 28/45] Delete select.php --- includes/Options/templates/fields/select.php | 24 -------------------- 1 file changed, 24 deletions(-) delete mode 100644 includes/Options/templates/fields/select.php diff --git a/includes/Options/templates/fields/select.php b/includes/Options/templates/fields/select.php deleted file mode 100644 index e763d262..00000000 --- a/includes/Options/templates/fields/select.php +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - getArg('description')) { ?> -

- - hasError()) { ?> -
- - - \ No newline at end of file From efe46bb179a0a571adecf24880e0cbb58d5c801a Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:23:48 +0100 Subject: [PATCH 29/45] Delete text-secure.php --- .../Options/templates/fields/text-secure.php | 22 ------------------- 1 file changed, 22 deletions(-) delete mode 100644 includes/Options/templates/fields/text-secure.php diff --git a/includes/Options/templates/fields/text-secure.php b/includes/Options/templates/fields/text-secure.php deleted file mode 100644 index 1ab177f0..00000000 --- a/includes/Options/templates/fields/text-secure.php +++ /dev/null @@ -1,22 +0,0 @@ -getValueAttribute()); -?> - - - - - - - getArg('description')) { ?> -

- - hasError()) { ?> -
- - - \ No newline at end of file From 55a09cb98f67f39846a60c315168b7ec8b86f6f0 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:23:52 +0100 Subject: [PATCH 30/45] Delete text.php --- includes/Options/templates/fields/text.php | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 includes/Options/templates/fields/text.php diff --git a/includes/Options/templates/fields/text.php b/includes/Options/templates/fields/text.php deleted file mode 100644 index ee7a6c25..00000000 --- a/includes/Options/templates/fields/text.php +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - getArg('description')) { ?> -

- - hasError()) { ?> -
- - - \ No newline at end of file From 750f76a0d33f5b980d29c96e05b52d5aebac9f2b Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:23:54 +0100 Subject: [PATCH 31/45] Delete textarea.php --- .../Options/templates/fields/textarea.php | 20 ------------------- 1 file changed, 20 deletions(-) delete mode 100644 includes/Options/templates/fields/textarea.php diff --git a/includes/Options/templates/fields/textarea.php b/includes/Options/templates/fields/textarea.php deleted file mode 100644 index 8e56e038..00000000 --- a/includes/Options/templates/fields/textarea.php +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - getArg('description')) { ?> -

- - hasError()) { ?> -
- - - \ No newline at end of file From a426df08aeeae4544fa78b9935b5f109d8a9882a Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:23:57 +0100 Subject: [PATCH 32/45] Delete section-menu.php --- includes/Options/templates/section-menu.php | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 includes/Options/templates/section-menu.php diff --git a/includes/Options/templates/section-menu.php b/includes/Options/templates/section-menu.php deleted file mode 100644 index 7df7487b..00000000 --- a/includes/Options/templates/section-menu.php +++ /dev/null @@ -1,13 +0,0 @@ - -getActiveTab()->getSectionLinks()) { ?> - - \ No newline at end of file From 4e7db744d074bd9a8becb2279583e56521eb98c3 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:23:59 +0100 Subject: [PATCH 33/45] Delete section.php --- includes/Options/templates/section.php | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 includes/Options/templates/section.php diff --git a/includes/Options/templates/section.php b/includes/Options/templates/section.php deleted file mode 100644 index 66b4c8e8..00000000 --- a/includes/Options/templates/section.php +++ /dev/null @@ -1,19 +0,0 @@ - -

title; ?>

- -description) { ?> -
description; ?>
- - - - - options as $option) { ?> - render(); ?> - - -
\ No newline at end of file From 158a4d3798fa5d1ec44010549e3d063d84a28e34 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:24:05 +0100 Subject: [PATCH 34/45] Delete sections.php --- includes/Options/templates/sections.php | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 includes/Options/templates/sections.php diff --git a/includes/Options/templates/sections.php b/includes/Options/templates/sections.php deleted file mode 100644 index 0564bfec..00000000 --- a/includes/Options/templates/sections.php +++ /dev/null @@ -1,17 +0,0 @@ - -
- - - getActiveTab()->getActiveSections() as $section) { ?> - - - - optionName, 'rrze_calendar_settings_save'); ?> - - -
\ No newline at end of file From d78dd00cf0c14137b87de36b244ecede7eb278c2 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:24:07 +0100 Subject: [PATCH 35/45] Delete settings-page.php --- includes/Options/templates/settings-page.php | 25 -------------------- 1 file changed, 25 deletions(-) delete mode 100644 includes/Options/templates/settings-page.php diff --git a/includes/Options/templates/settings-page.php b/includes/Options/templates/settings-page.php deleted file mode 100644 index 0c287add..00000000 --- a/includes/Options/templates/settings-page.php +++ /dev/null @@ -1,25 +0,0 @@ - -
-

title; ?>

- - flash->has()) { ?> -
-

-
- - - errors->getAll()) { ?> -
-

-
- - - renderTabMenu(); ?> - - renderActiveSections(); ?> -
\ No newline at end of file From ad80c3534b936502cd802d8972511daca2c919d5 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:24:10 +0100 Subject: [PATCH 36/45] Delete tab-menu.php --- includes/Options/templates/tab-menu.php | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 includes/Options/templates/tab-menu.php diff --git a/includes/Options/templates/tab-menu.php b/includes/Options/templates/tab-menu.php deleted file mode 100644 index 7f32dbbf..00000000 --- a/includes/Options/templates/tab-menu.php +++ /dev/null @@ -1,11 +0,0 @@ - - \ No newline at end of file From 39e34644a1c1cb0e14a54732b664b6581ca301cd Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:24:12 +0100 Subject: [PATCH 37/45] Delete Utils.php --- includes/Options/Utils.php | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 includes/Options/Utils.php diff --git a/includes/Options/Utils.php b/includes/Options/Utils.php deleted file mode 100644 index 27fc9c41..00000000 --- a/includes/Options/Utils.php +++ /dev/null @@ -1,28 +0,0 @@ - 0 && $count <= $hint) { - $value = str_pad($value, $count, '*', STR_PAD_LEFT); - } elseif ($count > $hint) { - $substr = substr($value, -$hint); - $value = str_pad($substr, $count, '*', STR_PAD_LEFT); - } - return $value; - } -} From 6362268198bb39e2122f598c9608f925beb11370 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:24:15 +0100 Subject: [PATCH 38/45] Delete Worker.php --- includes/Options/Worker.php | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 includes/Options/Worker.php diff --git a/includes/Options/Worker.php b/includes/Options/Worker.php deleted file mode 100644 index c74e9bc1..00000000 --- a/includes/Options/Worker.php +++ /dev/null @@ -1,35 +0,0 @@ -add($handle, $callback); - } - - public function remove($handle) - { - static::builder()->remove($handle); - } - - public static function enqueue() - { - static::builder()->enqueue(); - } -} From 316368527f75847c8f6d568c467c9bb1a7e1729e Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:24:17 +0100 Subject: [PATCH 39/45] Delete Plugin.php --- includes/Plugin.php | 204 -------------------------------------------- 1 file changed, 204 deletions(-) delete mode 100644 includes/Plugin.php diff --git a/includes/Plugin.php b/includes/Plugin.php deleted file mode 100644 index 5aa91d76..00000000 --- a/includes/Plugin.php +++ /dev/null @@ -1,204 +0,0 @@ -pluginFile = $pluginFile; - } - - /** - * loaded method - */ - public function loaded() - { - $this->setBasename() - ->setDirectory() - ->setUrl() - ->setVersion(); - } - - /** - * getFile method - * Get the full path and filename of the plugin. - * @return string The full path and filename. - */ - public function getFile(): string - { - return $this->pluginFile; - } - - /** - * getBasename method - * Get the basename of the plugin. - * @return string The basename. - */ - public function getBasename(): string - { - return $this->basename; - } - - /** - * setBasename method - * Set the basename of the plugin. - * @return object This Plugin object. - */ - public function setBasename(): object - { - $this->basename = plugin_basename($this->pluginFile); - return $this; - } - - /** - * getDirectory method - * Get the filesystem directory path (with trailing slash) for the plugin. - * @return string The filesystem directory path. - */ - public function getDirectory(): string - { - return $this->directory; - } - - /** - * setDirectory method - * Set the filesystem directory path (with trailing slash) for the plugin. - * @return object This Plugin object. - */ - public function setDirectory(): object - { - $this->directory = rtrim(plugin_dir_path($this->pluginFile), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; - return $this; - } - - /** - * getPath method - * Get the filesystem directory path (with trailing slash) for the plugin. - * @param string $path The path name. - * @return string The filesystem directory path. - */ - public function getPath(string $path = ''): string - { - return $this->directory . ($path ? trim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR : ''); - } - - /** - * getUrl method - * Get the URL directory path (with trailing slash) for the plugin. - * @param string $path The path name. - * @return string The URL directory path. - */ - public function getUrl(string $path = ''): string - { - return $this->url . ($path ? trim($path, '/') . '/' : ''); - } - - /** - * setUrl method - * Set the URL directory path (with trailing slash) for the plugin. - * @return object This Plugin object. - */ - public function setUrl(): object - { - $this->url = rtrim(plugin_dir_url($this->pluginFile), '/') . '/'; - return $this; - } - - /** - * getSlug method - * Get the slug of the plugin. - * @return string The slug. - */ - public function getSlug(): string - { - return sanitize_title(dirname($this->basename)); - } - - /** - * getVersion method - * Get the version of the plugin. - * @return string The version. - */ - public function getVersion(): string - { - if (defined('WP_DEBUG') && WP_DEBUG) { - return bin2hex(random_bytes(4)); - } - return $this->version; - } - - /** - * getVersion method - * Set the version of the plugin. - * @return object This Plugin object. - */ - public function setVersion(): object - { - $headers = ['Version' => 'Version']; - $fileData = get_file_data($this->pluginFile, $headers, 'plugin'); - if (isset($fileData['Version'])) { - $this->version = $fileData['Version']; - }; - return $this; - } - - /** - * __call method - * Method overloading. - */ - public function __call(string $name, array $arguments) - { - if (!method_exists($this, $name)) { - $message = sprintf('Call to undefined method %1$s::%2$s', __CLASS__, $name); - do_action( - 'rrze.log.error', - $message, - [ - 'class' => __CLASS__, - 'method' => $name, - 'arguments' => $arguments - ] - ); - if (defined('WP_DEBUG') && WP_DEBUG) { - throw new \Exception($message); - } - } - } -} From 215c1b09cec9819e2c0db89499d6b666a03daf78 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:24:19 +0100 Subject: [PATCH 40/45] Update Settings.php --- includes/Settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/Settings.php b/includes/Settings.php index 35fa6490..484a52e5 100644 --- a/includes/Settings.php +++ b/includes/Settings.php @@ -4,7 +4,7 @@ defined('ABSPATH') || exit; -use RRZE\Calendar\Options\Settings as OptionsSettings; +use RRZE\WP\Settings\Settings as OptionsSettings; class Settings { From c7be1d533fdeb382557258c946c2b84b12902676 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:24:44 +0100 Subject: [PATCH 41/45] Update lang files --- languages/rrule/de.php | 14 +++++----- languages/rrze-calendar-de_DE.mo | Bin 11591 -> 11412 bytes languages/rrze-calendar-de_DE.po | 34 +++++++++++------------- languages/rrze-calendar-de_DE_formal.mo | Bin 11601 -> 11422 bytes languages/rrze-calendar-de_DE_formal.po | 34 +++++++++++------------- languages/rrze-calendar.pot | 24 +++++------------ 6 files changed, 45 insertions(+), 61 deletions(-) diff --git a/languages/rrule/de.php b/languages/rrule/de.php index 07c550c4..4054e391 100755 --- a/languages/rrule/de.php +++ b/languages/rrule/de.php @@ -76,13 +76,13 @@ ], 'byweekday' => ' %{weekdays}', 'weekdays' => [ - 1 => 'montags', - 2 => 'dienstags', - 3 => 'mittwochs', - 4 => 'donnerstags', - 5 => 'freitags', - 6 => 'samstags', - 7 => 'sonntags', + 1 => 'Montag', + 2 => 'Dienstag', + 3 => 'Mittwoch', + 4 => 'Donnerstag', + 5 => 'Freitag', + 6 => 'Samstag', + 7 => 'Sonntag', ], 'nth_weekday' => [ '1' => 'der erste %{weekday}', // e.g. the first Monday diff --git a/languages/rrze-calendar-de_DE.mo b/languages/rrze-calendar-de_DE.mo index 69cff09247b3670caf85439bc8f950517725ed32..dab5e27912cc2fdb176dff33e43970bcbda8340a 100644 GIT binary patch delta 3279 zcmYk+d2EzL7{~EhXrX1dh(IY&Da(D9r9e4~N`;^xsmKwN0*zF2V_gU3+=o8p4*Q~?2|;+Uky&%2hXDtxQa^XXVg|S*z5nI5{PI0 z*-q0Q)xIxki3g(EkFxcbQ8S&6>SvZUgi2s(n1V7~g=$!3Z|p&JcnCG%QPk3%M{+P< zqgLn_?2f;o7h5M8(+$&6^{F@t7vn2<5?{llw$57@E~B81_Mrwigj%XP)Xa{d5;>e%`6G^oENoHgHc;H2DKtNNdIBur=SFiunW$`4p@actx?pT zeTM4bD(d;Ws09B&CH{}q)!wN$Mcq$8FSf>1Ot<%EV4U9n0t(7Jh#GhqdU2<%pRo1o zs16^Y28>O1X5z-FE|NrUnE)rUBd$gDdk|OQ5qmw8K_0)}Qty8u1OiXe1ax${oW(#V7I#h=zQ0>mz`c3O?)Rz8<+8P(xDZys^3#(yo3eRCWYG$RV z2bb9TO4OIG0=4IrsJ*SW^(g9XIf-h27M0*7)Wm*8ZP`QIf{nb!Y{cze*1v*6|4z=# zj^Q)ZU7ekojX-sjg*r4dt#eR^vII5oN@S5tC9=xq1Jr=$kX9h{8*^bFYRL{_EFMR7bP6@VMbuky4fTcl9d#%l+Uqghol~BKthO1A+%kS-E~Xqc z@L_C%;nNiK;Ca+xx`R5!4^W9D_HdTI7dD}uhI(!&Dxv35hij6pzlut@2$g6Fs-HEe z=cbY9f+jSJR)!$%Sz5n;@4R_NV^<|EW$y?|Q!>!^13(arcKrjOIG1?ol*TOW$?)W@TiIvZnfCThS!jKhVfftK6) zHdMR4s6=Z~2}DutKSj0s9K+hvuP8LdE9k`^Fcn>Woeq51jCwk%<4jbCFWUMPR6=>E zj)SQF7Fk!=>*eU;`s;*#oICBjbMjdY6O0^aHoSvA4Qq6n-y05QIrbygMqKWs(Z%-a zMAVG*E-SI61Ytuo!~{ZL5}8CUF^Sks=wlLz_&t4Gdm|e>t>X1HTSb^it*4`_I|b1jKH^o&oO z%f&^+eBI?&Kh1a9(OwD8C>tb>#f~Q0nABhIiJydBvd&pRY6! z%qtH1L!o|wV7@OjzgQ3Zii_sw7tHYmgJu5I8M#INIeEFk$noUlxU^y3v;i3d(xN{m VAMr#srX)u1^?cYUn$owI>p!TjUlRZT delta 3453 zcmYk+dr*{B7{~Fm0SfGrgd!!0OD3qmrc-EATB1&AL#3vPmJ^p(*wp2+ix@?#MOj|4 zMKjZ^OigX{4@#`a{&2!6b)vg74V6t7a~#bar;Dk5fAbz^dS{>gob&FvJm;Ku-?q|2 zv!mao#ji75JBaIv2NI0=9#){mhE`~iJ<8a3es)P(WOqW1kU zfZ52J%>CAx7*G8njAMRNMnN4M?2EOi6}F%fX+?F|h-$Y5mB22H!~Ix?oj4BzWHAlb z;jMTAM`3oFo5(DrshNu@%x`KaXu@Xfh0miVYDIR-ylmZtO5|Paj|Wf*eucI8J!%2> z^QC^3sENYJ=9m_wiD|=rxC5hv>EufdyHN=oM{Vf|)E1w$UP4XirT2VH$6Q>BnsBFe zKdRp$)Hq)vT}=<_D9)me_RoIozZzcVh6eWWgsI*iwbH?;frsLCI2x7cRHTb3M?JKS zs0rFo3wRUNZ!hYo4xo1U2&&yNRAQ&n*?)C7ZyWxLN+6m2RYDo4qsT_x&qpON202zU z1=ar{)D~Bu+J$X>32LRSsBtz}x1ti*6Q!UGJ5U`zvOj!|TJg82fzMkLGTa2xQCpdV z|=HZv9fi$}&NI-3!7q!w1R6<#{ z9zZ2fh+4ossFlt_Evy2y(mGVTCe+TgB1afCuT#(#b)Y8r5S2g|2JkQr#(!`iW({zk z;@eSYc^~Ros6h2wj2fpIwSX4ua%-#oeLed1|KCiZfQAQbgHx!C|3Iza0&3!q>J4}Vb@tt;Gw!kVbEtojo<#LeMkSbvTG%k{zs_tdH#T4~w&Az9 z5^J;Fm0iTK)W_f8t}KcgXccO!w_Eq19?pHJiMx1xnqMogot#3gk{1z(F zeaJXb^DzZA>_J{~<~P(CnxXDWQc?9msE#*Ti!qV<4Afc9MZKDvP>HNS9nnjum3G*A z532nIOwj*7W0$|JKMp;(kkF+kx0cX9g55Nc*kj4J4SbQ( z3PRV@E~W*w_LZ^Ek~1dN+q=_H3(|2au_XjKnbkxQp~Y<=yo9c22)&PD#AC4nZ)V{# zN}~x~PZ75f`v1-*c)6Ho2_LbAxRJ;qHpQB~nUkKQw2|0BtRi%+A#Nt-5U&tZ3B9Qo z6MEK{6S^LEF>7Nz-rSL|QPcKT+q)0r3&b15okSTio!Ck|L9CAz`tm&6V`aX+NiR`< zo@k9V`v!SljcxYb7nyg#)x))z3>IjE;lDKj$ zps?;r#d;4m*z%&-+LX~Lo2eBOFB47eU!{DLIMj(mf}yIgKNt=-IAMRK6LBgcPG!JM zzw%4CY!UVLUHuPT6)3G~@K@IOLp2e9HMjjvsHUN++F$F`FJypVO(^V-)Tl+Ix-1fC zuf49z6N_dJNE|WBKXOFTEu-6C%iQmqFew-cN1O!<8ko4YzNUPEvyh?c=a+>-k${;P zbo~Eo;e`B+4fT~!<%DaUU`4f4&(O1m_KgcnENf~Yk#c^VPOlI@Mral~*vVI=zu2jF RxD%{mA}17Re>88n=Rf(BkyHQx diff --git a/languages/rrze-calendar-de_DE.po b/languages/rrze-calendar-de_DE.po index bc44069f..839b5a1a 100644 --- a/languages/rrze-calendar-de_DE.po +++ b/languages/rrze-calendar-de_DE.po @@ -3,8 +3,9 @@ msgid "" msgstr "" "Project-Id-Version: RRZE Autoshare\n" -"POT-Creation-Date: 2024-01-30T17:02:49+00:00\n" -"PO-Revision-Date: 2024-02-06 10:47+0100\n" +"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/rrze-calendar\n" +"POT-Creation-Date: 2024-02-19T11:20:32+00:00\n" +"PO-Revision-Date: 2024-02-19 12:21+0100\n" "Last-Translator: \n" "Language-Team: RRZE Webteam\n" "Language: de\n" @@ -87,7 +88,7 @@ msgstr "Veranstaltungen durchsuchen" msgid "Parent Events:" msgstr "Übergeordnete Veranstaltungen:" -#: includes/CPT/CalendarEvent.php:66 includes/ICS/Events.php:46 +#: includes/CPT/CalendarEvent.php:66 includes/ICS/Events.php:48 msgid "No events found." msgstr "Keine Veranstaltungen gefunden." @@ -475,7 +476,7 @@ msgstr "Deaktivieren" msgid "Invalid access" msgstr "Unzulässiger Zugriff" -#: includes/ICS/Events.php:325 includes/Utils.php:828 +#: includes/ICS/Events.php:327 includes/Utils.php:828 msgid "m-d-Y" msgstr "d.m.Y" @@ -536,26 +537,14 @@ msgstr "Die Feed-URL ist ungültig." msgid "Settings" msgstr "Einstellungen" -#: includes/Main.php:89 +#: includes/Main.php:95 msgid "Hide past events" msgstr "Vergangene Termine ausblenden" -#: includes/Main.php:90 +#: includes/Main.php:96 msgid "Show past events" msgstr "Vergangene Termine anzeigen" -#: includes/Options/Settings.php:267 -msgid "You do not have enough permissions to do that." -msgstr "Dazu haben Sie nicht genügend Berechtigungen." - -#: includes/Options/Settings.php:292 -msgid "Settings saved." -msgstr "Die Einstellungen wurden gespeichert." - -#: includes/Options/templates/settings-page.php:18 -msgid "Settings issues detected." -msgstr "Einstellungsprobleme erkannt." - #: includes/Settings.php:17 msgid "Calendar Settings" msgstr "Einstellungen › Kalender" @@ -756,3 +745,12 @@ msgstr "" #: rrze-calendar.php:86 rrze-calendar.php:157 msgid "Plugins: %1$s: %2$s" msgstr "Plugins: %1$s: %2$s" + +#~ msgid "You do not have enough permissions to do that." +#~ msgstr "Dazu haben Sie nicht genügend Berechtigungen." + +#~ msgid "Settings saved." +#~ msgstr "Die Einstellungen wurden gespeichert." + +#~ msgid "Settings issues detected." +#~ msgstr "Einstellungsprobleme erkannt." diff --git a/languages/rrze-calendar-de_DE_formal.mo b/languages/rrze-calendar-de_DE_formal.mo index d6635e178ab0f96e521201d5164d6f7d0b415fa4..3bf12c636f8a0691572cd5802adcf5d038d80061 100644 GIT binary patch delta 3283 zcmYk+dr*{B7{~Fm3Igt8r4TA9OWr6!LPbMMOmk8j@)FgkQ4*|(nyibcpt+bDnrPZ9 zTI4M+X=9cQ&S+z5T4Z@Gqcp6Xn(;c*G>neZMXm3z_x#Zg51(`1_gtQH&ilUKjNdRW z{Bzrg8pCfZaUbzWq%jxp`PTg7cP`eLyYUB%$7|@-jW)*Qfe-yS1=VF4M&la12R9;J zOdV>RLzshK<3q-TP3OCe>B)sr$e)?ZzZhJGQCNc-c)hLfKn=JXeRvQx;c?W2ji~mQ zuopHXYchUjm)$V}Q?VuUn+yu-kcsVZFlvRls6-~BI!r;eD?uetfh};IOQtvK zp?v~1K_O}Zb5Q-lsH0ke+TnGmb~{jseG}+WKhJN++VmnQSdZB``lsK^az|I@Z`5n^6PqL`}FKwRIIYfw*XJ?hN9 zKn>7@YX3Vb!5gT=|F(KMy7eg3{aEy49HwEWyp!6e zyn~uBGSOX$7Xu!WL~faKp2#FzjT(0kR^btQeI%1;$EHZV|78@k!b)TjW;JT1AL0c3 z3JhP52#hDy9k5?k285J!l$tZI`fn zX1lqdj>l0Qu2>_wx&!-B_XpYf1k}!zqjqW$YG;;PYf%$!#|o^&EKKd@jyDOlgNwqp zP>U_Oup6~ydoU8eL=AKbHNiR5TX7Np`!b>)%Bb${^){GBJsH_`GYV;9N{}^~8q~xe zV=D}wrl5x3qaLQ4sHZrhhnq+eYU}%;It)a$8-hw`H0t5Xv-M(B!n06`R-zWR~;L+WO0=ez(!f{H9G$w_``tjSO2Kf-%&`p|-jJBQS`XunePdA!?#(Ti=T6 zw+of%UQ_}HQ2kG$`kleB&h$KmDEt-ucn#Cgo9Ygbg{`S)qXr&{8Zg(^3sDJ8M-4m= zHQr+Da(lf7JzRg8(2wU%C+|M_?1l+B@3$VY(Bvp?l%RsxEjJs=(mtqMXV%dJ9*y3%*B-Y6Z%yW0|~vT;|V?%W)a~d))8F^ z-VXD&v&)+}>@`YjiLJykLciriA7TRW4l#z%7kL(;M`8(~U%87};l%oSWNe_O?VW6| z=HVN}yTo83pLm+sMCfDUI00Wz&lYEuuU(A3W>ti7cKMP#>z$Lnbk8f!ZQrQ)8C;x8 zl<6+NVq&wCAKNZR&)f)IvcIQrqb&z;o-K=M#GC)CtN0{QYOl?74#)P7t)(`E(8qmF zePo-n(ew;Dh ztWemN)1rckV4@}s0s#?~;}0c*as`8ki79^&E+Gnt`u({>;+uW;GxP2o&&<60Zkcjo zYUt;-tr`s1cA_IOG1{05SR2n5SL_4EJcx0agsJGkKKMKiMF%&by6nSPJc1A5_n3ee zQR7_2r_i)v3}ZrO9EB|EA>?B|<|_{OVGJHd4SdYj&!PtW1-*C$HQ`;BySQGuBDiiu!bH$^52(f;za^4$Dz1tU)DGhw88i)$Scs0z0uK?!o!EA7`VFES|*% z9Eg`N7t`BD5_t}3YF@wu<~L;&G+{Ni#uccE>X6+so2@%hiR{H>Jb+5@6qe%!)B>L2 zOZ|#a69tgXF*QgNQ;&(b9YciK&zBk=M}HRn-BaUFHEeGt_dT1A- zCa6a(;3HJOPf1mf9WC6t0XigeWdUZ?~HA;)T- zMD?GJ+Tub~yMV1PMXj_BHO>a>HdF$igeWM(-KdU-?GHboR{Rrc;9J({lt=8_|kRuG4trWCHyHOK-iAvxI`tV!qig&ORc212v z#Y0hN`84WTC`9#Jgc_$BwSXGyN^70{eH}Xb|2I;|rr`nG;4&)X8>kiBMNJ%+7TMAa zRDHCq&qhtS95vx8)Pm}B7xLp7L7L2AJR-(3Ur*#)Od;SAK7Zb44Z{EGi2jv6nH!PPGjRqtu-hasKq;}o>weB@&$@}-7B zd;&wLm3@V3chuI8quzk0QD=V+b;ixMeh>98igzOY6Hy7Kq88Ry`>!(_#f=R(7VGgh zti`JI$jV|KHs(?4`KXnxKn=7Wwbh?l_n;omgQ$s*Bb#N;q23dJqUKBDf#Ot5YS&Pt zVJJ9P-PGsmpwP>D5T6fPQQ_2wIht#OpSKMu307a*r% zRwF~1(5Dnwq&bC}_%^o2HW`tI$*3*QMeRr)Dv=o&g8@|gC8&0JzI^oz5})L z&ryjUM8*l3A1SC|GxCx%zoX7DJ~OhCR8+kus^cK*Sd67U19g_gs8@3hDv<`%5p6@Q z^ebC$MzxRbsh#Bf(L})-Ixa&Gu0`$87JGk}tslWS?w?0( zeKRV7o2WPFZPdh>y&^l7i<<9o48>BIOhE(8L}mOUDv@&3Kub~WUPGPrDvZGfbg&V# z@c^p-WsJugsB!P1#*3km>M5v%(zAJgY2e=6(0~K2!%+7}BX3YMkI-Xx zwFnj$1bt2A9gakWLusk8eR7?gK7;!WXnHU0Ywz%pCH_FrEiJ8N;_`~JS*7kghN_rb z;P(f8Ca=VG{@23wI}0l-ieQc#D0fQ=i`|M~xKrnprbU_eTKMt`sw&B47QauRqo3b{ hwDf diff --git a/languages/rrze-calendar-de_DE_formal.po b/languages/rrze-calendar-de_DE_formal.po index 1d5a3cf9..54d3e56b 100644 --- a/languages/rrze-calendar-de_DE_formal.po +++ b/languages/rrze-calendar-de_DE_formal.po @@ -3,8 +3,9 @@ msgid "" msgstr "" "Project-Id-Version: RRZE Autoshare\n" -"POT-Creation-Date: 2024-01-26T14:35:57+00:00\n" -"PO-Revision-Date: 2024-02-06 10:47+0100\n" +"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/rrze-calendar\n" +"POT-Creation-Date: 2024-02-19T11:20:32+00:00\n" +"PO-Revision-Date: 2024-02-19 12:21+0100\n" "Last-Translator: \n" "Language-Team: RRZE Webteam\n" "Language: de_DE@formal\n" @@ -87,7 +88,7 @@ msgstr "Veranstaltungen durchsuchen" msgid "Parent Events:" msgstr "Übergeordnete Veranstaltungen:" -#: includes/CPT/CalendarEvent.php:66 includes/ICS/Events.php:46 +#: includes/CPT/CalendarEvent.php:66 includes/ICS/Events.php:48 msgid "No events found." msgstr "Keine Veranstaltungen gefunden." @@ -475,7 +476,7 @@ msgstr "Deaktivieren" msgid "Invalid access" msgstr "Unzulässiger Zugriff" -#: includes/ICS/Events.php:325 includes/Utils.php:828 +#: includes/ICS/Events.php:327 includes/Utils.php:828 msgid "m-d-Y" msgstr "d.m.Y" @@ -536,26 +537,14 @@ msgstr "Die Feed-URL ist ungültig." msgid "Settings" msgstr "Einstellungen" -#: includes/Main.php:89 +#: includes/Main.php:95 msgid "Hide past events" msgstr "Vergangene Termine ausblenden" -#: includes/Main.php:90 +#: includes/Main.php:96 msgid "Show past events" msgstr "Vergangene Termine anzeigen" -#: includes/Options/Settings.php:267 -msgid "You do not have enough permissions to do that." -msgstr "Dazu haben Sie nicht genügend Berechtigungen." - -#: includes/Options/Settings.php:292 -msgid "Settings saved." -msgstr "Die Einstellungen wurden gespeichert." - -#: includes/Options/templates/settings-page.php:18 -msgid "Settings issues detected." -msgstr "Einstellungsprobleme erkannt." - #: includes/Settings.php:17 msgid "Calendar Settings" msgstr "Einstellungen › Kalender" @@ -756,3 +745,12 @@ msgstr "" #: rrze-calendar.php:86 rrze-calendar.php:157 msgid "Plugins: %1$s: %2$s" msgstr "Plugins: %1$s: %2$s" + +#~ msgid "You do not have enough permissions to do that." +#~ msgstr "Dazu haben Sie nicht genügend Berechtigungen." + +#~ msgid "Settings saved." +#~ msgstr "Die Einstellungen wurden gespeichert." + +#~ msgid "Settings issues detected." +#~ msgstr "Einstellungsprobleme erkannt." diff --git a/languages/rrze-calendar.pot b/languages/rrze-calendar.pot index 00ce147c..100b79b9 100644 --- a/languages/rrze-calendar.pot +++ b/languages/rrze-calendar.pot @@ -2,14 +2,14 @@ # This file is distributed under the GNU General Public License v3.0. msgid "" msgstr "" -"Project-Id-Version: RRZE Calendar 2.0.13\n" +"Project-Id-Version: RRZE Calendar 2.1.1\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/rrze-calendar\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2024-02-06T09:38:16+00:00\n" +"POT-Creation-Date: 2024-02-19T11:20:32+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.9.0\n" "X-Domain: rrze-calendar\n" @@ -89,7 +89,7 @@ msgid "Parent Events:" msgstr "" #: includes/CPT/CalendarEvent.php:66 -#: includes/ICS/Events.php:46 +#: includes/ICS/Events.php:48 msgid "No events found." msgstr "" @@ -495,7 +495,7 @@ msgstr "" msgid "Invalid access" msgstr "" -#: includes/ICS/Events.php:325 +#: includes/ICS/Events.php:327 #: includes/Utils.php:828 msgid "m-d-Y" msgstr "" @@ -545,26 +545,14 @@ msgstr "" msgid "Settings" msgstr "" -#: includes/Main.php:89 +#: includes/Main.php:95 msgid "Hide past events" msgstr "" -#: includes/Main.php:90 +#: includes/Main.php:96 msgid "Show past events" msgstr "" -#: includes/Options/Settings.php:267 -msgid "You do not have enough permissions to do that." -msgstr "" - -#: includes/Options/Settings.php:292 -msgid "Settings saved." -msgstr "" - -#: includes/Options/templates/settings-page.php:18 -msgid "Settings issues detected." -msgstr "" - #: includes/Settings.php:17 msgid "Calendar Settings" msgstr "" From fbc49db615b3036499a5a034f3c202ef8c662747 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:24:49 +0100 Subject: [PATCH 42/45] Update rrze-calendar.php --- rrze-calendar.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rrze-calendar.php b/rrze-calendar.php index 779ccb69..7071a7eb 100644 --- a/rrze-calendar.php +++ b/rrze-calendar.php @@ -4,7 +4,7 @@ Plugin Name: RRZE Calendar Plugin URI: https://github.com/RRZE-Webteam/rrze-calendar Description: Import and output of FAU public events. -Version: 2.1.1 +Version: 2.2.0 Author: RRZE Webteam Author URI: https://blogs.fau.de/webworking/ License: GNU General Public License v3.0 @@ -17,6 +17,7 @@ defined('ABSPATH') || exit; +use RRZE\WP\Plugin\Plugin; use RRZE\Calendar\CPT\CalendarEvent; use RRZE\Calendar\CPT\CalendarFeed; From 5aadf5e6a5b391fbd29f2fc5a576d139ee141994 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 15:24:59 +0100 Subject: [PATCH 43/45] Update vendor files --- vendor/composer/autoload_psr4.php | 1 + vendor/composer/autoload_static.php | 5 + vendor/composer/installed.json | 48 +++ vendor/composer/installed.php | 13 +- vendor/rrze/wp/.gitignore | 12 + vendor/rrze/wp/README.md | 25 ++ vendor/rrze/wp/composer.json | 27 ++ vendor/rrze/wp/src/Plugin/Plugin.php | 204 +++++++++++ vendor/rrze/wp/src/Plugin/README.md | 35 ++ vendor/rrze/wp/src/Settings/Builder.php | 27 ++ vendor/rrze/wp/src/Settings/Encryption.php | 102 ++++++ vendor/rrze/wp/src/Settings/Error.php | 45 +++ vendor/rrze/wp/src/Settings/Flash.php | 29 ++ vendor/rrze/wp/src/Settings/Option.php | 119 +++++++ .../rrze/wp/src/Settings/Options/Checkbox.php | 24 ++ .../src/Settings/Options/CheckboxMultiple.php | 31 ++ .../rrze/wp/src/Settings/Options/Password.php | 24 ++ .../wp/src/Settings/Options/RadioGroup.php | 10 + .../rrze/wp/src/Settings/Options/Select.php | 10 + .../src/Settings/Options/SelectMultiple.php | 31 ++ vendor/rrze/wp/src/Settings/Options/Text.php | 10 + .../rrze/wp/src/Settings/Options/Textarea.php | 15 + vendor/rrze/wp/src/Settings/Options/Type.php | 108 ++++++ vendor/rrze/wp/src/Settings/README.md | 295 ++++++++++++++++ vendor/rrze/wp/src/Settings/Section.php | 41 +++ vendor/rrze/wp/src/Settings/Settings.php | 330 ++++++++++++++++++ vendor/rrze/wp/src/Settings/Tab.php | 88 +++++ vendor/rrze/wp/src/Settings/Template.php | 26 ++ vendor/rrze/wp/src/Settings/Worker.php | 35 ++ .../languages/rrze-wp-settings-de_DE.mo | Bin 0 -> 1056 bytes .../languages/rrze-wp-settings-de_DE.po | 38 ++ .../rrze-wp-settings-de_DE_formal.mo | Bin 0 -> 1076 bytes .../rrze-wp-settings-de_DE_formal.po | 39 +++ .../templates/options/checkbox-multiple.php | 27 ++ .../Settings/templates/options/checkbox.php | 23 ++ .../Settings/templates/options/password.php | 21 ++ .../templates/options/radio-group.php | 28 ++ .../templates/options/select-multiple.php | 25 ++ .../src/Settings/templates/options/select.php | 24 ++ .../src/Settings/templates/options/text.php | 20 ++ .../Settings/templates/options/textarea.php | 20 ++ .../src/Settings/templates/section-menu.php | 13 + .../wp/src/Settings/templates/section.php | 19 + .../wp/src/Settings/templates/sections.php | 17 + .../src/Settings/templates/settings-page.php | 25 ++ .../wp/src/Settings/templates/tab-menu.php | 11 + 46 files changed, 2118 insertions(+), 2 deletions(-) create mode 100644 vendor/rrze/wp/.gitignore create mode 100644 vendor/rrze/wp/README.md create mode 100644 vendor/rrze/wp/composer.json create mode 100644 vendor/rrze/wp/src/Plugin/Plugin.php create mode 100644 vendor/rrze/wp/src/Plugin/README.md create mode 100644 vendor/rrze/wp/src/Settings/Builder.php create mode 100644 vendor/rrze/wp/src/Settings/Encryption.php create mode 100644 vendor/rrze/wp/src/Settings/Error.php create mode 100644 vendor/rrze/wp/src/Settings/Flash.php create mode 100644 vendor/rrze/wp/src/Settings/Option.php create mode 100644 vendor/rrze/wp/src/Settings/Options/Checkbox.php create mode 100644 vendor/rrze/wp/src/Settings/Options/CheckboxMultiple.php create mode 100644 vendor/rrze/wp/src/Settings/Options/Password.php create mode 100644 vendor/rrze/wp/src/Settings/Options/RadioGroup.php create mode 100644 vendor/rrze/wp/src/Settings/Options/Select.php create mode 100644 vendor/rrze/wp/src/Settings/Options/SelectMultiple.php create mode 100644 vendor/rrze/wp/src/Settings/Options/Text.php create mode 100644 vendor/rrze/wp/src/Settings/Options/Textarea.php create mode 100644 vendor/rrze/wp/src/Settings/Options/Type.php create mode 100644 vendor/rrze/wp/src/Settings/README.md create mode 100644 vendor/rrze/wp/src/Settings/Section.php create mode 100644 vendor/rrze/wp/src/Settings/Settings.php create mode 100644 vendor/rrze/wp/src/Settings/Tab.php create mode 100644 vendor/rrze/wp/src/Settings/Template.php create mode 100644 vendor/rrze/wp/src/Settings/Worker.php create mode 100644 vendor/rrze/wp/src/Settings/languages/rrze-wp-settings-de_DE.mo create mode 100644 vendor/rrze/wp/src/Settings/languages/rrze-wp-settings-de_DE.po create mode 100644 vendor/rrze/wp/src/Settings/languages/rrze-wp-settings-de_DE_formal.mo create mode 100644 vendor/rrze/wp/src/Settings/languages/rrze-wp-settings-de_DE_formal.po create mode 100644 vendor/rrze/wp/src/Settings/templates/options/checkbox-multiple.php create mode 100644 vendor/rrze/wp/src/Settings/templates/options/checkbox.php create mode 100644 vendor/rrze/wp/src/Settings/templates/options/password.php create mode 100644 vendor/rrze/wp/src/Settings/templates/options/radio-group.php create mode 100644 vendor/rrze/wp/src/Settings/templates/options/select-multiple.php create mode 100644 vendor/rrze/wp/src/Settings/templates/options/select.php create mode 100644 vendor/rrze/wp/src/Settings/templates/options/text.php create mode 100644 vendor/rrze/wp/src/Settings/templates/options/textarea.php create mode 100644 vendor/rrze/wp/src/Settings/templates/section-menu.php create mode 100644 vendor/rrze/wp/src/Settings/templates/section.php create mode 100644 vendor/rrze/wp/src/Settings/templates/sections.php create mode 100644 vendor/rrze/wp/src/Settings/templates/settings-page.php create mode 100644 vendor/rrze/wp/src/Settings/templates/tab-menu.php diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 28717f25..b621c647 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -7,5 +7,6 @@ return array( 'RRule\\' => array($baseDir . '/src', $vendorDir . '/rlanvin/php-rrule/src'), + 'RRZE\\WP\\' => array($vendorDir . '/rrze/wp/src'), 'RRZE\\Calendar\\' => array($baseDir . '/includes'), ); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index fa0fa15d..bd34ad9b 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -14,6 +14,7 @@ class ComposerStaticInit2c498cedc94f6f3eba7205ee47469408 'R' => array ( 'RRule\\' => 6, + 'RRZE\\WP\\' => 8, 'RRZE\\Calendar\\' => 14, ), ); @@ -24,6 +25,10 @@ class ComposerStaticInit2c498cedc94f6f3eba7205ee47469408 0 => __DIR__ . '/../..' . '/src', 1 => __DIR__ . '/..' . '/rlanvin/php-rrule/src', ), + 'RRZE\\WP\\' => + array ( + 0 => __DIR__ . '/..' . '/rrze/wp/src', + ), 'RRZE\\Calendar\\' => array ( 0 => __DIR__ . '/../..' . '/includes', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 44fa4686..df81e2ca 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -180,6 +180,54 @@ "source": "https://github.com/rlanvin/php-rrule/tree/v2.4.1" }, "install-path": "../rlanvin/php-rrule" + }, + { + "name": "rrze/wp", + "version": "2.0.0", + "version_normalized": "2.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/RRZE-Webteam/rrze-wp.git", + "reference": "e44c01ddc4a69a38be1a9c6a900eeee87f6d6aac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/RRZE-Webteam/rrze-wp/zipball/e44c01ddc4a69a38be1a9c6a900eeee87f6d6aac", + "reference": "e44c01ddc4a69a38be1a9c6a900eeee87f6d6aac", + "shasum": "" + }, + "require": { + "php": ">=8.0" + }, + "time": "2024-02-19T13:55:11+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "RRZE\\WP\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-3.0-or-later" + ], + "authors": [ + { + "name": "RRZE-Webteam", + "email": "webmaster@fau.de", + "homepage": "https://www.rrze.fau.de" + } + ], + "description": "A general purpose library for WordPress.", + "homepage": "https://github.com/RRZE-Webteam/rrze-wp", + "keywords": [ + "wordpress" + ], + "support": { + "issues": "https://github.com/RRZE-Webteam/rrze-wp/issues", + "source": "https://github.com/RRZE-Webteam/rrze-wp/tree/2.0.0" + }, + "install-path": "../rrze/wp" } ], "dev": true, diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 20243ddc..3545a67a 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => '__root__', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '50a3090906f6af0c909c1343d8614b3544eeb08f', + 'reference' => '7d3be7ffc3b79c70bc3b72defca3ca470a6fd90f', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,7 +13,7 @@ '__root__' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '50a3090906f6af0c909c1343d8614b3544eeb08f', + 'reference' => '7d3be7ffc3b79c70bc3b72defca3ca470a6fd90f', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -46,5 +46,14 @@ 'aliases' => array(), 'dev_requirement' => false, ), + 'rrze/wp' => array( + 'pretty_version' => '2.0.0', + 'version' => '2.0.0.0', + 'reference' => 'e44c01ddc4a69a38be1a9c6a900eeee87f6d6aac', + 'type' => 'library', + 'install_path' => __DIR__ . '/../rrze/wp', + 'aliases' => array(), + 'dev_requirement' => false, + ), ), ); diff --git a/vendor/rrze/wp/.gitignore b/vendor/rrze/wp/.gitignore new file mode 100644 index 00000000..f0602c7e --- /dev/null +++ b/vendor/rrze/wp/.gitignore @@ -0,0 +1,12 @@ +### vscode ### +.vscode/ +### NetBeans ### +**/nbproject/ +### PhpStorm ### +.idea/ +### macOS ### +.DS_Store +### Node ### +node_modules/ +### Tmp ### +_tmp/ diff --git a/vendor/rrze/wp/README.md b/vendor/rrze/wp/README.md new file mode 100644 index 00000000..aa045eed --- /dev/null +++ b/vendor/rrze/wp/README.md @@ -0,0 +1,25 @@ +# RRZE WordPress Package + +The RRZE package for WordPress is a general-purpose package designed to simplify and streamline the development of plugins for WordPress. + +## Installation + +Install the latest version with + +```bash +% composer require rrze/wp +``` + +## Features + +### Plugin + +The purpose of this PHP library is to streamline the handling of files and directories within WordPress plugins. It offers methods to access various details about the plugin, including its file path, basename, directory, URL, version, and slug. + +[Read more](src/Plugin/README.md) + +### Settings + +This PHP library aims to simplify the creation of WordPress plugin settings pages, reducing reliance on the Settings API or custom code. It addresses the complexity of manual HTML coding for options and the integration of tabs and sections, streamlining the process for straightforward settings page creation. + +[Read more](src/Settings/README.md) diff --git a/vendor/rrze/wp/composer.json b/vendor/rrze/wp/composer.json new file mode 100644 index 00000000..6e714767 --- /dev/null +++ b/vendor/rrze/wp/composer.json @@ -0,0 +1,27 @@ +{ + "name": "rrze/wp", + "description": "A general purpose library for WordPress.", + "version": "2.0.0", + "type": "library", + "keywords": [ + "wordpress" + ], + "homepage": "https://github.com/RRZE-Webteam/rrze-wp", + "license": "GPL-3.0-or-later", + "authors": [ + { + "name": "RRZE-Webteam", + "email": "webmaster@fau.de", + "homepage": "https://www.rrze.fau.de" + } + ], + "require": { + "php": ">=8.0" + }, + "autoload": { + "psr-4": { + "RRZE\\WP\\": "src" + } + }, + "lock": false +} \ No newline at end of file diff --git a/vendor/rrze/wp/src/Plugin/Plugin.php b/vendor/rrze/wp/src/Plugin/Plugin.php new file mode 100644 index 00000000..76213fcf --- /dev/null +++ b/vendor/rrze/wp/src/Plugin/Plugin.php @@ -0,0 +1,204 @@ +pluginFile = $pluginFile; + } + + /** + * loaded method + */ + public function loaded() + { + $this->setBasename() + ->setDirectory() + ->setUrl() + ->setVersion(); + } + + /** + * getFile method + * Get the full path and filename of the plugin. + * @return string The full path and filename. + */ + public function getFile(): string + { + return $this->pluginFile; + } + + /** + * getBasename method + * Get the basename of the plugin. + * @return string The basename. + */ + public function getBasename(): string + { + return $this->basename; + } + + /** + * setBasename method + * Set the basename of the plugin. + * @return object This Plugin object. + */ + public function setBasename(): object + { + $this->basename = plugin_basename($this->pluginFile); + return $this; + } + + /** + * getDirectory method + * Get the filesystem directory path (with trailing slash) for the plugin. + * @return string The filesystem directory path. + */ + public function getDirectory(): string + { + return $this->directory; + } + + /** + * setDirectory method + * Set the filesystem directory path (with trailing slash) for the plugin. + * @return object This Plugin object. + */ + public function setDirectory(): object + { + $this->directory = rtrim(plugin_dir_path($this->pluginFile), '/') . '/'; + return $this; + } + + /** + * getPath method + * Get the filesystem directory path (with trailing slash) for the plugin. + * @param string $path The path name. + * @return string The filesystem directory path. + */ + public function getPath(string $path = ''): string + { + return $this->directory . ($path ? trim($path, '/') . '/' : ''); + } + + /** + * getUrl method + * Get the URL directory path (with trailing slash) for the plugin. + * @param string $path The path name. + * @return string The URL directory path. + */ + public function getUrl(string $path = ''): string + { + return $this->url . ($path ? trim($path, '/') . '/' : ''); + } + + /** + * setUrl method + * Set the URL directory path (with trailing slash) for the plugin. + * @return object This Plugin object. + */ + public function setUrl(): object + { + $this->url = rtrim(plugin_dir_url($this->pluginFile), '/') . '/'; + return $this; + } + + /** + * getSlug method + * Get the slug of the plugin. + * @return string The slug. + */ + public function getSlug(): string + { + return sanitize_title(dirname($this->basename)); + } + + /** + * getVersion method + * Get the version of the plugin. + * @return string The version. + */ + public function getVersion(): string + { + if (defined('WP_DEBUG') && WP_DEBUG) { + return bin2hex(random_bytes(4)); + } + return $this->version; + } + + /** + * getVersion method + * Set the version of the plugin. + * @return object This Plugin object. + */ + public function setVersion(): object + { + $headers = ['Version' => 'Version']; + $fileData = get_file_data($this->pluginFile, $headers, 'plugin'); + if (isset($fileData['Version'])) { + $this->version = $fileData['Version']; + }; + return $this; + } + + /** + * __call method + * Method overloading. + */ + public function __call(string $name, array $arguments) + { + if (!method_exists($this, $name)) { + $message = sprintf('Call to undefined method %1$s::%2$s', __CLASS__, $name); + do_action( + 'rrze.log.error', + $message, + [ + 'class' => __CLASS__, + 'method' => $name, + 'arguments' => $arguments + ] + ); + if (defined('WP_DEBUG') && WP_DEBUG) { + throw new \Exception($message); + } + } + } +} diff --git a/vendor/rrze/wp/src/Plugin/README.md b/vendor/rrze/wp/src/Plugin/README.md new file mode 100644 index 00000000..32acf519 --- /dev/null +++ b/vendor/rrze/wp/src/Plugin/README.md @@ -0,0 +1,35 @@ +# RRZE\WP\Plugin + +This PHP library is designed to simplify the management of WordPress plugin files and directories. It provides methods for retrieving information about the plugin, such as its file path, basename, directory, URL, version, and slug. + +## Usage + +To use this class, simply instantiate it with the full path and filename of the plugin: +```php +$plugin = new RRZE\WP\Plugin(__FILE__); +``` + +Then call the loaded() method to initialize the plugin properties: +```php +$plugin->loaded(); +``` + +You can now access various information about the plugin: +```php +$plugin_file = $plugin->getFile(); +$basename = $plugin->getBasename(); +$directory = $plugin->getDirectory(); +$url = $plugin->getUrl(); +$slug = $plugin->getSlug(); +$version = $plugin->getVersion(); +``` + +## Methods + +- `getFile()`: Get the full path and filename of the plugin. +- `getBasename()`: Get the basename of the plugin. +- `getDirectory()`: Get the filesystem directory path for the plugin. +- `getPath(string $path)`: Get the filesystem directory path for a specific file or directory within the plugin. +- `getUrl(string $path)`: Get the URL directory path for a specific file or directory within the plugin. +- `getSlug()`: Get the slug of the plugin. +- `getVersion()`: Get the version of the plugin. diff --git a/vendor/rrze/wp/src/Settings/Builder.php b/vendor/rrze/wp/src/Settings/Builder.php new file mode 100644 index 00000000..c319a892 --- /dev/null +++ b/vendor/rrze/wp/src/Settings/Builder.php @@ -0,0 +1,27 @@ +enqueued[$handle] = $callback; + } + + public function remove($handle) + { + unset($this->enqueued[$handle]); + } + + public function enqueue() + { + foreach ($this->enqueued as $enqueue) { + $enqueue(); + } + } +} diff --git a/vendor/rrze/wp/src/Settings/Encryption.php b/vendor/rrze/wp/src/Settings/Encryption.php new file mode 100644 index 00000000..dc4396f3 --- /dev/null +++ b/vendor/rrze/wp/src/Settings/Encryption.php @@ -0,0 +1,102 @@ +error = new \WP_Error; + $this->settings = $settings; + } + + public function getAll() + { + global $wp_settings_error; + + return $wp_settings_error[$this->settings->optionName] ?? false; + } + + public function get($key) + { + $errors = $this->getAll(); + + if (! is_wp_error($errors)) { + return; + } + + return $errors->get_error_message($key); + } + + public function add($key, $message) + { + global $wp_settings_error; + + $this->error->add($key, $message); + + $wp_settings_error[$this->settings->optionName] = $this->error; + } +} diff --git a/vendor/rrze/wp/src/Settings/Flash.php b/vendor/rrze/wp/src/Settings/Flash.php new file mode 100644 index 00000000..8f4c352b --- /dev/null +++ b/vendor/rrze/wp/src/Settings/Flash.php @@ -0,0 +1,29 @@ +settings = $settings; + } + + public function has() + { + global $wp_settings_flash; + + return $wp_settings_flash[$this->settings->optionName] ?? null; + } + + public function set($status, $message) + { + global $wp_settings_flash; + + $wp_settings_flash[$this->settings->optionName] = compact('status', 'message'); + } +} diff --git a/vendor/rrze/wp/src/Settings/Option.php b/vendor/rrze/wp/src/Settings/Option.php new file mode 100644 index 00000000..281a8434 --- /dev/null +++ b/vendor/rrze/wp/src/Settings/Option.php @@ -0,0 +1,119 @@ +section = $section; + $this->type = $type; + $this->args = $args; + + $typeMap = apply_filters('rrze_wp_settings_option_type_map', [ + 'checkbox' => Checkbox::class, + 'checkbox-multiple' => CheckboxMultiple::class, + 'password' => Password::class, + 'radio-group' => RadioGroup::class, + 'select' => Select::class, + 'select-multiple' => SelectMultiple::class, + 'text' => Text::class, + 'textarea' => Textarea::class + ]); + + if (isset($typeMap[$this->type])) { + $this->implementation = new $typeMap[$this->type]($section, $args); + } else { + $this->implementation = null; + } + } + + public function getArg($key, $fallback = null) + { + return $this->args[$key] ?? $fallback; + } + + public function sanitize($value) + { + if (is_callable($this->getArg('sanitize'))) { + return $this->getArg('sanitize')($value); + } + + return is_null($this->implementation) ?: $this->implementation->sanitize($value); + } + + public function validate($value) + { + if (is_array($this->getArg('validate'))) { + foreach ($this->getArg('validate') as $validate) { + if (!is_callable($validate['callback'])) { + continue; + } + + $valid = $validate['callback']($value); + + if (!$valid) { + $this->section->tab->settings->errors->add($this->getArg('name'), $validate['feedback']); + + return false; + } + } + + return true; + } + + if (is_callable($this->getArg('validate'))) { + return $this->getArg('validate')($value); + } + + return is_null($this->implementation) ?: $this->implementation->validate($value); + } + + public function render() + { + if (is_callable($this->getArg('visible')) && $this->getArg('visible')() === false) { + return; + } + + if (is_callable($this->getArg('render'))) { + echo $this->getArg('render')($this->implementation); + + return; + } + + echo is_null($this->implementation) ?: $this->implementation->render(); + } +} diff --git a/vendor/rrze/wp/src/Settings/Options/Checkbox.php b/vendor/rrze/wp/src/Settings/Options/Checkbox.php new file mode 100644 index 00000000..4399712e --- /dev/null +++ b/vendor/rrze/wp/src/Settings/Options/Checkbox.php @@ -0,0 +1,24 @@ +section->tab->settings->optionName)[$this->getArg('name')] ?? false; + if ($value === false) { + $value = $this->getArg('default'); + } + return $value; + } + + public function isChecked() + { + return (bool) $this->getValueAttribute(); + } +} diff --git a/vendor/rrze/wp/src/Settings/Options/CheckboxMultiple.php b/vendor/rrze/wp/src/Settings/Options/CheckboxMultiple.php new file mode 100644 index 00000000..3cedc0b1 --- /dev/null +++ b/vendor/rrze/wp/src/Settings/Options/CheckboxMultiple.php @@ -0,0 +1,31 @@ +section->tab->settings->optionName)[$this->getArg('name')] ?? false; + if ($value === false) { + $value = [$this->getArg('default')]; + } + return $value; + } + + public function sanitize($value) + { + return (array) $value; + } +} diff --git a/vendor/rrze/wp/src/Settings/Options/Password.php b/vendor/rrze/wp/src/Settings/Options/Password.php new file mode 100644 index 00000000..af9d9f0c --- /dev/null +++ b/vendor/rrze/wp/src/Settings/Options/Password.php @@ -0,0 +1,24 @@ +section->tab->settings->optionName)[$this->getArg('name')] ?? false; + + return $value ? Encryption::decrypt($value) : null; + } + + public function sanitize($value) + { + return Encryption::encrypt($value); + } +} diff --git a/vendor/rrze/wp/src/Settings/Options/RadioGroup.php b/vendor/rrze/wp/src/Settings/Options/RadioGroup.php new file mode 100644 index 00000000..a382dcd8 --- /dev/null +++ b/vendor/rrze/wp/src/Settings/Options/RadioGroup.php @@ -0,0 +1,10 @@ +section->tab->settings->optionName)[$this->getArg('name')] ?? false; + if ($value === false) { + $value = [$this->getArg('default')]; + } + return $value; + } + + public function sanitize($value) + { + return (array) $value; + } +} diff --git a/vendor/rrze/wp/src/Settings/Options/Text.php b/vendor/rrze/wp/src/Settings/Options/Text.php new file mode 100644 index 00000000..5336d14e --- /dev/null +++ b/vendor/rrze/wp/src/Settings/Options/Text.php @@ -0,0 +1,10 @@ +section = $section; + $this->args = $args; + } + + public function render() + { + return Template::include('options/' . $this->template, ['option' => $this]); + } + + public function hasError() + { + return $this->section->tab->settings->errors->get($this->getArg('name')); + } + + public function sanitize($value) + { + return sanitize_text_field($value); + } + + public function validate($value) + { + return true; + } + + public function getArg($key, $fallback = null) + { + if (empty($this->args[$key])) { + return $fallback; + } + + if (is_callable($this->args[$key])) { + return $this->args[$key](); + } + + return $this->args[$key]; + } + + public function getLabel() + { + return esc_attr($this->getArg('label')); + } + + public function getIdAttribute() + { + return $this->getArg('id', sanitize_title(str_replace('[', '_', $this->getNameAttribute()))); + } + + public function getName() + { + return $this->getArg('name'); + } + + public function getPlaceholderAttribute() + { + $placeholder = $this->getArg('placeholder') ?? null; + + return $placeholder ?: null; + } + + public function getCss() + { + return $this->getArg('css', []); + } + + public function getInputClassAttribute() + { + $class = $this->getCss()['input_class'] ?? null; + + return !empty($class) ? 'class="' . esc_attr($class) . '"' : null; + } + + public function getLabelClassAttribute() + { + $class = $this->getCss()['label_class'] ?? null; + + return !empty($class) ? 'class="' . esc_attr($class) . '"' : null; + } + + public function getNameAttribute() + { + return $this->section->tab->settings->optionName . '[' . $this->getArg('name') . ']'; + } + + public function getValueAttribute() + { + $value = get_option($this->section->tab->settings->optionName)[$this->getArg('name')] ?? false; + + return $value ? $value : $this->args['default'] ?? null; + } +} diff --git a/vendor/rrze/wp/src/Settings/README.md b/vendor/rrze/wp/src/Settings/README.md new file mode 100644 index 00000000..c1333073 --- /dev/null +++ b/vendor/rrze/wp/src/Settings/README.md @@ -0,0 +1,295 @@ +# RRZE\WP\Settings + +The objective of this PHP library is to simplify the process of creating settings pages for WordPress plugins. Traditionally, developers have utilized the Settings API or custom code for this purpose. Although the Settings API functions well, it necessitates substantial setup effort. For instance, developers must manually write the HTML code for their options. Additionally, incorporating tabs and tab-sections can become rather complex. This PHP library aims to streamline these tasks and make settings page creation more straightforward. + +Based on the package `jeffreyvanrossum/wp-settings`. + +## Usage + +### Basic example + +```php +use RRZE\WP\Settings\Settings; + +$settings = new Settings(__('My Plugin Settings')); + +$tab = $settings->addTab(__('Tab One', 'textdomain')); + +$section = $tab->addSection(__('Section One', 'textdomain')); + +$section->addOption('text', [ + 'name' => 'title', + 'label' => __('Title', 'textdomain') +]); + +$settings->build(); +``` + +### Initializing the Settings class + +```php +use RRZE\WP\Settings\Settings; + +$settings = new Settings(__('Custom Settings', 'textdomain')); +``` + +The constructor supports two parameters, namely `$title` and `$slug`. By default, the page slug is generated by sanitizing the title. If there's a specific slug preference, it can be passed as the second parameter to the constructor. + +Additional methods available in this class include: + +```php +$settings->setCapability('manage_options') + ->setOptionName('my_plugin_option') + ->setMenuTitle(__('My Plugin', 'textdomain')) + ->setMenuIcon('dashicons-admin-generic') + ->setMenuPosition(5) + ->setMenuParentSlug('options-general.php'); +``` + +### Tabs + +Tabs will be displayed only if there is more than one tab available. + +```php +$settings->addTab(__('General', 'textdomain')); +``` + +### Sections + +The `addSection` method can be called from an instance of `Tab`. It can also be called from the `Settings` instance. Subsequently, it will be added to the last created `Tab`. + +```php +$tab->addSection(__('Section One', 'textdomain')); +``` + +If sections are desired to be displayed as submenu-items, the following can be done: + +```php +$tab->addSection('Section One', ['as_link' => true]); +``` + +Note that this only has an effect when there are more than one `as_link` sections. + +### Options + +To add an option, you either call the `addOption` method from an instance of `Section`. `addOption` can also be called from the `Settings` instance. The option will then be added to the last created section. + +#### Text + +```php +$section->addOption('text', [ + 'name' => 'option_1', + 'label' => __('Option 1', 'textdomain') +]); +``` + +#### Textarea + +```php +$section->addOption('textarea', [ + 'name' => 'option_1', + 'label' => __('Option 1', 'textdomain') +]); +``` + +#### Checkbox + +```php +$section->addOption('checkbox', [ + 'name' => 'option_1', + 'label' => __('Option 1', 'textdomain') +]); +``` + +#### Checkbox Multiple + +```php +$section->addOption('checkbox-multiple', [ + 'name' => 'multiple_options_1', + 'label' => __('Multiple Options 1', 'textdomain'), + 'options' => [ + 'option_1' => __('Option 1', 'rrze-autoshare'), + 'option_2' => __('Option 2', 'rrze-autoshare') + ], +]); +``` + +#### Radio Group + +```php +$section->addOption('radio-group', [ + 'name' => 'radio_group_1', + 'label' => __('Radio Group 1', 'textdomain'), + 'options' => [ + 'option_1' => __('Option 1', 'rrze-autoshare'), + 'option_2' => __('Option 2', 'rrze-autoshare') + ], +]); +``` + +#### Select + +```php +$section->addOption('select', [ + 'name' => 'option_1', + 'label' => __( 'Option 1', 'textdomain' ), + 'options' => [ + 'value_1' => 'Label 1', + 'value_2' => 'Label 2' + ] +]); +``` + +#### Select Multiple + +```php +$section->addOption('select-multiple', [ + 'name' => 'option_1', + 'label' => __('Option 1', 'textdomain'), + 'options' => [ + 'value_1' => 'Label 1', + 'value_2' => 'Label 2' + ] +] ); +``` + +#### Password + +```php +$section->addOption('password', [ + 'name' => 'password_1', + 'label' => __('Password 1', 'textdomain') +]); +``` + +### Validate + +An option can be validated, allowing for the passing of a callback and a feedback message. Multiple validation rules can be passed as well. + +```php +$section->addOption('text', [ + 'name' => 'custom_api_key', + 'label' => __('API Key', 'textdomain'), + 'validate' => [ + [ + 'feedback' => __('The API key is too short.', 'textdomain'), + 'callback' => fn($value) => strlen($value) > 35 + ] + ] +]); +``` + +### Sanitize + +A sanitize callback can be passed. + +```php +$section->addOption('text', [ + 'name' => 'custom_api_key', + 'label' => __('API Key', 'textdomain'), + 'santitize' => fn($value) => sanitize_key($value) +]); +``` + +### Additional attributes + +#### Description + +```php +$section->addOption('text', [ + 'name' => 'custom_api_key', + 'label' => __('API Key', 'textdomain'), + 'description' => __('Enter the API key here.', 'textdomain') +]); +``` + +#### Placeholder + +```php +$section->addOption('text', [ + 'name' => 'custom_api_key', + 'label' => __('API Key', 'textdomain'), + 'placeholder' => __('Enter the API key here.', 'textdomain') +]); +``` + +#### Default value + +```php +$section->addOption('text', [ + 'name' => 'custom_api_key', + 'label' => __('API Key', 'textdomain'), + 'default' => 'default_value' +]); +``` + +#### CSS classes + +```php +$section->addOption('text', [ + 'name' => 'custom_api_key', + 'label' => __('API Key', 'textdomain'), + 'css' => [ + 'label_class' => 'regular-label', + 'input_class' => 'regular-text' + ] +]); +``` + +### Hooks + +```php +add_filter('rrze_wp_settings_new_options', array $newOptions, array $currentOptions) +``` + +```php +add_filter('rrze_wp_settings_new_option_{$optionName}', mixed $value, object \RRZE\WP\Settings\Options\Type) +``` + +```php +add_filter('rrze_wp_settings_option_type_map', array $optionTypeMap) +``` + +```php +add_filter('rrze_wp_settings_template_include', string $fileName, array $vars) +``` + +```php +add_action('rrze_wp_settings_after_update_option', string $optionName, array $options) +``` + +### Adding a custom option type + +To add a custom option type, the `rrze_wp_settings_option_type_map` filter can be used. + +```php +add_filter('rrze_wp_settings_option_type_map', function($options){ + $options['custom'] = MyCustomOption::class; + return $options; +}); +``` + +Next, the class `MyCustomOption` must be added for the custom option type. + +```php +use RRZE\WP\Settings\Options\Type; + +class MyCustomOption extends Type +{ + public $template = 'custom-option'; + + public function render() + { + echo 'My custom option HTML'; + } +} +``` + +Once registered, the option type can be used as follows: + +```php +$settings->addOption('custom-option', [ + 'name' => 'my_option_name', + 'label' => __('My label', 'textdomain') +]); +``` diff --git a/vendor/rrze/wp/src/Settings/Section.php b/vendor/rrze/wp/src/Settings/Section.php new file mode 100644 index 00000000..cffd67a7 --- /dev/null +++ b/vendor/rrze/wp/src/Settings/Section.php @@ -0,0 +1,41 @@ +tab = $tab; + $this->title = $title; + $this->args = $args; + $this->slug = $this->args['slug'] ?? sanitize_title($title); + $this->description = $this->args['description'] ?? null; + $this->as_link = $this->args['as_link'] ?? false; + } + + public function addOption($type, $args = []) + { + $option = new Option($this, $type, $args); + + $this->options[] = $option; + + return $option; + } +} diff --git a/vendor/rrze/wp/src/Settings/Settings.php b/vendor/rrze/wp/src/Settings/Settings.php new file mode 100644 index 00000000..e3a58b4a --- /dev/null +++ b/vendor/rrze/wp/src/Settings/Settings.php @@ -0,0 +1,330 @@ +title = $title; + $this->optionName = strtolower(str_replace('-', '_', sanitize_title($this->title))); + $this->slug = $slug; + + if ($this->slug === null) { + $this->slug = sanitize_title($title); + } + } + + public function setMenuParentSlug($slug) + { + $this->parentSlug = $slug; + return $this; + } + + public function setMenuTitle($title) + { + $this->menuTitle = $title; + return $this; + } + + public function getMenuTitle() + { + return $this->menuTitle ?? $this->title; + } + + public function setCapability($capability) + { + $this->capability = $capability; + return $this; + } + + public function setOptionName($name) + { + $this->optionName = $name; + return $this; + } + + public function setMenuIcon($icon) + { + $this->menuIcon = $icon; + return $this; + } + + public function setMenuPosition($position) + { + $this->menuPosition = $position; + return $this; + } + + public function addToMenu() + { + if ($this->parentSlug) { + add_submenu_page( + $this->parentSlug, + $this->title, + $this->getMenuTitle(), + $this->capability, + $this->slug, + [$this, 'render'], + $this->menuPosition + ); + } else { + add_menu_page( + $this->title, + $this->getMenuTitle(), + $this->capability, + $this->slug, + [$this, 'render'], + $this->menuIcon, + $this->menuPosition + ); + } + } + + public function build() + { + $this->errors = new Error($this); + $this->flash = new Flash($this); + + add_action('admin_init', [$this, 'save'], 20); + add_action('admin_menu', [$this, 'addToMenu'], 20); + add_action('admin_head', [$this, 'styling'], 20); + } + + public function isOnSettingsPage() + { + $screen = get_current_screen(); + if (is_null($screen)) { + return false; + } + + if ($screen->base === 'settings_page_' . $this->slug) { + return true; + } + + return false; + } + + public function styling() + { + if (!$this->isOnSettingsPage()) { + return; + } + + echo ''; + } + + public function getTabBySlug($slug) + { + foreach ($this->tabs as $tab) { + if ($tab->slug === $slug) { + return $tab; + } + } + + return false; + } + + public function getActiveTab() + { + $default = $this->tabs[0] ?? false; + + if (isset($_GET['tab'])) { + return in_array($_GET['tab'], array_map(function ($tab) { + return $tab->slug; + }, $this->tabs)) ? $this->getTabBySlug($_GET['tab']) : $default; + } + + return $default; + } + + public function addTab($title, $slug = null) + { + $tab = new Tab($this, $title, $slug); + + $this->tabs[] = $tab; + + return $tab; + } + + public function addSection($title, $args = []) + { + if (empty($this->tabs)) { + $tab = $this->addTab(__('Unnamed tab', 'rrze-wp-settings')); + } else { + $tab = end($this->tabs); + } + + return $tab->addSection($title, $args); + } + + public function addOption($type, $args = []) + { + $tab = end($this->tabs); + + if (!$tab instanceof Tab) { + return false; + } + + $section = end($tab->sections); + + if (!$section instanceof Section) { + return false; + } + + return $section->addOption($type, $args); + } + + public function shouldMakeTabs() + { + return count($this->tabs) > 1; + } + + public function getUrl() + { + if ($this->parentSlug && strpos($this->parentSlug, '.php') !== false) { + return add_query_arg('page', $this->slug, admin_url($this->parentSlug)); + } + + return admin_url("admin.php?page=$this->slug"); + } + + public function getFullUrl() + { + $params = []; + + if ($active_tab = $this->getActiveTab()) { + $params['tab'] = $active_tab->slug; + + if ($active_section = $active_tab->getActiveSection()) { + $params['section'] = $active_section->slug; + } + } + + return add_query_arg($params, $this->getUrl()); + } + + public function renderTabMenu() + { + if (!$this->shouldMakeTabs()) { + return; + } + + Template::include('tab-menu', ['settings' => $this]); + } + + public function renderActiveSections() + { + Template::include('sections', ['settings' => $this]); + } + + public function render() + { + Worker::setBuilder(new Builder); + + Worker::enqueue(); + + Template::include('settings-page', ['settings' => $this]); + } + + public function save() + { + if ( + !isset($_POST['rrze_wp_settings_save']) + || !wp_verify_nonce( + $_POST['rrze_wp_settings_save'], + 'rrze_wp_settings_save_' . $this->optionName + ) + ) { + return; + } + + if (!current_user_can($this->capability)) { + wp_die(__('You do not have enough permissions to do that.', 'rrze-wp-settings')); + } + + $currentOptions = $this->getOptions(); + $submittedOptions = apply_filters('rrze_wp_settings_new_options', $_POST[$this->optionName] ?? [], $currentOptions); + $newOptions = $currentOptions; + + foreach ($this->getActiveTab()->getActiveSections() as $section) { + foreach ($section->options as $option) { + $value = $submittedOptions[$option->implementation->getName()] ?? null; + + $valid = $option->validate($value); + + if (!$valid) { + continue; + } + + $value = apply_filters('rrze_wp_settings_new_option_' . $option->implementation->getName(), $option->sanitize($value), $option->implementation); + + $newOptions[$option->implementation->getName()] = $value; + } + } + + $this->updateOptions($newOptions); + + $this->flash->set('success', __('Settings saved.', 'rrze-wp-settings')); + } + + public function defaultOptions() + { + $options = []; + foreach ($this->tabs as $tab) { + foreach ($tab->sections as $section) { + foreach ($section->options as $option) { + $options[$option->args['name']] = $option->args['default'] ?? null; + } + } + } + + return $options; + } + + public function getOptions() + { + $defaults = $this->defaultOptions(); + $options = get_option($this->optionName, []); + $options = wp_parse_args($options, $defaults); + $options = array_intersect_key($options, $defaults); + + return $options; + } + + public function getOption($option) + { + $options = $this->getOptions(); + return $options[$option] ?? null; + } + + public function updateOptions($options) + { + update_option($this->optionName, $options); + do_action('rrze_wp_settings_after_update_option', $this->optionName, $options); + } +} diff --git a/vendor/rrze/wp/src/Settings/Tab.php b/vendor/rrze/wp/src/Settings/Tab.php new file mode 100644 index 00000000..cd01364e --- /dev/null +++ b/vendor/rrze/wp/src/Settings/Tab.php @@ -0,0 +1,88 @@ +title = $title; + $this->settings = $settings; + + if ($this->slug === null) { + $this->slug = sanitize_title($title); + } + } + + public function addSection($title, $args = []) + { + $section = new Section($this, $title, $args); + + $this->sections[] = $section; + + return $section; + } + + public function getSectionLinks() + { + return array_filter($this->sections, function ($section) { + return $section->as_link; + }); + } + + public function containsOnlySectionLinks() + { + return count($this->getSectionLinks()) === count($this->sections); + } + + public function getSectionByName($name) + { + foreach ($this->sections as $section) { + if ($section->slug == $name) { + return $section; + } + } + + return false; + } + + public function getActiveSection() + { + if (empty($this->getSectionLinks())) { + return; + } + + if (isset($_REQUEST['section'])) { + return $this->getSectionByName($_REQUEST['section']); + } + + if ($this->containsOnlySectionLinks()) { + return $this->sections[0]; + } + } + + public function getActiveSections() + { + if (!isset($_REQUEST['section']) && $this->containsOnlySectionLinks()) { + return [$this->sections[0]]; + } + + return \array_filter($this->sections, function ($section) { + if (isset($_REQUEST['section'])) { + return $section->as_link && $_REQUEST['section'] == $section->slug; + } + + return !$section->as_link; + }); + } +} diff --git a/vendor/rrze/wp/src/Settings/Template.php b/vendor/rrze/wp/src/Settings/Template.php new file mode 100644 index 00000000..74b06253 --- /dev/null +++ b/vendor/rrze/wp/src/Settings/Template.php @@ -0,0 +1,26 @@ + $value) { + ${$name} = $value; + } + + $path = __DIR__ . "/templates/{$fileName}.php"; + if (!file_exists($path)) { + return; + } + + ob_start(); + + include $path; + + echo apply_filters('rrze_wp_settings_template_include', ob_get_clean(), $fileName, $vars); + } +} diff --git a/vendor/rrze/wp/src/Settings/Worker.php b/vendor/rrze/wp/src/Settings/Worker.php new file mode 100644 index 00000000..77eb09e6 --- /dev/null +++ b/vendor/rrze/wp/src/Settings/Worker.php @@ -0,0 +1,35 @@ +add($handle, $callback); + } + + public function remove($handle) + { + static::builder()->remove($handle); + } + + public static function enqueue() + { + static::builder()->enqueue(); + } +} diff --git a/vendor/rrze/wp/src/Settings/languages/rrze-wp-settings-de_DE.mo b/vendor/rrze/wp/src/Settings/languages/rrze-wp-settings-de_DE.mo new file mode 100644 index 0000000000000000000000000000000000000000..f126a662fbe234357d48d50235f96fd9e4f49dc1 GIT binary patch literal 1056 zcmY*Y!EVz)5H(PQWDZE2KmutvAc4plC+&ec1fe!5s%S-&rnI0+*2bRN27A}q9k(f8 zKtF&BR}Opt5?2nK`2~&~`3A;uo0OHF-gxHC%zAeB_sykG4zH_>JB&W#8Y5@a>m%bf z<`@S&F#Tr*KN;t*R>*4-0Y;}-4IUcahc0Zbss$=|W@n9w@ligZ9I& zyDx?sYqH&hMHy`j>&JPTd0qgJS*U?pnJ zlBTsF;^gVvrKXMgT!LpBv{5LD40oTKxG*oMQY!K@)y!;EGqX`Ger!!zEG4A@cnjx_ zu1tjM%~S(u#=0+FphD9eax)fK_Ex;kg*=odN{3ud`2QDN1lk<%TxXCez7=_1@f#?O zp5$2YbvEy%Qhagy8NvkxDmbo8%#@%lF^f_(tlCu*RCNNv2opY;I^PgF{feK5B~Yv+ ih`E^h`JJ+a3#_3*c4i4TM%99\n" +"Language-Team: Deutsch\n" +"Language: de_DE\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;" +"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_ex:1,2c;" +"esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;" +"esc_html_x:1,2c\n" +"X-Poedit-Basepath: .\n" +"X-Poedit-SourceCharset: UTF-8\n" +"X-Generator: Poedit 3.4.2\n" +"X-Poedit-SearchPath-0: .\n" +"X-Poedit-SearchPath-1: ..\n" + +#: Main.php:177 +msgid "Unnamed tab" +msgstr "Unbenannte Registerkarte" + +#: Main.php:267 +msgid "You do not have enough permissions to do that." +msgstr "Du hast nicht die nötigen Berechtigungen, um das zu tun." + +#: Main.php:292 +msgid "Settings saved." +msgstr "Die Einstellungen wurden gespeichert." + +#: templates/settings-page.php:18 +msgid "Settings issues detected." +msgstr "Einstellungsprobleme erkannt." diff --git a/vendor/rrze/wp/src/Settings/languages/rrze-wp-settings-de_DE_formal.mo b/vendor/rrze/wp/src/Settings/languages/rrze-wp-settings-de_DE_formal.mo new file mode 100644 index 0000000000000000000000000000000000000000..69c818d085d9717a5e010313c5f57b5c81d211b5 GIT binary patch literal 1076 zcmY*YO>fgc5H(PQ6b?w7KmutvAc4plC+(p)1fe!5s%S-&rnI0+*2bRN27A`pUAHN} z0JwAF$b~!CN*sFUCvfG)Z(tm^Nm%LW&F;MU@a+2c&8066ud9qZj2`0}BV$zSBjYyX z6XOQs8{<0T2g7CjWPH8sIDeV%GCp5%ocqk*nQt-wV%}o@!+eRE$ys7l^{U08_1Zye zQ;H3w#*}CvLW`lr$aQ8OBaf>6E|JVJ0xQSP8&yK2fRu%Vy?~_3IDrCn&UsQr2CS+S zHj&nK23o!2tYR|~uTfWiABMxX{e!*1!9|(I5DTTP*fwz*iM28|Vx)X%3|@&L9;H=~ z=t+w{w7vF<@YatE!S(TE3!yj@1)>{EKcm>B9kd~ zAWWn-XuG?k4Y4}cRec?z7JUj;#PjxHb)4G9AS<=Z#D>zj@qvoz)^yt)sLd|Hy)Lvm zjeRjt7^POc#FJyCBeRtn>q8K90_+3<#e9w2h2LtnI|0=+I}J#w;@q`hhs}UOeYZ8-gu_*rCG$v;7% z)i}eP-?M%%iTLIAQiKHs5*(L0Vv5len1%^zR_)RlsR}?CV$3&F#cPWWza=\n" +"Language-Team: Deutsch (Sie)\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;" +"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;_ex:1,2c;" +"esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;" +"esc_html_x:1,2c\n" +"X-Poedit-Basepath: .\n" +"X-Poedit-SourceCharset: UTF-8\n" +"X-Generator: Poedit 3.4.2\n" +"X-Poedit-SearchPath-0: .\n" +"X-Poedit-SearchPath-1: ..\n" + +#: Main.php:177 +msgid "Unnamed tab" +msgstr "Unbenannte Registerkarte" + +#: Main.php:267 +msgid "You do not have enough permissions to do that." +msgstr "" +"Sie verfügen nicht über die erforderlichen Berechtigungen, um dies zu tun." + +#: Main.php:292 +msgid "Settings saved." +msgstr "Die Einstellungen wurden gespeichert." + +#: templates/settings-page.php:18 +msgid "Settings issues detected." +msgstr "Einstellungsprobleme erkannt." diff --git a/vendor/rrze/wp/src/Settings/templates/options/checkbox-multiple.php b/vendor/rrze/wp/src/Settings/templates/options/checkbox-multiple.php new file mode 100644 index 00000000..db5c522c --- /dev/null +++ b/vendor/rrze/wp/src/Settings/templates/options/checkbox-multiple.php @@ -0,0 +1,27 @@ + + + + getLabel(); ?> + + +
+ getLabel(); ?> + getArg('options', []) as $key => $label) : ?> +
+ + getArg('description')) : ?> +

+ hasError()) : ?> +
+ + +
+ + \ No newline at end of file diff --git a/vendor/rrze/wp/src/Settings/templates/options/checkbox.php b/vendor/rrze/wp/src/Settings/templates/options/checkbox.php new file mode 100644 index 00000000..c3b0bcf1 --- /dev/null +++ b/vendor/rrze/wp/src/Settings/templates/options/checkbox.php @@ -0,0 +1,23 @@ + + + + + + + + + + + hasError()) { ?> +
+ + + \ No newline at end of file diff --git a/vendor/rrze/wp/src/Settings/templates/options/password.php b/vendor/rrze/wp/src/Settings/templates/options/password.php new file mode 100644 index 00000000..d8b593ad --- /dev/null +++ b/vendor/rrze/wp/src/Settings/templates/options/password.php @@ -0,0 +1,21 @@ + + + + + + + getInputClassAttribute(); ?>> + getArg('description')) { ?> +

+ + hasError()) { ?> +
+ + + \ No newline at end of file diff --git a/vendor/rrze/wp/src/Settings/templates/options/radio-group.php b/vendor/rrze/wp/src/Settings/templates/options/radio-group.php new file mode 100644 index 00000000..f5fe70a7 --- /dev/null +++ b/vendor/rrze/wp/src/Settings/templates/options/radio-group.php @@ -0,0 +1,28 @@ + + + + getLabel(); ?> + + +
+ getLabel(); ?> + getArg('options', []) as $key => $label) { ?> +
+ + getArg('description')) { ?> +

+ + hasError()) { ?> +
+ +
+ + \ No newline at end of file diff --git a/vendor/rrze/wp/src/Settings/templates/options/select-multiple.php b/vendor/rrze/wp/src/Settings/templates/options/select-multiple.php new file mode 100644 index 00000000..24595624 --- /dev/null +++ b/vendor/rrze/wp/src/Settings/templates/options/select-multiple.php @@ -0,0 +1,25 @@ + + + + + + + + getArg('description')) { ?> +

+ + + hasError()) { ?> +
+ + + \ No newline at end of file diff --git a/vendor/rrze/wp/src/Settings/templates/options/select.php b/vendor/rrze/wp/src/Settings/templates/options/select.php new file mode 100644 index 00000000..c127b67a --- /dev/null +++ b/vendor/rrze/wp/src/Settings/templates/options/select.php @@ -0,0 +1,24 @@ + + + + + + + + getArg('description')) { ?> +

+ + hasError()) { ?> +
+ + + \ No newline at end of file diff --git a/vendor/rrze/wp/src/Settings/templates/options/text.php b/vendor/rrze/wp/src/Settings/templates/options/text.php new file mode 100644 index 00000000..bce1be32 --- /dev/null +++ b/vendor/rrze/wp/src/Settings/templates/options/text.php @@ -0,0 +1,20 @@ + + + + + + + getInputClassAttribute(); ?>> + getArg('description')) { ?> +

+ + hasError()) { ?> +
+ + + \ No newline at end of file diff --git a/vendor/rrze/wp/src/Settings/templates/options/textarea.php b/vendor/rrze/wp/src/Settings/templates/options/textarea.php new file mode 100644 index 00000000..ffb9262a --- /dev/null +++ b/vendor/rrze/wp/src/Settings/templates/options/textarea.php @@ -0,0 +1,20 @@ + + + + + + + + getArg('description')) { ?> +

+ + hasError()) { ?> +
+ + + \ No newline at end of file diff --git a/vendor/rrze/wp/src/Settings/templates/section-menu.php b/vendor/rrze/wp/src/Settings/templates/section-menu.php new file mode 100644 index 00000000..ac4921bf --- /dev/null +++ b/vendor/rrze/wp/src/Settings/templates/section-menu.php @@ -0,0 +1,13 @@ + +getActiveTab()->getSectionLinks()) { ?> + + \ No newline at end of file diff --git a/vendor/rrze/wp/src/Settings/templates/section.php b/vendor/rrze/wp/src/Settings/templates/section.php new file mode 100644 index 00000000..999aef83 --- /dev/null +++ b/vendor/rrze/wp/src/Settings/templates/section.php @@ -0,0 +1,19 @@ + +

title; ?>

+ +description) { ?> +
description; ?>
+ + + + + options as $option) { ?> + render(); ?> + + +
\ No newline at end of file diff --git a/vendor/rrze/wp/src/Settings/templates/sections.php b/vendor/rrze/wp/src/Settings/templates/sections.php new file mode 100644 index 00000000..18c4239f --- /dev/null +++ b/vendor/rrze/wp/src/Settings/templates/sections.php @@ -0,0 +1,17 @@ + +
+ + + getActiveTab()->getActiveSections() as $section) { ?> + + + + optionName, 'rrze_wp_settings_save'); ?> + + +
\ No newline at end of file diff --git a/vendor/rrze/wp/src/Settings/templates/settings-page.php b/vendor/rrze/wp/src/Settings/templates/settings-page.php new file mode 100644 index 00000000..0c73b62e --- /dev/null +++ b/vendor/rrze/wp/src/Settings/templates/settings-page.php @@ -0,0 +1,25 @@ + +
+

title; ?>

+ + flash->has()) { ?> +
+

+
+ + + errors->getAll()) { ?> +
+

+
+ + + renderTabMenu(); ?> + + renderActiveSections(); ?> +
\ No newline at end of file diff --git a/vendor/rrze/wp/src/Settings/templates/tab-menu.php b/vendor/rrze/wp/src/Settings/templates/tab-menu.php new file mode 100644 index 00000000..4c343fc9 --- /dev/null +++ b/vendor/rrze/wp/src/Settings/templates/tab-menu.php @@ -0,0 +1,11 @@ + + \ No newline at end of file From 0462692e2105060cf1d47d47fa9eae28c4a62804 Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 16:45:44 +0100 Subject: [PATCH 44/45] Update Main.php --- includes/Main.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/Main.php b/includes/Main.php index 7be8b687..b7df4832 100644 --- a/includes/Main.php +++ b/includes/Main.php @@ -20,6 +20,8 @@ public function __construct() add_action('admin_enqueue_scripts', [$this, 'adminEnqueueScripts']); add_action('wp_enqueue_scripts', [$this, 'wpEnqueueScripts']); + settings()->loaded(); + CalendarEvent::init(); CalendarFeed::init(); From 3a5538e1daed6366edce936dd7c10a97b6b0775d Mon Sep 17 00:00:00 2001 From: rvdforst Date: Mon, 19 Feb 2024 16:45:49 +0100 Subject: [PATCH 45/45] Update Settings.php --- includes/Settings.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/includes/Settings.php b/includes/Settings.php index 484a52e5..2ab72008 100644 --- a/includes/Settings.php +++ b/includes/Settings.php @@ -13,6 +13,11 @@ class Settings protected $settings; public function __construct() + { + add_action('rrze_wp_settings_after_update_option', [$this, 'flushRewriteRules']); + } + + public function loaded() { $this->settings = new OptionsSettings(__('Calendar Settings', 'rrze-calendar'), 'rrze-calendar'); @@ -59,12 +64,19 @@ public function __construct() $this->settings->build(); } + public function flushRewriteRules($optionName) + { + if ($optionName === self::OPTION_NAME) { + flush_rewrite_rules(false); + } + } + public function validateEndpointSlug($value) { - if ($validation = strlen(sanitize_title($value)) > 4) { - flush_rewrite_rules(); + if (mb_strlen(sanitize_title($value)) < 4) { + return false; } - return $validation; + return true; } public function getOption($option)