Skip to content

Commit

Permalink
feat(feedback): Added wp plugin repo feedback, version bump.
Browse files Browse the repository at this point in the history
  • Loading branch information
merlijnvanlent committed Sep 23, 2024
1 parent c2a5ef5 commit 2c65715
Show file tree
Hide file tree
Showing 24 changed files with 136 additions and 95 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,4 @@ fabric.properties

/dist/
/node_modules/
/vo-html-sitemap.zip
2 changes: 1 addition & 1 deletion Includes/Pages/LastWeek.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function getItems(array $parameters = []): array

public function getLabel(): string
{
return __('Last week', 'vo-html-sitemap');
return __('Last week', 'vohtmlsitemap');
}

public function getUrl(): string
Expand Down
8 changes: 6 additions & 2 deletions Includes/Pages/Month.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ public function getItems(array $parameters = []): array

$qh = QueryHelper::getInstance();

$sql = "SELECT DAY(post_date) AS day FROM {$qh->wpdb->posts} WHERE YEAR(post_date) = %d AND MONTH(post_date) = %d AND post_type IN ({$qh->getPostTypesPreparableCount()}) AND post_status = 'publish' GROUP BY day ORDER BY day ASC";
$days = $qh->query($sql, array_merge([$this->year->number, $this->number], $qh->getPostTypesPreparableValues()));
$days = $qh->wpdb->get_results(
$qh->wpdb->prepare(
"SELECT DAY(post_date) AS day FROM {$qh->wpdb->posts} WHERE YEAR(post_date) = %d AND MONTH(post_date) = %d AND post_type IN ({$qh->getPostTypesPreparableCount()}) AND post_status = 'publish' GROUP BY day ORDER BY day ASC",
array_merge([$this->year->number, $this->number], $qh->getPostTypesPreparableValues())
)
);

return $this->items = array_map(fn($day) => new Day($this->year, $this, $day->day), $days);
}
Expand Down
8 changes: 6 additions & 2 deletions Includes/Pages/Sitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ public function getItems(array $parameters = []): array

$qh = QueryHelper::getInstance();

$sql = "SELECT YEAR(post_date) AS year FROM {$qh->wpdb->posts} WHERE post_type IN ({$qh->getPostTypesPreparableCount()}) AND post_status = 'publish' GROUP BY year ORDER BY year DESC";
$years = $qh->query($sql, $qh->getPostTypesPreparableValues());
$years = $qh->wpdb->get_results(
$qh->wpdb->prepare(
"SELECT YEAR(post_date) AS year FROM {$qh->wpdb->posts} WHERE post_type IN ({$qh->getPostTypesPreparableCount()}) AND post_status = 'publish' GROUP BY year ORDER BY year DESC",
$qh->getPostTypesPreparableValues()
)
);

return $this->items = array_map(fn($year) => new Year($year->year), $years);
}
Expand Down
2 changes: 1 addition & 1 deletion Includes/Pages/ThisWeek.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function getItems(array $parameters = []): array

public function getLabel(): string
{
return __('This week', 'vo-html-sitemap');
return __('This week', 'vohtmlsitemap');
}

public function getUrl(): string
Expand Down
2 changes: 1 addition & 1 deletion Includes/Pages/Today.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function getItems(array $parameters = []): array

public function getLabel(): string
{
return __('Today', 'vo-html-sitemap');
return __('Today', 'vohtmlsitemap');
}

public function getUrl(): string
Expand Down
8 changes: 6 additions & 2 deletions Includes/Pages/Year.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ public function getItems(array $parameters = []): array

$qh = QueryHelper::getInstance();

$sql = "SELECT MONTH(post_date) AS month FROM {$qh->wpdb->posts} WHERE YEAR(post_date) = %d AND post_type IN ({$qh->getPostTypesPreparableCount()}) AND post_status = 'publish' GROUP BY month ORDER BY month ASC";
$months = $qh->query($sql, array_merge([$this->number], $qh->getPostTypesPreparableValues()));
$months = $qh->wpdb->get_results(
$qh->wpdb->prepare(
"SELECT MONTH(post_date) AS month FROM {$qh->wpdb->posts} WHERE YEAR(post_date) = %d AND post_type IN ({$qh->getPostTypesPreparableCount()}) AND post_status = 'publish' GROUP BY month ORDER BY month ASC",
array_merge([$this->number], $qh->getPostTypesPreparableValues())
)
);

