Synced folder
This commit is contained in:
parent
3047a9579b
commit
1bde243f80
10 changed files with 1578 additions and 0 deletions
BIN
ansico-laegenoter-plugins-1.0.0.zip
Normal file
BIN
ansico-laegenoter-plugins-1.0.0.zip
Normal file
Binary file not shown.
BIN
ansico-laegenoter-plugins-1.0.0.zip:Zone.Identifier
Normal file
BIN
ansico-laegenoter-plugins-1.0.0.zip:Zone.Identifier
Normal file
Binary file not shown.
Binary file not shown.
4
ansico-ln-plugins/README.txt
Normal file
4
ansico-ln-plugins/README.txt
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
Ansico LN plugins
|
||||||
|
Version: 1.0.0
|
||||||
|
Forfatter: Andreas Andersen (Ansico)
|
||||||
|
URL: https://ansico.dk
|
||||||
1294
ansico-ln-plugins/ansico-ln-plugins.php
Normal file
1294
ansico-ln-plugins/ansico-ln-plugins.php
Normal file
File diff suppressed because it is too large
Load diff
136
ansico-ln-plugins/blocks/taxonomiliste/editor.js
Normal file
136
ansico-ln-plugins/blocks/taxonomiliste/editor.js
Normal file
|
|
@ -0,0 +1,136 @@
|
||||||
|
(function (blocks, element, blockEditor, components, i18n, serverSideRender) {
|
||||||
|
var el = element.createElement;
|
||||||
|
var InspectorControls = blockEditor.InspectorControls;
|
||||||
|
var PanelBody = components.PanelBody;
|
||||||
|
var SelectControl = components.SelectControl;
|
||||||
|
var ToggleControl = components.ToggleControl;
|
||||||
|
var RangeControl = components.RangeControl;
|
||||||
|
var Placeholder = components.Placeholder;
|
||||||
|
var ServerSideRender = serverSideRender;
|
||||||
|
var __ = i18n.__;
|
||||||
|
|
||||||
|
var data = window.AnsicoLNTaxonomilisteData || {};
|
||||||
|
var taxonomies = Array.isArray(data.taxonomies) ? data.taxonomies : [];
|
||||||
|
|
||||||
|
blocks.registerBlockType('ansico-ln/taxonomiliste', {
|
||||||
|
apiVersion: 2,
|
||||||
|
title: __('Taxonomiliste', 'ansico-ln-plugins'),
|
||||||
|
description: __('Viser termer fra en valgt taxonomi som liste eller tag sky.', 'ansico-ln-plugins'),
|
||||||
|
icon: 'tag',
|
||||||
|
category: 'widgets',
|
||||||
|
attributes: {
|
||||||
|
taxonomy: {
|
||||||
|
type: 'string',
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
displayType: {
|
||||||
|
type: 'string',
|
||||||
|
default: 'list'
|
||||||
|
},
|
||||||
|
showCount: {
|
||||||
|
type: 'boolean',
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
showAll: {
|
||||||
|
type: 'boolean',
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
limit: {
|
||||||
|
type: 'number',
|
||||||
|
default: 20
|
||||||
|
},
|
||||||
|
sortBy: {
|
||||||
|
type: 'string',
|
||||||
|
default: 'alphabetical'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
edit: function (props) {
|
||||||
|
var attributes = props.attributes;
|
||||||
|
var setAttributes = props.setAttributes;
|
||||||
|
var taxonomyOptions = [{ label: __('Vælg taxonomi', 'ansico-ln-plugins'), value: '' }].concat(
|
||||||
|
taxonomies.map(function (taxonomy) {
|
||||||
|
return { label: taxonomy.label, value: taxonomy.slug };
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
return el(
|
||||||
|
element.Fragment,
|
||||||
|
{},
|
||||||
|
el(
|
||||||
|
InspectorControls,
|
||||||
|
{},
|
||||||
|
el(
|
||||||
|
PanelBody,
|
||||||
|
{ title: __('Indstillinger', 'ansico-ln-plugins'), initialOpen: true },
|
||||||
|
el(SelectControl, {
|
||||||
|
label: __('Taxonomi', 'ansico-ln-plugins'),
|
||||||
|
value: attributes.taxonomy,
|
||||||
|
options: taxonomyOptions,
|
||||||
|
onChange: function (value) {
|
||||||
|
setAttributes({ taxonomy: value });
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
el(SelectControl, {
|
||||||
|
label: __('Visning', 'ansico-ln-plugins'),
|
||||||
|
value: attributes.displayType,
|
||||||
|
options: [
|
||||||
|
{ label: __('Liste', 'ansico-ln-plugins'), value: 'list' },
|
||||||
|
{ label: __('Tag sky', 'ansico-ln-plugins'), value: 'cloud' }
|
||||||
|
],
|
||||||
|
onChange: function (value) {
|
||||||
|
setAttributes({ displayType: value });
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
el(SelectControl, {
|
||||||
|
label: __('Sortering', 'ansico-ln-plugins'),
|
||||||
|
value: attributes.sortBy || 'alphabetical',
|
||||||
|
options: [
|
||||||
|
{ label: __('Alfabetisk', 'ansico-ln-plugins'), value: 'alphabetical' },
|
||||||
|
{ label: __('Flest emner først', 'ansico-ln-plugins'), value: 'count' }
|
||||||
|
],
|
||||||
|
onChange: function (value) {
|
||||||
|
setAttributes({ sortBy: value });
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
el(ToggleControl, {
|
||||||
|
label: __('Vis antal emner pr. tag', 'ansico-ln-plugins'),
|
||||||
|
checked: !!attributes.showCount,
|
||||||
|
onChange: function (value) {
|
||||||
|
setAttributes({ showCount: value });
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
el(ToggleControl, {
|
||||||
|
label: __('Vis alle tags', 'ansico-ln-plugins'),
|
||||||
|
checked: !!attributes.showAll,
|
||||||
|
onChange: function (value) {
|
||||||
|
setAttributes({ showAll: value });
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
!attributes.showAll && el(RangeControl, {
|
||||||
|
label: __('Antal tags', 'ansico-ln-plugins'),
|
||||||
|
value: attributes.limit || 20,
|
||||||
|
onChange: function (value) {
|
||||||
|
setAttributes({ limit: value || 1 });
|
||||||
|
},
|
||||||
|
min: 1,
|
||||||
|
max: 200
|
||||||
|
})
|
||||||
|
)
|
||||||
|
),
|
||||||
|
attributes.taxonomy ?
|
||||||
|
el(ServerSideRender, {
|
||||||
|
block: 'ansico-ln/taxonomiliste',
|
||||||
|
attributes: attributes
|
||||||
|
}) :
|
||||||
|
el(Placeholder, {
|
||||||
|
icon: 'tag',
|
||||||
|
label: __('Taxonomiliste', 'ansico-ln-plugins'),
|
||||||
|
instructions: __('Vælg en taxonomi i blokindstillingerne.', 'ansico-ln-plugins')
|
||||||
|
})
|
||||||
|
);
|
||||||
|
},
|
||||||
|
save: function () {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})(window.wp.blocks, window.wp.element, window.wp.blockEditor, window.wp.components, window.wp.i18n, window.wp.serverSideRender);
|
||||||
56
ansico-ln-plugins/readme.txt
Normal file
56
ansico-ln-plugins/readme.txt
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
=== Ansico Lægenoter plugins ===
|
||||||
|
Contributors: ansico
|
||||||
|
Tags: search, custom post types, taxonomy, gutenberg, table of contents
|
||||||
|
Requires at least: 6.0
|
||||||
|
Tested up to: 6.9.4
|
||||||
|
Requires PHP: 7.0
|
||||||
|
Stable tag: 1.0.0
|
||||||
|
License: GPL-3.0-or-later
|
||||||
|
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
|
Plugins til at forbedre lægenoter.
|
||||||
|
|
||||||
|
== Description ==
|
||||||
|
|
||||||
|
Ansico Lægenoter plugins samler en række funktioner til WordPress, der forbedrer visning af lægefagligt indhold.
|
||||||
|
|
||||||
|
Pluginet indeholder blandt andet:
|
||||||
|
|
||||||
|
* grupperede søgeresultater på tværs af post types
|
||||||
|
* specialarkiver for custom post types og taxonomier
|
||||||
|
* Gutenberg-blokken "Taxonomiliste"
|
||||||
|
* automatisk indholdsfortegnelse
|
||||||
|
* styring af metadata som forfatter og dato
|
||||||
|
* automatisk liste over citerede kilder ud fra eksterne links i indholdet
|
||||||
|
|
||||||
|
== Installation ==
|
||||||
|
|
||||||
|
1. Upload pluginmappen til `/wp-content/plugins/` eller installer ZIP-filen via WordPress.
|
||||||
|
2. Aktivér pluginet i WordPress.
|
||||||
|
3. Gå til **Indstillinger > Ansico Lægenoter plugins** for at konfigurere funktionerne.
|
||||||
|
|
||||||
|
== Frequently Asked Questions ==
|
||||||
|
|
||||||
|
= Hvilke post types understøttes? =
|
||||||
|
|
||||||
|
Pluginet understøtter indlæg, sider og custom post types, afhængigt af de valgte indstillinger.
|
||||||
|
|
||||||
|
= Understøtter pluginet block themes? =
|
||||||
|
|
||||||
|
Ja. Pluginet er tilpasset både klassiske temaer og block themes.
|
||||||
|
|
||||||
|
== Changelog ==
|
||||||
|
|
||||||
|
= 1.0.0 =
|
||||||
|
* Første stabile release.
|
||||||
|
* Grupperede søgeresultater efter post type.
|
||||||
|
* Specialarkiver for post types og taxonomier.
|
||||||
|
* Gutenberg-blokken "Taxonomiliste".
|
||||||
|
* Automatisk indholdsfortegnelse med flere visningsmuligheder.
|
||||||
|
* Kontrol over forfatter, dato og opdateringsdato.
|
||||||
|
* Automatisk "Citerede kilder" ud fra eksterne links.
|
||||||
|
|
||||||
|
== Upgrade Notice ==
|
||||||
|
|
||||||
|
= 1.0.0 =
|
||||||
|
Første stabile release.
|
||||||
26
ansico-ln-plugins/templates/archive-post-type.php
Normal file
26
ansico-ln-plugins/templates/archive-post-type.php
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
if (!defined('ABSPATH')) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
get_header();
|
||||||
|
|
||||||
|
$post_type = Ansico_LN_Plugins::get_current_archive_post_type();
|
||||||
|
$grouped_results = Ansico_LN_Plugins::get_archive_results_grouped_by_letter($post_type);
|
||||||
|
$title = Ansico_LN_Plugins::get_post_type_label($post_type);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<main id="primary" class="site-main ansico-ln-archive-results" style="max-width: 960px; margin: 0 auto; padding: 2rem 1rem;">
|
||||||
|
<header class="page-header" style="margin-bottom: 2rem;">
|
||||||
|
<h1 class="page-title"><?php echo esc_html($title); ?></h1>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<?php if (!empty($grouped_results)) : ?>
|
||||||
|
<?php echo Ansico_LN_Plugins::render_alphabetical_archive_sections($grouped_results); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||||
|
<?php else : ?>
|
||||||
|
<p>Der blev ikke fundet nogen resultater.</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
get_footer();
|
||||||
31
ansico-ln-plugins/templates/archive-taxonomy.php
Normal file
31
ansico-ln-plugins/templates/archive-taxonomy.php
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
if (!defined('ABSPATH')) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
get_header();
|
||||||
|
|
||||||
|
$results = Ansico_LN_Plugins::get_taxonomy_archive_results();
|
||||||
|
$description = Ansico_LN_Plugins::get_current_taxonomy_description();
|
||||||
|
?>
|
||||||
|
|
||||||
|
<main id="primary" class="site-main ansico-ln-taxonomy-results" style="max-width: 960px; margin: 0 auto; padding: 2rem 1rem;">
|
||||||
|
<header class="page-header" style="margin-bottom: 2rem;">
|
||||||
|
<h1 class="page-title"><?php single_term_title(); ?></h1>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<?php if (!empty($description)) : ?>
|
||||||
|
<div class="archive-description" style="margin-bottom:1.5rem;">
|
||||||
|
<?php echo wp_kses_post($description); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if (!empty($results)) : ?>
|
||||||
|
<?php echo Ansico_LN_Plugins::render_simple_results_list($results); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||||
|
<?php else : ?>
|
||||||
|
<p>Der blev ikke fundet nogen resultater.</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
get_footer();
|
||||||
31
ansico-ln-plugins/templates/search.php
Normal file
31
ansico-ln-plugins/templates/search.php
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
if (!defined('ABSPATH')) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
get_header();
|
||||||
|
|
||||||
|
$grouped_results = Ansico_LN_Plugins::get_grouped_search_results();
|
||||||
|
$total_results = Ansico_LN_Plugins::get_total_results_count($grouped_results);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<main id="primary" class="site-main ansico-ln-search-results" style="max-width: 960px; margin: 0 auto; padding: 2rem 1rem;">
|
||||||
|
<header class="page-header" style="margin-bottom: 2rem;">
|
||||||
|
<h1 class="page-title">Søgeresultater</h1>
|
||||||
|
<p><?php echo esc_html(Ansico_LN_Plugins::get_total_results_text($total_results)); ?></p>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<?php if (!empty($grouped_results)) : ?>
|
||||||
|
<?php foreach ($grouped_results as $post_type => $group) : ?>
|
||||||
|
<section class="ansico-ln-search-group" style="margin-bottom: 2rem;">
|
||||||
|
<strong><?php echo esc_html($group['label']); ?></strong>
|
||||||
|
<?php echo Ansico_LN_Plugins::render_group_results_list($group['results']); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||||
|
</section>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php else : ?>
|
||||||
|
<p>Der blev ikke fundet nogen resultater.</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
get_footer();
|
||||||
Loading…
Reference in a new issue