diff --git a/class/config.php b/class/config.php
index 8f02119..98a3245 100644
--- a/class/config.php
+++ b/class/config.php
@@ -1,44 +1,51 @@
-footnotes';
/**
* Public Plugin name for dashboard heading
- *
+ *
* After properly displaying in dashboard headings until WPv5.4, the above started
- * in WPv5.5 being torn apart as if the headline was text-align:justify and not
+ * in WPv5.5 being torn apart as if the headline was text-align:justify and not
* the last line. That ugly display bug badly affected the plugin’s communication.
* The only working solution found so far is using position:fixed in one heading
* that isn’t translated, and dropping the logo in another, translatable heading.
@@ -51,6 +58,7 @@ class MCI_Footnotes_Config {
/**
* Html tag for the LOVE symbol.
*
+ * @author Stefan Herndler
* @since 1.5.0
* @var string
*/
@@ -67,6 +75,7 @@ class MCI_Footnotes_Config {
/**
* Short code to DON'T display the 'LOVE ME' slug on certain pages.
*
+ * @author Stefan Herndler
* @since 1.5.0
* @var string
*/
diff --git a/class/convert.php b/class/convert.php
index 3adb313..e1823ad 100644
--- a/class/convert.php
+++ b/class/convert.php
@@ -3,16 +3,20 @@
* Includes the Convert Class.
*
* @filesource
- * @package footnotes
- * @since 1.5.0
- * @date 12.09.14 10:56
- *
+ * @author Stefan Herndler
+ * @since 1.5.0 12.09.14 10:56
+ *
+ * Edited:
* @since 2.2.0 add lowercase Roman 2020-12-12T1540+0100
+ *
+ * Last modified: 2020-12-12T1541+0100
*/
+
/**
* Converts data types and Footnotes specific values.
*
+ * @author Stefan Herndler
* @since 1.5.0
*/
class MCI_Footnotes_Convert {
@@ -20,29 +24,30 @@ class MCI_Footnotes_Convert {
/**
* Converts a integer into the user-defined counter style for the footnotes.
*
+ * @author Stefan Herndler
* @since 1.5.0
- * @param int $p_int_index Index to be converted.
- * @param string $p_str_convert_style Style of the new/converted Index.
+ * @param int $p_int_Index Index to be converted.
+ * @param string $p_str_ConvertStyle Style of the new/converted Index.
* @return string Converted Index as string in the defined counter style.
- *
+ *
* Edited:
* @since 2.2.0 lowercase Roman numerals supported
*/
- public static function index( $p_int_index, $p_str_convert_style = 'arabic_plain' ) {
- switch ( $p_str_convert_style ) {
- case 'romanic':
- return self::to_romanic( $p_int_index, true );
- case 'roman_low':
- return self::to_romanic( $p_int_index, false );
- case 'latin_high':
- return self::to_latin( $p_int_index, true );
- case 'latin_low':
- return self::to_latin( $p_int_index, false );
- case 'arabic_leading':
- return self::to_arabic_leading( $p_int_index );
- case 'arabic_plain':
+ public static function Index($p_int_Index, $p_str_ConvertStyle = "arabic_plain") {
+ switch ($p_str_ConvertStyle) {
+ case "romanic":
+ return self::toRomanic($p_int_Index, true);
+ case "roman_low":
+ return self::toRomanic($p_int_Index, false);
+ case "latin_high":
+ return self::toLatin($p_int_Index, true);
+ case "latin_low":
+ return self::toLatin($p_int_Index, false);
+ case "arabic_leading":
+ return self::toArabicLeading($p_int_Index);
+ case "arabic_plain":
default:
- return $p_int_index;
+ return $p_int_Index;
}
}
@@ -50,174 +55,175 @@ class MCI_Footnotes_Convert {
* Converts an integer into latin ascii characters, either lower or upper-case.
* Function available from A to ZZ ( means 676 footnotes at 1 page possible).
*
+ * @author Stefan Herndler
* @since 1.0-gamma
- * @param int $p_int_value Value/Index to be converted.
- * @param bool $p_bool_upper_case True to convert the value to upper case letter, otherwise to lower case.
+ * @param int $p_int_Value Value/Index to be converted.
+ * @param bool $p_bool_UpperCase True to convert the value to upper case letter, otherwise to lower case.
* @return string
*/
- private static function to_latin( $p_int_value, $p_bool_upper_case ) {
- // Output string.
- $l_str_return = '';
- $l_int_offset = 0;
- // Check if the value is higher then 26 = Z.
- while ( $p_int_value > 26 ) {
- // Increase offset and reduce counter.
- $l_int_offset++;
- $p_int_value -= 26;
+ private static function toLatin($p_int_Value, $p_bool_UpperCase) {
+ // output string
+ $l_str_Return = "";
+ $l_int_Offset = 0;
+ // check if the value is higher then 26 = Z
+ while ($p_int_Value > 26) {
+ // increase offset and reduce counter
+ $l_int_Offset++;
+ $p_int_Value -= 26;
}
- // If offset set (more then Z), then add a new letter in front.
- if ( $l_int_offset > 0 ) {
- $l_str_return = chr( $l_int_offset + 64 );
+ // if offset set (more then Z), then add a new letter in front
+ if ($l_int_Offset > 0) {
+ $l_str_Return = chr($l_int_Offset + 64);
}
- // Add the origin letter.
- $l_str_return .= chr( $p_int_value + 64 );
- // Return the latin character representing the integer.
- if ( $p_bool_upper_case ) {
- return strtoupper( $l_str_return );
+ // add the origin letter
+ $l_str_Return .= chr($p_int_Value + 64);
+ // return the latin character representing the integer
+ if ($p_bool_UpperCase) {
+ return strtoupper($l_str_Return);
}
- return strtolower( $l_str_return );
+ return strtolower($l_str_Return);
}
/**
* Converts an integer to a leading-0 integer.
*
+ * @author Stefan Herndler
* @since 1.0-gamma
- * @param int $p_int_value Value/Index to be converted.
+ * @param int $p_int_Value Value/Index to be converted.
* @return string Value with a leading zero.
*/
- private static function to_arabic_leading( $p_int_value ) {
- // Add a leading 0 if number lower then 10.
- if ( $p_int_value < 10 ) {
- return '0' . $p_int_value;
+ private static function toArabicLeading($p_int_Value) {
+ // add a leading 0 if number lower then 10
+ if ($p_int_Value < 10) {
+ return "0" . $p_int_Value;
}
- return $p_int_value;
+ return $p_int_Value;
}
/**
* Converts an integer to a romanic letter.
*
+ * @author Stefan Herndler
* @since 1.0-gamma
- * @param int $p_int_value Value/Index to be converted.
- * @param bool $p_bool_upper_case Whether to uppercase.
+ * @param int $p_int_Value Value/Index to be converted.
* @return string
- *
+ *
* Edited:
* @since 2.2.0 optionally lowercase (code from Latin) 2020-12-12T1538+0100
*/
- private static function to_romanic( $p_int_value, $p_bool_upper_case ) {
- // Table containing all necessary romanic letters.
- $l_arr_romanic_letters = array(
- 'M' => 1000,
+ private static function toRomanic($p_int_Value, $p_bool_UpperCase) {
+ // table containing all necessary romanic letters
+ $l_arr_RomanicLetters = array(
+ 'M' => 1000,
'CM' => 900,
- 'D' => 500,
+ 'D' => 500,
'CD' => 400,
- 'C' => 100,
+ 'C' => 100,
'XC' => 90,
- 'L' => 50,
+ 'L' => 50,
'XL' => 40,
- 'X' => 10,
+ 'X' => 10,
'IX' => 9,
- 'V' => 5,
+ 'V' => 5,
'IV' => 4,
- 'I' => 1,
+ 'I' => 1
);
- // Return value.
- $l_str_return = '';
- // Iterate through integer value until it is reduced to 0.
- while ( $p_int_value > 0 ) {
- foreach ( $l_arr_romanic_letters as $l_str_romanic => $l_int_arabic ) {
- if ( $p_int_value >= $l_int_arabic ) {
- $p_int_value -= $l_int_arabic;
- $l_str_return .= $l_str_romanic;
+ // return value
+ $l_str_Return = '';
+ // iterate through integer value until it is reduced to 0
+ while ($p_int_Value > 0) {
+ foreach ($l_arr_RomanicLetters as $l_str_Romanic => $l_int_Arabic) {
+ if ($p_int_Value >= $l_int_Arabic) {
+ $p_int_Value -= $l_int_Arabic;
+ $l_str_Return .= $l_str_Romanic;
break;
}
}
}
- // Return romanic letters as string.
- if ( $p_bool_upper_case ) {
- return strtoupper( $l_str_return );
+ // return romanic letters as string
+ if ($p_bool_UpperCase) {
+ return strtoupper($l_str_Return);
}
- return strtolower( $l_str_return );
+ return strtolower($l_str_Return);
}
/**
* Converts a string depending on its value to a boolean.
*
+ * @author Stefan Herndler
* @since 1.0-beta
- * @param string $p_str_value String to be converted to boolean.
+ * @param string $p_str_Value String to be converted to boolean.
* @return bool Boolean representing the string.
*/
- public static function to_bool( $p_str_value ) {
- // Convert string to lower-case to make it easier.
- $p_str_value = strtolower( $p_str_value );
- // Check if string seems to contain a "true" value.
- switch ( $p_str_value ) {
- case 'checked':
- case 'yes':
- case 'true':
- case 'on':
- case '1':
+ public static function toBool($p_str_Value) {
+ // convert string to lower-case to make it easier
+ $p_str_Value = strtolower($p_str_Value);
+ // check if string seems to contain a "true" value
+ switch ($p_str_Value) {
+ case "checked":
+ case "yes":
+ case "true":
+ case "on":
+ case "1":
return true;
}
- // Nothing found that says "true", so we return false.
+ // nothing found that says "true", so we return false
return false;
}
/**
* Get a html Array short code depending on Arrow-Array key index.
*
+ * @author Stefan Herndler
* @since 1.3.2
- * @param int $p_int_index Index representing the Arrow. If empty all Arrows are specified.
+ * @param int $p_int_Index Index representing the Arrow. If empty all Arrows are specified.
* @return array|string Array of all Arrows if Index is empty otherwise html tag of a specific arrow.
*/
- public static function get_arrow( $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 );
+ 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 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 ];
+ // return a single arrow
+ return $l_arr_Arrows[$p_int_Index];
}
- // phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_var_dump
- // phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_print_r
/**
* Displays a Variable.
*
+ * @author Stefan Herndler
* @since 1.5.0
- * @param mixed $p_mixed_value The variable to display.
- * @return void
+ * @param mixed $p_mixed_Value
*/
- public static function debug( $p_mixed_value ) {
- if ( empty( $p_mixed_value ) ) {
- var_dump( $p_mixed_value );
+ public static function debug($p_mixed_Value) {
+ if (empty($p_mixed_Value)) {
+ var_dump($p_mixed_Value);
- } elseif ( is_array( $p_mixed_value ) ) {
- printf( '
' );
- print_r( $p_mixed_value );
- printf( '
' );
+ } else if (is_array($p_mixed_Value)) {
+ printf("
' );
+ } else if (is_object($p_mixed_Value)) {
+ printf("
");
+ print_r($p_mixed_Value);
+ printf("
");
- } elseif ( is_numeric( $p_mixed_value ) || is_int( $p_mixed_value ) ) {
- var_dump( $p_mixed_value );
+ } else if (is_numeric($p_mixed_Value) || is_int($p_mixed_Value)) {
+ var_dump($p_mixed_Value);
- } elseif ( is_date( $p_mixed_value ) ) {
- var_dump( $p_mixed_value );
+ } else if (is_date($p_mixed_Value)) {
+ var_dump($p_mixed_Value);
} else {
- var_dump( $p_mixed_value );
+ var_dump($p_mixed_Value);
}
- echo ' ';
+ echo " ";
}
- // phpcs:disable
}
diff --git a/class/dashboard/init.php b/class/dashboard/init.php
index 2adbbbf..b18e77c 100644
--- a/class/dashboard/init.php
+++ b/class/dashboard/init.php
@@ -1,212 +1,212 @@
-a_arr_SubPageClasses[$l_obj_Class->getPriority()] = $l_obj_Class;
- }
- }
- ksort($this->a_arr_SubPageClasses);
-
- // register hooks/actions
- add_action('admin_init', array($this, 'initializeSettings'));
- add_action('admin_menu', array($this, 'registerMainMenu'));
- // register AJAX callbacks for Plugin information
- add_action("wp_ajax_nopriv_footnotes_getPluginInfo", array($this, "getPluginMetaInformation"));
- add_action("wp_ajax_footnotes_getPluginInfo", array($this, "getPluginMetaInformation"));
- }
-
- /**
- * Initializes all sub pages and registers the settings.
- *
- * @author Stefan Herndler
- * @since 1.5.0
- */
- public function initializeSettings() {
- MCI_Footnotes_Settings::instance()->RegisterSettings();
- // iterate though each sub class of the layout engine and register their sections
- /** @var MCI_Footnotes_LayoutEngine $l_obj_LayoutEngineSubClass */
- foreach($this->a_arr_SubPageClasses as $l_obj_LayoutEngineSubClass) {
- $l_obj_LayoutEngineSubClass->registerSections();
- }
- }
-
- /**
- * Registers the new main menu for the WordPress dashboard.
- * Registers all sub menu pages for the new main menu.
- *
- * @author Stefan Herndler
- * @since 1.5.0
- * @see http://codex.wordpress.org/Function_Reference/add_menu_page
- */
- public function registerMainMenu() {
- global $menu;
- // iterate through each main menu
- foreach($menu as $l_arr_MainMenu) {
- // iterate through each main menu attribute
- foreach($l_arr_MainMenu as $l_str_Attribute) {
- // main menu already added, append sub pages and stop
- if ($l_str_Attribute == self::C_STR_MAIN_MENU_SLUG) {
- $this->registerSubPages();
- return;
- }
- }
- }
-
- // add a new main menu page to the WordPress dashboard
- add_menu_page(
- self::C_STR_MAIN_MENU_TITLE, // page title
- self::C_STR_MAIN_MENU_TITLE, // menu title
- 'manage_options', // capability
- self::C_STR_MAIN_MENU_SLUG, // menu slug
- array($this, "displayOtherPlugins"), // function
- plugins_url('footnotes/img/main-menu.png'), // icon url
- null // position
- );
- $this->registerSubPages();
- }
-
- /**
- * Registers all SubPages for this Plugin.
- *
- * @author Stefan Herndler
- * @since 1.5.0
- */
- private function registerSubPages() {
- // first registered sub menu page MUST NOT contain a unique slug suffix
- // iterate though each sub class of the layout engine and register their sub page
- /** @var MCI_Footnotes_LayoutEngine $l_obj_LayoutEngineSubClass */
- foreach($this->a_arr_SubPageClasses as $l_obj_LayoutEngineSubClass) {
- $l_obj_LayoutEngineSubClass->registerSubPage();
- }
- }
-
- /**
- * Displays other Plugins from the developers.
- *
- * @author Stefan Herndler
- * @since 1.5.0
- */
- public function displayOtherPlugins() {
- printf("
';
-
- if ($l_bool_SettingsUpdated) {
- echo sprintf('
%s
', __("Settings saved", MCI_Footnotes_Config::C_STR_PLUGIN_NAME));
- }
-
- // form to submit the active section
- echo '';
- // close container for the settings page
- echo '
';
- // output special javascript for the expand/collapse function of the meta boxes
- echo '';
- }
-
- /**
- * Save all Plugin settings.
- *
- * @author Stefan Herndler
- * @since 1.5.0
- * @return bool
- */
- private function saveSettings() {
- $l_arr_newSettings = array();
- // get current section
- reset($this->a_arr_Sections);
- $l_str_ActiveSectionID = isset($_GET['t']) ? $_GET['t'] : key($this->a_arr_Sections);
- $l_arr_ActiveSection = $this->a_arr_Sections[$l_str_ActiveSectionID];
-
- // iterate through each value that has to be in the specific container
- foreach(MCI_Footnotes_Settings::instance()->getDefaults($l_arr_ActiveSection["container"]) as $l_str_Key => $l_mixed_Value) {
- // setting is available in the POST array, use it
- if (array_key_exists($l_str_Key, $_POST)) {
- $l_arr_newSettings[$l_str_Key] = $_POST[$l_str_Key];
- } else {
- // setting is not defined in the POST array, define it to avoid the Default value
- $l_arr_newSettings[$l_str_Key] = "";
- }
- }
- // update settings
- return MCI_Footnotes_Settings::instance()->saveOptions($l_arr_ActiveSection["container"], $l_arr_newSettings);
- }
-
- /**
- * Output the Description of a section. May be overwritten in any section.
- *
- * @author Stefan Herndler
- * @since 1.5.0
- */
- public function Description() {
- // default no description will be displayed
- }
-
- /**
- * Loads specific setting and returns an array with the keys [id, name, value].
- *
- * @author Stefan Herndler
- * @since 1.5.0
- * @param string $p_str_SettingKeyName Settings Array key name.
- * @return array Contains Settings ID, Settings Name and Settings Value.
- */
- protected function LoadSetting($p_str_SettingKeyName) {
- // get current section
- reset($this->a_arr_Sections);
- $p_arr_Return = array();
- $p_arr_Return["id"] = sprintf('%s', $p_str_SettingKeyName);
- $p_arr_Return["name"] = sprintf('%s', $p_str_SettingKeyName);
- $p_arr_Return["value"] = esc_attr(MCI_Footnotes_Settings::instance()->get($p_str_SettingKeyName));
- return $p_arr_Return;
- }
-
- /**
- * Returns a line break to start a new line.
- *
- * @author Stefan Herndler
- * @since 1.5.0
- * @return string
- */
- protected function addNewline() {
- return ' ';
- }
-
- /**
- * Returns a line break to have a space between two lines.
- *
- * @author Stefan Herndler
- * @since 1.5.0
- * @return string
- */
- protected function addLineSpace() {
- return '
';
- }
-
- /**
- * Returns a simple text inside html text.
- *
- * @author Stefan Herndler
- * @since 1.5.0
- * @param string $p_str_Text Message to be surrounded with simple html tag (span).
- * @return string
- */
- protected function addText($p_str_Text) {
- return sprintf('%s', $p_str_Text);
- }
-
- /**
- * Returns the html tag for an input/select label.
- *
- * @author Stefan Herndler
- * @since 1.5.0
- * @param string $p_str_SettingName Name of the Settings key to connect the Label with the input/select field.
- * @param string $p_str_Caption Label caption.
- * @return string
- *
- * Edited 2020-12-01T0159+0100..
- * @since 2.1.6 no colon
- */
- protected function addLabel($p_str_SettingName, $p_str_Caption) {
- if (empty($p_str_Caption)) {
- return "";
- }
- // remove the colon causing localization issues with French,
- // and with languages not using punctuation at all,
- // and with languages using other punctuation marks instead of colon,
- // e.g. Greek using a raised dot.
- // In French, colon is preceded by a space, forcibly non-breaking,
- // and narrow per new school.
- // Add colon to label strings for inclusion in localization.
- // Colon after label is widely preferred best practice, mandatory per style guides.
- //
- return sprintf('', $p_str_SettingName, $p_str_Caption);
- // ^ here deleted colon 2020-12-08T1546+0100
- }
-
- /**
- * Returns the html tag for an input [type = text].
- *
- * @author Stefan Herndler
- * @since 1.5.0
- * @param string $p_str_SettingName Name of the Settings key to pre load the input field.
- * @param int $p_str_MaxLength Maximum length of the input, default 999 characters.
- * @param bool $p_bool_Readonly Set the input to be read only, default false.
- * @param bool $p_bool_Hidden Set the input to be hidden, default false.
- * @return string
- */
- protected function addTextBox($p_str_SettingName, $p_str_MaxLength = 999, $p_bool_Readonly = false, $p_bool_Hidden = false) {
- $l_str_Style = "";
- // collect data for given settings field
- $l_arr_Data = $this->LoadSetting($p_str_SettingName);
- if ($p_bool_Hidden) {
- $l_str_Style .= 'display:none;';
- }
- return sprintf('',
- $l_arr_Data["name"], $l_arr_Data["id"], $p_str_MaxLength,
- $l_str_Style, $l_arr_Data["value"], $p_bool_Readonly ? 'readonly="readonly"' : '');
- }
-
- /**
- * Returns the html tag for an input [type = checkbox].
- *
- * @author Stefan Herndler
- * @since 1.5.0
- * @param string $p_str_SettingName Name of the Settings key to pre load the input field.
- * @return string
- */
- protected function addCheckbox($p_str_SettingName) {
- // collect data for given settings field
- $l_arr_Data = $this->LoadSetting($p_str_SettingName);
- return sprintf('',
- $l_arr_Data["name"], $l_arr_Data["id"],
- MCI_Footnotes_Convert::toBool($l_arr_Data["value"]) ? 'checked="checked"' : '');
- }
-
- /**
- * Returns the html tag for a select box.
- *
- * @author Stefan Herndler
- * @since 1.5.0
- * @param string $p_str_SettingName Name of the Settings key to pre select the current value.
- * @param array $p_arr_Options Possible options to be selected.
- * @return string
- */
- protected function addSelectBox($p_str_SettingName, $p_arr_Options) {
- // collect data for given settings field
- $l_arr_Data = $this->LoadSetting($p_str_SettingName);
- $l_str_Options = "";
-
- /* loop through all array keys */
- foreach ($p_arr_Options as $l_str_Value => $l_str_Caption) {
- $l_str_Options .= sprintf('',
- $l_str_Value,
- $l_arr_Data["value"] == $l_str_Value ? "selected" : "",
- $l_str_Caption);
- }
- return sprintf('',
- $l_arr_Data["name"], $l_arr_Data["id"], $l_str_Options);
- }
-
- /**
- * Returns the html tag for a text area.
- *
- * @author Stefan Herndler
- * @since 1.5.0
- * @param string $p_str_SettingName Name of the Settings key to pre fill the text area.
- * @return string
- */
- protected function addTextArea($p_str_SettingName) {
- // collect data for given settings field
- $l_arr_Data = $this->LoadSetting($p_str_SettingName);
- return sprintf('',
- $l_arr_Data["name"], $l_arr_Data["id"], $l_arr_Data["value"]);
- }
-
- /**
- * Returns the html tag for an input [type = text] with color selection class.
- *
- * @author Stefan Herndler
- * @since 1.5.6
- * @param string $p_str_SettingName Name of the Settings key to pre load the input field.
- * @return string
- */
- protected function addColorSelection($p_str_SettingName) {
- // collect data for given settings field
- $l_arr_Data = $this->LoadSetting($p_str_SettingName);
- return sprintf('',
- $l_arr_Data["name"], $l_arr_Data["id"], $l_arr_Data["value"]);
- }
-
- /**
- * Returns the html tag for an input [type = num].
- *
- * @author Stefan Herndler
- * @since 1.5.0
- * @param string $p_str_SettingName Name of the Settings key to pre load the input field.
- * @param int $p_in_Min Minimum value.
- * @param int $p_int_Max Maximum value.
- * @param bool $p_bool_Deci true if 0.1 steps and floating to string, false if integer (default)
- * @return string
- *
- * Edited:
- * @since 2.1.4 step argument and number_format() to allow decimals 2020-12-03T0631+0100..2020-12-12T1110+0100
- */
- protected function addNumBox($p_str_SettingName, $p_in_Min, $p_int_Max, $p_bool_Deci = false ) {
- // collect data for given settings field
- $l_arr_Data = $this->LoadSetting($p_str_SettingName);
-
- if ($p_bool_Deci) {
- $l_str_Value = number_format(floatval($l_arr_Data["value"]), 1);
- return sprintf('',
- $l_arr_Data["name"], $l_arr_Data["id"], $l_str_Value, $p_in_Min, $p_int_Max);
- } else {
- return sprintf('',
- $l_arr_Data["name"], $l_arr_Data["id"], $l_arr_Data["value"], $p_in_Min, $p_int_Max);
- }
- }
-
-} // end of class
+ MCI_Footnotes_Config::C_STR_PLUGIN_NAME . "-" . $p_str_ID, "title" => $p_str_Title, "submit" => $p_bool_hasSubmitButton, "container" => $p_int_SettingsContainerIndex);
+ }
+
+ /**
+ * Returns an array describing a meta box.
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ * @param string $p_str_SectionID Parent Section ID.
+ * @param string $p_str_ID Unique ID suffix.
+ * @param string $p_str_Title Title for the meta box.
+ * @param string $p_str_CallbackFunctionName Class method name for callback.
+ * @return array meta box description to be able to append a meta box to the output.
+ */
+ protected function addMetaBox($p_str_SectionID, $p_str_ID, $p_str_Title, $p_str_CallbackFunctionName) {
+ return array(
+ "parent" => MCI_Footnotes_Config::C_STR_PLUGIN_NAME . "-" . $p_str_SectionID,
+ "id" => $p_str_ID,
+ "title" => $p_str_Title,
+ "callback" => $p_str_CallbackFunctionName
+ );
+ }
+
+ /**
+ * Registers a sub page.
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ */
+ public function registerSubPage() {
+ global $submenu;
+ // any sub menu for our main menu exists
+ if (array_key_exists(plugin_basename(MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG), $submenu)) {
+ // iterate through all sub menu entries of the ManFisher main menu
+ foreach($submenu[plugin_basename(MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG)] as $l_arr_SubMenu) {
+ if ($l_arr_SubMenu[2] == plugin_basename(MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->getSubPageSlug())) {
+ // remove that sub menu and add it again to move it to the bottom
+ remove_submenu_page(MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG, MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG .$this->getSubPageSlug());
+ }
+ }
+ }
+
+ $this->a_str_SubPageHook = add_submenu_page(
+ MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG, // parent slug
+ $this->getSubPageTitle(), // page title
+ $this->getSubPageTitle(), // menu title
+ 'manage_options', // capability
+ MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->getSubPageSlug(), // menu slug
+ array($this, 'displayContent') // function
+ );
+ }
+
+ /**
+ * Registers all sections for a sub page.
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ */
+ public function registerSections() {
+ // iterate through each section
+ foreach($this->getSections() as $l_arr_Section) {
+ // append tab to the tab-array
+ $this->a_arr_Sections[$l_arr_Section["id"]] = $l_arr_Section;
+ add_settings_section(
+ $l_arr_Section["id"], // unique id
+ "", //$l_arr_Section["title"], // title
+ array($this, 'Description'), // callback function for the description
+ $l_arr_Section["id"] // parent sub page slug
+ );
+ $this->registerMetaBoxes($l_arr_Section["id"]);
+ }
+ }
+
+ /**
+ * Registers all Meta boxes for a sub page.
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ * @param string $p_str_ParentID Parent section unique id.
+ */
+ private function registerMetaBoxes($p_str_ParentID) {
+ // iterate through each meta box
+ foreach($this->getMetaBoxes() as $l_arr_MetaBox) {
+ if ($l_arr_MetaBox["parent"] != $p_str_ParentID) {
+ continue;
+ }
+ add_meta_box(
+ $p_str_ParentID. "-" . $l_arr_MetaBox["id"], // unique id
+ $l_arr_MetaBox["title"], // meta box title
+ array($this, $l_arr_MetaBox["callback"]), // callback function to display (echo) the content
+ $p_str_ParentID, // post type = parent section id
+ 'main' // context
+ );
+ }
+ }
+
+ /**
+ * Append javascript and css files for specific sub page.
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ */
+ private function appendScripts() {
+ // enable meta boxes layout and close functionality
+ wp_enqueue_script('postbox');
+ // add WordPress color picker layout
+ wp_enqueue_style('wp-color-picker');
+ // add WordPress color picker function
+ wp_enqueue_script('wp-color-picker');
+
+
+ /**
+ * Registers and enqueues the dashboard stylesheet.
+ *
+ * - Bugfix: Stylesheets: minify to shrink the carbon footprint, increase speed and implement best practice, thanks to @docteurfitness issue report.
+ *
+ * @since 2.5.5
+ * @date 2021-02-14T1928+0100
+ *
+ * @reporter @docteurfitness
+ * @link https://wordpress.org/support/topic/simply-speed-optimisation/
+ *
+ * See the public stylesheet enqueuing:
+ * @see class/init.php
+ *
+ * added version # after changes started to settings.css from 2.1.2 on.
+ * automated update of version number for cache busting.
+ * No need to use '-styles' in the handle, as '-css' is appended automatically.
+ */
+ if ( C_BOOL_CSS_PRODUCTION_MODE === true ) {
+
+ wp_register_style( 'mci-footnotes-admin', plugins_url( 'footnotes/css/settings.min.css' ), array(), C_STR_FOOTNOTES_VERSION );
+
+ } else {
+
+ wp_register_style( 'mci-footnotes-admin', plugins_url( 'footnotes/css/settings.css' ), array(), C_STR_FOOTNOTES_VERSION );
+
+ }
+
+ wp_enqueue_style('mci-footnotes-admin');
+ }
+
+ /**
+ * Displays the content of specific sub page.
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ */
+ public function displayContent() {
+ // register and enqueue scripts and styling
+ $this->appendScripts();
+ // get current section
+ reset($this->a_arr_Sections);
+ $l_str_ActiveSectionID = isset($_GET['t']) ? $_GET['t'] : key($this->a_arr_Sections);
+ $l_arr_ActiveSection = $this->a_arr_Sections[$l_str_ActiveSectionID];
+ // store settings
+ $l_bool_SettingsUpdated = false;
+ if (array_key_exists("save-settings", $_POST)) {
+ if ($_POST["save-settings"] == "save") {
+ unset($_POST["save-settings"]);
+ unset($_POST["submit"]);
+ $l_bool_SettingsUpdated = $this->saveSettings();
+ }
+ }
+
+ // display all sections and highlight the active section
+ echo '
';
+
+ if ($l_bool_SettingsUpdated) {
+ echo sprintf('
%s
', __("Settings saved", MCI_Footnotes_Config::C_STR_PLUGIN_NAME));
+ }
+
+ // form to submit the active section
+ echo '';
+ // close container for the settings page
+ echo '
';
+ // output special javascript for the expand/collapse function of the meta boxes
+ echo '';
+ }
+
+ /**
+ * Save all Plugin settings.
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ * @return bool
+ */
+ private function saveSettings() {
+ $l_arr_newSettings = array();
+ // get current section
+ reset($this->a_arr_Sections);
+ $l_str_ActiveSectionID = isset($_GET['t']) ? $_GET['t'] : key($this->a_arr_Sections);
+ $l_arr_ActiveSection = $this->a_arr_Sections[$l_str_ActiveSectionID];
+
+ // iterate through each value that has to be in the specific container
+ foreach(MCI_Footnotes_Settings::instance()->getDefaults($l_arr_ActiveSection["container"]) as $l_str_Key => $l_mixed_Value) {
+ // setting is available in the POST array, use it
+ if (array_key_exists($l_str_Key, $_POST)) {
+ $l_arr_newSettings[$l_str_Key] = $_POST[$l_str_Key];
+ } else {
+ // setting is not defined in the POST array, define it to avoid the Default value
+ $l_arr_newSettings[$l_str_Key] = "";
+ }
+ }
+ // update settings
+ return MCI_Footnotes_Settings::instance()->saveOptions($l_arr_ActiveSection["container"], $l_arr_newSettings);
+ }
+
+ /**
+ * Output the Description of a section. May be overwritten in any section.
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ */
+ public function Description() {
+ // default no description will be displayed
+ }
+
+ /**
+ * Loads specific setting and returns an array with the keys [id, name, value].
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ * @param string $p_str_SettingKeyName Settings Array key name.
+ * @return array Contains Settings ID, Settings Name and Settings Value.
+ */
+ protected function LoadSetting($p_str_SettingKeyName) {
+ // get current section
+ reset($this->a_arr_Sections);
+ $p_arr_Return = array();
+ $p_arr_Return["id"] = sprintf('%s', $p_str_SettingKeyName);
+ $p_arr_Return["name"] = sprintf('%s', $p_str_SettingKeyName);
+ $p_arr_Return["value"] = esc_attr(MCI_Footnotes_Settings::instance()->get($p_str_SettingKeyName));
+ return $p_arr_Return;
+ }
+
+ /**
+ * Returns a line break to start a new line.
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ * @return string
+ */
+ protected function addNewline() {
+ return ' ';
+ }
+
+ /**
+ * Returns a line break to have a space between two lines.
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ * @return string
+ */
+ protected function addLineSpace() {
+ return '
';
+ }
+
+ /**
+ * Returns a simple text inside html text.
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ * @param string $p_str_Text Message to be surrounded with simple html tag (span).
+ * @return string
+ */
+ protected function addText($p_str_Text) {
+ return sprintf('%s', $p_str_Text);
+ }
+
+ /**
+ * Returns the html tag for an input/select label.
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ * @param string $p_str_SettingName Name of the Settings key to connect the Label with the input/select field.
+ * @param string $p_str_Caption Label caption.
+ * @return string
+ *
+ * Edited 2020-12-01T0159+0100..
+ * @since 2.1.6 no colon
+ */
+ protected function addLabel($p_str_SettingName, $p_str_Caption) {
+ if (empty($p_str_Caption)) {
+ return "";
+ }
+ // remove the colon causing localization issues with French,
+ // and with languages not using punctuation at all,
+ // and with languages using other punctuation marks instead of colon,
+ // e.g. Greek using a raised dot.
+ // In French, colon is preceded by a space, forcibly non-breaking,
+ // and narrow per new school.
+ // Add colon to label strings for inclusion in localization.
+ // Colon after label is widely preferred best practice, mandatory per style guides.
+ //
+ return sprintf('', $p_str_SettingName, $p_str_Caption);
+ // ^ here deleted colon 2020-12-08T1546+0100
+ }
+
+ /**
+ * Returns the html tag for an input [type = text].
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ * @param string $p_str_SettingName Name of the Settings key to pre load the input field.
+ * @param int $p_str_MaxLength Maximum length of the input, default 999 characters.
+ * @param bool $p_bool_Readonly Set the input to be read only, default false.
+ * @param bool $p_bool_Hidden Set the input to be hidden, default false.
+ * @return string
+ */
+ protected function addTextBox($p_str_SettingName, $p_str_MaxLength = 999, $p_bool_Readonly = false, $p_bool_Hidden = false) {
+ $l_str_Style = "";
+ // collect data for given settings field
+ $l_arr_Data = $this->LoadSetting($p_str_SettingName);
+ if ($p_bool_Hidden) {
+ $l_str_Style .= 'display:none;';
+ }
+ return sprintf('',
+ $l_arr_Data["name"], $l_arr_Data["id"], $p_str_MaxLength,
+ $l_str_Style, $l_arr_Data["value"], $p_bool_Readonly ? 'readonly="readonly"' : '');
+ }
+
+ /**
+ * Returns the html tag for an input [type = checkbox].
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ * @param string $p_str_SettingName Name of the Settings key to pre load the input field.
+ * @return string
+ */
+ protected function addCheckbox($p_str_SettingName) {
+ // collect data for given settings field
+ $l_arr_Data = $this->LoadSetting($p_str_SettingName);
+ return sprintf('',
+ $l_arr_Data["name"], $l_arr_Data["id"],
+ MCI_Footnotes_Convert::toBool($l_arr_Data["value"]) ? 'checked="checked"' : '');
+ }
+
+ /**
+ * Returns the html tag for a select box.
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ * @param string $p_str_SettingName Name of the Settings key to pre select the current value.
+ * @param array $p_arr_Options Possible options to be selected.
+ * @return string
+ */
+ protected function addSelectBox($p_str_SettingName, $p_arr_Options) {
+ // collect data for given settings field
+ $l_arr_Data = $this->LoadSetting($p_str_SettingName);
+ $l_str_Options = "";
+
+ /* loop through all array keys */
+ foreach ($p_arr_Options as $l_str_Value => $l_str_Caption) {
+ $l_str_Options .= sprintf('',
+ $l_str_Value,
+ $l_arr_Data["value"] == $l_str_Value ? "selected" : "",
+ $l_str_Caption);
+ }
+ return sprintf('',
+ $l_arr_Data["name"], $l_arr_Data["id"], $l_str_Options);
+ }
+
+ /**
+ * Returns the html tag for a text area.
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ * @param string $p_str_SettingName Name of the Settings key to pre fill the text area.
+ * @return string
+ */
+ protected function addTextArea($p_str_SettingName) {
+ // collect data for given settings field
+ $l_arr_Data = $this->LoadSetting($p_str_SettingName);
+ return sprintf('',
+ $l_arr_Data["name"], $l_arr_Data["id"], $l_arr_Data["value"]);
+ }
+
+ /**
+ * Returns the html tag for an input [type = text] with color selection class.
+ *
+ * @author Stefan Herndler
+ * @since 1.5.6
+ * @param string $p_str_SettingName Name of the Settings key to pre load the input field.
+ * @return string
+ */
+ protected function addColorSelection($p_str_SettingName) {
+ // collect data for given settings field
+ $l_arr_Data = $this->LoadSetting($p_str_SettingName);
+ return sprintf('',
+ $l_arr_Data["name"], $l_arr_Data["id"], $l_arr_Data["value"]);
+ }
+
+ /**
+ * Returns the html tag for an input [type = num].
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ * @param string $p_str_SettingName Name of the Settings key to pre load the input field.
+ * @param int $p_in_Min Minimum value.
+ * @param int $p_int_Max Maximum value.
+ * @param bool $p_bool_Deci true if 0.1 steps and floating to string, false if integer (default)
+ * @return string
+ *
+ * Edited:
+ * @since 2.1.4 step argument and number_format() to allow decimals 2020-12-03T0631+0100..2020-12-12T1110+0100
+ */
+ protected function addNumBox($p_str_SettingName, $p_in_Min, $p_int_Max, $p_bool_Deci = false ) {
+ // collect data for given settings field
+ $l_arr_Data = $this->LoadSetting($p_str_SettingName);
+
+ if ($p_bool_Deci) {
+ $l_str_Value = number_format(floatval($l_arr_Data["value"]), 1);
+ return sprintf('',
+ $l_arr_Data["name"], $l_arr_Data["id"], $l_str_Value, $p_in_Min, $p_int_Max);
+ } else {
+ return sprintf('',
+ $l_arr_Data["name"], $l_arr_Data["id"], $l_arr_Data["value"], $p_in_Min, $p_int_Max);
+ }
+ }
+
+} // end of class
diff --git a/class/dashboard/subpage-diagnostics.php b/class/dashboard/subpage-diagnostics.php
index 5a1fd49..33f327a 100644
--- a/class/dashboard/subpage-diagnostics.php
+++ b/class/dashboard/subpage-diagnostics.php
@@ -1,140 +1,140 @@
-addSection("diagnostics", __("Diagnostics", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), null, false)
- );
- }
-
- /**
- * Returns an array of all registered meta boxes for each section of the sub page.
- *
- * @author Stefan Herndler
- * @since 1.5.0
- * @return array
- */
- protected function getMetaBoxes() {
- return array(
- $this->addMetaBox("diagnostics", "diagnostics", __("Displays information about the web server, PHP and WordPress", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Diagnostics")
- );
- }
-
- /**
- * Displays a diagnostics about the web server, php and WordPress.
- *
- * @author Stefan Herndler
- * @since 1.5.0
- */
- public function Diagnostics() {
- global $wp_version;
- $l_str_PhpExtensions = "";
- // iterate through each PHP extension
- foreach (get_loaded_extensions() as $l_int_Index => $l_str_Extension) {
- if ($l_int_Index > 0) {
- $l_str_PhpExtensions .= ' | ';
- }
- $l_str_PhpExtensions .= $l_str_Extension . ' ' . phpversion($l_str_Extension);
- }
-
- /** @var WP_Theme $l_obj_CurrentTheme */
- $l_obj_CurrentTheme = wp_get_theme();
-
- $l_str_WordPressPlugins = "";
- // iterate through each installed WordPress Plugin
- foreach (get_plugins() as $l_arr_Plugin) {
- $l_str_WordPressPlugins .= '
';
+ }
+ // load template file
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "diagnostics");
+ // replace all placeholders
+ $l_obj_Template->replace(
+ array(
+ "label-server" => __("Server name", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "server" => $_SERVER["SERVER_NAME"],
+
+ "label-php" => __("PHP version", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "php" => phpversion(),
+
+ "label-user-agent" => __("User agent", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "user-agent" => $_SERVER["HTTP_USER_AGENT"],
+
+ "label-max-execution-time" => __("Max execution time", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "max-execution-time" => ini_get('max_execution_time') . ' ' . __('seconds', MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-memory-limit" => __("Memory limit", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "memory-limit" => ini_get('memory_limit'),
+
+ "label-php-extensions" => __("PHP extensions", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "php-extensions" => $l_str_PhpExtensions,
+
+ "label-wordpress" => __("WordPress version", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "wordpress" => $wp_version,
+
+ "label-theme" => __("Active Theme", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "theme" => $l_obj_CurrentTheme->get("Name") . " " . $l_obj_CurrentTheme->get("Version") . ", " . $l_obj_CurrentTheme->get("Author"). " [" . $l_obj_CurrentTheme->get("AuthorURI") . "]",
+
+ "plugins" => $l_str_WordPressPlugins
+ )
+ );
+ // display template with replaced placeholders
+ echo $l_obj_Template->getContent();
+ }
}
\ No newline at end of file
diff --git a/class/dashboard/subpage-main.php b/class/dashboard/subpage-main.php
index f4098ad..940a22b 100644
--- a/class/dashboard/subpage-main.php
+++ b/class/dashboard/subpage-main.php
@@ -1,1182 +1,1182 @@
-addSection("settings", __("General settings", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 0, true);
-
- // sync tab name with mirror in public function CustomCSSMigration():
- $l_arr_Tabs[] = $this->addSection("customize", __("Referrers and tooltips", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 1, true);
-
- $l_arr_Tabs[] = $this->addSection("expert", __("Scope and priority", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 2, true);
- $l_arr_Tabs[] = $this->addSection("customcss", __("Custom CSS", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 3, true);
- $l_arr_Tabs[] = $this->addSection("how-to", __("Quick start guide", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), null, false);
-
- return $l_arr_Tabs;
- }
-
- /**
- * Returns an array of all registered meta boxes for each section of the sub page.
- *
- * @author Stefan Herndler
- * @since 1.5.0
- * @return array
- *
- * Edited for 2.0.0 and later.
- *
- * HyperlinkArrow meta box:
- * @since 2.0.0 discontinued
- * @since 2.0.4 restored to meet user demand for arrow symbol semantics
- * @since 2.1.4 discontinued, content moved to Settings > Reference container > Display a backlink symbol
- *
- * @since 2.0.4 to reflect changes in meta box label display since WPv5.5
- * spans need position:fixed and become unlocalizable
- * fix: logo is kept only in the label that doesn’t need to be translated:
- * Change string "%s styling" to "Footnotes styling" to fix layout in WPv5.5
- * @see details in class/config.php
- *
- * @since 2.1.6 / 2.2.0 tabs reordered and renamed
- */
- protected function getMetaBoxes() {
- $l_arr_MetaBoxes = array();
-
- // sync box name with mirror in task.php:
- $l_arr_MetaBoxes[] = $this->addMetaBox("settings", "start-end", __("Footnote start and end short codes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "StartEnd");
- $l_arr_MetaBoxes[] = $this->addMetaBox("settings", "numbering", __("Footnotes numbering", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Numbering");
- $l_arr_MetaBoxes[] = $this->addMetaBox("settings", "scrolling", __("Scrolling behavior", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Scrolling");
- $l_arr_MetaBoxes[] = $this->addMetaBox("settings", "reference-container", __("Reference container", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "ReferenceContainer");
- $l_arr_MetaBoxes[] = $this->addMetaBox("settings", "excerpts", __("Footnotes in excerpts", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Excerpts");
- $l_arr_MetaBoxes[] = $this->addMetaBox("settings", "love", MCI_Footnotes_Config::C_STR_PLUGIN_HEADING_NAME . ' ' . MCI_Footnotes_Config::C_STR_LOVE_SYMBOL_HEADING, "Love");
-
- $l_arr_MetaBoxes[] = $this->addMetaBox("customize", "hyperlink-arrow", __("Backlink symbol", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "HyperlinkArrow");
- $l_arr_MetaBoxes[] = $this->addMetaBox("customize", "superscript", __("Referrer typesetting and formatting", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Superscript");
- $l_arr_MetaBoxes[] = $this->addMetaBox("customize", "mouse-over-box", __("Tooltips", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "MouseOverBox");
- $l_arr_MetaBoxes[] = $this->addMetaBox("customize", "mouse-over-box-position", __("Tooltip position", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "MouseOverBoxPosition");
- $l_arr_MetaBoxes[] = $this->addMetaBox("customize", "mouse-over-box-dimensions", __("Tooltip dimensions", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "MouseOverBoxDimensions");
- $l_arr_MetaBoxes[] = $this->addMetaBox("customize", "mouse-over-box-timing", __("Tooltip timing", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "MouseOverBoxTiming");
- $l_arr_MetaBoxes[] = $this->addMetaBox("customize", "mouse-over-box-truncation", __("Tooltip truncation", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "MouseOverBoxTruncation");
- $l_arr_MetaBoxes[] = $this->addMetaBox("customize", "mouse-over-box-text", __("Tooltip text", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "MouseOverBoxText");
- $l_arr_MetaBoxes[] = $this->addMetaBox("customize", "mouse-over-box-appearance", __("Tooltip appearance", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "MouseOverBoxAppearance");
- if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_CUSTOM_CSS_LEGACY_ENABLE))) {
- $l_arr_MetaBoxes[] = $this->addMetaBox("customize", "custom-css", __("Your existing Custom CSS code", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "CustomCSS");
- }
-
- $l_arr_MetaBoxes[] = $this->addMetaBox("expert", "lookup", __("WordPress hooks with priority level", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "LookupHooks");
-
- if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_CUSTOM_CSS_LEGACY_ENABLE))) {
- $l_arr_MetaBoxes[] = $this->addMetaBox("customcss", "custom-css-migration", __("Your existing Custom CSS code", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "CustomCSSMigration");
- }
- $l_arr_MetaBoxes[] = $this->addMetaBox("customcss", "custom-css-new", __("Custom CSS", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "CustomCSSNew");
-
- $l_arr_MetaBoxes[] = $this->addMetaBox("how-to", "help", __("Brief introduction in how to use the plugin", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Help");
- $l_arr_MetaBoxes[] = $this->addMetaBox("how-to", "donate", __("Help us to improve our Plugin", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Donate");
-
- return $l_arr_MetaBoxes;
- }
-
- /**
- * Displays all settings for the reference container.
- *
- * @author Stefan Herndler
- * @since 1.5.0
- *
- * Completed:
- * @since 2.1.4: layout and typography options 2020-11-30T0548+0100
- * @since 2.2.5 options for label element and label bottom border, thanks to @markhillyer 2020-12-18T1447+0100
- * @link https://wordpress.org/support/topic/how-do-i-eliminate-the-horizontal-line-beneath-the-reference-container-heading/
- */
- public function ReferenceContainer() {
-
- // options for the label element:
- $l_arr_LabelElement = array(
- "p" => __("paragraph", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "h2" => __("heading 2", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "h3" => __("heading 3", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "h4" => __("heading 4", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "h5" => __("heading 5", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "h6" => __("heading 6", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- );
- // options for the positioning of the reference container
- $l_arr_Positions = array(
- "post_end" => __("at the end of the post", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "widget" => __("in the widget area", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "footer" => __("in the footer", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- );
- // basic responsive page layout options:
- $l_arr_PageLayoutOptions = array(
- "none" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "reference-container" => __("to the reference container exclusively", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "entry-content" => __("to the div element starting below the post title", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "main-content" => __("to the main element including the post title", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- );
- // options for the separating punctuation between backlinks:
- $l_arr_Separators = array(
- // Unicode character names are conventionally uppercase.
- "comma" => __("COMMA", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "semicolon" => __("SEMICOLON", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "en_dash" => __("EN DASH", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
- );
- // options for the terminating punctuation after backlinks:
- // The Unicode name of RIGHT PARENTHESIS was originally more accurate because
- // this character is bidi-mirrored. Let’s use the Unicode 1.0 name.
- // The wrong names were enforced in spite of Unicode, that subsequently scrambled to correct.
- $l_arr_Terminators = array(
- "period" => __("FULL STOP", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- // Unicode 1.0 name of RIGHT PARENTHESIS (represented as a left parenthesis in right-to-left scripts):
- "parenthesis" => __("CLOSING PARENTHESIS", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "colon" => __("COLON", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
- );
- // options for the first column width (per cent is a ratio, not a unit):
- $l_arr_WidthUnits = array(
- "%" => __("per cent", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "px" => __("pixels", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "rem" => __("root em", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "em" => __("em", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "vw" => __("viewport width", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- );
- // options for reference container script mode:
- $l_arr_ScriptMode = array(
- "jquery" => __("jQuery", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "js" => __("plain JavaScript", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
- );
- // options for Yes/No select box:
- $l_arr_Enabled = array(
- "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
- );
-
- // load template file
- $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-reference-container");
- // replace all placeholders
- $l_obj_Template->replace(
- array(
- "label-name" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME, __("Heading:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "name" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME),
-
- "label-element" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT, __("Heading’s HTML element:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "element" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT, $l_arr_LabelElement),
-
- "label-border" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER, __("Border under the heading:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "border" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER, $l_arr_Enabled),
-
- "label-collapse" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE, __("Collapse by default:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "collapse" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE, $l_arr_Enabled),
-
- "label-script" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE, __("Script mode:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "script" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE, $l_arr_ScriptMode),
- "notice-script" => __("The plain JavaScript mode does not support scroll animation and will enable hard links with scroll offset.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-position" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION, __("Default position:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "position" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION, $l_arr_Positions),
- "notice-position" => sprintf(__("To use the position shortcode, please set the position to: %s", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), '' . __("at the end of the post", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . ''),
-
- "label-shortcode" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE, __("Position shortcode:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "shortcode" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE),
- "notice-shortcode" => __("If present in the content, any shortcode in this text box will be replaced with the reference container.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-startpage" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_START_PAGE_ENABLE, __("Display on start page too:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "startpage" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_START_PAGE_ENABLE, $l_arr_Enabled),
-
- "label-margin-top" => $this->addLabel(MCI_Footnotes_Settings::C_INT_REFERENCE_CONTAINER_TOP_MARGIN, __("Top margin:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "margin-top" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_REFERENCE_CONTAINER_TOP_MARGIN, -500, 500),
- "notice-margin-top" => __("pixels; may be negative", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-margin-bottom" => $this->addLabel(MCI_Footnotes_Settings::C_INT_REFERENCE_CONTAINER_BOTTOM_MARGIN, __("Bottom margin:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "margin-bottom" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_REFERENCE_CONTAINER_BOTTOM_MARGIN, -500, 500),
- "notice-margin-bottom" => __("pixels; may be negative", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-page-layout" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT, __("Apply basic responsive page layout:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "page-layout" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT, $l_arr_PageLayoutOptions),
- "notice-page-layout" => __("Most themes don’t need this fix.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-url-wrap" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTE_URL_WRAP_ENABLED, __("Allow URLs to line-wrap anywhere:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "url-wrap" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTE_URL_WRAP_ENABLED, $l_arr_Enabled),
- "notice-url-wrap" => __("Unicode-conformant browsers don’t need this fix.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-symbol" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, __("Display a backlink symbol:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "symbol-enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, $l_arr_Enabled),
- "notice-symbol" => __("Please choose or input the symbol at the top of the next dashboard tab.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-switch" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH, __("Symbol appended, not prepended:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "switch" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH, $l_arr_Enabled),
-
- "label-3column" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, __("Backlink symbol in an extra column:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "3column" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, $l_arr_Enabled),
- "notice-3column" => __("This legacy layout is available if identical footnotes are not combined.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-row-borders" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_ROW_BORDERS_ENABLE, __("Borders around the table rows:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "row-borders" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_ROW_BORDERS_ENABLE, $l_arr_Enabled),
-
- "label-separator" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_SEPARATOR_ENABLED, __("Add a separator when enumerating backlinks:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "separator-enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_SEPARATOR_ENABLED, $l_arr_Enabled),
- "separator-options" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_OPTION, $l_arr_Separators),
- "separator-custom" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_CUSTOM),
- "notice-separator" => __("Your input overrides the selection.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-terminator" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_TERMINATOR_ENABLED, __("Add a terminal punctuation to backlinks:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "terminator-enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_TERMINATOR_ENABLED, $l_arr_Enabled),
- "terminator-options" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_OPTION, $l_arr_Terminators),
- "terminator-custom" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_CUSTOM),
- "notice-terminator" => __("Your input overrides the selection.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-width" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_COLUMN_WIDTH_ENABLED, __("Set backlinks column width:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "width-enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_COLUMN_WIDTH_ENABLED, $l_arr_Enabled),
- "width-scalar" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_BACKLINKS_COLUMN_WIDTH_SCALAR, 0, 500, true),
- "width-unit" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_WIDTH_UNIT, $l_arr_WidthUnits),
- "notice-width" => __("Absolute width in pixels doesn’t need to be accurate to the tenth, but relative width in rem or em may.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-max-width" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED, __("Set backlinks column maximum width:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "max-width-enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED, $l_arr_Enabled),
- "max-width-scalar" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_BACKLINKS_COLUMN_MAX_WIDTH_SCALAR, 0, 500, true),
- "max-width-unit" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_UNIT, $l_arr_WidthUnits),
- "notice-max-width" => __("Absolute width in pixels doesn’t need to be accurate to the tenth, but relative width in rem or em may.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-line-break" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_LINE_BREAKS_ENABLED, __("Stack backlinks when enumerating:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "line-break" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_LINE_BREAKS_ENABLED, $l_arr_Enabled),
- "notice-line-break" => __("This option adds a line break before each added backlink when identical footnotes are combined.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-link" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_LINK_ELEMENT_ENABLED, __("Use the link element for referrers and backlinks:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "link" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_LINK_ELEMENT_ENABLED, $l_arr_Enabled),
- "notice-link" => __("The link element is needed to apply the theme’s link color.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "description-link" => __("If the link element is not desired for styling, a simple span is used instead when the above is set to No. The link addresses have been removed. Else footnote clicks are logged in the browsing history and make the back button unusable.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- )
- );
- // display template with replaced placeholders
- echo $l_obj_Template->getContent();
- }
-
- /**
- * Displays all options for the footnotes start and end tag short codes
- * Displays all options for the footnotes numbering
- * Displays all options for the scrolling behavior
- *
- * @author Stefan Herndler
- * @since 1.5.0
- *
- * Edited heading 2020-12-12T1412+0100
- * @since 2.2.0 start/end short codes: more predefined options 2020-12-12T1412+0100
- * @link https://wordpress.org/support/topic/doesnt-work-with-mailpoet/
- * @since 2.2.0 3 boxes for clarity 2020-12-12T1422+0100
- * @since 2.2.5 support for Ibid. notation thanks to @meglio 2020-12-17T2019+0100
- * @link https://wordpress.org/support/topic/add-support-for-ibid-notation/
- * @since 2.4.0 added warning about Block Editor escapement disruption 2021-01-02T2324+0100
- * @since 2.4.0 removed the HTML comment tag option 2021-01-02T2325+0100
- * @since 2.5.0 Shortcode syntax validation: add more information around the setting, thanks to @andreasra
- * @link https://wordpress.org/support/topic/warning-unbalanced-footnote-start-tag-short-code-before/
- */
- public function StartEnd() {
- // footnotes start tag short code options:
- $l_arr_ShortCodeStart = array(
- "((" => "((",
- "(((" => "(((",
- "{{" => "{{",
- "{{{" => "{{{",
- "[n]" => "[n]",
- "[fn]" => "[fn]",
- htmlspecialchars("") => htmlspecialchars(""),
- "[ref]" => "[ref]",
- htmlspecialchars("") => htmlspecialchars(""),
- // Custom (user-defined) start and end tags bracketing the footnote text inline:
- "userdefined" => __('custom short code', MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
- );
- // footnotes end tag short code options:
- $l_arr_ShortCodeEnd = array(
- "))" => "))",
- ")))" => ")))",
- "}}" => "}}",
- "}}}" => "}}}",
- "[/n]" => "[/n]",
- "[/fn]" => "[/fn]",
- htmlspecialchars("") => htmlspecialchars(""),
- "[/ref]" => "[/ref]",
- htmlspecialchars("") => htmlspecialchars(""),
- // Custom (user-defined) start and end tags bracketing the footnote text inline:
- "userdefined" => __("custom short code", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
- );
- // options for the syntax validation:
- $l_arr_Enable = array(
- "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
- );
-
- // load template file
- $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-start-end");
- // replace all placeholders
- $l_obj_Template->replace(
- array(
-
- "description-escapement" => __("WARNING: Short codes with closing pointy brackets are disabled in the new WordPress Block Editor that disrupts the traditional balanced escapement applied by WordPress Classic Editor.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-short-code-start" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, __("Footnote start tag short code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "short-code-start" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, $l_arr_ShortCodeStart),
- "short-code-start-user" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED),
-
- "label-short-code-end" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END, __("Footnote end tag short code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "short-code-end" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END, $l_arr_ShortCodeEnd),
- "short-code-end-user" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED),
-
- // for script showing/hiding user defined text boxes:
- "short-code-start-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START,
- "short-code-end-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END,
- "short-code-start-user-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED,
- "short-code-end-user-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED,
-
- "description-parentheses" => __("WARNING: Although widespread industry standard, the double parentheses are problematic because they may occur in scripts embedded in the content and be mistaken as a short code.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- // option to enable syntax validation, label mirrored in task.php:
- "label-syntax" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE, __("Check for balanced shortcodes:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "syntax" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE, $l_arr_Enable),
- "notice-syntax" => __("In the presence of a lone start tag shortcode, a warning displays below the post title.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "description-syntax" => __("If the start tag short code is ‘((’ or ‘(((’, it will not be reported as unbalanced if the following string contains braces hinting that it is a script.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- )
- );
- // display template with replaced placeholders
- echo $l_obj_Template->getContent();
- }
-
- public function Numbering() {
- // define some space for the output
- $l_str_Space = " ";
- // options for the combination of identical footnotes
- $l_arr_Enable = array(
- "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
- );
- // options for the numbering style of the footnotes:
- $l_arr_CounterStyle = array(
- "arabic_plain" => __("plain Arabic numbers", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "1, 2, 3, 4, 5, …",
- "arabic_leading" => __("zero-padded Arabic numbers", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "01, 02, 03, 04, 05, …",
- "latin_low" => __("lowercase Latin letters", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "a, b, c, d, e, …",
- "latin_high" => __("uppercase Latin letters", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "A, B, C, D, E, …",
- "romanic" => __("uppercase Roman numerals", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "I, II, III, IV, V, …",
- "roman_low" => __("lowercase Roman numerals", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "i, ii, iii, iv, v, …",
- );
-
- // load template file
- $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-numbering");
- // replace all placeholders
- $l_obj_Template->replace(
- array(
- "label-counter-style" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE, __("Numbering style:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "counter-style" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE, $l_arr_CounterStyle),
-
- // algorithmically combine identicals:
- "label-identical" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES, __("Combine identical footnotes:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "identical" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES, $l_arr_Enable),
- "notice-identical" => __("This option may require copy-pasting footnotes in multiple instances.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- // Support for Ibid. notation added thanks to @meglio in .
- "description-identical" => __("Even when footnotes are combined, footnote numbers keep incrementing. This avoids suboptimal referrer and backlink disambiguation using a secondary numbering system. The Ibid. notation and the op. cit. abbreviation followed by the current page number avoid repeating the footnote content. For changing sources, shortened citations may be used. Repeating full citations is also an opportunity to add details.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- )
- );
- // display template with replaced placeholders
- echo $l_obj_Template->getContent();
- }
-
- public function Scrolling() {
-
- // options for enabling hard links for AMP compat:
- $l_arr_Enable = array(
- "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
- );
-
- // load template file
- $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-scrolling");
- // replace all placeholders
- $l_obj_Template->replace(
- array(
-
- "label-scroll-offset" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET, __("Scroll offset:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "scroll-offset" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET, 0, 100),
- "notice-scroll-offset" => __("per cent from the upper edge of the window", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-scroll-duration" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DURATION, __("Scroll duration:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "scroll-duration" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DURATION, 0, 20000),
- "notice-scroll-duration" => __("milliseconds; instantly if hard links are enabled and JavaScript is disabled", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- // enable hard links for AMP compat:
- "label-hard-links" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_HARD_LINKS_ENABLE, __("Enable hard links:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "hard-links" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_HARD_LINKS_ENABLE, $l_arr_Enable),
- "notice-hard-links" => __("Hard links are indispensable for AMP compatibility and allow to link to footnotes.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-footnote" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTE_FRAGMENT_ID_SLUG, __("Fragment identifier slug for footnotes:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "footnote" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTE_FRAGMENT_ID_SLUG),
- "notice-footnote" => __("This will show up in the address bar after clicking on a hard-linked footnote referrer.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-referrer" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERRER_FRAGMENT_ID_SLUG, __("Fragment identifier slug for footnote referrers:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "referrer" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_REFERRER_FRAGMENT_ID_SLUG),
- "notice-referrer" => __("This will show up in the address bar after clicking on a hard-linked backlink.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-separator" => $this->addLabel(MCI_Footnotes_Settings::C_STR_HARD_LINK_IDS_SEPARATOR, __("ID separator:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "separator" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_HARD_LINK_IDS_SEPARATOR),
- "notice-separator" => __("May be empty or any string, for example _, - or +, to distinguish post number, container number and footnote number.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- // enable backlink tooltips:
- "label-backlink-tooltips" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE, __("Enable backlink tooltips:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "backlink-tooltips" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE, $l_arr_Enable),
- "notice-backlink-tooltips" => __("Hard backlinks get ordinary tooltips hinting to use the backbutton instead.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-backlink-tooltip-text" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT, __("Backlink tooltip text:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "backlink-tooltip-text" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT),
- "notice-backlink-tooltip-text" => __("Default text is the keyboard shortcut, but you may wish to input a descriptive hint in your language.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- )
- );
- // display template with replaced placeholders
- echo $l_obj_Template->getContent();
- }
-
- /**
- * Displays all settings for 'I love Footnotes'.
- *
- * @author Stefan Herndler
- * @since 1.5.0
- *
- * Edited:
- * @since 2.2.0 position-sensitive placeholders to support more locales 2020-12-11T0432+0100
- * @since 2.2.0 more options 2020-12-11T0432+0100
- */
- public function Love() {
- // options for the acknowledgment display in the footer:
- $l_arr_Love = array(
- // logo only:
- "text-3" => sprintf('%s', MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME),
- // logo followed by heart symbol:
- "text-4" => sprintf('%s %s', MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL),
- // logo preceded by heart symbol:
- "text-5" => sprintf('%s %s', MCI_Footnotes_Config::C_STR_LOVE_SYMBOL, MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME),
- // "I love Footnotes": placeholder %1$s is the 'footnotes' logogram, placeholder %2$s is a heart symbol.
- "text-1" => sprintf(__('I %2$s %1$s', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL),
- // "This website uses Footnotes."
- "text-6" => sprintf(__('This website uses %s.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME),
- // "This website uses the Footnotes plugin."
- "text-7" => sprintf(__('This website uses the %s plugin.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME),
- // "This website uses the awesome Footnotes plugin."
- "text-2" => sprintf(__('This website uses the awesome %s plugin.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME),
- "random" => __('randomly determined display of either mention', MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- // "No display of any “Footnotes love” mention in the footer"
- "no" => sprintf(__('no display of any “%1$s %2$s” mention in the footer', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL)
- );
-
- // load template file
- $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-love");
- // replace all placeholders
- $l_obj_Template->replace(
- array(
- "label-love" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE, sprintf(__("Tell the world you’re using %s:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME)),
- "love" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE, $l_arr_Love),
-
- "label-no-love" => $this->addText(sprintf(__("Shortcode to inhibit the display of the %s mention on specific pages:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME)),
- "no-love" => $this->addText(MCI_Footnotes_Config::C_STR_NO_LOVE_SLUG)
- )
- );
- // display template with replaced placeholders
- echo $l_obj_Template->getContent();
- }
-
- /**
- * Displays the excerpt setting
- *
- * @author Stefan Herndler
- * @since 1.5.0
- *
- * Edited heading 2020-12-12T1453+0100
- * @since 2.1.1 more settings and notices, thanks to @nikelaos
- * @link https://wordpress.org/support/topic/doesnt-work-any-more-11/#post-13687068
- * @link https://wordpress.org/support/topic/jquery-comes-up-in-feed-content/#post-13110879
- * @since 2.2.0 dedicated to the excerpt setting and its notices 2020-12-12T1454+0100
- */
- public function Excerpts() {
- // options for Yes/No select box:
- $l_arr_Enabled = array(
- "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
- );
-
- // load template file
- $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-excerpts");
- // replace all placeholders
- $l_obj_Template->replace(
- array(
- "label-excerpts" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT, __("Display footnotes in excerpts:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "excerpts" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT, $l_arr_Enabled),
- "notice-excerpts" => __("The recommended value is No.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- // In some themes, the Advanced Excerpt plugin is indispensable to display footnotes in excerpts.
- "description-excerpts" => sprintf(__("In some themes, the %s plugin is indispensable to display footnotes in excerpts. Footnotes cannot be disabled in excerpts. A workaround is to avoid footnotes in the first 55 words.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 'Advanced Excerpt'),
- )
- );
- // display template with replaced placeholders
- echo $l_obj_Template->getContent();
- }
-
- /**
- * Displays all settings for the footnote referrers
- *
- * @author Stefan Herndler
- * @since 1.5.0
- *
- * Edited heading 2020-12-12T1513+0100
- * @since 2.1.1 option for superscript (optionally baseline referrers)
- * @since 2.2.0 option for link element moved here 2020-12-12T1514+0100
- */
- public function Superscript() {
- // options for Yes/No select box:
- $l_arr_Enabled = array(
- "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
- );
- // options for superscript normalize scope:
- $l_arr_NormalizeSuperscript = array(
- "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "referrers" => __("Footnote referrers", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "all" => __("All superscript elements", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- );
- // load template file
- $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-superscript");
- // replace all placeholders
- $l_obj_Template->replace(
- array(
- "label-superscript" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, __("Display footnote referrers in superscript:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "superscript" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, $l_arr_Enabled),
-
- "label-before" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE, __("At the start of the footnote referrers:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "before" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE),
-
- "label-after" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER, __("At the end of the footnote referrers:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "after" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER),
-
- "label-link" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_LINK_ELEMENT_ENABLED, __("Use the link element for referrers and backlinks:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "notice-link" => __("Please find this setting at the end of the reference container settings. The link element is needed to apply the theme’s link color.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-normalize" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT, __("Normalize vertical alignment and font size:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "normalize" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT, $l_arr_NormalizeSuperscript),
- "notice-normalize" => __("Most themes don’t need this fix.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- )
- );
- // display template with replaced placeholders
- echo $l_obj_Template->getContent();
- }
-
- /**
- * Displays all settings for the footnotes mouse-over box.
- *
- * @author Stefan Herndler
- * @since 1.5.2
- *
- * Edited:
- * @since 2.2.0 5 parts to address increased settings number
- * @since 2.2.5 position settings for alternative tooltips
- */
- public function MouseOverBox() {
- // options for Yes/No select box:
- $l_arr_Enabled = array(
- "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
- );
-
- // load template file
- $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "mouse-over-box-display");
- // replace all placeholders
- $l_obj_Template->replace(
- array(
-
- "label-enable" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, __("Display tooltips:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, $l_arr_Enabled),
- "notice-enable" => __("Formatted text boxes allowing hyperlinks, displayed on mouse-over or tap and hold.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-alternative" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, __("Display alternative tooltips:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "alternative" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, $l_arr_Enabled),
- "notice-alternative" => __("Intended to work around a configuration-related tooltip outage.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- // The placeholder is the name of the plugin as logogram “footnotes”.
- "description-alternative" => sprintf(__("These alternative tooltips work around a website related jQuery UI outage. They are low-script but use the AMP incompatible onmouseover and onmouseout arguments, along with CSS transitions for fade-in/out. The very small script is inserted after Footnotes’ internal stylesheet. When this option is enabled, %s does not load jQuery UI nor jQuery Tools.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), '' . MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME . ''),
-
- )
- );
- // display template with replaced placeholders
- echo $l_obj_Template->getContent();
- }
-
- public function MouseOverBoxPosition() {
-
- // options for the Mouse-over box position
- $l_arr_Position = array(
- "top left" => __("top left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "top center" => __("top center", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "top right" => __("top right", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "center right" => __("center right", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "bottom right" => __("bottom right", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "bottom center" => __("bottom center", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "bottom left" => __("bottom left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "center left" => __("center left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- );
- // options for the alternative Mouse-over box position
- $l_arr_AlternativePosition = array(
- "top left" => __("top left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "top right" => __("top right", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "bottom right" => __("bottom right", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "bottom left" => __("bottom left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- );
-
- // load template file
- $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "mouse-over-box-position");
- // replace all placeholders
- $l_obj_Template->replace(
- array(
-
- "label-position" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, __("Position:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "position" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, $l_arr_Position),
- "position-alternative" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION, $l_arr_AlternativePosition),
- "notice-position" => __("The second column of settings boxes is for the alternative tooltips.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-offset-x" => $this->addLabel (MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, __("Horizontal offset:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "offset-x" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, -500, 500),
- "offset-x-alternative" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X, -500, 500),
- "notice-offset-x" => __("pixels; negative value for a leftwards offset; alternative tooltips: direction depends on position", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-offset-y" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, __("Vertical offset:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "offset-y" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, -500, 500),
- "offset-y-alternative" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y, -500, 500),
- "notice-offset-y" => __("pixels; negative value for an upwards offset; alternative tooltips: direction depends on position", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- )
- );
- // display template with replaced placeholders
- echo $l_obj_Template->getContent();
- }
-
- public function MouseOverBoxDimensions() {
-
- // load template file
- $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "mouse-over-box-dimensions");
- // replace all placeholders
- $l_obj_Template->replace(
- array(
-
- "label-max-width" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, __("Maximum width:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "max-width" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, 0, 1280),
- "width" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH, 0, 1280),
- "notice-max-width" => __("pixels; set to 0 for jQuery tooltips without max width; alternative tooltips are given the value in the second box as fixed width.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- )
- );
- // display template with replaced placeholders
- echo $l_obj_Template->getContent();
- }
-
- public function MouseOverBoxTiming() {
-
- // load template file
- $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "mouse-over-box-timing");
- // replace all placeholders
- $l_obj_Template->replace(
- array(
-
- "label-fade-in-delay" => $this->addLabel(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY, __("Fade-in delay:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "fade-in-delay" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY, 0, 20000),
- "notice-fade-in-delay" => __("milliseconds", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-fade-in-duration" => $this->addLabel(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION, __("Fade-in duration:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "fade-in-duration" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION, 0, 20000),
- "notice-fade-in-duration" => __("milliseconds", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-fade-out-delay" => $this->addLabel(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY, __("Fade-out delay:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "fade-out-delay" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY, 0, 20000),
- "notice-fade-out-delay" => __("milliseconds", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-fade-out-duration" => $this->addLabel(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION, __("Fade-out duration:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "fade-out-duration" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION, 0, 20000),
- "notice-fade-out-duration" => __("milliseconds", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- )
- );
- // display template with replaced placeholders
- echo $l_obj_Template->getContent();
- }
-
- public function MouseOverBoxTruncation() {
- // options for Yes/No select box:
- $l_arr_Enabled = array(
- "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
- );
-
- // load template file
- $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "mouse-over-box-truncation");
- // replace all placeholders
- $l_obj_Template->replace(
- array(
-
- "label-truncation" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, __("Truncate the note in the tooltip:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "truncation" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, $l_arr_Enabled),
-
- "label-max-length" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH, __("Maximum number of characters in the tooltip:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "max-length" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH, 3, 10000),
- // The feature trims back until the last full word.
- "notice-max-length" => __("No weird cuts.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-readon" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL, __("‘Read on’ button label:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "readon" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL),
-
- )
- );
- // display template with replaced placeholders
- echo $l_obj_Template->getContent();
- }
-
- public function MouseOverBoxText() {
- // options for Yes/No select box:
- $l_arr_Enabled = array(
- "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
- );
-
- // load template file
- $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "mouse-over-box-text");
- // replace all placeholders
- $l_obj_Template->replace(
- array(
-
- "description-delimiter" => __("Tooltips can display another content than the footnote entry in the reference container. The trigger is a shortcode in the footnote text separating the tooltip text from the note. That is consistent with what WordPress does for excerpts.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-delimiter" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER, __("Delimiter for dedicated tooltip text:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "delimiter" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER),
- "notice-delimiter" => __("If the delimiter shortcode is present, the tooltip text will be the part before it.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-mirror" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE, __("Mirror the tooltip in the reference container:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "mirror" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE, $l_arr_Enabled),
- "notice-mirror" => __("Tooltips may be harder to use on mobiles. This option allows to read it in the reference container.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-separator" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR, __("Separator between tooltip text and footnote text:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "separator" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR),
- "notice-separator" => __("May be a simple space, or a line break <br />, or any string in your language.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "description-mirror" => __("Tooltips, even jQuery-driven, may be hard to consult on mobiles. This option allows to read the tooltip content in the reference container too.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
-
- )
- );
- // display template with replaced placeholders
- echo $l_obj_Template->getContent();
- }
-
- public function MouseOverBoxAppearance() {
- // options for Yes/No select box:
- $l_arr_Enabled = array(
- "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
- );
- // options for the font size unit:
- $l_arr_FontSizeUnits = array(
- "em" => __("em", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "rem" => __("rem", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "px" => __("pixels", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "pt" => __("points", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "pc" => __("picas", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "mm" => __("millimeters", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "%" => __("per cent", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- );
-
- // load template file
- $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "mouse-over-box-appearance");
- // replace all placeholders
- $l_obj_Template->replace(
- array(
-
- "label-font-size" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_MOUSE_OVER_BOX_FONT_SIZE_ENABLED, __("Set font size:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "font-size-enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_MOUSE_OVER_BOX_FONT_SIZE_ENABLED, $l_arr_Enabled),
- "font-size-scalar" => $this->addNumBox(MCI_Footnotes_Settings::C_FLO_MOUSE_OVER_BOX_FONT_SIZE_SCALAR, 0, 50, true),
- "font-size-unit" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_UNIT, $l_arr_FontSizeUnits),
- "notice-font-size" => __("By default, the font size is set to equal the surrounding text.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-color" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR, __("Text color:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "color" => $this->addColorSelection(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR),
- // To use default: Clear or leave empty.
- "notice-color" => sprintf(__("To use the current theme’s default text color: %s", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), __("Clear or leave empty.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
-
- "label-background" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND, __("Background color:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "background" => $this->addColorSelection(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND),
- // To use default: Clear or leave empty.
- "notice-background" => sprintf(__("To use the current theme’s default background color: %s", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), __("Clear or leave empty.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
-
- "label-border-width" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, __("Border width:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "border-width" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, 0, 4, true),
- "notice-border-width" => __("pixels; 0 for borderless", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-border-color" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR, __("Border color:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "border-color" => $this->addColorSelection(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR),
- // To use default: Clear or leave empty.
- "notice-border-color" => sprintf(__("To use the current theme’s default border color: %s", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), __("Clear or leave empty.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
-
- "label-border-radius" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, __("Rounded corner radius:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "border-radius" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, 0, 500),
- "notice-border-radius" => __("pixels; 0 for sharp corners", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-box-shadow-color" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR, __("Box shadow color:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "box-shadow-color" => $this->addColorSelection(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR),
- // To use default: Clear or leave empty.
- "notice-box-shadow-color" => sprintf(__("To use the current theme’s default box shadow color: %s", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), __("Clear or leave empty.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
-
- )
- );
- // display template with replaced placeholders
- echo $l_obj_Template->getContent();
- }
-
- /**
- * Displays all settings for the prepended symbol
- *
- * @author Stefan Herndler
- * @since 1.5.0
- *
- * Edited heading for v2.0.4
- *
- * The former 'hyperlink arrow', incompatible with combined identical footnotes,
- * became 'prepended arrow' in v2.0.3 after a user complaint about missing backlinking semantics
- * of the footnote number.
- *
- * @since 2.1.4 moved to Settings > Reference container > Display a backlink symbol
- * @since 2.2.1 and 2.2.4 back here
- */
- public function HyperlinkArrow() {
- // load template file
- $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-hyperlink-arrow");
- // replace all placeholders
- $l_obj_Template->replace(
- array(
- "label-symbol" => $this->addLabel(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW, __("Select or input the backlink symbol:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "symbol-options" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW, MCI_Footnotes_Convert::getArrow()),
- "symbol-custom" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW_USER_DEFINED),
- "notice-symbol" => __("Your input overrides the selection.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "description-symbol" => __("This symbol is used in the reference container. But this setting pre-existed under this tab and cannot be moved to another one.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- )
- );
- // display template with replaced placeholders
- echo $l_obj_Template->getContent();
- }
-
- /**
- * Displays the custom css box.
- *
- * @author Stefan Herndler
- * @since 1.5.0
- *
- * Edited:
- * @since 2.1.6 drop localized notices for CSS classes as the number increased to 16
- * list directly in the template, as CSS is in English anyway
- * @see templates/dashboard/customize-css.html
- * 2020-12-09T1113+0100
- *
- * @since 2.2.2 migrate Custom CSS to a dedicated tab 2020-12-15T0506+0100
- * @since 2.3.0 say 'copy-paste' instead of 'cut and paste' since cutting is not needed 2020-12-27T1257+0100
- * @since 2.5.1 mention validity while visible, thanks to @rkupadhya bug report
- */
- public function CustomCSS() {
- // load template file
- $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-css");
- // replace all placeholders
- $l_obj_Template->replace(
- array(
- "label-css" => $this->addLabel(MCI_Footnotes_Settings::C_STR_CUSTOM_CSS, __("Your existing Custom CSS code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "css" => $this->addTextArea(MCI_Footnotes_Settings::C_STR_CUSTOM_CSS),
- "description-css" => __('Custom CSS migrates to a dedicated tab. This text area is intended to keep your data safe, and the code remains valid while visible. Please copy-paste the content into the new text area under the new tab.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- // CSS classes are listed in the template.
- // Localized notices are dropped to ease translators’ task.
-
- // "label-class-1" => ".footnote_plugin_tooltip_text",
- // "class-1" => $this->addText(__("superscript, Footnotes index", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
-
- // "label-class-2" => ".footnote_tooltip",
- // "class-2" => $this->addText(__("mouse-over box, tooltip for each superscript", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
-
- // "label-class-3" => ".footnote_plugin_index",
- // "class-3" => $this->addText(__("1st column of the Reference Container, Footnotes index", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
-
- // "label-class-4" => ".footnote_plugin_text",
- // "class-4" => $this->addText(__("2nd column of the Reference Container, Footnote text", MCI_Footnotes_Config::C_STR_PLUGIN_NAME))
- )
- );
- // display template with replaced placeholders
- echo $l_obj_Template->getContent();
- }
-
- public function CustomCSSMigration() {
-
- // options for Yes/No select box:
- $l_arr_Enabled = array(
- "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
- );
-
- // load template file
- $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-css-migration");
- // replace all placeholders
- $l_obj_Template->replace(
- array(
- "label-css" => $this->addLabel(MCI_Footnotes_Settings::C_STR_CUSTOM_CSS, __("Your existing Custom CSS code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
- "css" => $this->addTextArea(MCI_Footnotes_Settings::C_STR_CUSTOM_CSS),
- "description-css" => __('Custom CSS migrates to a dedicated tab. This text area is intended to keep your data safe, and the code remains valid while visible. Please copy-paste the content into the new text area below. Set Show legacy to No. Save twice.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-show-legacy" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_CUSTOM_CSS_LEGACY_ENABLE, "Show legacy Custom CSS settings containers:"),
- "show-legacy" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_CUSTOM_CSS_LEGACY_ENABLE, $l_arr_Enabled),
- "notice-show-legacy" => __("Please set to No when you are done migrating, for the legacy Custom CSS containers to disappear.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- // The placeholder is the “Referrers and tooltips” settings tab name.
- "description-show-legacy" => sprintf(__('The legacy Custom CSS under the %s tab and its mirror here are emptied, and the select box saved as No, when the settings tab is saved while the settings container is not displayed.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), __("Referrers and tooltips", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
-
- )
- );
- // display template with replaced placeholders
- echo $l_obj_Template->getContent();
- }
-
- public function CustomCSSNew() {
- // load template file
- $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-css-new");
- // replace all placeholders
- $l_obj_Template->replace(
- array(
- "css" => $this->addTextArea(MCI_Footnotes_Settings::C_STR_CUSTOM_CSS_NEW),
-
- "headline" => $this->addText(__("Recommended CSS classes:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
-
- )
- );
- // display template with replaced placeholders
- echo $l_obj_Template->getContent();
- }
-
- /**
- * Displays available Hooks to look for Footnote short codes.
- *
- * @author Stefan Herndler
- * @since 1.5.5
- *
- * Edited:
- * @since 2.1.1 priority level setting for the_content 2020-11-16T2152+0100
- * @since 2.1.4 priority level settings for the other hooks 2020-11-19T1421+0100
- *
- * priority level was initially hard-coded default
- * shows "9223372036854775807" in the numbox
- * empty should be interpreted as PHP_INT_MAX,
- * but a numbox cannot be set to empty:
- * define -1 as PHP_INT_MAX instead
- *
- * @since 2.2.9 removed the warning about the widget text hook 2020-12-25T0348+0100
- * @since 2.2.9 added guidance for the widget text hook 2020-12-25T0353+0100
- */
- public function LookupHooks() {
- // load template file
- $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "expert-lookup");
-
- // replace all placeholders
- $l_obj_Template->replace(
- array(
-
- "description-1" => __('The priority level determines whether Footnotes is executed timely before other plugins, and how the reference container is positioned relative to other features.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "description-2" => sprintf(__('For the_content, this figure must be lower than %1$d so that certain strings added by a plugin running at %1$d may not be mistaken as a footnote. This makes also sure that the reference container displays above a feature inserted by a plugin running at %2$d.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 99, 1200),
- "description-3" => sprintf(__('%1$d is lowest priority, %2$d is highest. To set priority level to lowest, set it to %3$d, interpreted as %1$d, the constant %4$s.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), PHP_INT_MAX, 0, -1, 'PHP_INT_MAX'),
- "description-4" => __('The widget_text hook must be enabled either when footnotes are present in theme text widgets, or when Elementor accordions or toggles shall have a reference container per section. If they should not, this hook must be disabled.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "head-hook" => __("WordPress hook function name", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "head-checkbox" => __("Activate", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "head-numbox" => __("Priority level", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "head-url" => __("WordPress documentation", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
-
- "label-the-title" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_TITLE, "the_title"),
- "the-title" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_TITLE),
- "priority-the-title" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL, -1, PHP_INT_MAX),
- "url-the-title" => "https://developer.wordpress.org/reference/hooks/the_title/",
-
- "label-the-content" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_CONTENT, "the_content"),
- "the-content" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_CONTENT),
- "priority-the-content" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL, -1, PHP_INT_MAX),
- "url-the-content" => "https://developer.wordpress.org/reference/hooks/the_content/",
-
- "label-the-excerpt" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT, "the_excerpt"),
- "the-excerpt" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT),
- "priority-the-excerpt" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL, -1, PHP_INT_MAX),
- "url-the-excerpt" => "https://developer.wordpress.org/reference/functions/the_excerpt/",
-
- "label-widget-title" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE, "widget_title"),
- "widget-title" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE),
- "priority-widget-title" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL, -1, PHP_INT_MAX),
- "url-widget-title" => "https://codex.wordpress.org/Plugin_API/Filter_Reference/widget_title",
-
- "label-widget-text" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT, "widget_text"),
- "widget-text" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT),
- "priority-widget-text" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL, -1, PHP_INT_MAX),
- "url-widget-text" => "https://codex.wordpress.org/Plugin_API/Filter_Reference/widget_text",
- )
- );
- // display template with replaced placeholders
- echo $l_obj_Template->getContent();
- }
-
- /**
- * Displays a short introduction of the Plugin.
- *
- * @author Stefan Herndler
- * @since 1.5.0
- */
- public function Help() {
- global $g_obj_MCI_Footnotes;
- // load footnotes starting and end tag
- $l_arr_Footnote_StartingTag = $this->LoadSetting(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START);
- $l_arr_Footnote_EndingTag = $this->LoadSetting(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END);
-
- if ($l_arr_Footnote_StartingTag["value"] == "userdefined" || $l_arr_Footnote_EndingTag["value"] == "userdefined") {
- // load user defined starting and end tag
- $l_arr_Footnote_StartingTag = $this->LoadSetting(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED);
- $l_arr_Footnote_EndingTag = $this->LoadSetting(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED);
- }
- $l_str_Example = "Hello" . $l_arr_Footnote_StartingTag["value"] .
- "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,".
- " sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.".
- " Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet,".
- " consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.".
- " At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."
- . $l_arr_Footnote_EndingTag["value"] . " World!";
-
- // load template file
- $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "how-to-help");
- // replace all placeholders
- $l_obj_Template->replace(
- array(
- "label-start" => __("Start your footnote with the following short code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "start" => $l_arr_Footnote_StartingTag["value"],
-
- "label-end" => __("…and end your footnote with this short code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "end" => $l_arr_Footnote_EndingTag["value"],
-
- "example-code" => $l_str_Example,
- "example-string" => " " . __("will be displayed as:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
- "example" => $g_obj_MCI_Footnotes->a_obj_Task->exec($l_str_Example, true),
-
- "information" => sprintf(__("For further information please check out our %ssupport forum%s on WordPress.org.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), '', '')
- )
- );
- // call wp_head function to get the Styling of the mouse-over box
- $g_obj_MCI_Footnotes->a_obj_Task->wp_head();
- // display template with replaced placeholders
- echo $l_obj_Template->getContent();
- }
-
- /**
- * Displays all Donate button to support the developers.
- *
- * @author Stefan Herndler
- * @since 1.5.0
- */
- public function Donate() {
- // load template file
- $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "how-to-donate");
- // replace all placeholders
- $l_obj_Template->replace(
- array(
- "caption" => __('Donate now',MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
- )
- );
- // display template with replaced placeholders
- echo $l_obj_Template->getContent();
- }
-}
+addSection("settings", __("General settings", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 0, true);
+
+ // sync tab name with mirror in public function CustomCSSMigration():
+ $l_arr_Tabs[] = $this->addSection("customize", __("Referrers and tooltips", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 1, true);
+
+ $l_arr_Tabs[] = $this->addSection("expert", __("Scope and priority", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 2, true);
+ $l_arr_Tabs[] = $this->addSection("customcss", __("Custom CSS", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 3, true);
+ $l_arr_Tabs[] = $this->addSection("how-to", __("Quick start guide", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), null, false);
+
+ return $l_arr_Tabs;
+ }
+
+ /**
+ * Returns an array of all registered meta boxes for each section of the sub page.
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ * @return array
+ *
+ * Edited for 2.0.0 and later.
+ *
+ * HyperlinkArrow meta box:
+ * @since 2.0.0 discontinued
+ * @since 2.0.4 restored to meet user demand for arrow symbol semantics
+ * @since 2.1.4 discontinued, content moved to Settings > Reference container > Display a backlink symbol
+ *
+ * @since 2.0.4 to reflect changes in meta box label display since WPv5.5
+ * spans need position:fixed and become unlocalizable
+ * fix: logo is kept only in the label that doesn’t need to be translated:
+ * Change string "%s styling" to "Footnotes styling" to fix layout in WPv5.5
+ * @see details in class/config.php
+ *
+ * @since 2.1.6 / 2.2.0 tabs reordered and renamed
+ */
+ protected function getMetaBoxes() {
+ $l_arr_MetaBoxes = array();
+
+ // sync box name with mirror in task.php:
+ $l_arr_MetaBoxes[] = $this->addMetaBox("settings", "start-end", __("Footnote start and end short codes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "StartEnd");
+ $l_arr_MetaBoxes[] = $this->addMetaBox("settings", "numbering", __("Footnotes numbering", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Numbering");
+ $l_arr_MetaBoxes[] = $this->addMetaBox("settings", "scrolling", __("Scrolling behavior", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Scrolling");
+ $l_arr_MetaBoxes[] = $this->addMetaBox("settings", "reference-container", __("Reference container", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "ReferenceContainer");
+ $l_arr_MetaBoxes[] = $this->addMetaBox("settings", "excerpts", __("Footnotes in excerpts", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Excerpts");
+ $l_arr_MetaBoxes[] = $this->addMetaBox("settings", "love", MCI_Footnotes_Config::C_STR_PLUGIN_HEADING_NAME . ' ' . MCI_Footnotes_Config::C_STR_LOVE_SYMBOL_HEADING, "Love");
+
+ $l_arr_MetaBoxes[] = $this->addMetaBox("customize", "hyperlink-arrow", __("Backlink symbol", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "HyperlinkArrow");
+ $l_arr_MetaBoxes[] = $this->addMetaBox("customize", "superscript", __("Referrer typesetting and formatting", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Superscript");
+ $l_arr_MetaBoxes[] = $this->addMetaBox("customize", "mouse-over-box", __("Tooltips", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "MouseOverBox");
+ $l_arr_MetaBoxes[] = $this->addMetaBox("customize", "mouse-over-box-position", __("Tooltip position", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "MouseOverBoxPosition");
+ $l_arr_MetaBoxes[] = $this->addMetaBox("customize", "mouse-over-box-dimensions", __("Tooltip dimensions", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "MouseOverBoxDimensions");
+ $l_arr_MetaBoxes[] = $this->addMetaBox("customize", "mouse-over-box-timing", __("Tooltip timing", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "MouseOverBoxTiming");
+ $l_arr_MetaBoxes[] = $this->addMetaBox("customize", "mouse-over-box-truncation", __("Tooltip truncation", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "MouseOverBoxTruncation");
+ $l_arr_MetaBoxes[] = $this->addMetaBox("customize", "mouse-over-box-text", __("Tooltip text", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "MouseOverBoxText");
+ $l_arr_MetaBoxes[] = $this->addMetaBox("customize", "mouse-over-box-appearance", __("Tooltip appearance", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "MouseOverBoxAppearance");
+ if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_CUSTOM_CSS_LEGACY_ENABLE))) {
+ $l_arr_MetaBoxes[] = $this->addMetaBox("customize", "custom-css", __("Your existing Custom CSS code", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "CustomCSS");
+ }
+
+ $l_arr_MetaBoxes[] = $this->addMetaBox("expert", "lookup", __("WordPress hooks with priority level", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "LookupHooks");
+
+ if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_CUSTOM_CSS_LEGACY_ENABLE))) {
+ $l_arr_MetaBoxes[] = $this->addMetaBox("customcss", "custom-css-migration", __("Your existing Custom CSS code", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "CustomCSSMigration");
+ }
+ $l_arr_MetaBoxes[] = $this->addMetaBox("customcss", "custom-css-new", __("Custom CSS", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "CustomCSSNew");
+
+ $l_arr_MetaBoxes[] = $this->addMetaBox("how-to", "help", __("Brief introduction in how to use the plugin", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Help");
+ $l_arr_MetaBoxes[] = $this->addMetaBox("how-to", "donate", __("Help us to improve our Plugin", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Donate");
+
+ return $l_arr_MetaBoxes;
+ }
+
+ /**
+ * Displays all settings for the reference container.
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ *
+ * Completed:
+ * @since 2.1.4: layout and typography options 2020-11-30T0548+0100
+ * @since 2.2.5 options for label element and label bottom border, thanks to @markhillyer 2020-12-18T1447+0100
+ * @link https://wordpress.org/support/topic/how-do-i-eliminate-the-horizontal-line-beneath-the-reference-container-heading/
+ */
+ public function ReferenceContainer() {
+
+ // options for the label element:
+ $l_arr_LabelElement = array(
+ "p" => __("paragraph", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "h2" => __("heading 2", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "h3" => __("heading 3", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "h4" => __("heading 4", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "h5" => __("heading 5", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "h6" => __("heading 6", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ );
+ // options for the positioning of the reference container
+ $l_arr_Positions = array(
+ "post_end" => __("at the end of the post", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "widget" => __("in the widget area", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "footer" => __("in the footer", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ );
+ // basic responsive page layout options:
+ $l_arr_PageLayoutOptions = array(
+ "none" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "reference-container" => __("to the reference container exclusively", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "entry-content" => __("to the div element starting below the post title", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "main-content" => __("to the main element including the post title", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ );
+ // options for the separating punctuation between backlinks:
+ $l_arr_Separators = array(
+ // Unicode character names are conventionally uppercase.
+ "comma" => __("COMMA", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "semicolon" => __("SEMICOLON", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "en_dash" => __("EN DASH", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
+ );
+ // options for the terminating punctuation after backlinks:
+ // The Unicode name of RIGHT PARENTHESIS was originally more accurate because
+ // this character is bidi-mirrored. Let’s use the Unicode 1.0 name.
+ // The wrong names were enforced in spite of Unicode, that subsequently scrambled to correct.
+ $l_arr_Terminators = array(
+ "period" => __("FULL STOP", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ // Unicode 1.0 name of RIGHT PARENTHESIS (represented as a left parenthesis in right-to-left scripts):
+ "parenthesis" => __("CLOSING PARENTHESIS", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "colon" => __("COLON", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
+ );
+ // options for the first column width (per cent is a ratio, not a unit):
+ $l_arr_WidthUnits = array(
+ "%" => __("per cent", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "px" => __("pixels", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "rem" => __("root em", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "em" => __("em", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "vw" => __("viewport width", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ );
+ // options for reference container script mode:
+ $l_arr_ScriptMode = array(
+ "jquery" => __("jQuery", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "js" => __("plain JavaScript", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
+ );
+ // options for Yes/No select box:
+ $l_arr_Enabled = array(
+ "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
+ );
+
+ // load template file
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-reference-container");
+ // replace all placeholders
+ $l_obj_Template->replace(
+ array(
+ "label-name" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME, __("Heading:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "name" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME),
+
+ "label-element" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT, __("Heading’s HTML element:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "element" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT, $l_arr_LabelElement),
+
+ "label-border" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER, __("Border under the heading:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "border" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER, $l_arr_Enabled),
+
+ "label-collapse" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE, __("Collapse by default:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "collapse" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE, $l_arr_Enabled),
+
+ "label-script" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE, __("Script mode:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "script" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE, $l_arr_ScriptMode),
+ "notice-script" => __("The plain JavaScript mode does not support scroll animation and will enable hard links with scroll offset.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-position" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION, __("Default position:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "position" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION, $l_arr_Positions),
+ "notice-position" => sprintf(__("To use the position shortcode, please set the position to: %s", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), '' . __("at the end of the post", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . ''),
+
+ "label-shortcode" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE, __("Position shortcode:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "shortcode" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE),
+ "notice-shortcode" => __("If present in the content, any shortcode in this text box will be replaced with the reference container.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-startpage" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_START_PAGE_ENABLE, __("Display on start page too:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "startpage" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_START_PAGE_ENABLE, $l_arr_Enabled),
+
+ "label-margin-top" => $this->addLabel(MCI_Footnotes_Settings::C_INT_REFERENCE_CONTAINER_TOP_MARGIN, __("Top margin:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "margin-top" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_REFERENCE_CONTAINER_TOP_MARGIN, -500, 500),
+ "notice-margin-top" => __("pixels; may be negative", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-margin-bottom" => $this->addLabel(MCI_Footnotes_Settings::C_INT_REFERENCE_CONTAINER_BOTTOM_MARGIN, __("Bottom margin:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "margin-bottom" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_REFERENCE_CONTAINER_BOTTOM_MARGIN, -500, 500),
+ "notice-margin-bottom" => __("pixels; may be negative", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-page-layout" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT, __("Apply basic responsive page layout:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "page-layout" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT, $l_arr_PageLayoutOptions),
+ "notice-page-layout" => __("Most themes don’t need this fix.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-url-wrap" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTE_URL_WRAP_ENABLED, __("Allow URLs to line-wrap anywhere:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "url-wrap" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTE_URL_WRAP_ENABLED, $l_arr_Enabled),
+ "notice-url-wrap" => __("Unicode-conformant browsers don’t need this fix.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-symbol" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, __("Display a backlink symbol:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "symbol-enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE, $l_arr_Enabled),
+ "notice-symbol" => __("Please choose or input the symbol at the top of the next dashboard tab.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-switch" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH, __("Symbol appended, not prepended:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "switch" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH, $l_arr_Enabled),
+
+ "label-3column" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, __("Backlink symbol in an extra column:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "3column" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE, $l_arr_Enabled),
+ "notice-3column" => __("This legacy layout is available if identical footnotes are not combined.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-row-borders" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_ROW_BORDERS_ENABLE, __("Borders around the table rows:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "row-borders" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_ROW_BORDERS_ENABLE, $l_arr_Enabled),
+
+ "label-separator" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_SEPARATOR_ENABLED, __("Add a separator when enumerating backlinks:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "separator-enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_SEPARATOR_ENABLED, $l_arr_Enabled),
+ "separator-options" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_OPTION, $l_arr_Separators),
+ "separator-custom" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_CUSTOM),
+ "notice-separator" => __("Your input overrides the selection.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-terminator" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_TERMINATOR_ENABLED, __("Add a terminal punctuation to backlinks:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "terminator-enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_TERMINATOR_ENABLED, $l_arr_Enabled),
+ "terminator-options" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_OPTION, $l_arr_Terminators),
+ "terminator-custom" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_CUSTOM),
+ "notice-terminator" => __("Your input overrides the selection.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-width" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_COLUMN_WIDTH_ENABLED, __("Set backlinks column width:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "width-enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_COLUMN_WIDTH_ENABLED, $l_arr_Enabled),
+ "width-scalar" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_BACKLINKS_COLUMN_WIDTH_SCALAR, 0, 500, true),
+ "width-unit" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_WIDTH_UNIT, $l_arr_WidthUnits),
+ "notice-width" => __("Absolute width in pixels doesn’t need to be accurate to the tenth, but relative width in rem or em may.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-max-width" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED, __("Set backlinks column maximum width:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "max-width-enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED, $l_arr_Enabled),
+ "max-width-scalar" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_BACKLINKS_COLUMN_MAX_WIDTH_SCALAR, 0, 500, true),
+ "max-width-unit" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_UNIT, $l_arr_WidthUnits),
+ "notice-max-width" => __("Absolute width in pixels doesn’t need to be accurate to the tenth, but relative width in rem or em may.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-line-break" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_LINE_BREAKS_ENABLED, __("Stack backlinks when enumerating:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "line-break" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_LINE_BREAKS_ENABLED, $l_arr_Enabled),
+ "notice-line-break" => __("This option adds a line break before each added backlink when identical footnotes are combined.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-link" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_LINK_ELEMENT_ENABLED, __("Use the link element for referrers and backlinks:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "link" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_LINK_ELEMENT_ENABLED, $l_arr_Enabled),
+ "notice-link" => __("The link element is needed to apply the theme’s link color.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "description-link" => __("If the link element is not desired for styling, a simple span is used instead when the above is set to No. The link addresses have been removed. Else footnote clicks are logged in the browsing history and make the back button unusable.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ )
+ );
+ // display template with replaced placeholders
+ echo $l_obj_Template->getContent();
+ }
+
+ /**
+ * Displays all options for the footnotes start and end tag short codes
+ * Displays all options for the footnotes numbering
+ * Displays all options for the scrolling behavior
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ *
+ * Edited heading 2020-12-12T1412+0100
+ * @since 2.2.0 start/end short codes: more predefined options 2020-12-12T1412+0100
+ * @link https://wordpress.org/support/topic/doesnt-work-with-mailpoet/
+ * @since 2.2.0 3 boxes for clarity 2020-12-12T1422+0100
+ * @since 2.2.5 support for Ibid. notation thanks to @meglio 2020-12-17T2019+0100
+ * @link https://wordpress.org/support/topic/add-support-for-ibid-notation/
+ * @since 2.4.0 added warning about Block Editor escapement disruption 2021-01-02T2324+0100
+ * @since 2.4.0 removed the HTML comment tag option 2021-01-02T2325+0100
+ * @since 2.5.0 Shortcode syntax validation: add more information around the setting, thanks to @andreasra
+ * @link https://wordpress.org/support/topic/warning-unbalanced-footnote-start-tag-short-code-before/
+ */
+ public function StartEnd() {
+ // footnotes start tag short code options:
+ $l_arr_ShortCodeStart = array(
+ "((" => "((",
+ "(((" => "(((",
+ "{{" => "{{",
+ "{{{" => "{{{",
+ "[n]" => "[n]",
+ "[fn]" => "[fn]",
+ htmlspecialchars("") => htmlspecialchars(""),
+ "[ref]" => "[ref]",
+ htmlspecialchars("") => htmlspecialchars(""),
+ // Custom (user-defined) start and end tags bracketing the footnote text inline:
+ "userdefined" => __('custom short code', MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
+ );
+ // footnotes end tag short code options:
+ $l_arr_ShortCodeEnd = array(
+ "))" => "))",
+ ")))" => ")))",
+ "}}" => "}}",
+ "}}}" => "}}}",
+ "[/n]" => "[/n]",
+ "[/fn]" => "[/fn]",
+ htmlspecialchars("") => htmlspecialchars(""),
+ "[/ref]" => "[/ref]",
+ htmlspecialchars("") => htmlspecialchars(""),
+ // Custom (user-defined) start and end tags bracketing the footnote text inline:
+ "userdefined" => __("custom short code", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
+ );
+ // options for the syntax validation:
+ $l_arr_Enable = array(
+ "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
+ );
+
+ // load template file
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-start-end");
+ // replace all placeholders
+ $l_obj_Template->replace(
+ array(
+
+ "description-escapement" => __("WARNING: Short codes with closing pointy brackets are disabled in the new WordPress Block Editor that disrupts the traditional balanced escapement applied by WordPress Classic Editor.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-short-code-start" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, __("Footnote start tag short code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "short-code-start" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, $l_arr_ShortCodeStart),
+ "short-code-start-user" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED),
+
+ "label-short-code-end" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END, __("Footnote end tag short code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "short-code-end" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END, $l_arr_ShortCodeEnd),
+ "short-code-end-user" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED),
+
+ // for script showing/hiding user defined text boxes:
+ "short-code-start-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START,
+ "short-code-end-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END,
+ "short-code-start-user-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED,
+ "short-code-end-user-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED,
+
+ "description-parentheses" => __("WARNING: Although widespread industry standard, the double parentheses are problematic because they may occur in scripts embedded in the content and be mistaken as a short code.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ // option to enable syntax validation, label mirrored in task.php:
+ "label-syntax" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE, __("Check for balanced shortcodes:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "syntax" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE, $l_arr_Enable),
+ "notice-syntax" => __("In the presence of a lone start tag shortcode, a warning displays below the post title.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "description-syntax" => __("If the start tag short code is ‘((’ or ‘(((’, it will not be reported as unbalanced if the following string contains braces hinting that it is a script.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ )
+ );
+ // display template with replaced placeholders
+ echo $l_obj_Template->getContent();
+ }
+
+ public function Numbering() {
+ // define some space for the output
+ $l_str_Space = " ";
+ // options for the combination of identical footnotes
+ $l_arr_Enable = array(
+ "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
+ );
+ // options for the numbering style of the footnotes:
+ $l_arr_CounterStyle = array(
+ "arabic_plain" => __("plain Arabic numbers", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "1, 2, 3, 4, 5, …",
+ "arabic_leading" => __("zero-padded Arabic numbers", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "01, 02, 03, 04, 05, …",
+ "latin_low" => __("lowercase Latin letters", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "a, b, c, d, e, …",
+ "latin_high" => __("uppercase Latin letters", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "A, B, C, D, E, …",
+ "romanic" => __("uppercase Roman numerals", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "I, II, III, IV, V, …",
+ "roman_low" => __("lowercase Roman numerals", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "i, ii, iii, iv, v, …",
+ );
+
+ // load template file
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-numbering");
+ // replace all placeholders
+ $l_obj_Template->replace(
+ array(
+ "label-counter-style" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE, __("Numbering style:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "counter-style" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE, $l_arr_CounterStyle),
+
+ // algorithmically combine identicals:
+ "label-identical" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES, __("Combine identical footnotes:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "identical" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES, $l_arr_Enable),
+ "notice-identical" => __("This option may require copy-pasting footnotes in multiple instances.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ // Support for Ibid. notation added thanks to @meglio in .
+ "description-identical" => __("Even when footnotes are combined, footnote numbers keep incrementing. This avoids suboptimal referrer and backlink disambiguation using a secondary numbering system. The Ibid. notation and the op. cit. abbreviation followed by the current page number avoid repeating the footnote content. For changing sources, shortened citations may be used. Repeating full citations is also an opportunity to add details.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ )
+ );
+ // display template with replaced placeholders
+ echo $l_obj_Template->getContent();
+ }
+
+ public function Scrolling() {
+
+ // options for enabling hard links for AMP compat:
+ $l_arr_Enable = array(
+ "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
+ );
+
+ // load template file
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-scrolling");
+ // replace all placeholders
+ $l_obj_Template->replace(
+ array(
+
+ "label-scroll-offset" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET, __("Scroll offset:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "scroll-offset" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET, 0, 100),
+ "notice-scroll-offset" => __("per cent from the upper edge of the window", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-scroll-duration" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DURATION, __("Scroll duration:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "scroll-duration" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DURATION, 0, 20000),
+ "notice-scroll-duration" => __("milliseconds; instantly if hard links are enabled and JavaScript is disabled", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ // enable hard links for AMP compat:
+ "label-hard-links" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_HARD_LINKS_ENABLE, __("Enable hard links:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "hard-links" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_HARD_LINKS_ENABLE, $l_arr_Enable),
+ "notice-hard-links" => __("Hard links are indispensable for AMP compatibility and allow to link to footnotes.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-footnote" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTE_FRAGMENT_ID_SLUG, __("Fragment identifier slug for footnotes:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "footnote" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTE_FRAGMENT_ID_SLUG),
+ "notice-footnote" => __("This will show up in the address bar after clicking on a hard-linked footnote referrer.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-referrer" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERRER_FRAGMENT_ID_SLUG, __("Fragment identifier slug for footnote referrers:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "referrer" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_REFERRER_FRAGMENT_ID_SLUG),
+ "notice-referrer" => __("This will show up in the address bar after clicking on a hard-linked backlink.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-separator" => $this->addLabel(MCI_Footnotes_Settings::C_STR_HARD_LINK_IDS_SEPARATOR, __("ID separator:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "separator" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_HARD_LINK_IDS_SEPARATOR),
+ "notice-separator" => __("May be empty or any string, for example _, - or +, to distinguish post number, container number and footnote number.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ // enable backlink tooltips:
+ "label-backlink-tooltips" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE, __("Enable backlink tooltips:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "backlink-tooltips" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE, $l_arr_Enable),
+ "notice-backlink-tooltips" => __("Hard backlinks get ordinary tooltips hinting to use the backbutton instead.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-backlink-tooltip-text" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT, __("Backlink tooltip text:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "backlink-tooltip-text" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT),
+ "notice-backlink-tooltip-text" => __("Default text is the keyboard shortcut, but you may wish to input a descriptive hint in your language.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ )
+ );
+ // display template with replaced placeholders
+ echo $l_obj_Template->getContent();
+ }
+
+ /**
+ * Displays all settings for 'I love Footnotes'.
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ *
+ * Edited:
+ * @since 2.2.0 position-sensitive placeholders to support more locales 2020-12-11T0432+0100
+ * @since 2.2.0 more options 2020-12-11T0432+0100
+ */
+ public function Love() {
+ // options for the acknowledgment display in the footer:
+ $l_arr_Love = array(
+ // logo only:
+ "text-3" => sprintf('%s', MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME),
+ // logo followed by heart symbol:
+ "text-4" => sprintf('%s %s', MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL),
+ // logo preceded by heart symbol:
+ "text-5" => sprintf('%s %s', MCI_Footnotes_Config::C_STR_LOVE_SYMBOL, MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME),
+ // "I love Footnotes": placeholder %1$s is the 'footnotes' logogram, placeholder %2$s is a heart symbol.
+ "text-1" => sprintf(__('I %2$s %1$s', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL),
+ // "This website uses Footnotes."
+ "text-6" => sprintf(__('This website uses %s.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME),
+ // "This website uses the Footnotes plugin."
+ "text-7" => sprintf(__('This website uses the %s plugin.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME),
+ // "This website uses the awesome Footnotes plugin."
+ "text-2" => sprintf(__('This website uses the awesome %s plugin.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME),
+ "random" => __('randomly determined display of either mention', MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ // "No display of any “Footnotes love” mention in the footer"
+ "no" => sprintf(__('no display of any “%1$s %2$s” mention in the footer', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL)
+ );
+
+ // load template file
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-love");
+ // replace all placeholders
+ $l_obj_Template->replace(
+ array(
+ "label-love" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE, sprintf(__("Tell the world you’re using %s:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME)),
+ "love" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE, $l_arr_Love),
+
+ "label-no-love" => $this->addText(sprintf(__("Shortcode to inhibit the display of the %s mention on specific pages:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME)),
+ "no-love" => $this->addText(MCI_Footnotes_Config::C_STR_NO_LOVE_SLUG)
+ )
+ );
+ // display template with replaced placeholders
+ echo $l_obj_Template->getContent();
+ }
+
+ /**
+ * Displays the excerpt setting
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ *
+ * Edited heading 2020-12-12T1453+0100
+ * @since 2.1.1 more settings and notices, thanks to @nikelaos
+ * @link https://wordpress.org/support/topic/doesnt-work-any-more-11/#post-13687068
+ * @link https://wordpress.org/support/topic/jquery-comes-up-in-feed-content/#post-13110879
+ * @since 2.2.0 dedicated to the excerpt setting and its notices 2020-12-12T1454+0100
+ */
+ public function Excerpts() {
+ // options for Yes/No select box:
+ $l_arr_Enabled = array(
+ "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
+ );
+
+ // load template file
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-excerpts");
+ // replace all placeholders
+ $l_obj_Template->replace(
+ array(
+ "label-excerpts" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT, __("Display footnotes in excerpts:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "excerpts" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT, $l_arr_Enabled),
+ "notice-excerpts" => __("The recommended value is No.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ // In some themes, the Advanced Excerpt plugin is indispensable to display footnotes in excerpts.
+ "description-excerpts" => sprintf(__("In some themes, the %s plugin is indispensable to display footnotes in excerpts. Footnotes cannot be disabled in excerpts. A workaround is to avoid footnotes in the first 55 words.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 'Advanced Excerpt'),
+ )
+ );
+ // display template with replaced placeholders
+ echo $l_obj_Template->getContent();
+ }
+
+ /**
+ * Displays all settings for the footnote referrers
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ *
+ * Edited heading 2020-12-12T1513+0100
+ * @since 2.1.1 option for superscript (optionally baseline referrers)
+ * @since 2.2.0 option for link element moved here 2020-12-12T1514+0100
+ */
+ public function Superscript() {
+ // options for Yes/No select box:
+ $l_arr_Enabled = array(
+ "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
+ );
+ // options for superscript normalize scope:
+ $l_arr_NormalizeSuperscript = array(
+ "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "referrers" => __("Footnote referrers", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "all" => __("All superscript elements", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ );
+ // load template file
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-superscript");
+ // replace all placeholders
+ $l_obj_Template->replace(
+ array(
+ "label-superscript" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, __("Display footnote referrers in superscript:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "superscript" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, $l_arr_Enabled),
+
+ "label-before" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE, __("At the start of the footnote referrers:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "before" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE),
+
+ "label-after" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER, __("At the end of the footnote referrers:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "after" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER),
+
+ "label-link" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_LINK_ELEMENT_ENABLED, __("Use the link element for referrers and backlinks:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "notice-link" => __("Please find this setting at the end of the reference container settings. The link element is needed to apply the theme’s link color.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-normalize" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT, __("Normalize vertical alignment and font size:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "normalize" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT, $l_arr_NormalizeSuperscript),
+ "notice-normalize" => __("Most themes don’t need this fix.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ )
+ );
+ // display template with replaced placeholders
+ echo $l_obj_Template->getContent();
+ }
+
+ /**
+ * Displays all settings for the footnotes mouse-over box.
+ *
+ * @author Stefan Herndler
+ * @since 1.5.2
+ *
+ * Edited:
+ * @since 2.2.0 5 parts to address increased settings number
+ * @since 2.2.5 position settings for alternative tooltips
+ */
+ public function MouseOverBox() {
+ // options for Yes/No select box:
+ $l_arr_Enabled = array(
+ "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
+ );
+
+ // load template file
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "mouse-over-box-display");
+ // replace all placeholders
+ $l_obj_Template->replace(
+ array(
+
+ "label-enable" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, __("Display tooltips:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, $l_arr_Enabled),
+ "notice-enable" => __("Formatted text boxes allowing hyperlinks, displayed on mouse-over or tap and hold.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-alternative" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, __("Display alternative tooltips:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "alternative" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, $l_arr_Enabled),
+ "notice-alternative" => __("Intended to work around a configuration-related tooltip outage.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ // The placeholder is the name of the plugin as logogram “footnotes”.
+ "description-alternative" => sprintf(__("These alternative tooltips work around a website related jQuery UI outage. They are low-script but use the AMP incompatible onmouseover and onmouseout arguments, along with CSS transitions for fade-in/out. The very small script is inserted after Footnotes’ internal stylesheet. When this option is enabled, %s does not load jQuery UI nor jQuery Tools.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), '' . MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME . ''),
+
+ )
+ );
+ // display template with replaced placeholders
+ echo $l_obj_Template->getContent();
+ }
+
+ public function MouseOverBoxPosition() {
+
+ // options for the Mouse-over box position
+ $l_arr_Position = array(
+ "top left" => __("top left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "top center" => __("top center", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "top right" => __("top right", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "center right" => __("center right", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "bottom right" => __("bottom right", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "bottom center" => __("bottom center", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "bottom left" => __("bottom left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "center left" => __("center left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ );
+ // options for the alternative Mouse-over box position
+ $l_arr_AlternativePosition = array(
+ "top left" => __("top left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "top right" => __("top right", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "bottom right" => __("bottom right", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "bottom left" => __("bottom left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ );
+
+ // load template file
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "mouse-over-box-position");
+ // replace all placeholders
+ $l_obj_Template->replace(
+ array(
+
+ "label-position" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, __("Position:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "position" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, $l_arr_Position),
+ "position-alternative" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION, $l_arr_AlternativePosition),
+ "notice-position" => __("The second column of settings boxes is for the alternative tooltips.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-offset-x" => $this->addLabel (MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, __("Horizontal offset:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "offset-x" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, -500, 500),
+ "offset-x-alternative" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X, -500, 500),
+ "notice-offset-x" => __("pixels; negative value for a leftwards offset; alternative tooltips: direction depends on position", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-offset-y" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, __("Vertical offset:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "offset-y" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, -500, 500),
+ "offset-y-alternative" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y, -500, 500),
+ "notice-offset-y" => __("pixels; negative value for an upwards offset; alternative tooltips: direction depends on position", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ )
+ );
+ // display template with replaced placeholders
+ echo $l_obj_Template->getContent();
+ }
+
+ public function MouseOverBoxDimensions() {
+
+ // load template file
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "mouse-over-box-dimensions");
+ // replace all placeholders
+ $l_obj_Template->replace(
+ array(
+
+ "label-max-width" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, __("Maximum width:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "max-width" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, 0, 1280),
+ "width" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH, 0, 1280),
+ "notice-max-width" => __("pixels; set to 0 for jQuery tooltips without max width; alternative tooltips are given the value in the second box as fixed width.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ )
+ );
+ // display template with replaced placeholders
+ echo $l_obj_Template->getContent();
+ }
+
+ public function MouseOverBoxTiming() {
+
+ // load template file
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "mouse-over-box-timing");
+ // replace all placeholders
+ $l_obj_Template->replace(
+ array(
+
+ "label-fade-in-delay" => $this->addLabel(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY, __("Fade-in delay:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "fade-in-delay" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY, 0, 20000),
+ "notice-fade-in-delay" => __("milliseconds", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-fade-in-duration" => $this->addLabel(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION, __("Fade-in duration:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "fade-in-duration" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION, 0, 20000),
+ "notice-fade-in-duration" => __("milliseconds", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-fade-out-delay" => $this->addLabel(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY, __("Fade-out delay:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "fade-out-delay" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY, 0, 20000),
+ "notice-fade-out-delay" => __("milliseconds", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-fade-out-duration" => $this->addLabel(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION, __("Fade-out duration:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "fade-out-duration" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION, 0, 20000),
+ "notice-fade-out-duration" => __("milliseconds", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ )
+ );
+ // display template with replaced placeholders
+ echo $l_obj_Template->getContent();
+ }
+
+ public function MouseOverBoxTruncation() {
+ // options for Yes/No select box:
+ $l_arr_Enabled = array(
+ "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
+ );
+
+ // load template file
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "mouse-over-box-truncation");
+ // replace all placeholders
+ $l_obj_Template->replace(
+ array(
+
+ "label-truncation" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, __("Truncate the note in the tooltip:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "truncation" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, $l_arr_Enabled),
+
+ "label-max-length" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH, __("Maximum number of characters in the tooltip:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "max-length" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH, 3, 10000),
+ // The feature trims back until the last full word.
+ "notice-max-length" => __("No weird cuts.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-readon" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL, __("‘Read on’ button label:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "readon" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL),
+
+ )
+ );
+ // display template with replaced placeholders
+ echo $l_obj_Template->getContent();
+ }
+
+ public function MouseOverBoxText() {
+ // options for Yes/No select box:
+ $l_arr_Enabled = array(
+ "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
+ );
+
+ // load template file
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "mouse-over-box-text");
+ // replace all placeholders
+ $l_obj_Template->replace(
+ array(
+
+ "description-delimiter" => __("Tooltips can display another content than the footnote entry in the reference container. The trigger is a shortcode in the footnote text separating the tooltip text from the note. That is consistent with what WordPress does for excerpts.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-delimiter" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER, __("Delimiter for dedicated tooltip text:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "delimiter" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER),
+ "notice-delimiter" => __("If the delimiter shortcode is present, the tooltip text will be the part before it.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-mirror" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE, __("Mirror the tooltip in the reference container:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "mirror" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE, $l_arr_Enabled),
+ "notice-mirror" => __("Tooltips may be harder to use on mobiles. This option allows to read it in the reference container.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-separator" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR, __("Separator between tooltip text and footnote text:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "separator" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR),
+ "notice-separator" => __("May be a simple space, or a line break <br />, or any string in your language.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "description-mirror" => __("Tooltips, even jQuery-driven, may be hard to consult on mobiles. This option allows to read the tooltip content in the reference container too.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+
+ )
+ );
+ // display template with replaced placeholders
+ echo $l_obj_Template->getContent();
+ }
+
+ public function MouseOverBoxAppearance() {
+ // options for Yes/No select box:
+ $l_arr_Enabled = array(
+ "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
+ );
+ // options for the font size unit:
+ $l_arr_FontSizeUnits = array(
+ "em" => __("em", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "rem" => __("rem", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "px" => __("pixels", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "pt" => __("points", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "pc" => __("picas", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "mm" => __("millimeters", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "%" => __("per cent", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ );
+
+ // load template file
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "mouse-over-box-appearance");
+ // replace all placeholders
+ $l_obj_Template->replace(
+ array(
+
+ "label-font-size" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_MOUSE_OVER_BOX_FONT_SIZE_ENABLED, __("Set font size:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "font-size-enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_MOUSE_OVER_BOX_FONT_SIZE_ENABLED, $l_arr_Enabled),
+ "font-size-scalar" => $this->addNumBox(MCI_Footnotes_Settings::C_FLO_MOUSE_OVER_BOX_FONT_SIZE_SCALAR, 0, 50, true),
+ "font-size-unit" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_MOUSE_OVER_BOX_FONT_SIZE_UNIT, $l_arr_FontSizeUnits),
+ "notice-font-size" => __("By default, the font size is set to equal the surrounding text.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-color" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR, __("Text color:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "color" => $this->addColorSelection(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR),
+ // To use default: Clear or leave empty.
+ "notice-color" => sprintf(__("To use the current theme’s default text color: %s", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), __("Clear or leave empty.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+
+ "label-background" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND, __("Background color:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "background" => $this->addColorSelection(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND),
+ // To use default: Clear or leave empty.
+ "notice-background" => sprintf(__("To use the current theme’s default background color: %s", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), __("Clear or leave empty.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+
+ "label-border-width" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, __("Border width:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "border-width" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH, 0, 4, true),
+ "notice-border-width" => __("pixels; 0 for borderless", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-border-color" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR, __("Border color:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "border-color" => $this->addColorSelection(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR),
+ // To use default: Clear or leave empty.
+ "notice-border-color" => sprintf(__("To use the current theme’s default border color: %s", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), __("Clear or leave empty.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+
+ "label-border-radius" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, __("Rounded corner radius:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "border-radius" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS, 0, 500),
+ "notice-border-radius" => __("pixels; 0 for sharp corners", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-box-shadow-color" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR, __("Box shadow color:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "box-shadow-color" => $this->addColorSelection(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR),
+ // To use default: Clear or leave empty.
+ "notice-box-shadow-color" => sprintf(__("To use the current theme’s default box shadow color: %s", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), __("Clear or leave empty.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+
+ )
+ );
+ // display template with replaced placeholders
+ echo $l_obj_Template->getContent();
+ }
+
+ /**
+ * Displays all settings for the prepended symbol
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ *
+ * Edited heading for v2.0.4
+ *
+ * The former 'hyperlink arrow', incompatible with combined identical footnotes,
+ * became 'prepended arrow' in v2.0.3 after a user complaint about missing backlinking semantics
+ * of the footnote number.
+ *
+ * @since 2.1.4 moved to Settings > Reference container > Display a backlink symbol
+ * @since 2.2.1 and 2.2.4 back here
+ */
+ public function HyperlinkArrow() {
+ // load template file
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-hyperlink-arrow");
+ // replace all placeholders
+ $l_obj_Template->replace(
+ array(
+ "label-symbol" => $this->addLabel(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW, __("Select or input the backlink symbol:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "symbol-options" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW, MCI_Footnotes_Convert::getArrow()),
+ "symbol-custom" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW_USER_DEFINED),
+ "notice-symbol" => __("Your input overrides the selection.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "description-symbol" => __("This symbol is used in the reference container. But this setting pre-existed under this tab and cannot be moved to another one.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ )
+ );
+ // display template with replaced placeholders
+ echo $l_obj_Template->getContent();
+ }
+
+ /**
+ * Displays the custom css box.
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ *
+ * Edited:
+ * @since 2.1.6 drop localized notices for CSS classes as the number increased to 16
+ * list directly in the template, as CSS is in English anyway
+ * @see templates/dashboard/customize-css.html
+ * 2020-12-09T1113+0100
+ *
+ * @since 2.2.2 migrate Custom CSS to a dedicated tab 2020-12-15T0506+0100
+ * @since 2.3.0 say 'copy-paste' instead of 'cut and paste' since cutting is not needed 2020-12-27T1257+0100
+ * @since 2.5.1 mention validity while visible, thanks to @rkupadhya bug report
+ */
+ public function CustomCSS() {
+ // load template file
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-css");
+ // replace all placeholders
+ $l_obj_Template->replace(
+ array(
+ "label-css" => $this->addLabel(MCI_Footnotes_Settings::C_STR_CUSTOM_CSS, __("Your existing Custom CSS code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "css" => $this->addTextArea(MCI_Footnotes_Settings::C_STR_CUSTOM_CSS),
+ "description-css" => __('Custom CSS migrates to a dedicated tab. This text area is intended to keep your data safe, and the code remains valid while visible. Please copy-paste the content into the new text area under the new tab.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ // CSS classes are listed in the template.
+ // Localized notices are dropped to ease translators’ task.
+
+ // "label-class-1" => ".footnote_plugin_tooltip_text",
+ // "class-1" => $this->addText(__("superscript, Footnotes index", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+
+ // "label-class-2" => ".footnote_tooltip",
+ // "class-2" => $this->addText(__("mouse-over box, tooltip for each superscript", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+
+ // "label-class-3" => ".footnote_plugin_index",
+ // "class-3" => $this->addText(__("1st column of the Reference Container, Footnotes index", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+
+ // "label-class-4" => ".footnote_plugin_text",
+ // "class-4" => $this->addText(__("2nd column of the Reference Container, Footnote text", MCI_Footnotes_Config::C_STR_PLUGIN_NAME))
+ )
+ );
+ // display template with replaced placeholders
+ echo $l_obj_Template->getContent();
+ }
+
+ public function CustomCSSMigration() {
+
+ // options for Yes/No select box:
+ $l_arr_Enabled = array(
+ "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
+ );
+
+ // load template file
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-css-migration");
+ // replace all placeholders
+ $l_obj_Template->replace(
+ array(
+ "label-css" => $this->addLabel(MCI_Footnotes_Settings::C_STR_CUSTOM_CSS, __("Your existing Custom CSS code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+ "css" => $this->addTextArea(MCI_Footnotes_Settings::C_STR_CUSTOM_CSS),
+ "description-css" => __('Custom CSS migrates to a dedicated tab. This text area is intended to keep your data safe, and the code remains valid while visible. Please copy-paste the content into the new text area below. Set Show legacy to No. Save twice.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-show-legacy" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_CUSTOM_CSS_LEGACY_ENABLE, "Show legacy Custom CSS settings containers:"),
+ "show-legacy" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_CUSTOM_CSS_LEGACY_ENABLE, $l_arr_Enabled),
+ "notice-show-legacy" => __("Please set to No when you are done migrating, for the legacy Custom CSS containers to disappear.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ // The placeholder is the “Referrers and tooltips” settings tab name.
+ "description-show-legacy" => sprintf(__('The legacy Custom CSS under the %s tab and its mirror here are emptied, and the select box saved as No, when the settings tab is saved while the settings container is not displayed.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), __("Referrers and tooltips", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+
+ )
+ );
+ // display template with replaced placeholders
+ echo $l_obj_Template->getContent();
+ }
+
+ public function CustomCSSNew() {
+ // load template file
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-css-new");
+ // replace all placeholders
+ $l_obj_Template->replace(
+ array(
+ "css" => $this->addTextArea(MCI_Footnotes_Settings::C_STR_CUSTOM_CSS_NEW),
+
+ "headline" => $this->addText(__("Recommended CSS classes:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
+
+ )
+ );
+ // display template with replaced placeholders
+ echo $l_obj_Template->getContent();
+ }
+
+ /**
+ * Displays available Hooks to look for Footnote short codes.
+ *
+ * @author Stefan Herndler
+ * @since 1.5.5
+ *
+ * Edited:
+ * @since 2.1.1 priority level setting for the_content 2020-11-16T2152+0100
+ * @since 2.1.4 priority level settings for the other hooks 2020-11-19T1421+0100
+ *
+ * priority level was initially hard-coded default
+ * shows "9223372036854775807" in the numbox
+ * empty should be interpreted as PHP_INT_MAX,
+ * but a numbox cannot be set to empty:
+ * define -1 as PHP_INT_MAX instead
+ *
+ * @since 2.2.9 removed the warning about the widget text hook 2020-12-25T0348+0100
+ * @since 2.2.9 added guidance for the widget text hook 2020-12-25T0353+0100
+ */
+ public function LookupHooks() {
+ // load template file
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "expert-lookup");
+
+ // replace all placeholders
+ $l_obj_Template->replace(
+ array(
+
+ "description-1" => __('The priority level determines whether Footnotes is executed timely before other plugins, and how the reference container is positioned relative to other features.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "description-2" => sprintf(__('For the_content, this figure must be lower than %1$d so that certain strings added by a plugin running at %1$d may not be mistaken as a footnote. This makes also sure that the reference container displays above a feature inserted by a plugin running at %2$d.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 99, 1200),
+ "description-3" => sprintf(__('%1$d is lowest priority, %2$d is highest. To set priority level to lowest, set it to %3$d, interpreted as %1$d, the constant %4$s.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), PHP_INT_MAX, 0, -1, 'PHP_INT_MAX'),
+ "description-4" => __('The widget_text hook must be enabled either when footnotes are present in theme text widgets, or when Elementor accordions or toggles shall have a reference container per section. If they should not, this hook must be disabled.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "head-hook" => __("WordPress hook function name", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "head-checkbox" => __("Activate", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "head-numbox" => __("Priority level", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "head-url" => __("WordPress documentation", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+
+ "label-the-title" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_TITLE, "the_title"),
+ "the-title" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_TITLE),
+ "priority-the-title" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL, -1, PHP_INT_MAX),
+ "url-the-title" => "https://developer.wordpress.org/reference/hooks/the_title/",
+
+ "label-the-content" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_CONTENT, "the_content"),
+ "the-content" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_CONTENT),
+ "priority-the-content" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL, -1, PHP_INT_MAX),
+ "url-the-content" => "https://developer.wordpress.org/reference/hooks/the_content/",
+
+ "label-the-excerpt" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT, "the_excerpt"),
+ "the-excerpt" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT),
+ "priority-the-excerpt" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL, -1, PHP_INT_MAX),
+ "url-the-excerpt" => "https://developer.wordpress.org/reference/functions/the_excerpt/",
+
+ "label-widget-title" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE, "widget_title"),
+ "widget-title" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE),
+ "priority-widget-title" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL, -1, PHP_INT_MAX),
+ "url-widget-title" => "https://codex.wordpress.org/Plugin_API/Filter_Reference/widget_title",
+
+ "label-widget-text" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT, "widget_text"),
+ "widget-text" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT),
+ "priority-widget-text" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL, -1, PHP_INT_MAX),
+ "url-widget-text" => "https://codex.wordpress.org/Plugin_API/Filter_Reference/widget_text",
+ )
+ );
+ // display template with replaced placeholders
+ echo $l_obj_Template->getContent();
+ }
+
+ /**
+ * Displays a short introduction of the Plugin.
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ */
+ public function Help() {
+ global $g_obj_MCI_Footnotes;
+ // load footnotes starting and end tag
+ $l_arr_Footnote_StartingTag = $this->LoadSetting(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START);
+ $l_arr_Footnote_EndingTag = $this->LoadSetting(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END);
+
+ if ($l_arr_Footnote_StartingTag["value"] == "userdefined" || $l_arr_Footnote_EndingTag["value"] == "userdefined") {
+ // load user defined starting and end tag
+ $l_arr_Footnote_StartingTag = $this->LoadSetting(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED);
+ $l_arr_Footnote_EndingTag = $this->LoadSetting(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED);
+ }
+ $l_str_Example = "Hello" . $l_arr_Footnote_StartingTag["value"] .
+ "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,".
+ " sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.".
+ " Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet,".
+ " consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.".
+ " At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."
+ . $l_arr_Footnote_EndingTag["value"] . " World!";
+
+ // load template file
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "how-to-help");
+ // replace all placeholders
+ $l_obj_Template->replace(
+ array(
+ "label-start" => __("Start your footnote with the following short code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "start" => $l_arr_Footnote_StartingTag["value"],
+
+ "label-end" => __("…and end your footnote with this short code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "end" => $l_arr_Footnote_EndingTag["value"],
+
+ "example-code" => $l_str_Example,
+ "example-string" => " " . __("will be displayed as:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
+ "example" => $g_obj_MCI_Footnotes->a_obj_Task->exec($l_str_Example, true),
+
+ "information" => sprintf(__("For further information please check out our %ssupport forum%s on WordPress.org.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), '', '')
+ )
+ );
+ // call wp_head function to get the Styling of the mouse-over box
+ $g_obj_MCI_Footnotes->a_obj_Task->wp_head();
+ // display template with replaced placeholders
+ echo $l_obj_Template->getContent();
+ }
+
+ /**
+ * Displays all Donate button to support the developers.
+ *
+ * @author Stefan Herndler
+ * @since 1.5.0
+ */
+ public function Donate() {
+ // load template file
+ $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "how-to-donate");
+ // replace all placeholders
+ $l_obj_Template->replace(
+ array(
+ "caption" => __('Donate now',MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
+ )
+ );
+ // display template with replaced placeholders
+ echo $l_obj_Template->getContent();
+ }
+}
diff --git a/class/hooks.php b/class/hooks.php
index f5c90d1..e86d106 100644
--- a/class/hooks.php
+++ b/class/hooks.php
@@ -1,18 +1,19 @@
-ClearAll();
}
/**
* Add Links to the Plugin in the "installed Plugins" page.
*
+ * @author Stefan Herndler
* @since 1.5.0
- * @param array $p_arr_links Current Links.
- * @param string $p_str_plugin_file_name Plugins init file name.
+ * @param array $p_arr_Links Current Links.
+ * @param string $p_str_PluginFileName Plugins init file name.
* @return array
*/
- public static function plugin_links( $p_arr_links, $p_str_plugin_file_name ) {
- // Append link to the WordPress Plugin page.
- $p_arr_links[] = sprintf( '%s', __( 'Support', 'footnotes' ) );
- // Append link to the settings page.
- $p_arr_links[] = sprintf( '%s', admin_url( 'admin.php?page=mfmmf-footnotes' ), __( 'Settings', 'footnotes' ) );
- // Append link to the PayPal donate function.
- $p_arr_links[] = sprintf( '%s', __( 'Donate', 'footnotes' ) );
- // Return new links.
- return $p_arr_links;
+ public static function PluginLinks($p_arr_Links, $p_str_PluginFileName) {
+ // append link to the WordPress Plugin page
+ $p_arr_Links[] = sprintf('%s', __('Support', MCI_Footnotes_Config::C_STR_PLUGIN_NAME));
+ // append link to the Settings page
+ $p_arr_Links[] = sprintf('%s', admin_url('admin.php?page=mfmmf-footnotes'), __('Settings', MCI_Footnotes_Config::C_STR_PLUGIN_NAME));
+ // append link to the PlayPal Donate function
+ $p_arr_Links[] = sprintf('%s', __('Donate', MCI_Footnotes_Config::C_STR_PLUGIN_NAME));
+ // return new links
+ return $p_arr_Links;
}
}
diff --git a/class/init.php b/class/init.php
index 45cd4ec..e1001a3 100644
--- a/class/init.php
+++ b/class/init.php
@@ -1,11 +1,13 @@
-initialize_dashboard();
- // Initialize the Plugin Task.
- $this->initialize_task();
+ // initialize the Plugin Dashboard
+ $this->initializeDashboard();
+ // initialize the Plugin Task
+ $this->initializeTask();
- // Register all Public Stylesheets and Scripts.
- add_action( 'init', array( $this, 'register_public' ) );
- // Enqueue all Public Stylesheets and Scripts.
- add_action( 'wp_enqueue_scripts', array( $this, 'register_public' ) );
- // Register all Widgets of the Plugin..
- add_action( 'widgets_init', array( $this, 'initialize_widgets' ) );
+ // Register all Public Stylesheets and Scripts
+ add_action('init', array($this, 'registerPublic'));
+ // Enqueue all Public Stylesheets and Scripts
+ add_action('wp_enqueue_scripts', array($this, 'registerPublic'));
+ // Register all Widgets of the Plugin.
+ add_action('widgets_init', array($this, 'initializeWidgets'));
}
/**
* Initializes all Widgets of the Plugin.
*
+ * @author Stefan Herndler
* @since 1.5.0
*
+ *
* - Update: Fix for deprecated PHP function create_function(), thanks to @psykonevro @daliasued bug reports, thanks to @felipelavinz code contribution
*
* @since 1.6.5
@@ -124,34 +129,37 @@ class MCI_Footnotes {
* and use the bare register_widget() here.
* @see self::run()
*
- * Also, the visibility of initialize_widgets() is not private any longer.
+ * Also, the visibility of initializeWidgets() is not private any longer.
*/
- public function initialize_widgets() {
- register_widget( 'MCI_Footnotes_Widget_Reference_container' );
+ public function initializeWidgets() {
+ register_widget( "MCI_Footnotes_Widget_ReferenceContainer" );
}
/**
* Initializes the Dashboard of the Plugin and loads them.
*
+ * @author Stefan Herndler
* @since 1.5.0
*/
- private function initialize_dashboard() {
+ private function initializeDashboard() {
new MCI_Footnotes_Layout_Init();
}
/**
* Initializes the Plugin Task and registers the Task hooks.
*
+ * @author Stefan Herndler
* @since 1.5.0
*/
- private function initialize_task() {
- $this->a_obj_task = new MCI_Footnotes_Task();
- $this->a_obj_task->register_hooks();
+ private function initializeTask() {
+ $this->a_obj_Task = new MCI_Footnotes_Task();
+ $this->a_obj_Task->registerHooks();
}
/**
* Registers and enqueues scripts and stylesheets to the public pages.
*
+ * @author Stefan Herndler
* @since 1.5.0
*
* @since 2.0.0 Update: Tooltips: fix disabling bug by loading jQuery UI library, thanks to @rajinderverma @ericcorbett2 @honlapdavid @mmallett bug reports, thanks to @vonpiernik code contribution.
@@ -160,7 +168,7 @@ class MCI_Footnotes {
* @since 2.1.4 automate passing version number for cache busting 2020-11-30T0646+0100
* @since 2.1.4 optionally enqueue an extra stylesheet 2020-12-04T2231+0100
*/
- public function register_public() {
+ public function registerPublic() {
/**
* Enqueues external scripts.
@@ -173,10 +181,10 @@ class MCI_Footnotes {
*
* The condition about tooltips was missing, only the not-alternative-tooltips part was present.
*/
- // Set conditions re-used for stylesheet enqueuing.
- self::$a_bool_tooltips_enabled = MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ENABLED ) );
- self::$a_bool_alternative_tooltips_enabled = MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE ) );
- $l_str_script_mode = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE );
+ // set conditions re-used for stylesheet enqueuing:
+ self::$a_bool_TooltipsEnabled = MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED ) );
+ self::$a_bool_AlternativeTooltipsEnabled = MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE ) );
+ $l_str_ScriptMode = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE);
/**
* Enqueues the jQuery library registered by WordPress.
@@ -187,79 +195,68 @@ class MCI_Footnotes {
*
* @reporter @hopper87it
* @link https://wordpress.org/support/topic/footnotes-wp-rocket/
- *
+ *
* jQuery is also used for animated scrolling, so it was loaded by default.
* The function wp_enqueue_script() avoids loading the same library multiple times.
* After adding the alternative reference container, jQuery has become optional,
* but still enabled by default.
*/
- if ( 'jquery' === $l_str_script_mode || ( self::$a_bool_tooltips_enabled && ! self::$a_bool_alternative_tooltips_enabled ) ) {
-
+ if ( $l_str_ScriptMode == 'jquery' || ( self::$a_bool_TooltipsEnabled && ! self::$a_bool_AlternativeTooltipsEnabled ) ) {
+
wp_enqueue_script( 'jquery' );
-
+
}
- if ( self::$a_bool_tooltips_enabled && ! self::$a_bool_alternative_tooltips_enabled ) {
+ if ( self::$a_bool_TooltipsEnabled && ! self::$a_bool_AlternativeTooltipsEnabled ) {
/**
* Enqueues the jQuery Tools library shipped with the plugin.
*
- * Redacted jQuery.browser, completed minification;
- * see full header in js/jquery.tools.js.
- *
- * Add versioning.
- *
- * @since 2.1.2
- * @date 2020-11-18T2150+0100
- *
- * No '-js' in the handle, is appended automatically.
- *
- * Deferring to the footer breaks jQuery tooltip display.
- * @date 2021-02-23T1105+0100
+ * redacted jQuery.browser, completed minification;
+ * see full header in js/jquery.tools.js
+ * added versioning 2020-11-18T2150+0100
+ * not use '-js' in the handle, is appended automatically
*/
wp_enqueue_script(
'mci-footnotes-jquery-tools',
- plugins_url( 'footnotes/js/jquery.tools.min.js' ),
+ plugins_url('footnotes/js/jquery.tools.min.js'),
array(),
- '1.2.7.redacted.2',
- false
+ '1.2.7.redacted.2'
);
/**
- * Enqueues some jQuery UI libraries registered by WordPress.
+ * Registers jQuery UI from the JavaScript Content Delivery Network.
*
* - Update: Tooltips: fix disabling bug by loading jQuery UI library, thanks to @rajinderverma @ericcorbett2 @honlapdavid @mmallett bug reports, thanks to @vonpiernik code contribution.
*
* @since 2.0.0
+ * Alternatively, fetch jQuery UI from cdnjs.cloudflare.com:
+ * @since 2.0.0 add jQueryUI from Cloudflare 2020-10-26T1907+0100
+ * Used to add jQuery UI following @vonpiernik:
+ * :
*
- * @reporter @rajinderverma
- * @link https://wordpress.org/support/topic/tooltip-hover-not-showing/
*
- * @reporter @ericcorbett2
- * @link https://wordpress.org/support/topic/tooltip-hover-not-showing/#post-13324142
+ * jQueryUI re-enables the tooltip infobox disabled when WPv5.5 was released.
*
- * @reporter @honlapdavid
- * @link https://wordpress.org/support/topic/tooltip-hover-not-showing/#post-13355421
+ * Updated for v2.0.4 by adding jQuery UI from WordPress following @check2020de:
+ *
+ * See
*
- * @reporter @mmallett
- * @link https://wordpress.org/support/topic/tooltip-hover-not-showing/#post-13445437
- *
- * Fetch jQuery UI from cdnjs.cloudflare.com.
- * @since 2.0.0
- * @date 2020-10-26T1907+0100
- * @contributor @vonpiernik
- * @link https://wordpress.org/support/topic/tooltip-hover-not-showing/#post-13456762
- *
- * jQueryUI re-enables the tooltip infobox disabled when WPv5.5 was released. * @since 2.1.2
- *
- * - Update: Libraries: Load jQuery UI from WordPress, thanks to @check2020de issue report.
- *
- * @since 2.0.4
- * @date 2020-11-01T1902+0100
- * @reporter @check2020de
- * @link https://wordpress.org/support/topic/gdpr-issue-with-jquery/
- * @link https://wordpress.stackexchange.com/questions/273986/correct-way-to-enqueue-jquery-ui
+ * This was enabled in Footnotes v2.0.0 through v2.0.3.
+ * Re-added for 2.0.9d1 / 2.1.1d0 to look whether it can fix a broken tooltip display. 2020-11-07T1601+0100/2020-11-08T2246+0100
+ */
+ //wp_register_script( 'jQueryUI', 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js', null, null, false ); // in header 2020-11-09T2003+0100
+ //wp_enqueue_script( 'jQueryUI' );
+ /**
+ * This is then needed instead of the above first instance:
+ * Add jQuery Tools and finish adding jQueryUI: 2020-11-08T1638+0100/2020-11-08T2246+0100
+ */
+ //wp_enqueue_script('mci-footnotes-js-jquery-tools', plugins_url('../js/jquery.tools.min.js', __FILE__), ['jQueryUI']);
+
+ /**
+ * Enqueues some jQuery UI libraries registered by WordPress.
*
+ * @since 2.0.4 add jQuery UI from WordPress 2020-11-01T1902+0100
* If alternative tooltips are enabled, these libraries are not needed.
*/
wp_enqueue_script( 'jquery-ui-core' );
@@ -311,43 +308,34 @@ class MCI_Footnotes {
* The media scope argument 'all' is the default.
* No need to use '-css' in the handle, as this is appended automatically.
*/
- // Set tooltip mode for use in stylesheet name.
- if ( self::$a_bool_tooltips_enabled ) {
- if ( self::$a_bool_alternative_tooltips_enabled ) {
- $l_str_tooltip_mode_short = 'al';
- $l_str_tooltip_mode_rest = 'ternative-tooltips';
+ // set tooltip mode for use in stylesheet name:
+ if ( self::$a_bool_TooltipsEnabled ) {
+ if ( self::$a_bool_AlternativeTooltipsEnabled ) {
+ $l_str_TooltipMode = 'al';
+ $l_str_TComplement = 'ternative-tooltips';
} else {
- $l_str_tooltip_mode_short = 'jq';
- $l_str_tooltip_mode_rest = 'uery-tooltips';
+ $l_str_TooltipMode = 'jq';
+ $l_str_TComplement = 'uery-tooltips';
}
} else {
- $l_str_tooltip_mode_short = 'no';
- $l_str_tooltip_mode_rest = '-tooltips';
+ $l_str_TooltipMode = 'no';
+ $l_str_TComplement = '-tooltips';
}
- // Set basic responsive page layout mode for use in stylesheet name.
- $l_str_page_layout_option = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT );
- switch ( $l_str_page_layout_option ) {
- case 'reference-container':
- $l_str_layout_mode = '1';
- break;
- case 'entry-content':
- $l_str_layout_mode = '2';
- break;
- case 'main-content':
- $l_str_layout_mode = '3';
- break;
- case 'none':
- default:
- $l_str_layout_mode = '0';
- break;
+ // set basic responsive page layout mode for use in stylesheet name:
+ $l_str_PageLayoutOption = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT);
+ switch ( $l_str_PageLayoutOption ) {
+ case "reference-container": $l_str_LayoutMode = '1'; break;
+ case "entry-content" : $l_str_LayoutMode = '2'; break;
+ case "main-content" : $l_str_LayoutMode = '3'; break;
+ case "none": default: $l_str_LayoutMode = '0'; break;
}
- // Enqueue the tailored united minified stylesheet.
+ // enqueue the tailored united minified stylesheet:
wp_enqueue_style(
- 'mci-footnotes-' . $l_str_tooltip_mode_short . $l_str_tooltip_mode_rest . '-pagelayout-' . $l_str_page_layout_option,
+ 'mci-footnotes-' . $l_str_TooltipMode . $l_str_TComplement . '-pagelayout-' . $l_str_PageLayoutOption,
plugins_url(
- MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/footnotes-' . $l_str_tooltip_mode_short . 'ttbrpl' . $l_str_layout_mode . '.min.css'
+ MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/footnotes-' . $l_str_TooltipMode . 'ttbrpl' . $l_str_LayoutMode . '.min.css'
),
array(),
C_STR_FOOTNOTES_VERSION,
@@ -368,12 +356,12 @@ class MCI_Footnotes {
wp_enqueue_style( 'mci-footnotes-tooltips', plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-tooltips.css' ), array(), C_STR_FOOTNOTES_VERSION );
wp_enqueue_style( 'mci-footnotes-alternative', plugins_url( MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-tooltips-alternative.css' ), array(), C_STR_FOOTNOTES_VERSION );
- $l_str_page_layout_option = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT );
- if ( 'none' !== $l_str_page_layout_option ) {
+ $l_str_PageLayoutOption = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT);
+ if ($l_str_PageLayoutOption != 'none') {
wp_enqueue_style(
- 'mci-footnotes-layout-' . $l_str_page_layout_option,
+ 'mci-footnotes-layout-' . $l_str_PageLayoutOption,
plugins_url(
- MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-layout-' . $l_str_page_layout_option . '.css'
+ MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/dev-layout-' . $l_str_PageLayoutOption . '.css'
),
array(),
C_STR_FOOTNOTES_VERSION,
diff --git a/class/language.php b/class/language.php
index fd86a8c..fccf143 100644
--- a/class/language.php
+++ b/class/language.php
@@ -1,11 +1,13 @@
- array(
+ "footnotes_storage" => array(
- self::C_STR_FOOTNOTES_SHORT_CODE_START => '((',
- self::C_STR_FOOTNOTES_SHORT_CODE_END => '))',
- self::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED => '',
- self::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED => '',
+ self::C_STR_FOOTNOTES_SHORT_CODE_START => '((',
+ self::C_STR_FOOTNOTES_SHORT_CODE_END => '))',
+ self::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED => '',
+ self::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED => '',
- self::C_STR_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE => 'yes',
+ self::C_BOOL_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE => 'yes',
- self::C_STR_FOOTNOTES_COUNTER_STYLE => 'arabic_plain',
- self::C_STR_COMBINE_IDENTICAL_FOOTNOTES => 'yes',
+ self::C_STR_FOOTNOTES_COUNTER_STYLE => 'arabic_plain',
+ self::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES => 'yes',
- self::C_STR_FOOTNOTES_HARD_LINKS_ENABLE => 'no',
- self::C_STR_REFERRER_FRAGMENT_ID_SLUG => 'r',
- self::C_STR_FOOTNOTE_FRAGMENT_ID_SLUG => 'f',
- self::C_STR_HARD_LINK_IDS_SEPARATOR => '+',
- self::C_INT_FOOTNOTES_SCROLL_OFFSET => 20,
- self::C_INT_FOOTNOTES_SCROLL_DURATION => 380,
+ self::C_BOOL_FOOTNOTES_HARD_LINKS_ENABLE => 'no',
+ self::C_STR_REFERRER_FRAGMENT_ID_SLUG => 'r',
+ self::C_STR_FOOTNOTE_FRAGMENT_ID_SLUG => 'f',
+ self::C_STR_HARD_LINK_IDS_SEPARATOR => '+',
+ self::C_INT_FOOTNOTES_SCROLL_OFFSET => 20,
+ self::C_INT_FOOTNOTES_SCROLL_DURATION => 380,
- // 2.5.4 fast-tracked.
- self::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE => 'yes',
- self::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT => 'Alt+ ←',
+ // 2.5.4 fast-tracked:
+ self::C_BOOL_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE => 'yes',
+ self::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT => 'Alt+ ←',
- self::C_STR_REFERENCE_CONTAINER_NAME => 'References',
- self::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT => 'p',
- self::C_STR_REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER => 'yes',
- self::C_STR_REFERENCE_CONTAINER_COLLAPSE => 'no',
- self::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE => 'jquery',
+ self::C_STR_REFERENCE_CONTAINER_NAME => 'References',
+ self::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT => 'p',
+ self::C_BOOL_REFERENCE_CONTAINER_LABEL_BOTTOM_BORDER => 'yes',
+ self::C_BOOL_REFERENCE_CONTAINER_COLLAPSE => 'no',
+ self::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE => 'jquery',
- self::C_STR_REFERENCE_CONTAINER_POSITION => 'post_end',
- self::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE => '[[references]]',
- self::C_STR_REFERENCE_CONTAINER_START_PAGE_ENABLE => 'yes',
+ self::C_STR_REFERENCE_CONTAINER_POSITION => 'post_end',
+ self::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE => '[[references]]',
+ self::C_BOOL_REFERENCE_CONTAINER_START_PAGE_ENABLE => 'yes',
- // Whether to enqueue additional stylesheet.
- self::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT => 'none',
+ // whether to enqueue additional stylesheet:
+ self::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT => 'none',
- // Top and bottom margins.
- self::C_INT_REFERENCE_CONTAINER_TOP_MARGIN => 24,
- self::C_INT_REFERENCE_CONTAINER_BOTTOM_MARGIN => 0,
+ // top and bottom margins:
+ self::C_INT_REFERENCE_CONTAINER_TOP_MARGIN => 24,
+ self::C_INT_REFERENCE_CONTAINER_BOTTOM_MARGIN => 0,
- // Table cell borders.
- self::C_STR_REFERENCE_CONTAINER_ROW_BORDERS_ENABLE => 'no',
+ // table cell borders:
+ self::C_BOOL_REFERENCE_CONTAINER_ROW_BORDERS_ENABLE => 'no',
- // Backlink symbol.
- self::C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE => 'no',
- self::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE => 'yes',
- self::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH => 'no',
+ // backlink symbol:
+ self::C_BOOL_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE => 'no',
+ self::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE => 'yes',
+ self::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH => 'no',
- // Backlink separators and terminators are often not preferred..
- // But a choice must be provided along with the ability to customize.
- self::C_STR_BACKLINKS_SEPARATOR_ENABLED => 'yes',
- self::C_STR_BACKLINKS_SEPARATOR_OPTION => 'comma',
- self::C_STR_BACKLINKS_SEPARATOR_CUSTOM => '',
- self::C_STR_BACKLINKS_TERMINATOR_ENABLED => 'no',
- self::C_STR_BACKLINKS_TERMINATOR_OPTION => 'full_stop',
- self::C_STR_BACKLINKS_TERMINATOR_CUSTOM => '',
+ // backlink separators and terminators are often not preferred.
+ // but a choice must be provided along with the ability to customize:
+ self::C_BOOL_BACKLINKS_SEPARATOR_ENABLED => 'yes',
+ self::C_STR_BACKLINKS_SEPARATOR_OPTION => 'comma',
+ self::C_STR_BACKLINKS_SEPARATOR_CUSTOM => '',
+ self::C_BOOL_BACKLINKS_TERMINATOR_ENABLED => 'no',
+ self::C_STR_BACKLINKS_TERMINATOR_OPTION => 'full_stop',
+ self::C_STR_BACKLINKS_TERMINATOR_CUSTOM => '',
- // Set backlinks column width.
- self::C_STR_BACKLINKS_COLUMN_WIDTH_ENABLED => 'no',
- self::C_INT_BACKLINKS_COLUMN_WIDTH_SCALAR => '50',
- self::C_STR_BACKLINKS_COLUMN_WIDTH_UNIT => 'px',
+ // set backlinks column width:
+ self::C_BOOL_BACKLINKS_COLUMN_WIDTH_ENABLED => 'no',
+ self::C_INT_BACKLINKS_COLUMN_WIDTH_SCALAR => '50',
+ self::C_STR_BACKLINKS_COLUMN_WIDTH_UNIT => 'px',
- // Set backlinks column max. width.
- self::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED => 'no',
- self::C_INT_BACKLINKS_COLUMN_MAX_WIDTH_SCALAR => '140',
- self::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_UNIT => 'px',
+ // set backlinks column max. width:
+ self::C_BOOL_BACKLINKS_COLUMN_MAX_WIDTH_ENABLED => 'no',
+ self::C_INT_BACKLINKS_COLUMN_MAX_WIDTH_SCALAR => '140',
+ self::C_STR_BACKLINKS_COLUMN_MAX_WIDTH_UNIT => 'px',
- // Whether a tag is inserted.
- self::C_STR_BACKLINKS_LINE_BREAKS_ENABLED => 'no',
+ // whether a tag is inserted:
+ self::C_BOOL_BACKLINKS_LINE_BREAKS_ENABLED => 'no',
- // Whether to enable URL line wrapping.
- self::C_STR_FOOTNOTE_URL_WRAP_ENABLED => 'yes',
+ // whether to enable URL line wrapping:
+ self::C_BOOL_FOOTNOTE_URL_WRAP_ENABLED => 'yes',
- // Whether to use link elements.
- self::C_STR_LINK_ELEMENT_ENABLED => 'yes',
+ // whether to use link elements:
+ self::C_BOOL_LINK_ELEMENT_ENABLED => 'yes',
- // Excerpt should be disabled.
- self::C_STR_FOOTNOTES_IN_EXCERPT => 'no',
+ // excerpt should be disabled:
+ self::C_BOOL_FOOTNOTES_IN_EXCERPT => 'no',
- self::C_STR_FOOTNOTES_EXPERT_MODE => 'yes',
+ self::C_BOOL_FOOTNOTES_EXPERT_MODE => 'yes',
- self::C_STR_FOOTNOTES_LOVE => 'no',
+ self::C_STR_FOOTNOTES_LOVE => 'no',
),
- 'footnotes_storage_custom' => array(
+ "footnotes_storage_custom" => array(
- self::C_STR_HYPERLINK_ARROW => '↑',
- self::C_STR_HYPERLINK_ARROW_USER_DEFINED => '',
+ self::C_STR_HYPERLINK_ARROW => '↑',
+ self::C_STR_HYPERLINK_ARROW_USER_DEFINED => '',
- self::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL => 'Continue reading',
+ self::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL => 'Continue reading',
- self::C_STR_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS => 'yes',
+ self::C_BOOL_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS => 'yes',
- self::C_STR_FOOTNOTES_STYLING_BEFORE => '[',
- self::C_STR_FOOTNOTES_STYLING_AFTER => ']',
+ self::C_STR_FOOTNOTES_STYLING_BEFORE => '[',
+ self::C_STR_FOOTNOTES_STYLING_AFTER => ']',
- self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ENABLED => 'yes',
+ self::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED => 'yes',
- self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE => 'no',
+ self::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE => 'no',
- // The mouse over content truncation should be enabled by default.
- // To raise awareness of the functionality and to prevent the screen.
- // From being filled at mouse-over, and to allow the Continue reading.
- self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED => 'yes',
+ // The mouse over content truncation should be enabled by default
+ // to raise awareness of the functionality and to prevent the screen
+ // from being filled at mouse-over, and to allow the Continue reading:
+ self::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED => 'yes',
- // The truncation length is raised from 150 to 200 chars.
- self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH => 200,
+ // The truncation length is raised from 150 to 200 chars:
+ self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH => 200,
- // 2.5.4 fast-tracked.
- self::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER => '[[/tooltip]]',
- self::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE => 'no',
- self::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR => ' — ',
- self::C_STR_FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT => 'no',
+ // 2.5.4 fast-tracked:
+ self::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER => '[[/tooltip]]',
+ self::C_BOOL_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE => 'no',
+ self::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR => ' — ',
+ self::C_STR_FOOTNOTE_REFERRERS_NORMAL_SUPERSCRIPT => 'no',
- // The default position should not be lateral because of the risk.
- // The box gets squeezed between note anchor at line end and window edge,.
- // And top because reading at the bottom of the window is more likely.
- self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION => 'top center',
+ // The default position should not be lateral because of the risk
+ // the box gets squeezed between note anchor at line end and window edge,
+ // and top because reading at the bottom of the window is more likely:
+ self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION => 'top center',
- self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X => 0,
- // The vertical offset must be negative for the box not to cover.
- // The current line of text (web coordinates origin is top left).
- self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y => -7,
+ self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X => 0,
+ // The vertical offset must be negative for the box not to cover
+ // the current line of text (web coordinates origin is top left):
+ self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y => -7,
- // The width should be limited to start with, for the box to have shape.
- self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH => 450,
+ // The width should be limited to start with, for the box to have shape:
+ self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH => 450,
- // Fixed width is for alternative tooltips, cannot reuse max-width nor offsets.
+ // fixed width is for alternative tooltips, cannot reuse max-width nor offsets:
self::C_STR_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_POSITION => 'top right',
self::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_X => -50,
- self::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y => 24,
- self::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH => 400,
+ self::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_OFFSET_Y => 24,
+ self::C_INT_FOOTNOTES_ALTERNATIVE_MOUSE_OVER_BOX_WIDTH => 400,
- // Tooltip display durations.
- // Called mouse over box not tooltip for consistency.
- self::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY => 0,
- self::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION => 200,
- self::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY => 400,
- self::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION => 200,
+ // tooltip display durations:
+ // called mouse over box not tooltip for consistency
+ self::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY => 0,
+ self::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION => 200,
+ self::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY => 400,
+ self::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION => 200,
- // Tooltip font size reset to legacy by default since 2.1.4;.
- // Was set to inherit since 2.1.1 as it overrode custom CSS,.
- // Is moved to settings since 2.1.4 2020-12-04T1023+0100.
- self::C_STR_MOUSE_OVER_BOX_FONT_SIZE_ENABLED => 'yes',
- self::C_FLO_MOUSE_OVER_BOX_FONT_SIZE_SCALAR => 13,
- self::C_STR_MOUSE_OVER_BOX_FONT_SIZE_UNIT => 'px',
+ // tooltip font size reset to legacy by default since 2.1.4;
+ // was set to inherit since 2.1.1 as it overrode custom CSS,
+ // is moved to settings since 2.1.4 2020-12-04T1023+0100
+ self::C_BOOL_MOUSE_OVER_BOX_FONT_SIZE_ENABLED => 'yes',
+ self::C_FLO_MOUSE_OVER_BOX_FONT_SIZE_SCALAR => 13,
+ self::C_STR_MOUSE_OVER_BOX_FONT_SIZE_UNIT => 'px',
- self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR => '',
- // The mouse over box shouldn’t feature a colored background.
- // By default, due to diverging user preferences. White is neutral.
- self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND => '#ffffff',
+ self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR => '',
+ // The mouse over box shouldn’t feature a colored background
+ // by default, due to diverging user preferences. White is neutral:
+ self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND => '#ffffff',
- self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH => 1,
- self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR => '#cccc99',
+ self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH => 1,
+ self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR => '#cccc99',
- // The mouse over box corners mustn’t be rounded as that is outdated.
- self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS => 0,
+ // The mouse over box corners mustn’t be rounded as that is outdated:
+ self::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS => 0,
- self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR => '#666666',
+ self::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR => '#666666',
- // Custom CSS migrates to a dedicated tab.
- self::C_STR_CUSTOM_CSS => '',
+ // Custom CSS migrates to a dedicated tab:
+ self::C_STR_CUSTOM_CSS => '',
),
- 'footnotes_storage_expert' => array(
+ "footnotes_storage_expert" => array(
- // These are checkboxes; keyword 'checked' is converted to Boolean true,.
- // Empty string to false (default).
+ // These are checkboxes; keyword 'checked' is converted to Boolean true,
+ // empty string to false (default):
- // Titles should all be enabled by default to prevent users from.
- // Thinking at first that the feature is broken in post titles..
- // See .
- // Yet in titles, footnotes are still buggy, because WordPress.
- // Uses the title string in menus and in the title element..
- self::C_STR_EXPERT_LOOKUP_THE_TITLE => '',
+ // Titles should all be enabled by default to prevent users from
+ // thinking at first that the feature is broken in post titles.
+ // See
+ // Yet in titles, footnotes are still buggy, because WordPress
+ // uses the title string in menus and in the title element.
+ self::C_BOOL_EXPERT_LOOKUP_THE_TITLE => '',
- self::C_STR_EXPERT_LOOKUP_THE_CONTENT => 'checked',
+ self::C_BOOL_EXPERT_LOOKUP_THE_CONTENT => 'checked',
- // And the_excerpt is disabled by default following @nikelaos in.
- // .
- // .
- self::C_STR_EXPERT_LOOKUP_THE_EXCERPT => '',
+ // And the_excerpt is disabled by default following @nikelaos in
+ //
+ //
+ self::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT => '',
- self::C_STR_EXPERT_LOOKUP_WIDGET_TITLE => '',
+ self::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE => '',
- // The widget_text hook must be disabled by default, because it causes.
- // Multiple reference containers to appear in Elementor accordions, but.
- // It must be enabled if multiple reference containers are desired, as.
- // In Elementor toggles..
- self::C_STR_EXPERT_LOOKUP_WIDGET_TEXT => '',
+ // The widget_text hook must be disabled by default, because it causes
+ // multiple reference containers to appear in Elementor accordions, but
+ // it must be enabled if multiple reference containers are desired, as
+ // in Elementor toggles.
+ self::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT => '',
- // Initially hard-coded default.
- // Shows "9223372036854780000" instead of 9223372036854775807 in the numbox.
- // Empty should be interpreted as PHP_INT_MAX, but a numbox cannot be set to empty.
- // .
- // Interpret -1 as PHP_INT_MAX instead.
- self::C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL => PHP_INT_MAX,
+ // initially hard-coded default
+ // shows "9223372036854780000" instead of 9223372036854775807 in the numbox
+ // empty should be interpreted as PHP_INT_MAX, but a numbox cannot be set to empty:
+ //
+ // interpret -1 as PHP_INT_MAX instead
+ self::C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL => PHP_INT_MAX,
- // Priority level of the_content and of widget_text as the only relevant.
- // Hooks must be less than 99 because social buttons may yield scripts.
- // That contain the strings '((' and '))', i.e. the default footnote.
- // Start and end short codes, causing issues with fake footnotes..
- self::C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL => 98,
- self::C_INT_EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL => PHP_INT_MAX,
- self::C_INT_EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL => PHP_INT_MAX,
- self::C_INT_EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL => 98,
+ // Priority level of the_content and of widget_text as the only relevant
+ // hooks must be less than 99 because social buttons may yield scripts
+ // that contain the strings '((' and '))', i.e. the default footnote
+ // start and end short codes, causing issues with fake footnotes.
+ self::C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL => 98,
+ self::C_INT_EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL => PHP_INT_MAX,
+ self::C_INT_EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL => PHP_INT_MAX,
+ self::C_INT_EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL => 98,
),
- 'footnotes_storage_custom_css' => array(
+ "footnotes_storage_custom_css" => array(
- self::C_STR_CUSTOM_CSS_LEGACY_ENABLE => 'yes',
- self::C_STR_CUSTOM_CSS_NEW => '',
+ self::C_BOOL_CUSTOM_CSS_LEGACY_ENABLE => 'yes',
+ self::C_STR_CUSTOM_CSS_NEW => '',
),
@@ -1032,123 +1074,130 @@ class MCI_Footnotes_Settings {
/**
* Contains all Settings from each Settings container as soon as this class is initialized.
*
+ * @author Stefan Herndler
* @since 1.5.0
* @var array
*/
- private $a_arr_settings = array();
+ private $a_arr_Settings = array();
/**
* Class Constructor. Loads all Settings from each WordPress Settings container.
*
+ * @author Stefan Herndler
* @since 1.5.0
*/
private function __construct() {
- $this->load_all();
+ $this->loadAll();
}
/**
* Returns a singleton of this class.
*
+ * @author Stefan Herndler
* @since 1.5.0
* @return MCI_Footnotes_Settings
*/
public static function instance() {
- // No instance defined yet, load it.
- if ( ! self::$a_obj_instance ) {
- self::$a_obj_instance = new self();
+ // no instance defined yet, load it
+ if (self::$a_obj_Instance === null) {
+ self::$a_obj_Instance = new self();
}
- // Return a singleton of this class.
- return self::$a_obj_instance;
+ // return a singleton of this class
+ return self::$a_obj_Instance;
}
/**
* Returns the name of a specified Settings Container.
*
+ * @author Stefan Herndler
* @since 1.5.0
- * @param int $p_int_index Settings Container Array Key Index.
+ * @param int $p_int_Index Settings Container Array Key Index.
* @return str Settings Container name.
*/
- public function get_container( $p_int_index ) {
- return $this->a_arr_container[ $p_int_index ];
+ public function getContainer($p_int_Index) {
+ return $this->a_arr_Container[$p_int_Index];
}
/**
* Returns the default values of a specific Settings Container.
*
+ * @author Stefan Herndler
* @since 1.5.6
- * @param int $p_int_index Settings Container Aray Key Index.
+ * @param int $p_int_Index Settings Container Aray Key Index.
* @return array
*/
- public function get_defaults( $p_int_index ) {
- return $this->a_arr_default[ $this->a_arr_container[ $p_int_index ] ];
+ public function getDefaults($p_int_Index) {
+ return $this->a_arr_Default[$this->a_arr_Container[$p_int_Index]];
}
/**
* Loads all Settings from each Settings container.
*
+ * @author Stefan Herndler
* @since 1.5.0
*/
- private function load_all() {
- // Clear current settings.
- $this->a_arr_settings = array();
- $num_settings = count( $this->a_arr_container );
- for ( $i = 0; $i < $num_settings; $i++ ) {
- // Load settings.
- $this->a_arr_settings = array_merge( $this->a_arr_settings, $this->load( $i ) );
+ private function loadAll() {
+ // clear current settings
+ $this->a_arr_Settings = array();
+ for ($i = 0; $i < count($this->a_arr_Container); $i++) {
+ // load settings
+ $this->a_arr_Settings = array_merge($this->a_arr_Settings, $this->Load($i));
}
}
/**
* Loads all Settings from specified Settings Container.
*
+ * @author Stefan Herndler
* @since 1.5.0
- * @param int $p_int_index Settings Container Array Key Index.
+ * @param int $p_int_Index Settings Container Array Key Index.
* @return array Settings loaded from Container of Default Settings if Settings Container is empty (first usage).
*
* @since ditched trimming whitespace from text box content in response to user request.
* @link https://wordpress.org/support/topic/leading-space-in-footnotes-tag/#post-5347966
*/
- private function load( $p_int_index ) {
- // Load all settings from container.
- $l_arr_options = get_option( $this->get_container( $p_int_index ) );
- // Load all default settings.
- $l_arr_default = $this->a_arr_default[ $this->get_container( $p_int_index ) ];
+ private function Load($p_int_Index) {
+ // load all settings from container
+ $l_arr_Options = get_option($this->getContainer($p_int_Index));
+ // load all default settings
+ $l_arr_Default = $this->a_arr_Default[$this->getContainer($p_int_Index)];
- // No settings found, set them to their default value.
- if ( empty( $l_arr_options ) ) {
- return $l_arr_default;
+ // no settings found, set them to their default value
+ if (empty($l_arr_Options)) {
+ return $l_arr_Default;
}
- // Iterate through all available settings ( = default values).
- foreach ( $l_arr_default as $l_str_key => $l_str_value ) {
- // Available setting not found in the container.
- if ( ! array_key_exists( $l_str_key, $l_arr_options ) ) {
- // Define the setting with its default value.
- $l_arr_options[ $l_str_key ] = $l_str_value;
+ // iterate through all available settings ( = default values)
+ foreach($l_arr_Default as $l_str_Key => $l_str_Value) {
+ // available setting not found in the container
+ if (!array_key_exists($l_str_Key, $l_arr_Options)) {
+ // define the setting with its default value
+ $l_arr_Options[$l_str_Key] = $l_str_Value;
}
}
- // Iterate through each setting in the container.
- foreach ( $l_arr_options as $l_str_key => $l_str_value ) {
- // Remove all whitespace at the beginning and end of a setting.
- // Trimming whitespace is ditched.
- // $l_str_value = trim($l_str_value);.
- // Write the sanitized value back to the setting container.
- $l_arr_options[ $l_str_key ] = $l_str_value;
+ // iterate through each setting in the container
+ foreach($l_arr_Options as $l_str_Key => $l_str_Value) {
+ // remove all whitespace at the beginning and end of a setting
+ // trimming whitespace is ditched:
+ //$l_str_Value = trim($l_str_Value);
+ // write the sanitized value back to the setting container
+ $l_arr_Options[$l_str_Key] = $l_str_Value;
}
- // Return settings loaded from Container.
- return $l_arr_options;
+ // return settings loaded from Container
+ return $l_arr_Options;
}
/**
* Updates a whole Settings container.
*
+ * @author Stefan Herndler
* @since 1.5.0
- * @param int $p_int_index Index of the Settings container.
- * @param array $p_arr_new_values new Settings.
+ * @param int $p_int_Index Index of the Settings container.
+ * @param array $p_arr_newValues new Settings.
* @return bool
*/
- public function save_options( $p_int_index, $p_arr_new_values ) {
- if ( update_option( $this->get_container( $p_int_index ), $p_arr_new_values ) ) {
- $this->load_all();
+ public function saveOptions($p_int_Index, $p_arr_newValues) {
+ if (update_option($this->getContainer($p_int_Index), $p_arr_newValues)) {
+ $this->loadAll();
return true;
}
return false;
@@ -1157,17 +1206,19 @@ class MCI_Footnotes_Settings {
/**
* Returns the value of specified Settings name.
*
+ * @author Stefan Herndler
* @since 1.5.0
- * @param string $p_str_key Settings Array Key name.
+ * @param string $p_str_Key Settings Array Key name.
* @return mixed Value of the Setting on Success or Null in Settings name is invalid.
*/
- public function get( $p_str_key ) {
- return array_key_exists( $p_str_key, $this->a_arr_settings ) ? $this->a_arr_settings[ $p_str_key ] : null;
+ public function get($p_str_Key) {
+ return array_key_exists($p_str_Key, $this->a_arr_Settings) ? $this->a_arr_Settings[$p_str_Key] : null;
}
/**
* Deletes each Settings Container and loads the default values for each Settings Container.
*
+ * @author Stefan Herndler
* @since 1.5.0
*
* Edit: This didn’t actually work.
@@ -1176,28 +1227,27 @@ class MCI_Footnotes_Settings {
* done by deleting and reinstalling (see the warning about database backup).
* 2020-12-13T1353+0100
*/
- public function clear_all() {
- // Iterate through each Settings Container.
- $num_settings = count( $this->a_arr_container );
- for ( $i = 0; $i < $num_settings; $i++ ) {
- // Delete the settings container.
- delete_option( $this->get_container( $i ) );
+ public function ClearAll() {
+ // iterate through each Settings Container
+ for ($i = 0; $i < count($this->a_arr_Container); $i++) {
+ // delete the settings container
+ delete_option($this->getContainer($i));
}
- // Set settings back to the default values.
- $this->a_arr_settings = $this->a_arr_default;
+ // set settings back to the default values
+ $this->a_arr_Settings = $this->a_arr_Default;
}
/**
* Register all Settings Container for the Plugin Settings Page in the Dashboard.
* Settings Container Label will be the same as the Settings Container Name.
*
+ * @author Stefan Herndler
* @since 1.5.0
*/
- public function register_settings() {
- // Register all settings.
- $num_settings = count( $this->a_arr_container );
- for ( $i = 0; $i < $num_settings; $i++ ) {
- register_setting( $this->get_container( $i ), $this->get_container( $i ) );
+ public function RegisterSettings() {
+ // register all settings
+ for ($i = 0; $i < count($this->a_arr_Container); $i++) {
+ register_setting($this->getContainer($i), $this->getContainer($i));
}
}
}
diff --git a/class/task.php b/class/task.php
index e39a7e4..249636c 100644
--- a/class/task.php
+++ b/class/task.php
@@ -1,11 +1,12 @@
-get( MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL ) );
- $l_int_the_content_priority = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL ) );
- $l_int_the_excerpt_priority = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL ) );
- $l_int_widget_title_priority = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL ) );
- $l_int_widget_text_priority = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL ) );
+ // get values from settings:
+ $l_int_TheTitlePriority = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL));
+ $l_int_TheContentPriority = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL));
+ $l_int_TheExcerptPriority = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL));
+ $l_int_WidgetTitlePriority = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL));
+ $l_int_WidgetTextPriority = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL));
- // PHP_INT_MAX can be set by -1.
- $l_int_the_title_priority = ( -1 === $l_int_the_title_priority ) ? PHP_INT_MAX : $l_int_the_title_priority;
- $l_int_the_content_priority = ( -1 === $l_int_the_content_priority ) ? PHP_INT_MAX : $l_int_the_content_priority;
- $l_int_the_excerpt_priority = ( -1 === $l_int_the_excerpt_priority ) ? PHP_INT_MAX : $l_int_the_excerpt_priority;
- $l_int_widget_title_priority = ( -1 === $l_int_widget_title_priority ) ? PHP_INT_MAX : $l_int_widget_title_priority;
- $l_int_widget_text_priority = ( -1 === $l_int_widget_text_priority ) ? PHP_INT_MAX : $l_int_widget_text_priority;
+ // PHP_INT_MAX can be set by -1:
+ $l_int_TheTitlePriority = ($l_int_TheTitlePriority == -1) ? PHP_INT_MAX : $l_int_TheTitlePriority ;
+ $l_int_TheContentPriority = ($l_int_TheContentPriority == -1) ? PHP_INT_MAX : $l_int_TheContentPriority ;
+ $l_int_TheExcerptPriority = ($l_int_TheExcerptPriority == -1) ? PHP_INT_MAX : $l_int_TheExcerptPriority ;
+ $l_int_WidgetTitlePriority = ($l_int_WidgetTitlePriority == -1) ? PHP_INT_MAX : $l_int_WidgetTitlePriority;
+ $l_int_WidgetTextPriority = ($l_int_WidgetTextPriority == -1) ? PHP_INT_MAX : $l_int_WidgetTextPriority ;
- // Append custom css to the header.
- add_filter( 'wp_head', array( $this, 'wp_head' ), PHP_INT_MAX );
- // Append the love and share me slug to the footer.
- add_filter( 'wp_footer', array( $this, 'wp_footer' ), PHP_INT_MAX );
+ // append custom css to the header
+ add_filter('wp_head', array($this, "wp_head"), PHP_INT_MAX);
- if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_EXPERT_LOOKUP_THE_TITLE ) ) ) {
- add_filter( 'the_title', array( $this, 'the_title' ), $l_int_the_title_priority );
+ // append the love and share me slug to the footer
+ add_filter('wp_footer', array($this, "wp_footer"), PHP_INT_MAX);
+
+ if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_TITLE))) {
+ add_filter('the_title', array($this, "the_title"), $l_int_TheTitlePriority);
}
- // Configurable priority level for reference container relative positioning; default 98.
- if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_EXPERT_LOOKUP_THE_CONTENT ) ) ) {
- add_filter( 'the_content', array( $this, 'the_content' ), $l_int_the_content_priority );
+ // configurable priority level for reference container relative positioning; default 98:
+ if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_CONTENT))) {
+ add_filter('the_content', array($this, "the_content"), $l_int_TheContentPriority);
/**
- * Hook for category pages.
+ * Hook for category pages
*
* - Bugfix: Hooks: support footnotes on category pages, thanks to @vitaefit bug report, thanks to @misfist code contribution.
*
@@ -533,10 +462,10 @@ class MCI_Footnotes_Task {
* For this to happen, WordPress’ built-in partial HTML blocker needs to be disabled.
* @link https://docs.woocommerce.com/document/allow-html-in-term-category-tag-descriptions/
*/
- add_filter( 'term_description', array( $this, 'the_content' ), $l_int_the_content_priority );
+ add_filter('term_description', array($this, "the_content"), $l_int_TheContentPriority);
/**
- * Hook for popup maker popups.
+ * Hook for popup maker popups
*
* - Bugfix: Hooks: support footnotes in Popup Maker popups, thanks to @squatcher bug report.
*
@@ -546,21 +475,22 @@ class MCI_Footnotes_Task {
* @reporter @squatcher
* @link https://wordpress.org/support/topic/footnotes-use-in-popup-maker/
*/
- add_filter( 'pum_popup_content', array( $this, 'the_content' ), $l_int_the_content_priority );
+ add_filter('pum_popup_content', array($this, "the_content"), $l_int_TheContentPriority);
}
- if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_EXPERT_LOOKUP_THE_EXCERPT ) ) ) {
- add_filter( 'the_excerpt', array( $this, 'the_excerpt' ), $l_int_the_excerpt_priority );
+ if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT))) {
+ add_filter('the_excerpt', array($this, "the_excerpt"), $l_int_TheExcerptPriority);
}
- if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_EXPERT_LOOKUP_WIDGET_TITLE ) ) ) {
- add_filter( 'widget_title', array( $this, 'widget_title' ), $l_int_widget_title_priority );
+ if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE))) {
+ add_filter('widget_title', array($this, "widget_title"), $l_int_WidgetTitlePriority);
}
- if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_EXPERT_LOOKUP_WIDGET_TEXT ) ) ) {
- add_filter( 'widget_text', array( $this, 'widget_text' ), $l_int_widget_text_priority );
+ if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT))) {
+ add_filter('widget_text', array($this, "widget_text"), $l_int_WidgetTextPriority);
}
+
/**
- * The the_post hook.
+ * The the_post hook
*
* - Adding: Hooks: support 'the_post' in response to user request for custom post types.
*
@@ -625,16 +555,18 @@ class MCI_Footnotes_Task {
* @accountable @pewgeuges
*/
- // Reset stored footnotes when displaying the header.
- self::$a_arr_footnotes = array();
- self::$a_bool_allow_love_me = true;
+ // reset stored footnotes when displaying the header
+ self::$a_arr_Footnotes = array();
+ self::$a_bool_AllowLoveMe = true;
}
/**
* Outputs the custom css to the header of the public page.
*
+ * @author Stefan Herndler
* @since 1.5.0
*
+ *
* @since 2.1.1 Bugfix: Reference container: fix start pages by making its display optional, thanks to @dragon013 bug report.
* @since 2.1.1 Bugfix: Tooltips: optional alternative JS implementation with CSS transitions to fix configuration-related outage, thanks to @andreasra feedback.
* @since 2.1.3 raise settings priority to override theme stylesheets
@@ -647,7 +579,7 @@ class MCI_Footnotes_Task {
*/
public function wp_head() {
- // Insert start tag without switching out of PHP.
+ // insert start tag without switching out of PHP:
echo "\r\n\r\n";
/**
@@ -1002,222 +921,184 @@ class MCI_Footnotes_Task {
* @reporter @andreasra
* @link https://wordpress.org/support/topic/footnotes-appearing-in-header/page/2/#post-13632566
*
- * The script for alternative tooltips is printed formatted, not minified,
- * for transparency. It isn’t indented though (the PHP open tag neither).
+ * The script for alternative tooltips is printed formatted, not minified:
*/
- if ( self::$a_bool_alternative_tooltips_enabled ) {
-
- // Start internal script.
+ if ( self::$a_bool_AlternativeTooltipsEnabled ) {
?>
- get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION ) ) {
- echo $this->reference_container();
+ if (MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "footer") {
+ echo $this->ReferenceContainer();
}
- // Get setting for love and share this plugin.
- $l_str_love_me_index = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE );
- // Check if the admin allows to add a link to the footer.
- if ( empty( $l_str_love_me_index ) || 'no' === strtolower( $l_str_love_me_index ) || ! self::$a_bool_allow_love_me ) {
+ // get setting for love and share this plugin
+ $l_str_LoveMeIndex = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE);
+ // check if the admin allows to add a link to the footer
+ if (empty($l_str_LoveMeIndex) || strtolower($l_str_LoveMeIndex) == "no" || !self::$a_bool_AllowLoveMe) {
return;
}
- // Set a hyperlink to the word "footnotes" in the Love slug.
- $l_str_linked_name = sprintf( '%s', MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME );
- // Get random love me text.
- if ( 'random' === strtolower( $l_str_love_me_index ) ) {
- $l_str_love_me_index = 'text-' . wp_rand( 1, 7 );
+ // set a hyperlink to the word "footnotes" in the Love slug
+ $l_str_LinkedName = sprintf('%s', MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME);
+ // get random love me text
+ if (strtolower($l_str_LoveMeIndex) == "random") {
+ $l_str_LoveMeIndex = "text-" . rand(1,7);
}
- switch ( $l_str_love_me_index ) {
- // Options named wrt backcompat, simplest is default.
- case 'text-1':
- /* Translators: 2: Link to plugin page 1: Love heart symbol */
- $l_str_love_me_text = sprintf( __( 'I %2$s %1$s', 'footnotes' ), $l_str_linked_name, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL );
- break;
- case 'text-2':
- /* Translators: %s: Link to plugin page */
- $l_str_love_me_text = sprintf( __( 'This website uses the awesome %s plugin.', 'footnotes' ), $l_str_linked_name );
- break;
- case 'text-4':
- /* Translators: 1: Link to plugin page 2: Love heart symbol */
- $l_str_love_me_text = sprintf( '%1$s %2$s', $l_str_linked_name, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL );
- break;
- case 'text-5':
- /* Translators: 1: Love heart symbol 2: Link to plugin page */
- $l_str_love_me_text = sprintf( '%1$s %2$s', MCI_Footnotes_Config::C_STR_LOVE_SYMBOL, $l_str_linked_name );
- break;
- case 'text-6':
- /* Translators: %s: Link to plugin page */
- $l_str_love_me_text = sprintf( __( 'This website uses %s.', 'footnotes' ), $l_str_linked_name );
- break;
- case 'text-7':
- /* Translators: %s: Link to plugin page */
- $l_str_love_me_text = sprintf( __( 'This website uses the %s plugin.', 'footnotes' ), $l_str_linked_name );
- break;
- case 'text-3':
- default:
- /* Translators: %s: Link to plugin page */
- $l_str_love_me_text = sprintf( '%s', $l_str_linked_name );
- break;
+ switch ($l_str_LoveMeIndex) {
+ // options named wrt backcompat, simplest is default:
+ case "text-1": $l_str_LoveMeText = sprintf(__('I %2$s %1$s', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), $l_str_LinkedName, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL); break;
+ case "text-2": $l_str_LoveMeText = sprintf(__('This website uses the awesome %s plugin.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), $l_str_LinkedName); break;
+ case "text-4": $l_str_LoveMeText = sprintf('%s %s', $l_str_LinkedName, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL); break;
+ case "text-5": $l_str_LoveMeText = sprintf('%s %s', MCI_Footnotes_Config::C_STR_LOVE_SYMBOL, $l_str_LinkedName); break;
+ case "text-6": $l_str_LoveMeText = sprintf(__('This website uses %s.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), $l_str_LinkedName); break;
+ case "text-7": $l_str_LoveMeText = sprintf(__('This website uses the %s plugin.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), $l_str_LinkedName); break;
+ case "text-3": default: $l_str_LoveMeText = sprintf('%s', $l_str_LinkedName); break;
}
- echo sprintf( '
%s
', $l_str_love_me_text );
+ echo sprintf('
%s
', $l_str_LoveMeText);
}
/**
* Replaces footnotes in the post/page title.
*
+ * @author Stefan Herndler
* @since 1.5.0
- * @param string $p_str_content Widget content.
+ * @param string $p_str_Content Widget content.
* @return string Content with replaced footnotes.
*/
- public function the_title( $p_str_content ) {
- // Appends the reference container if set to "post_end".
- return $this->exec( $p_str_content, false );
+ public function the_title($p_str_Content) {
+ // appends the reference container if set to "post_end"
+ return $this->exec($p_str_Content, false);
}
/**
* Replaces footnotes in the content of the current page/post.
*
+ * @author Stefan Herndler
* @since 1.5.0
- * @param string $p_str_content Page/Post content.
+ * @param string $p_str_Content Page/Post content.
* @return string Content with replaced footnotes.
*/
- public function the_content( $p_str_content ) {
- /**
- * Empties the footnotes list every time Footnotes is run when the_content hook is called.
- *
- * - Bugfix: Process: fix footnote duplication by emptying the footnotes list every time the search algorithm is run on the content, thanks to @inoruhana bug report.
- *
- * @since 2.5.7
- *
- * @reporter @inoruhana
- * @link https://wordpress.org/support/topic/footnote-duplicated-in-the-widget/
- *
- * Under certain circumstances, footnotes were duplicated, because the footnotes list was
- * not emptied every time before the search algorithm was run. That happened eg when both
- * the reference container resides in the widget area, and the YOAST SEO plugin is active
- * and calls the hook the_content to generate the Open Graph description, while Footnotes
- * is set to avoid missing out on the footnotes (in the content) by hooking in as soon as
- * the_content is called, whereas at post end Footnotes seems to hook in the_content only
- * the time it’s the blog engine processing the post for display and appending the refs.
- */
- self::$a_arr_footnotes = array();
-
- // phpcs:disable WordPress.PHP.YodaConditions.NotYoda
- // Appends the reference container if set to "post_end".
- return $this->exec( $p_str_content, 'post_end' === MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION ) );
- // phpcs:enable WordPress.PHP.YodaConditions.NotYoda
+ public function the_content($p_str_Content) {
+ // appends the reference container if set to "post_end"
+ return $this->exec($p_str_Content, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "post_end" ? true : false);
}
/**
* Replaces footnotes in the excerpt of the current page/post.
*
+ * @author Stefan Herndler
* @since 1.5.0
- * @param string $p_str_content Page/Post content.
+ * @param string $p_str_Content Page/Post content.
* @return string Content with replaced footnotes.
*/
- public function the_excerpt( $p_str_content ) {
- return $this->exec( $p_str_content, false, ! MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_IN_EXCERPT ) ) );
+ public function the_excerpt($p_str_Content) {
+ return $this->exec($p_str_Content, false, !MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT)));
}
/**
* Replaces footnotes in the widget title.
*
+ * @author Stefan Herndler
* @since 1.5.0
- * @param string $p_str_content Widget content.
+ * @param string $p_str_Content Widget content.
* @return string Content with replaced footnotes.
*/
- public function widget_title( $p_str_content ) {
- // Appends the reference container if set to "post_end".
- return $this->exec( $p_str_content, false );
+ public function widget_title($p_str_Content) {
+ // appends the reference container if set to "post_end"
+ return $this->exec($p_str_Content, false);
}
/**
* Replaces footnotes in the content of the current widget.
*
+ * @author Stefan Herndler
* @since 1.5.0
- * @param string $p_str_content Widget content.
+ * @param string $p_str_Content Widget content.
* @return string Content with replaced footnotes.
*/
- public function widget_text( $p_str_content ) {
- // phpcs:disable WordPress.PHP.YodaConditions.NotYoda
- // Appends the reference container if set to "post_end".
- return $this->exec( $p_str_content, 'post_end' === MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION ) ? true : false );
- // phpcs:enable WordPress.PHP.YodaConditions.NotYoda
+ public function widget_text($p_str_Content) {
+ // appends the reference container if set to "post_end"
+ return $this->exec($p_str_Content, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "post_end" ? true : false);
}
/**
* Replaces footnotes in each Content var of the current Post object.
*
+ * @author Stefan Herndler
* @since 1.5.4
- * @param array|WP_Post $p_mixed_posts The current Post object.
+ * @param array|WP_Post $p_mixed_Posts
*/
- public function the_post( &$p_mixed_posts ) {
- // Single WP_Post object received.
- if ( ! is_array( $p_mixed_posts ) ) {
- $p_mixed_posts = $this->replace_post_object( $p_mixed_posts );
+ public function the_post(&$p_mixed_Posts) {
+ // single WP_Post object received
+ if (!is_array($p_mixed_Posts)) {
+ $p_mixed_Posts = $this->replacePostObject($p_mixed_Posts);
return;
}
- $num_posts = count( $p_mixed_posts );
- // Array of WP_Post objects received.
- for ( $l_int_index = 0; $l_int_index < $num_posts; $l_int_index++ ) {
- $p_mixed_posts[ $l_int_index ] = $this->replace_post_object( $p_mixed_posts[ $l_int_index ] );
+ // array of WP_Post objects received
+ for($l_int_Index = 0; $l_int_Index < count($p_mixed_Posts); $l_int_Index++) {
+ $p_mixed_Posts[$l_int_Index] = $this->replacePostObject($p_mixed_Posts[$l_int_Index]);
}
}
/**
* Replace all Footnotes in a WP_Post object.
*
+ * @author Stefan Herndler
* @since 1.5.6
- * @param WP_Post $p_obj_post The Post object.
+ * @param WP_Post $p_obj_Post
* @return WP_Post
*/
- private function replace_post_object( $p_obj_post ) {
- $p_obj_post->post_content = $this->exec( $p_obj_post->post_content );
- $p_obj_post->post_content_filtered = $this->exec( $p_obj_post->post_content_filtered );
- $p_obj_post->post_excerpt = $this->exec( $p_obj_post->post_excerpt );
- return $p_obj_post;
+ private function replacePostObject($p_obj_Post) {
+ //MCI_Footnotes_Convert::debug($p_obj_Post);
+ $p_obj_Post->post_content = $this->exec($p_obj_Post->post_content);
+ $p_obj_Post->post_content_filtered = $this->exec($p_obj_Post->post_content_filtered);
+ $p_obj_Post->post_excerpt = $this->exec($p_obj_Post->post_excerpt);
+ return $p_obj_Post;
}
/**
* Replaces all footnotes that occur in the given content.
*
+ * @author Stefan Herndler
* @since 1.5.0
- * @param string $p_str_content Any string that may contain footnotes to be replaced.
- * @param bool $p_bool_output_references Appends the Reference Container to the output if set to true, default true.
- * @param bool $p_bool_hide_footnotes_text Hide footnotes found in the string.
+ * @param string $p_str_Content Any string that may contain footnotes to be replaced.
+ * @param bool $p_bool_OutputReferences Appends the Reference Container to the output if set to true, default true.
+ * @param bool $p_bool_HideFootnotesText Hide footnotes found in the string.
* @return string
*
+ *
* @since 2.2.0 Adding: Reference container: support for custom position shortcode, thanks to @hamshe issue report.
* @since 2.2.5 Bugfix: Reference container: delete position shortcode if unused because position may be widget or footer, thanks to @hamshe bug report.
*/
- public function exec( $p_str_content, $p_bool_output_references = false, $p_bool_hide_footnotes_text = false ) {
+ public function exec($p_str_Content, $p_bool_OutputReferences = false, $p_bool_HideFootnotesText = false) {
- // Replace all footnotes in the content, settings are converted to html characters.
- $p_str_content = $this->search( $p_str_content, true, $p_bool_hide_footnotes_text );
- // Replace all footnotes in the content, settings are NOT converted to html characters.
- $p_str_content = $this->search( $p_str_content, false, $p_bool_hide_footnotes_text );
+ // replace all footnotes in the content, settings are converted to html characters
+ $p_str_Content = $this->search($p_str_Content, true, $p_bool_HideFootnotesText);
+ // replace all footnotes in the content, settings are NOT converted to html characters
+ $p_str_Content = $this->search($p_str_Content, false, $p_bool_HideFootnotesText);
/**
- * Reference container customized positioning through shortcode.
+ * Reference container customized positioning through shortcode
*
* - Adding: Reference container: support for custom position shortcode, thanks to @hamshe issue report.
*
@@ -1235,48 +1116,50 @@ class MCI_Footnotes_Task {
*
* @reporter @hamshe
* @link https://wordpress.org/support/topic/reference-container-in-elementor/#post-13784126
+ *
*/
- // Append the reference container or insert at shortcode.
- $l_str_reference_container_position_shortcode = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE );
- if ( empty( $l_str_reference_container_position_shortcode ) ) {
- $l_str_reference_container_position_shortcode = '[[references]]';
+ // append the reference container or insert at shortcode:
+ $l_str_ReferenceContainerPositionShortcode = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE);
+ if ( empty( $l_str_ReferenceContainerPositionShortcode ) ) {
+ $l_str_ReferenceContainerPositionShortcode = '[[references]]';
}
- if ( $p_bool_output_references ) {
+ if ( $p_bool_OutputReferences ) {
- if ( strpos( $p_str_content, $l_str_reference_container_position_shortcode ) ) {
+ if ( strpos( $p_str_Content, $l_str_ReferenceContainerPositionShortcode ) !== false ) {
- $p_str_content = str_replace( $l_str_reference_container_position_shortcode, $this->reference_container(), $p_str_content );
+ $p_str_Content = str_replace( $l_str_ReferenceContainerPositionShortcode, $this->ReferenceContainer(), $p_str_Content );
} else {
- $p_str_content .= $this->reference_container();
+ $p_str_Content .= $this->ReferenceContainer();
}
- // Increment the container ID.
- self::$a_int_reference_container_id++;
+ // increment the container ID:
+ self::$a_int_ReferenceContainerId++;
}
- // Delete position shortcode should any remain.
- $p_str_content = str_replace( $l_str_reference_container_position_shortcode, '', $p_str_content );
+ // delete position shortcode should any remain:
+ $p_str_Content = str_replace( $l_str_ReferenceContainerPositionShortcode, '', $p_str_Content );
- // Take a look if the LOVE ME slug should NOT be displayed on this page/post, remove the short code if found.
- if ( strpos( $p_str_content, MCI_Footnotes_Config::C_STR_NO_LOVE_SLUG ) ) {
- self::$a_bool_allow_love_me = false;
- $p_str_content = str_replace( MCI_Footnotes_Config::C_STR_NO_LOVE_SLUG, '', $p_str_content );
+ // take a look if the LOVE ME slug should NOT be displayed on this page/post, remove the short code if found
+ if (strpos($p_str_Content, MCI_Footnotes_Config::C_STR_NO_LOVE_SLUG) !== false) {
+ self::$a_bool_AllowLoveMe = false;
+ $p_str_Content = str_replace(MCI_Footnotes_Config::C_STR_NO_LOVE_SLUG, "", $p_str_Content);
}
- // Return the content with replaced footnotes and optional reference container appended.
- return $p_str_content;
+ // return the content with replaced footnotes and optional reference container appended:
+ return $p_str_Content;
}
/**
* Replaces all footnotes in the given content and appends them to the static property.
*
+ * @author Stefan Herndler
* @since 1.5.0
- * @param string $p_str_content Content to be searched for footnotes.
- * @param bool $p_bool_convert_html_chars html encode settings, default true.
- * @param bool $p_bool_hide_footnotes_text Hide footnotes found in the string.
+ * @param string $p_str_Content Content to be searched for footnotes.
+ * @param bool $p_bool_ConvertHtmlChars html encode settings, default true.
+ * @param bool $p_bool_HideFootnotesText Hide footnotes found in the string.
* @return string
*
* @since 2.0.0 various.
@@ -1285,37 +1168,37 @@ class MCI_Footnotes_Task {
* @since 2.5.0 Bugfix: Footnote delimiters: Syntax validation: complete message with hint about setting, thanks to @andreasra bug report.
* @since 2.5.0 Bugfix: Footnote delimiters: Syntax validation: limit length of quoted string to 300 characters, thanks to @andreasra bug report.
*/
- public function search( $p_str_content, $p_bool_convert_html_chars, $p_bool_hide_footnotes_text ) {
+ public function search($p_str_Content, $p_bool_ConvertHtmlChars, $p_bool_HideFootnotesText) {
- // Post ID to make everything unique wrt infinite scroll and archive view.
- self::$a_int_post_id = get_the_id();
+ // post ID to make everything unique wrt infinite scroll and archive view
+ self::$a_int_PostId = get_the_id();
- // Contains the index for the next footnote on this page.
- $l_int_footnote_index = count( self::$a_arr_footnotes ) + 1;
+ // contains the index for the next footnote on this page
+ $l_int_FootnoteIndex = count(self::$a_arr_Footnotes) + 1;
- // Contains the starting position for the lookup of a footnote.
- $l_int_pos_start = 0;
+ // contains the starting position for the lookup of a footnote
+ $l_int_PosStart = 0;
- // Get start and end tag for the footnotes short code.
- $l_str_starting_tag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START );
- $l_str_ending_tag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END );
- if ( 'userdefined' === $l_str_starting_tag || 'userdefined' === $l_str_ending_tag ) {
- $l_str_starting_tag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED );
- $l_str_ending_tag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED );
+ // get start and end tag for the footnotes short code
+ $l_str_StartingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START);
+ $l_str_EndingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END);
+ if ($l_str_StartingTag == "userdefined" || $l_str_EndingTag == "userdefined") {
+ $l_str_StartingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED);
+ $l_str_EndingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED);
}
- // Decode html special chars.
- if ( $p_bool_convert_html_chars ) {
- $l_str_starting_tag = htmlspecialchars( $l_str_starting_tag );
- $l_str_ending_tag = htmlspecialchars( $l_str_ending_tag );
+ // decode html special chars
+ if ($p_bool_ConvertHtmlChars) {
+ $l_str_StartingTag = htmlspecialchars($l_str_StartingTag);
+ $l_str_EndingTag = htmlspecialchars($l_str_EndingTag);
}
- // If footnotes short code is empty, return the content without changes.
- if ( empty( $l_str_starting_tag ) || empty( $l_str_ending_tag ) ) {
- return $p_str_content;
+ // if footnotes short code is empty, return the content without changes
+ if (empty($l_str_StartingTag) || empty($l_str_EndingTag)) {
+ return $p_str_Content;
}
/**
- * Footnote delimiter syntax validation.
+ * Footnote delimiter syntax validation
*
* - Adding: Footnote delimiters: syntax validation for balanced footnote start and end tag short codes.
*
@@ -1336,74 +1219,74 @@ class MCI_Footnotes_Task {
* If footnotes short codes are unbalanced, and syntax validation is not disabled,
* prepend a warning to the content; displays de facto beneath the post title.
*/
- if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE ) ) ) {
+ if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE))) {
- // Make shortcodes conform to regex syntax.
- $l_str_start_tag_regex = preg_replace( '#([\(\)\{\}\[\]\*\.\?\!])#', '\\\\$1', $l_str_starting_tag );
- $l_str_end_tag_regex = preg_replace( '#([\(\)\{\}\[\]\*\.\?\!])#', '\\\\$1', $l_str_ending_tag );
+ // make shortcodes conform to regex syntax:
+ $l_str_StartTagRegex = preg_replace( '#([\(\)\{\}\[\]\*\.\?\!])#', '\\\\$1', $l_str_StartingTag );
+ $l_str_EndTagRegex = preg_replace( '#([\(\)\{\}\[\]\*\.\?\!])#', '\\\\$1', $l_str_EndingTag );
- // Apply different regex depending on whether start shortcode is double/triple opening parenthesis.
- if ( '((' === $l_str_starting_tag || '(((' === $l_str_starting_tag ) {
+ // apply different regex depending on whether start shortcode is double/triple opening parenthesis:
+ if ( $l_str_StartingTag == '((' || $l_str_StartingTag == '(((' ) {
- // This prevents from catching a script containing e.g. a double opening parenthesis.
- $l_str_validation_regex = '#' . $l_str_start_tag_regex . '(((?!' . $l_str_end_tag_regex . ')[^\{\}])*?)(' . $l_str_start_tag_regex . '|$)#s';
+ // this prevents from catching a script containing e.g. a double opening parenthesis:
+ $l_str_ValidationRegex = '#' . $l_str_StartTagRegex . '(((?!' . $l_str_EndTagRegex . ')[^\{\}])*?)(' . $l_str_StartTagRegex . '|$)#s';
} else {
- // Catch all only if the start shortcode is not double/triple opening parenthesis, i.e. is unlikely to occur in scripts.
- $l_str_validation_regex = '#' . $l_str_start_tag_regex . '(((?!' . $l_str_end_tag_regex . ').)*?)(' . $l_str_start_tag_regex . '|$)#s';
+ // catch all only if the start shortcode is not double/triple opening parenthesis, i.e. is unlikely to occur in scripts:
+ $l_str_ValidationRegex = '#' . $l_str_StartTagRegex . '(((?!' . $l_str_EndTagRegex . ').)*?)(' . $l_str_StartTagRegex . '|$)#s';
}
- // Check syntax and get error locations.
- preg_match( $l_str_validation_regex, $p_str_content, $p_arr_error_location );
- if ( empty( $p_arr_error_location ) ) {
- self::$a_bool_syntax_error_flag = false;
+ // check syntax and get error locations:
+ preg_match( $l_str_ValidationRegex, $p_str_Content, $p_arr_ErrorLocation );
+ if ( empty( $p_arr_ErrorLocation ) ) {
+ self::$a_bool_SyntaxErrorFlag = false;
}
- // Prevent generating and inserting the warning multiple times.
- if ( self::$a_bool_syntax_error_flag ) {
+ // prevent generating and inserting the warning multiple times:
+ if ( self::$a_bool_SyntaxErrorFlag ) {
- // Get plain text string for error location.
- $l_str_error_spot_string = wp_strip_all_tags( $p_arr_error_location[1] );
+ // get plain text string for error location:
+ $l_str_ErrorSpotString = strip_tags( $p_arr_ErrorLocation[1] );
- // Limit string length to 300 characters.
- if ( strlen( $l_str_error_spot_string ) > 300 ) {
- $l_str_error_spot_string = substr( $l_str_error_spot_string, 0, 299 ) . '…';
+ // limit string length to 300 characters:
+ if ( strlen( $l_str_ErrorSpotString ) > 300 ) {
+ $l_str_ErrorSpotString = substr( $l_str_ErrorSpotString, 0, 299 ) . '…';
}
- // Compose warning box.
- $l_str_syntax_error_warning = '
';
- $l_str_syntax_error_warning .= __( 'WARNING: unbalanced footnote start tag short code found.', 'footnotes' );
- $l_str_syntax_error_warning .= '
';
+ $l_str_SyntaxErrorWarning .= __("WARNING: unbalanced footnote start tag short code found.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME);
+ $l_str_SyntaxErrorWarning .= '
';
- // Syntax validation setting in the dashboard under the General settings tab.
- /* Translators: 1: General Settings 2: Footnote start and end short codes 3: Check for balanced shortcodes */
- $l_str_syntax_error_warning .= sprintf( __( 'If this warning is irrelevant, please disable the syntax validation feature in the dashboard under %1$s > %2$s > %3$s.', 'footnotes' ), __( 'General settings', 'footnotes' ), __( 'Footnote start and end short codes', 'footnotes' ), __( 'Check for balanced shortcodes', 'footnotes' ) );
+ // syntax validation setting in the dashboard under the General settings tab:
+ $l_str_SyntaxErrorWarning .= sprintf( __("If this warning is irrelevant, please disable the syntax validation feature in the dashboard under %s > %s > %s.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), __("General settings", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), __("Footnote start and end short codes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), __("Check for balanced shortcodes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) );
- $l_str_syntax_error_warning .= '
';
- $l_str_syntax_error_warning .= __( 'Unbalanced start tag short code found before:', 'footnotes' );
- $l_str_syntax_error_warning .= '