return $this->items = array_map(fn($month) => new Month($this, $month->month), $months);
}
Expand Down
2 changes: 1 addition & 1 deletion Includes/Pages/Yesterday.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function getItems(array $parameters = []): array

public function getLabel(): string
{
return __('Yesterday', 'vo-html-sitemap');
return __('Yesterday', 'vohtmlsitemap');
}

public function getUrl(): string
Expand Down
10 changes: 5 additions & 5 deletions Includes/PagesRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ class PagesRepository
{
public static function resolve(): ?Page
{
if (get_query_var('vo-html-sitemap', false) !== 'true') {
if (get_query_var('vohtmlsitemap', false) !== 'true') {
return null;
}

$range = get_query_var('vo-html-sitemap-range', false);
$day = get_query_var('vo-html-sitemap-day', false);
$month = get_query_var('vo-html-sitemap-month', false);
$year = get_query_var('vo-html-sitemap-year', false);
$range = get_query_var('vohtmlsitemap-range', false);
$day = get_query_var('vohtmlsitemap-day', false);
$month = get_query_var('vohtmlsitemap-month', false);
$year = get_query_var('vohtmlsitemap-year', false);

if ($range !== false && ($range = self::getRangeBySlug($range))) {
return $range;
Expand Down
6 changes: 3 additions & 3 deletions Includes/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function valiDateQuery(WP_Query $query): void

$this->page = $page;

wp_enqueue_style('vo-html-sitemap');
wp_enqueue_style('vohtmlsitemap');

if ($page->getLatestDateShown()->getTimestamp() < strtotime('-1 year')) {
header('X-Robots-Tag: noindex');
Expand All @@ -73,11 +73,11 @@ public function enqueueAssets(): void
{
$rootUrl = plugin_dir_url(VOHTMLSITEMAP_FILE);

wp_register_style('vo-html-sitemap', $rootUrl . 'dist/main.css', [], VOHTMLSITEMAP_VERSION);
wp_register_style('vohtmlsitemap', $rootUrl . 'dist/main.css', [], VOHTMLSITEMAP_VERSION);
}

public function loadTextDomain(): void
{
load_plugin_textdomain('vo-html-sitemap', false, dirname(plugin_basename(VOHTMLSITEMAP_FILE)) . '/languages');
load_plugin_textdomain('vohtmlsitemap', false, dirname(plugin_basename(VOHTMLSITEMAP_FILE)) . '/languages');
}
}
20 changes: 10 additions & 10 deletions Includes/RewriteRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ public static function addRewriteRules(): void

add_rewrite_rule(
"^{$base}\/([0-9]{4})\/?([0-9]{1,2})\/([0-9]{1,2})$",
'index.php?page_id=' . $page->ID . '&vo-html-sitemap=true&vo-html-sitemap-year=$matches[1]&vo-html-sitemap-month=$matches[2]&vo-html-sitemap-day=$matches[3]',
'index.php?page_id=' . $page->ID . '&vohtmlsitemap=true&vohtmlsitemap-year=$matches[1]&vohtmlsitemap-month=$matches[2]&vohtmlsitemap-day=$matches[3]',
'top'
);
add_rewrite_rule(
"^{$base}\/([0-9]{4})\/([0-9]{1,2})$",
'index.php?page_id=' . $page->ID . '&vo-html-sitemap=true&vo-html-sitemap-year=$matches[1]&vo-html-sitemap-month=$matches[2]',
'index.php?page_id=' . $page->ID . '&vohtmlsitemap=true&vohtmlsitemap-year=$matches[1]&vohtmlsitemap-month=$matches[2]',
'top'
);

add_rewrite_rule(
"^{$base}\/([0-9]{4})$",
'index.php?page_id=' . $page->ID . '&vo-html-sitemap=true&vo-html-sitemap-year=$matches[1]',
'index.php?page_id=' . $page->ID . '&vohtmlsitemap=true&vohtmlsitemap-year=$matches[1]',
'top'
);

Expand All @@ -52,24 +52,24 @@ public static function addRewriteRules(): void

add_rewrite_rule(
"^{$base}\/({$expression})$",
'index.php?page_id=' . $page->ID . '&vo-html-sitemap=true&vo-html-sitemap-range=$matches[1]',
'index.php?page_id=' . $page->ID . '&vohtmlsitemap=true&vohtmlsitemap-range=$matches[1]',
'top'
);

add_rewrite_rule(
"^{$base}$",
'index.php?page_id=' . $page->ID . '&vo-html-sitemap=true',
'index.php?page_id=' . $page->ID . '&vohtmlsitemap=true',
'top'
);
}

public static function addQueryVars(array $vars): array
{
$vars[] = 'vo-html-sitemap';
$vars[] = 'vo-html-sitemap-range';
$vars[] = 'vo-html-sitemap-year';
$vars[] = 'vo-html-sitemap-month';
$vars[] = 'vo-html-sitemap-day';
$vars[] = 'vohtmlsitemap';
$vars[] = 'vohtmlsitemap-range';
$vars[] = 'vohtmlsitemap-year';
$vars[] = 'vohtmlsitemap-month';
$vars[] = 'vohtmlsitemap-day';

return $vars;
}
Expand Down
4 changes: 2 additions & 2 deletions Includes/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ class Settings
{
public static function getPostTypes(): array
{
return array_filter(get_option('vo-html-sitemap-post-types', ['post' => true]));
return array_filter(get_option('vohtmlsitemap-post-types', ['post' => true]));
}

public static function getPageId(): int
{
return get_option('vo-html-sitemap-page', 0);
return get_option('vohtmlsitemap-page', 0);
}
}
29 changes: 21 additions & 8 deletions Includes/SettingsPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static function init(): void

public static function registerSettings(): void
{
register_setting('vo-html-sitemap-settings', 'vo-html-sitemap-post-types', [
register_setting('vohtmlsitemap-settings', 'vohtmlsitemap-post-types', [
'type' => 'array',
'sanitize_callback' => function ($value) {
return array_map(function (string $type) use ($value) {
Expand All @@ -24,7 +24,7 @@ public static function registerSettings(): void
]
]);

register_setting('vo-html-sitemap-settings', 'vo-html-sitemap-page', [
register_setting('vohtmlsitemap-settings', 'vohtmlsitemap-page', [
'type' => 'integer',
'sanitize_callback' => function ($value) {
$id = (int) $value;
Expand All @@ -36,21 +36,34 @@ public static function registerSettings(): void
]);

add_settings_section(
'vo-html-sitemap',
__('VO HTML Sitemap Settings', 'vo-html-sitemap'),
'vohtmlsitemap',
__('VO HTML Sitemap Settings', 'vohtmlsitemap'),
'__return_false',
'vo-html-sitemap'
'vohtmlsitemap'
);

$settings = [
'vo-html-sitemap-post-types' => 'vohtmlsitemap-post-types',
'vo-html-sitemap-page' => 'vohtmlsitemap-page'
];

// rename old settings, if they exist
foreach ($settings as $old => $new) {
if ($value = get_option($old)) {
update_option($new, $value);
delete_option($old);
}
}
}

public static function addSubmenuPage(): void
{
add_submenu_page(
'options-general.php',
__('VO HTML Sitemap', 'vo-html-sitemap'),
__('HTML Sitemap', 'vo-html-sitemap'),
__('VO HTML Sitemap', 'vohtmlsitemap'),
__('HTML Sitemap', 'vohtmlsitemap'),
'manage_options',
'vo-html-sitemap',
'vohtmlsitemap',
[self::class, 'renderSubmenuPage']
);
}
Expand Down
Binary file modified languages/vo-html-sitemap-nl_NL.mo
Binary file not shown.
28 changes: 14 additions & 14 deletions languages/vo-html-sitemap-nl_NL.po
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/vo-html-sitemap\n"
"POT-Creation-Date: 2024-08-26T08:46:04+00:00\n"
"PO-Revision-Date: 2024-08-26 10:46+0200\n"
"POT-Creation-Date: 2024-09-23T08:55:20+00:00\n"
"PO-Revision-Date: 2024-09-23 10:56+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: nl_NL\n"
Expand All @@ -15,8 +15,9 @@ msgstr ""
"X-Poedit-Basepath: .\n"

#. Plugin Name of the plugin
msgid "Van Ons HTML Sitemap"
msgstr "Van Ons HTML Sitemap"
#: Includes/SettingsPage.php:63
msgid "VO HTML Sitemap"
msgstr "VO HTML Sitemap"

#. Description of the plugin
msgid "Van Ons plugin to add a HTML sitemap to your site."
Expand Down Expand Up @@ -50,30 +51,29 @@ msgstr "Gisteren"
msgid "VO HTML Sitemap Settings"
msgstr "VO HTML Sitemap Instellingen"

#: Includes/SettingsPage.php:50
msgid "VO HTML Sitemap"
msgstr "VO HTML Sitemap"

#: Includes/SettingsPage.php:51
#: Includes/SettingsPage.php:64
msgid "HTML Sitemap"
msgstr "HTML Sitemap"

#: templates/admin/settings.php:9
#: templates/admin/settings.php:15
msgid "Post types"
msgstr "Berichttypen"

#: templates/admin/settings.php:14
#: templates/admin/settings.php:20
msgid "Post types to include in the sitemap"
msgstr "Berichttypen die in de sitemap moeten worden opgenomen"

#: templates/admin/settings.php:29
#: templates/admin/settings.php:35
msgid "Sitemap page"
msgstr "Sitemap pagina"

#: templates/admin/settings.php:34
#: templates/admin/settings.php:40
msgid "Select a page"
msgstr "Selecteer een pagina"

#: templates/sitemap-range.php:24
#: templates/sitemap-range.php:28
msgid "No posts found"
msgstr "Geen berichten gevonden"

#~ msgid "Van Ons HTML Sitemap"
#~ msgstr "Van Ons HTML Sitemap"
25 changes: 11 additions & 14 deletions languages/vo-html-sitemap.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@
# This file is distributed under the MIT.
msgid ""
msgstr ""
"Project-Id-Version: Van Ons HTML Sitemap 1.0.0\n"
"Project-Id-Version: VO HTML Sitemap 1.0.2\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/vo-html-sitemap\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2024-08-26T08:46:04+00:00\n"
"POT-Creation-Date: 2024-09-23T08:55:20+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.5.0\n"
"X-Domain: vo-html-sitemap\n"
"X-Domain: vohtmlsitemap\n"

#. Plugin Name of the plugin
msgid "Van Ons HTML Sitemap"
#: Includes/SettingsPage.php:63
msgid "VO HTML Sitemap"
msgstr ""

#. Description of the plugin
Expand Down Expand Up @@ -50,30 +51,26 @@ msgstr ""
msgid "VO HTML Sitemap Settings"
msgstr ""

#: Includes/SettingsPage.php:50
msgid "VO HTML Sitemap"
msgstr ""

#: Includes/SettingsPage.php:51
#: Includes/SettingsPage.php:64
msgid "HTML Sitemap"
msgstr ""

#: templates/admin/settings.php:9
#: templates/admin/settings.php:15
msgid "Post types"
msgstr ""

#: templates/admin/settings.php:14
#: templates/admin/settings.php:20
msgid "Post types to include in the sitemap"
msgstr ""

#: templates/admin/settings.php:29
#: templates/admin/settings.php:35
msgid "Sitemap page"
msgstr ""

#: templates/admin/settings.php:34
#: templates/admin/settings.php:40
msgid "Select a page"
msgstr ""

#: templates/sitemap-range.php:24
#: templates/sitemap-range.php:28
msgid "No posts found"
msgstr ""
8 changes: 4 additions & 4 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
=== VO HTML Sitemap ===
Contributors: vanons
Contributors: vanonsopensource
Donate link: https://van-ons.nl/
Tags: 1.0.1
Tags: sitemap, SEO, html
Requires at least: 6.4
Tested up to: 6.6
Stable tag: 1.0.1
Stable tag: 1.0.2
Requires PHP: 8.0
License: MIT
License URI: https://opensource.org/licenses/MIT

VO HTML Sitemap is a simple plugin that adds a HTML sitemap of your WordPress site.
VO HTML Sitemap is a simple plugin that adds a HTML sitemap to your WordPress site.
Loading

0 comments on commit 2c65715

Please sign in to comment.