Prepare for release version 1.3.2
- Bugfix: More security recognizing Footnotes on public pages (e.g. ignoring empty Footnote short codes) - Bugfix: Clear old Footnotes before lookup new public page (only if no reference container displayed before) - Updated: language EN and DE - Added: Setting to customize the hyperlink symbol in der reference container for each footnote reference - Added: Setting to enter a user defined hyperlink symbol git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@969519 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
parent
26dc75ff83
commit
6924027cd8
13 changed files with 329 additions and 126 deletions
|
@ -357,6 +357,9 @@ class MCI_Footnotes_Admin {
|
|||
$l_str_Output = '<select ' . $p_str_ClassName . ' name="' . $l_arr_Data["name"] . '" id="' . $l_arr_Data["id"] . '">';
|
||||
// loop through all array keys
|
||||
foreach ($p_arr_Options as $l_str_Value => $l_str_Caption) {
|
||||
if (!is_string($l_str_Value)) {
|
||||
$l_str_Value = (string)$l_str_Value;
|
||||
}
|
||||
// add key as option value
|
||||
$l_str_Output .= '<option value="' . $l_str_Value . '"';
|
||||
// check if option value is set and has to be pre-selected
|
||||
|
|
|
@ -147,6 +147,26 @@ class MCI_Footnotes_Convert {
|
|||
// nothing found that says "true", so we return false */
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.3.2
|
||||
* @param int $p_int_Index [default: -1 = all arrows, otherwise the arrow with the specified index]
|
||||
* @return array|string
|
||||
*/
|
||||
public static function getArrow($p_int_Index = -1) {
|
||||
// define all possible arrows
|
||||
$l_arr_Arrows = array("↑", "↥", "↟", "↩", "↲", "↵", "⇑", "⇡", "⇧", "↑");
|
||||
// convert index to an integer
|
||||
if (!is_int($p_int_Index)) {
|
||||
$p_int_Index = intval($p_int_Index);
|
||||
}
|
||||
// return the whole arrow array
|
||||
if ($p_int_Index < 0 || $p_int_Index > count($l_arr_Arrows)) {
|
||||
return $l_arr_Arrows;
|
||||
}
|
||||
// return a single arrow
|
||||
return $l_arr_Arrows[$p_int_Index];
|
||||
}
|
||||
} // class MCI_Footnotes_Convert
|
||||
|
||||
endif;
|
|
@ -33,14 +33,22 @@ class MCI_Footnotes_Tab_Custom extends MCI_Footnotes_Admin {
|
|||
array($this, 'Description'),
|
||||
FOOTNOTES_SETTINGS_TAB_CUSTOM
|
||||
);
|
||||
// styling
|
||||
// superscript
|
||||
add_meta_box(
|
||||
'MCI_Footnotes_Tab_Custom_Styling',
|
||||
'MCI_Footnotes_Tab_Custom_Superscript',
|
||||
__("Superscript layout", FOOTNOTES_PLUGIN_NAME),
|
||||
array($this, 'Superscript'),
|
||||
FOOTNOTES_SETTINGS_TAB_CUSTOM,
|
||||
'main'
|
||||
);
|
||||
// symbol hyperlink to footnotes index
|
||||
add_meta_box(
|
||||
'MCI_Footnotes_Tab_Custom_HyperlinkSymbol',
|
||||
__("Hyperlink symbol in the Reference container", FOOTNOTES_PLUGIN_NAME),
|
||||
array($this, 'HyperlinkSymbol'),
|
||||
FOOTNOTES_SETTINGS_TAB_CUSTOM,
|
||||
'main'
|
||||
);
|
||||
// custom css
|
||||
add_meta_box(
|
||||
'MCI_Footnotes_Tab_Custom_Customize',
|
||||
|
@ -74,6 +82,24 @@ class MCI_Footnotes_Tab_Custom extends MCI_Footnotes_Admin {
|
|||
$this->AddNewline();
|
||||
}
|
||||
|
||||
/**
|
||||
* layout of the hyperlink symbol to jump to the footnotes index inside post
|
||||
* @since 1.3.2
|
||||
* @return void
|
||||
*/
|
||||
public function HyperlinkSymbol() {
|
||||
// load convert class
|
||||
require_once(dirname(__FILE__) . "/convert.php");
|
||||
$this->AddLabel(FOOTNOTES_INPUT_CUSTOM_HYPERLINK_SYMBOL, __("Hyperlink symbol:", FOOTNOTES_PLUGIN_NAME));
|
||||
$this->AddSelect(FOOTNOTES_INPUT_CUSTOM_HYPERLINK_SYMBOL, MCI_Footnotes_Convert::getArrow(), "footnote_plugin_15");
|
||||
$this->AddNewline();
|
||||
|
||||
$this->AddLabel(FOOTNOTES_INPUT_CUSTOM_HYPERLINK_SYMBOL_USER, __("or enter a user defined symbol:", FOOTNOTES_PLUGIN_NAME));
|
||||
$this->AddTextbox(FOOTNOTES_INPUT_CUSTOM_HYPERLINK_SYMBOL_USER, "footnote_plugin_15");
|
||||
$this->AddText(" ");
|
||||
$this->AddText("<i>" . __("if set it overrides the hyperlink symbol above", FOOTNOTES_PLUGIN_NAME) . "</i>");
|
||||
}
|
||||
|
||||
/**
|
||||
* customize css box for public page
|
||||
* @since 1.3
|
||||
|
|
|
@ -288,6 +288,20 @@ class MCI_Footnotes_Task {
|
|||
$l_bool_CollapseReference = MCI_Footnotes_Convert::toBool($this->a_arr_Settings[FOOTNOTES_INPUT_COLLAPSE_REFERENCES]);
|
||||
// get footnote counter style
|
||||
$l_str_CounterStyle = $this->a_arr_Settings[FOOTNOTES_INPUT_COUNTER_STYLE];
|
||||
// get hyperlink symbol index
|
||||
$l_int_HyperlinkSymbolIndex = $this->a_arr_Settings[FOOTNOTES_INPUT_CUSTOM_HYPERLINK_SYMBOL];
|
||||
// get html arrow
|
||||
$l_str_HyperlinkSymbol = MCI_Footnotes_Convert::getArrow($l_int_HyperlinkSymbolIndex);
|
||||
// set html arrow to the first one if invalid index defined
|
||||
if (is_array($l_str_HyperlinkSymbol)) {
|
||||
$l_str_HyperlinkSymbol = MCI_Footnotes_Convert::getArrow(0);
|
||||
}
|
||||
// get user defined hyperlink symbol
|
||||
$l_int_HyperlinkSymbol_UserDefined = $this->a_arr_Settings[FOOTNOTES_INPUT_CUSTOM_HYPERLINK_SYMBOL_USER];
|
||||
if (!empty($l_int_HyperlinkSymbol_UserDefined)) {
|
||||
// override hyperlink symbol with user defined symbol
|
||||
$l_str_HyperlinkSymbol = $l_int_HyperlinkSymbol_UserDefined;
|
||||
}
|
||||
|
||||
// add expand/collapse buttons to the reference label if collapsed by default
|
||||
// @since 1.2.2
|
||||
|
@ -339,6 +353,7 @@ class MCI_Footnotes_Task {
|
|||
// added function to convert the counter style in the reference container (bugfix for the link to the footnote) in version 1.0.6
|
||||
$l_str_ReplaceText = str_replace("[[FOOTNOTE INDEX SHORT]]", MCI_Footnotes_Convert::Index($l_str_FirstFootnoteIndex, $l_str_CounterStyle), $l_str_FootnoteTemplate);
|
||||
$l_str_ReplaceText = str_replace("[[FOOTNOTE INDEX]]", $l_str_FootnoteIndex, $l_str_ReplaceText);
|
||||
$l_str_ReplaceText = str_replace("[[HYPERLINK SYMBOL]]", $l_str_HyperlinkSymbol, $l_str_ReplaceText);
|
||||
$l_str_ReplaceText = str_replace("[[FOOTNOTE TEXT]]", $l_str_FootnoteText, $l_str_ReplaceText);
|
||||
$l_str_ReplaceText = preg_replace('@[\s]{2,}@',' ',$l_str_ReplaceText);
|
||||
// add the footnote container to the output
|
||||
|
|
Reference in a new issue