diff --git a/classes/footnotes_settings.php b/classes/footnotes_settings.php
index 3bf8381..4ea13e8 100644
--- a/classes/footnotes_settings.php
+++ b/classes/footnotes_settings.php
@@ -28,7 +28,9 @@ class Class_FootnotesSettings
FOOTNOTE_INPUTFIELD_SEARCH_IN_EXCERPT => 'yes',
FOOTNOTE_INPUTFIELD_LOVE => 'no',
FOOTNOTE_INPUTFIELD_COUNTER_STYLE => 'arabic_plain',
- FOOTNOTE_INPUTFIELD_REFERENCE_CONTAINER_PLACE => 'post_end'
+ FOOTNOTE_INPUTFIELD_REFERENCE_CONTAINER_PLACE => 'post_end',
+ FOOTNOTE_INPUTFIELD_PLACEHOLDER_START_USERDEFINED => '',
+ FOOTNOTE_INPUTFIELD_PLACEHOLDER_END_USERDEFINED => ''
);
/*
* resulting pagehook for adding a new sub menu page to the settings
@@ -187,7 +189,29 @@ class Class_FootnotesSettings
$('.if-js-closed').removeClass('if-js-closed').addClass('closed');
// postboxes setup
postboxes.add_postbox_toggles('a_str_Pagehook; ?>');
+
+ jQuery('#getFieldID(FOOTNOTE_INPUTFIELD_PLACEHOLDER_START); ?>').on('change', function() {
+ var l_int_SelectedIndex = jQuery(this).prop("selectedIndex");
+ jQuery('#getFieldID(FOOTNOTE_INPUTFIELD_PLACEHOLDER_END); ?> option:eq(' + l_int_SelectedIndex + ')').prop('selected', true);
+ footnotes_Display_UserDefined_Placeholders();
+ });
+ jQuery('#getFieldID(FOOTNOTE_INPUTFIELD_PLACEHOLDER_END); ?>').on('change', function() {
+ var l_int_SelectedIndex = jQuery(this).prop("selectedIndex");
+ jQuery('#getFieldID(FOOTNOTE_INPUTFIELD_PLACEHOLDER_START); ?> option:eq(' + l_int_SelectedIndex + ')').prop('selected', true);
+ footnotes_Display_UserDefined_Placeholders();
+ });
+ footnotes_Display_UserDefined_Placeholders();
});
+
+ function footnotes_Display_UserDefined_Placeholders() {
+ if (jQuery('#getFieldID(FOOTNOTE_INPUTFIELD_PLACEHOLDER_START); ?>').val() == "userdefined") {
+ jQuery('#getFieldID(FOOTNOTE_INPUTFIELD_PLACEHOLDER_START_USERDEFINED); ?>').show();
+ jQuery('#getFieldID(FOOTNOTE_INPUTFIELD_PLACEHOLDER_END_USERDEFINED); ?>').show();
+ } else {
+ jQuery('#getFieldID(FOOTNOTE_INPUTFIELD_PLACEHOLDER_START_USERDEFINED); ?>').hide();
+ jQuery('#getFieldID(FOOTNOTE_INPUTFIELD_PLACEHOLDER_END_USERDEFINED); ?>').hide();
+ }
+ }
LoadSetting($p_str_SettingsID);
@@ -303,8 +328,11 @@ class Class_FootnotesSettings
if ($p_bool_Readonly) {
$p_bool_Readonly = ' readonly="readonly"';
}
+ if ($p_bool_Hidden) {
+ $p_bool_Hidden = ' style="display:none;"';
+ }
/* outputs an input field type TEXT */
- echo '';
+ echo '';
}
/**
@@ -441,13 +469,33 @@ class Class_FootnotesSettings
$this->AddSelectbox(FOOTNOTE_INPUTFIELD_COMBINE_IDENTICAL, $l_arr_Options, "footnote_plugin_50");
$this->AddNewline();
+
/* setting for 'footnote tag starts with' */
+ $l_arr_Options = array(
+ "((" => __("((", FOOTNOTES_PLUGIN_NAME),
+ "" => htmlspecialchars(__("", FOOTNOTES_PLUGIN_NAME)),
+ "[ref]" => __("[ref]", FOOTNOTES_PLUGIN_NAME),
+ "userdefined" => __('user defined', FOOTNOTES_PLUGIN_NAME)
+ );
$this->AddLabel(FOOTNOTE_INPUTFIELD_PLACEHOLDER_START, __("Footnote tag starts with:", FOOTNOTES_PLUGIN_NAME));
- $this->AddTextbox(FOOTNOTE_INPUTFIELD_PLACEHOLDER_START, "footnote_plugin_15", 14);
+ $this->AddSelectbox(FOOTNOTE_INPUTFIELD_PLACEHOLDER_START, $l_arr_Options, "footnote_plugin_15");
/* setting for 'footnote tag ends with' */
+ $l_arr_Options = array(
+ "))" => __("))", FOOTNOTES_PLUGIN_NAME),
+ "" => htmlspecialchars(__("", FOOTNOTES_PLUGIN_NAME)),
+ "[/ref]" => __("[/ref]", FOOTNOTES_PLUGIN_NAME),
+ "userdefined" => __('user defined', FOOTNOTES_PLUGIN_NAME)
+ );
$this->AddLabel(FOOTNOTE_INPUTFIELD_PLACEHOLDER_END, __("and ends with:", FOOTNOTES_PLUGIN_NAME) . ' ', 'text-align: right;');
- $this->AddTextbox(FOOTNOTE_INPUTFIELD_PLACEHOLDER_END, "footnote_plugin_15", 14);
+ $this->AddSelectbox(FOOTNOTE_INPUTFIELD_PLACEHOLDER_END, $l_arr_Options, "footnote_plugin_15");
+ $this->AddNewline();
+
+ /* user defined setting for 'footnote start and end tag' */
+ $this->AddLabel(FOOTNOTE_INPUTFIELD_PLACEHOLDER_START_USERDEFINED, "");
+ $this->AddTextbox(FOOTNOTE_INPUTFIELD_PLACEHOLDER_START_USERDEFINED, "footnote_plugin_15", 14, false, true);
+ $this->AddLabel(FOOTNOTE_INPUTFIELD_PLACEHOLDER_END_USERDEFINED, "");
+ $this->AddTextbox(FOOTNOTE_INPUTFIELD_PLACEHOLDER_END_USERDEFINED, "footnote_plugin_15", 14, false, true);
$this->AddNewline();
/* setting for 'footnotes counter style' */
diff --git a/includes/defines.php b/includes/defines.php
index 116b852..5ef17cb 100644
--- a/includes/defines.php
+++ b/includes/defines.php
@@ -40,6 +40,14 @@ define("FOOTNOTE_INPUTFIELD_COUNTER_STYLE", "footnote_inputfield_counter_style")
*/
define("FOOTNOTE_INPUTFIELD_REFERENCE_CONTAINER_PLACE", "footnote_inputfield_reference_container_place");
+/*
+ * id of input field for 'user defined placeholder start and end tag
+ * @since 1.1.2
+ */
+define("FOOTNOTE_INPUTFIELD_PLACEHOLDER_START_USERDEFINED", "footnote_inputfield_placeholder_start_user_defined");
+define("FOOTNOTE_INPUTFIELD_PLACEHOLDER_END_USERDEFINED", "footnote_inputfield_placeholder_end_user_defined");
+
+
/* PLUGIN REFERENCES CONTAINER ID */
define("FOOTNOTE_REFERENCES_CONTAINER_ID", "footnote_references_container"); /* id for the div surrounding the footnotes */
diff --git a/includes/replacer.php b/includes/replacer.php
index 63e3546..7a5938e 100644
--- a/includes/replacer.php
+++ b/includes/replacer.php
@@ -218,6 +218,13 @@ function footnotes_getFromString($p_str_Content)
/*get footnote counter style */
$l_str_CounterStyle = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_COUNTER_STYLE];
+ if ($l_str_StartingTag == "userdefined" || $l_str_EndingTag == "userdefined") {
+ /* get user defined footnote starting tag */
+ $l_str_StartingTag = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_PLACEHOLDER_START_USERDEFINED];
+ /*get user defined footnote ending tag */
+ $l_str_EndingTag = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_PLACEHOLDER_END_USERDEFINED];
+ }
+
/* check for a footnote placeholder in the current page */
do {
/* get first occurence of a footnote starting tag */
diff --git a/readme.txt b/readme.txt
index 16435b1..aaf712b 100755
--- a/readme.txt
+++ b/readme.txt
@@ -43,6 +43,7 @@ No, this Plugin has been written from scratch. Of course some inspirations on ho
= 1.1.2 =
- Update: Moved footnotes 'love' settings to a separate container
- Bugfix: Setting for the position of the "reference container" works for the options "footer" and "end of post"
+- Add: Pre defined footnote short codes and possibility for a user defined short code
= 1.1.1 =
- Feature: Short code to not display the 'love me' slug on specific pages ( short code = [[no footnotes: love]] )