diff --git a/admin/css/mfn-wp-plugin-admin.css b/admin/css/mfn-wp-plugin-admin.css
index bd9515a..d1c73ce 100644
--- a/admin/css/mfn-wp-plugin-admin.css
+++ b/admin/css/mfn-wp-plugin-admin.css
@@ -132,6 +132,10 @@ input.wide {
color: rgba(44,51,56,.5);
}
+.mfn-settings-table input::placeholder {
+ color: rgba(44,51,56,.5);
+}
+
.mfn-settings-table th {
text-align: left;
}
diff --git a/admin/js/mfn-wp-plugin-admin.js b/admin/js/mfn-wp-plugin-admin.js
index dcb7d7d..a99e8a2 100644
--- a/admin/js/mfn-wp-plugin-admin.js
+++ b/admin/js/mfn-wp-plugin-admin.js
@@ -47,8 +47,12 @@
return new Promise((resolve) => setTimeout(resolve, ms));
}
+ function no_cache_param(p) {
+ return p + 'no-cache='+Math.round((Math.random()*1000000));
+ }
+
function mfn_sync_single_item(post_id) {
- $.get(mfn_admin_params.plugin_url + '/cc.php?mode=sync&limit=1&offset=0&post_id=' + post_id)
+ $.get(mfn_admin_params.plugin_url + '/cc.php?mode=sync&limit=1&offset=0&post_id=' + post_id + no_cache_param('&'))
.done(function () {
if (post_id !== null) {
$('#mfn-item-restore-status').html('');
@@ -83,7 +87,7 @@
.html('
Waiting...');
}
- $.get(mfn_admin_params.plugin_url + '/cc.php?mode=sync&limit=' + limit + '&offset=' + offset, function (data) {
+ $.get(mfn_admin_params.plugin_url + '/cc.php?mode=sync&limit=' + limit + '&offset=' + offset + no_cache_param('&'), function (data) {
sync_condition = 'running';
var fetched = parseInt(data.split(' ')[0]);
var inserted = parseInt(data.split(' ')[1]);
@@ -127,7 +131,7 @@
async function syncTax() {
$('#mfn-sync-tax-status').html('
');
- await $.get(mfn_admin_params.plugin_url + '/cc.php?mode=sync-tax', function () {
+ await $.get(mfn_admin_params.plugin_url + '/cc.php?mode=sync-tax' + no_cache_param('&'), function () {
$('#mfn-sync-tax-status')
.html("Done!
");
});
@@ -246,7 +250,7 @@
return;
}
- $.get(pluginUrl + '/cc.php?mode=ping', function (data) {
+ $.get(pluginUrl + '/cc.php?mode=ping' + no_cache_param('&'), function (data) {
if (data === 'pong') {
pluginUrlTestEl
.html("Current: (" + mfn_admin_params.plugin_url + ")");
@@ -301,7 +305,7 @@
var subStatusEl = $('#mfn-subscription-status');
var subStatusContainerEl = $('#mfn-status-container');
- $.get(pluginUrl + '/cc.php?mode=verify-subscription').done(function (res) {
+ $.get(pluginUrl + '/cc.php?mode=verify-subscription' + no_cache_param('&')).done(function (res) {
// got error from websub verification
if (msg !== '') {
mfn_subscription_error(msg, 'mfn-subscription-status');
@@ -341,7 +345,7 @@
var subStatusEl = $('#mfn-subscription-status');
$('#mfn-sub-button').attr("disabled", true);
- $.get(pluginUrl + '/cc.php?mode=subscribe', function (msg) {
+ $.get(pluginUrl + '/cc.php?mode=subscribe' + no_cache_param('&'), function (msg) {
subStatusEl.html('
Subscribing...');
mfn_verify_subscription(pluginUrl, verificationRetries, msg);
});
@@ -353,7 +357,7 @@
$('#mfn-unsub-button').attr("disabled", true);
$('#save-submit-btn').prop("disabled", false);
- $.get(pluginUrl + '/cc.php?mode=unsubscribe', function () {
+ $.get(pluginUrl + '/cc.php?mode=unsubscribe' + no_cache_param('&'), function () {
subStatusEl
.html('
Unsubscribing...');
@@ -377,7 +381,7 @@
function mfn_clear_settings(){
var pluginUrl = mfn_admin_params.plugin_url;
- $.get(pluginUrl + '/cc.php?mode=clear-settings', function () {
+ $.get(pluginUrl + '/cc.php?mode=clear-settings' + no_cache_param('&'), function () {
setTimeout(function () {
location.reload();
}, 100);
@@ -399,7 +403,7 @@
.html('
Deleting tags...');
delTagsBtnSpanEl.removeClass("dashicons dashicons-tag");
delTagsBtnSpanEl.html('
');
- $.get(pluginUrl + '/cc.php?mode=delete-all-tags&limit=10', function (data) {
+ $.get(pluginUrl + '/cc.php?mode=delete-all-tags&limit=10' + no_cache_param('&'), function (data) {
var parts = data.split(';');
var i = parseInt(parts[0]);
var deleted = parseInt(parts[1]);
@@ -422,7 +426,7 @@
if (acceptedTypes.includes(type)) {
var modalUrl = mfn_admin_params.plugin_url + '/admin/partials/modals/mfn-modal-' + type + '.php';
- await $.get(modalUrl, function (data) {
+ await $.get(modalUrl + no_cache_param('?'), function (data) {
$('body').append(data);
// modal main events
$('.mfn-close-modal').click(function() {
@@ -449,7 +453,7 @@
delPostsBtnSpanEl.addClass("dashicons dashicons-admin-post");
}
- $.get(pluginUrl + '/cc.php?mode=delete-all-posts&limit=10&include-dirty=' + includeDirty, function (data, xhr) {
+ $.get(pluginUrl + '/cc.php?mode=delete-all-posts&limit=10&include-dirty=' + includeDirty + no_cache_param('&'), function (data, xhr) {
var parts = data.split(';');
var i = parseInt(parts[0]);
var deleted = parseInt(parts[1]);
diff --git a/admin/partials/mfn-wp-plugin-admin-display.php b/admin/partials/mfn-wp-plugin-admin-display.php
index ad08d39..a943b12 100644
--- a/admin/partials/mfn-wp-plugin-admin-display.php
+++ b/admin/partials/mfn-wp-plugin-admin-display.php
@@ -70,12 +70,14 @@
$verify_signature = $options['verify_signature'] ?? 'off';
$reset_cache = $options['reset_cache'] ?? 'on';
$enable_attachments = $options['enable_attachments'] ?? 'off';
+$taxonomy_disable_cus_prefix = $options['taxonomy_disable_cus_prefix'] ?? "off";
// Rewrite settings
$rewrite = isset($options['rewrite_post_type']) ? unserialize($options['rewrite_post_type']) : null;
$slug = (isset($rewrite['slug']) && $rewrite['slug'] !== '' ? $rewrite['slug'] : MFN_POST_TYPE);
$archive_name = (isset($rewrite['archive-name']) && $rewrite['archive-name'] !== '' ? $rewrite['archive-name'] : MFN_ARCHIVE_NAME);
$singular_name = (isset($rewrite['singular-name']) && $rewrite['singular-name'] !== '' ? $rewrite['singular-name'] : MFN_SINGULAR_NAME);
+$taxonomy_rewrite_slug = $options['taxonomy_rewrite_slug'] ?? '';
// HTML
echo '
@@ -184,6 +186,21 @@ function toggleQueryInput(e) {
+
+
+ ' . mfn_parse_label('label_rewrite_taxonomy_slug') . '
+ ' . mfn_parse_small('small_mfn-news-tag') . '
+ |
+
+
+
+
+
+
+ ' . mfn_get_text('tooltip_taxonomy_rewrite_slug') . '
+
+ |
+
' . mfn_parse_label('label_rewrite_post_type_archive_name') . '
@@ -383,6 +400,16 @@ function toggleQueryInput(e) {
|
|
+
+
+
+
+ ' . mfn_parse_label('label_taxonomy_disable_cus_prefix') . '
+
+ ' . mfn_parse_small('small_taxonomy_disable_cus_prefix_description') . '
+
+ |
+ |
diff --git a/admin/partials/modals/mfn-modal-clear-settings.php b/admin/partials/modals/mfn-modal-clear-settings.php
index 1bb0912..5186bc2 100644
--- a/admin/partials/modals/mfn-modal-clear-settings.php
+++ b/admin/partials/modals/mfn-modal-clear-settings.php
@@ -1,6 +1,13 @@
posts po
INNER JOIN $wpdb->term_relationships r
ON r.object_id = po.ID
diff --git a/cc.php b/cc.php
index 5a0d010..1e5a2ac 100644
--- a/cc.php
+++ b/cc.php
@@ -182,9 +182,16 @@ function mfn_delete_all_tags(): array
$options = get_option( "mfn-wp-plugin" );
$wpml_enabled = defined( 'WPML_PLUGIN_BASENAME' ) && isset( $options['language_plugin'] ) && $options['language_plugin'] == 'wpml';
+ $pll_enabled = isset($options['language_plugin']) && $options['language_plugin'] == 'pll';
if ( $wpml_enabled ) {
$terms = MFN_get_terms_wpml( '' );
+ } else if ( $pll_enabled ) {
+ $terms = get_terms( array(
+ 'taxonomy' => MFN_TAXONOMY_NAME,
+ 'hide_empty' => false,
+ 'lang' => '',
+ ) );
} else {
$terms = get_terms( array(
'taxonomy' => MFN_TAXONOMY_NAME,
diff --git a/config.php b/config.php
index 8b47bab..ca0d2df 100644
--- a/config.php
+++ b/config.php
@@ -151,6 +151,11 @@ function mfn_register_types()
'menu_name' => __('News Tags'),
);
+ $taxonomy_rewrite_slug = '';
+ if (isset(get_option(MFN_PLUGIN_NAME)['taxonomy_rewrite_slug'])) {
+ $taxonomy_rewrite_slug = get_option(MFN_PLUGIN_NAME)['taxonomy_rewrite_slug'];
+ }
+
register_taxonomy(MFN_TAXONOMY_NAME, array(MFN_POST_TYPE), array(
'hierarchical' => true,
'labels' => $labels,
@@ -158,7 +163,7 @@ function mfn_register_types()
'show_admin_column' => true,
'show_in_menu' => true,
'query_var' => true,
- 'rewrite' => array('slug' => MFN_TAXONOMY_NAME),
+ 'rewrite' => array('slug' => empty($taxonomy_rewrite_slug) ? MFN_TAXONOMY_NAME : $taxonomy_rewrite_slug),
));
}
@@ -168,7 +173,7 @@ function mfn_sync_taxonomy()
$tax = [
"slug" => MFN_TAG_PREFIX,
"name" => "News",
- "i10n" => ["sv" => "Nyheter"],
+ "i10n" => ["sv" => "Nyheter", "fi" => "Uutiset"],
"children" => [
[
"slug" => "type-ir",
@@ -195,6 +200,16 @@ function mfn_sync_taxonomy()
"name" => "Finnish",
"i10n" => ["sv" => "Finska", 'fi' => "Suomi"]
],
+ [
+ "slug" => "lang-no",
+ "name" => "Norwegian",
+ "i10n" => ["sv" => "Norska"]
+ ],
+ [
+ "slug" => "lang-zh",
+ "name" => "Chinese",
+ "i10n" => ["sv" => "Kinesiska"]
+ ],
[
"slug" => "correction",
"name" => "Correction",
@@ -220,12 +235,21 @@ function mfn_sync_taxonomy()
"name" => "LHFI",
"i10n" => ["sv" => "LHFI"]
],
+ [
+ "slug" => "nsta",
+ "name" => "NSTA",
+ "i10n" => ["sv" => "NSTA"]
+ ],
+ [
+ "slug" => "dcma",
+ "name" => "DCMA",
+ "i10n" => ["sv" => "DCMA"]
+ ],
[
"slug" => "listing",
"name" => "Listing Regulation",
"i10n" => ["sv" => "Noteringskrav", 'fi' => "Listausvaatimukset"]
],
-
]
],
[
@@ -263,7 +287,6 @@ function mfn_sync_taxonomy()
"name" => "Yearend",
"i10n" => ["sv" => "Bokslutskommuniké", 'fi' => "Vuoden loppu"]
],
-
]
],
]
@@ -293,6 +316,36 @@ function mfn_sync_taxonomy()
"name" => "Prospectus",
"i10n" => ["sv" => "Prospekt", 'fi' => "Esite"]
],
+ [
+ "slug" => "aoa",
+ "name" => "Articles of association",
+ "i10n" => ["sv" => "Bolagsordning", 'fi' => "Yhtiöjärjestys"]
+ ],
+ [
+ "slug" => "bid",
+ "name" => "Tender offer",
+ "i10n" => ["sv" => "Offentligt uppköpserbjudande", 'fi' => "Julkinen ostotarjous"]
+ ],
+ [
+ "slug" => "member-state",
+ "name" => "Member state",
+ "i10n" => ["sv" => "Hemstat", 'fi' => "Jäsenvaltio"]
+ ],
+ [
+ "slug" => "nav",
+ "name" => "Net Asset Value",
+ "i10n" => ["sv" => "NAV kurs", 'fi' => "Substanssiarvo"]
+ ],
+ [
+ "slug" => "description",
+ "name" => "Company Description",
+ "i10n" => ["sv" => "Företagsbeskrivning", 'fi' => "Yrityksen kuvaus"]
+ ],
+ [
+ "slug" => "exdate",
+ "name" => "Ex date",
+ "i10n" => ["sv" => "X-datum"]
+ ],
[
"slug" => "shares",
"name" => "Shares",
@@ -313,7 +366,6 @@ function mfn_sync_taxonomy()
"name" => "Rights Change",
"i10n" => ["sv" => "Rättighetsförändring", 'fi' => "Oikeuksien muutos"]
]
-
]
]
]
@@ -360,6 +412,16 @@ function mfn_sync_taxonomy()
"name" => "Nomination Committee",
"i10n" => ["sv" => "Valberedning", "fi" => "Nimityskomitea"]
],
+ [
+ "slug" => "insider",
+ "name" => "Insider Transaction",
+ "i10n" => ["sv" => "Insynstransaktion", "fi" => "Johdon liiketoimet"]
+ ],
+ [
+ "slug" => "shareholder-announcement",
+ "name" => "Shareholder announcement",
+ "i10n" => ["sv" => "Flaggning", "fi" => "Liputusilmoitukset"]
+ ],
[
"slug" => "sales",
"name" => "Sales",
@@ -375,14 +437,7 @@ function mfn_sync_taxonomy()
[
"slug" => "staff",
"name" => "Staff change",
- "i10n" => ["sv" => "Personalförändring", "fi" => "Henkilöstön muutokset"],
- "children" => [
- [
- "slug" => "xxo",
- "name" => "Executive staff changes",
- "i10n" => ["sv" => "Exekutiva personalförändringar", "fi" => "Johtava henkilöstö muuttuu"],
- ]
- ]
+ "i10n" => ["sv" => "Personalförändring", "fi" => "Henkilöstön muutokset"]
]
]
]
diff --git a/lib.php b/lib.php
index 037cfb2..32fb95e 100644
--- a/lib.php
+++ b/lib.php
@@ -225,59 +225,126 @@ function mfn_starts_with($haystack, $needle): bool
return (substr($haystack, 0, $length) === $needle);
}
-function mfn_create_tags($item): array
+function mfn_trim_prefix($str, $prefix): string
+{
+ $length = strlen($prefix);
+ if (substr($str, 0, $length) === $prefix) {
+ return substr($str, $length);
+ }
+ return $str;
+}
+
+function mfn_create_tags($item, $prefix, $drop_custom_tag_prefix): array
{
$tags = $item->properties->tags ?? array();
- $lang = $item->properties->lang ?? 'xx';
- $type = $item->properties->type ?? 'ir';
+ $lang = $item->properties->lang ?? '';
+ $type = $item->properties->type ?? '';
+
+ if (empty($lang) || empty($type)) {
+ return array();
+ }
- $newtag = array();
+ $prefix = empty($prefix) ? '' : ($prefix . '-');
- $slug_prefix = (MFN_TAG_PREFIX !== '' && MFN_TAG_PREFIX !== null ? MFN_TAG_PREFIX . '-' : '');
+ $wp_tags = array();
- $newtag[] = MFN_TAG_PREFIX;
- $newtag[] = $slug_prefix . 'lang-' . $lang;
- $newtag[] = $slug_prefix . 'type-' . $type;
+ if ($prefix !== '') {
+ $wp_tags[] = MFN_TAG_PREFIX;
+ }
+ $wp_tags[] = $prefix . 'lang-' . $lang;
+ $wp_tags[] = $prefix . 'type-' . $type;
+
+ $skipped_tags = [
+ 'sub:ci:gm:notice:extra',
+ 'sub:ci:gm:info:extra'
+ ];
foreach ($tags as $tag) {
if (mfn_starts_with($tag, ':correction')) {
- $newtag[] = $slug_prefix . '-correction';
+ $wp_tags[] = $prefix . 'correction';
+ continue;
+ }
+ // don't include ext tags (or future unknown tags)
+ if (strpos($tag, 'sub:') !== 0 && strpos($tag, 'cus:') !== 0 && strpos($tag, ':regulatory') !== 0) {
+ continue;
+ }
+ if (in_array($tag, $skipped_tags, true)) {
+ continue;
+ }
+ // skip potential cus tags that could conflict with mfn tags when dropping the cus prefix
+ if ($drop_custom_tag_prefix && strpos($tag, 'cus:ci-') !== 0 && strpos($tag, 'cus:ca-') !== 0 && strpos($tag, 'cus:regulatory-') && strpos($tag, 'cus:report-') !== 0) {
continue;
}
- $tag = str_replace('sub:', '', $tag);
+ $tag = mfn_trim_prefix($tag, 'sub:');
$tag = trim($tag, ' :');
$tag = str_replace(':', '-', $tag);
- $tag = $slug_prefix . $tag;
- $newtag[] = $tag;
+
+ if ($drop_custom_tag_prefix && strpos($tag, 'cus-') === 0) {
+ $tag = str_replace('cus-', '', $tag);
+ if (strlen($tag) < 2) {
+ continue;
+ }
+ } else {
+ $tag = $prefix . $tag;
+ }
+ $wp_tags[] = $tag;
+ }
+ return $wp_tags;
+}
+
+function mfn_upsert_tags($post_id, $item)
+{
+ $lang = $item->properties->lang ?? '';
+ if (empty($lang)) {
+ return;
}
$options = get_option(MFN_PLUGIN_NAME);
- $use_wpml = isset($options['language_plugin']) && $options['language_plugin'] == 'wpml';
- $use_pll = isset($options['language_plugin']) && $options['language_plugin'] == 'pll';
+ $use_wpml = isset($options['language_plugin']) && $options['language_plugin'] == 'wpml'
+ && defined('WPML_PLUGIN_BASENAME') ;
+ $use_pll = isset($options['language_plugin']) && $options['language_plugin'] == 'pll'
+ && function_exists('pll_languages_list')
+ && function_exists('pll_is_translated_taxonomy')
+ && function_exists('pll_is_translated_post_type')
+ && pll_is_translated_taxonomy(MFN_TAXONOMY_NAME)
+ && pll_is_translated_post_type(MFN_POST_TYPE);
+ $drop_custom_tag_prefix = isset($options['taxonomy_disable_cus_prefix']) && $options['taxonomy_disable_cus_prefix'] === 'on';
+
+ $tags = mfn_create_tags($item, MFN_TAG_PREFIX, $drop_custom_tag_prefix);
+
+ if ($use_pll) {
+ $pllLangMapping = array();
+ foreach (pll_languages_list(array('fields' => array())) as $pll_lang) {
+ $l = explode('_', $pll_lang->locale)[0];
+ $pllLangMapping[$l] = $pll_lang->slug;
+ }
+ if (!isset($pllLangMapping[$lang])) {
+ return;
+ }
+ if ($lang != 'en') {
+ foreach ($tags as $i => $t) {
+ $tags[$i] = $t . "_" . $pllLangMapping[$lang];
+ }
+ }
+ }
+
if ($use_wpml && $lang != 'en') {
- foreach ($newtag as $i => $t) {
- $newtag[$i] = $t . "_" . $lang;
+ foreach ($tags as $i => $t) {
+ $tags[$i] = $t . "_" . $lang;
}
}
- if ($use_pll && $lang != 'en') {
- if (function_exists('pll_languages_list')) {
- $pllLangMapping = array();
- foreach (pll_languages_list(array('fields' => array())) as $pll_lang) {
- $l = explode('_', $pll_lang->locale)[0];
- $pllLangMapping[$l] = $pll_lang->slug;
- };
- foreach ($newtag as $i => $t) {
- if (!isset($pllLangMapping[$lang])) {
- continue;
- }
+ if ($use_wpml) {
+ global $sitepress;
+ $switch_lang = new WPML_Temporary_Switch_Language($sitepress, $lang);
+ }
- $newtag[$i] = $t . "_" . $pllLangMapping[$lang];
- }
- }
+ wp_set_object_terms($post_id, $tags, MFN_TAXONOMY_NAME, false);
+
+ if (isset($switch_lang)) {
+ $switch_lang->restore_lang();
}
- return $newtag;
}
function mfn_get_storage_url()
@@ -312,7 +379,14 @@ function mfn_list_post_attachments(): string
$icon = '';
}
$link = '' . $icon . $attachment->file_title . '';
- $attachments_content .= '' . $link . '
';
+ $classes = array("mfn-attachment");
+ if (isset($attachment->tags) && in_array(':primary', $attachment->tags)) {
+ $classes[] = "mfn-primary";
+ }
+ if (isset($attachment->tags) && in_array('image:primary', $attachment->tags)) {
+ $classes[] = "mfn-image-primary";
+ }
+ $attachments_content .= '' . $link . '
';
}
$attachments_content .= '';
return $attachments_content;
@@ -623,24 +697,14 @@ function mfn_upsert_item_full($item, $signature = '', $raw_data = '', $reset_cac
do_action('mfn_before_upsertitem', $item);
- $tags = mfn_create_tags($item);
-
- $outro = function ($post_id) use ($reset_cache, $group_id, $news_id, $lang, $slug, $attachments, $tags) {
+ $outro = function ($post_id) use ($reset_cache, $group_id, $news_id, $lang, $slug, $attachments, $item) {
if ($reset_cache) {
wp_cache_flush();
}
- $options = get_option(MFN_PLUGIN_NAME);
- if (defined('WPML_PLUGIN_BASENAME') && isset($options['language_plugin']) && $options['language_plugin'] == 'wpml') {
- global $sitepress;
- $switch_lang = new WPML_Temporary_Switch_Language($sitepress, $lang);
- }
- wp_set_object_terms($post_id, $tags, MFN_TAXONOMY_NAME, false);
- if (isset($switch_lang)) {
- $switch_lang->restore_lang();
- }
mfn_upsert_language($post_id, $group_id, $lang);
mfn_upsert_news_meta($post_id, $news_id, $slug);
+ mfn_upsert_tags($post_id, $item);
mfn_upsert_attachments($post_id, $attachments);
if ($reset_cache) {
@@ -653,6 +717,17 @@ function mfn_upsert_item_full($item, $signature = '', $raw_data = '', $reset_cac
$html = '';
}
+ // wordpress removes p tags when user edits a post for some reason
+ // unless they have some attribute: so we add a placeholder class
+ $dom = new DomDocument();
+ $encoding = '';
+ @$dom->loadHTML($encoding . $html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
+ foreach ($dom->getElementsByTagName('p') as $p) {
+ $class = trim($p->getAttribute('class'));
+ $p->setAttribute('class', (empty($class) ? '' : ' ') . 'mfn-wp-retain');
+ }
+ $html = mfn_trim_prefix($dom->saveHTML(), $encoding);
+
$options = get_option(MFN_PLUGIN_NAME);
$wpml = defined('WPML_PLUGIN_BASENAME') && isset($options['language_plugin']) && $options['language_plugin'] == 'wpml';
if ($wpml) {
diff --git a/posthook.php b/posthook.php
index bd50e89..3077d3a 100644
--- a/posthook.php
+++ b/posthook.php
@@ -38,7 +38,7 @@
if ($posthook_name != $wp_name) {
http_response_code(400);
- die("post hook name must be the same as in options " . $posthook_name . " " . $wp_name);
+ die("post hook name must be the same as in settings");
}
// Verifying intent
diff --git a/text-domain.php b/text-domain.php
index 1bab072..6c19073 100644
--- a/text-domain.php
+++ b/text-domain.php
@@ -35,6 +35,7 @@ function mfn_get_text($key)
'label_custom_singular_name' => mfn_text_domain('Custom Singular Name'),
'label_disable_archive' => mfn_text_domain('Disable Archive'),
'label_rewrite_post_type_slug' => mfn_text_domain('Custom Post Type Slug'),
+ 'label_rewrite_taxonomy_slug' => mfn_text_domain('Custom Taxonomy Slug'),
'label_rewrite_post_type_archive_name' => mfn_text_domain('Custom Archive Name'),
'label_rewrite_post_type_singular_name' => mfn_text_domain('Custom Singular Name'),
'label_language_plugin_none' => mfn_text_domain('No language plugin'),
@@ -45,9 +46,11 @@ function mfn_get_text($key)
'label_verify_signature' => mfn_text_domain('Verify Signature'),
'label_reset_cache' => mfn_text_domain('Reset Cache'),
'label_enable_attachments' => mfn_text_domain('Enable Attachments Widget'),
+ 'label_taxonomy_disable_cus_prefix' => mfn_text_domain('Drop Custom Tag Prefix'),
'label_meta_box_news_item_status' => mfn_text_domain(MFN_SINGULAR_NAME . ' Status'),
/* small */
'small_default_mfn_news' => mfn_text_domain('(Default: ' . MFN_POST_TYPE . ')'),
+ 'small_mfn-news-tag' => mfn_text_domain('(Default: ' . MFN_TAXONOMY_NAME . ')'),
'small_default_mfn_news_item' => mfn_text_domain('(Default: ' . MFN_SINGULAR_NAME . ')'),
'small_default_mfn_news_items' => mfn_text_domain('(Default: ' . MFN_ARCHIVE_NAME . ')'),
'small_probably_feed_mfn_se' => mfn_text_domain('(Probably: https://feed.mfn.se/v1)'),
@@ -71,6 +74,9 @@ function mfn_get_text($key)
'small_enable_attachments_description' => mfn_text_domain(
'(If enabled, our plugin will handle the listing of attachments and will bypass the default mfn-attachment footer) (Enabled by default)'
),
+ 'small_taxonomy_disable_cus_prefix_description' => mfn_text_domain(
+ '(If enabled, when custom tags are inserted their slug will not have the "mfn-cus-" prefix)'
+ ),
/* buttons */
'button_unlock' => mfn_text_domain('Unlock'),
'button_clear_mfn_settings' => mfn_text_domain('Clear all MFN settings'),
@@ -98,6 +104,9 @@ function mfn_get_text($key)
'tooltip_rewrite_post_type_slug' => mfn_text_domain(
'Rewrite the slug (' . MFN_POST_TYPE . ') in the URL - eg. "press-releases".'
),
+ 'tooltip_taxonomy_rewrite_slug' => mfn_text_domain(
+ 'Rewrite the taxonomy slug (' . MFN_TAXONOMY_NAME . ') in the URL'
+ ),
'tooltip_rewrite_post_type_archive_name' => mfn_text_domain(
'Set a custom name of the news archive page - eg. "Press Releases".'
),
diff --git a/widgets/mfn_news_feed/class-mfn-news-feed.php b/widgets/mfn_news_feed/class-mfn-news-feed.php
index d22f657..2ed9273 100644
--- a/widgets/mfn_news_feed/class-mfn-news-feed.php
+++ b/widgets/mfn_news_feed/class-mfn-news-feed.php
@@ -93,7 +93,9 @@ public function list_news_items($feed, $tzLocation, $timestampFormat, $onlytagsa
$is_disclaimer = true;
}
}
- if ($skipcustomtags && strpos($parts[0], 'mfn-cus-') !== false) {
+ if ($skipcustomtags
+ && (strpos($parts[1], MFN_TAG_PREFIX . '-cus-') === 0
+ || !(strpos($parts[1], MFN_TAG_PREFIX) === 0))) {
continue;
}
// always skip 'pll_' slug tags