development 2.2.0d8 with update readme “Tested up to: 5.6”. Please test UI redesign prior to adding the missing settings

git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@2438063 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
pewgeuges 2020-12-12 21:07:24 +00:00
parent 0911777bc1
commit 391cce446a
27 changed files with 858 additions and 636 deletions

View file

@ -5,6 +5,11 @@
* @filesource * @filesource
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 12.09.14 10:56 * @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
*/ */
@ -24,11 +29,16 @@ class MCI_Footnotes_Convert {
* @param int $p_int_Index Index to be converted. * @param int $p_int_Index Index to be converted.
* @param string $p_str_ConvertStyle Style of the new/converted Index. * @param string $p_str_ConvertStyle Style of the new/converted Index.
* @return string Converted Index as string in the defined counter style. * @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_ConvertStyle = "arabic_plain") { public static function Index($p_int_Index, $p_str_ConvertStyle = "arabic_plain") {
switch ($p_str_ConvertStyle) { switch ($p_str_ConvertStyle) {
case "romanic": case "romanic":
return self::toRomanic($p_int_Index); return self::toRomanic($p_int_Index, true);
case "roman_low":
return self::toRomanic($p_int_Index, false);
case "latin_high": case "latin_high":
return self::toLatin($p_int_Index, true); return self::toLatin($p_int_Index, true);
case "latin_low": case "latin_low":
@ -97,8 +107,11 @@ class MCI_Footnotes_Convert {
* @since 1.0-gamma * @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 * @return string
*
* Edited:
* @since 2.2.0 optionally lowercase (code from Latin) 2020-12-12T1538+0100
*/ */
private static function toRomanic($p_int_Value) { private static function toRomanic($p_int_Value, $p_bool_UpperCase) {
// table containing all necessary romanic letters // table containing all necessary romanic letters
$l_arr_RomanicLetters = array( $l_arr_RomanicLetters = array(
'M' => 1000, 'M' => 1000,
@ -128,7 +141,10 @@ class MCI_Footnotes_Convert {
} }
} }
// return romanic letters as string // return romanic letters as string
return $l_str_Return; if ($p_bool_UpperCase) {
return strtoupper($l_str_Return);
}
return strtolower($l_str_Return);
} }
/** /**

View file

@ -16,187 +16,187 @@
*/ */
class MCI_Footnotes_Layout_Init { class MCI_Footnotes_Layout_Init {
/** /**
* Slug for the Plugin main menu. * Slug for the Plugin main menu.
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
* @var string * @var string
*/ */
const C_STR_MAIN_MENU_SLUG = "mfmmf"; const C_STR_MAIN_MENU_SLUG = "mfmmf";
/** /**
* Plugin main menu name. * Plugin main menu name.
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
* @var string * @var string
*/ */
const C_STR_MAIN_MENU_TITLE = "ManFisher"; const C_STR_MAIN_MENU_TITLE = "ManFisher";
/** /**
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
* @var array * @var array
*/ */
private $a_arr_SubPageClasses = array(); private $a_arr_SubPageClasses = array();
/** /**
* Class Constructor. Initializes all WordPress hooks for the Plugin Settings. * Class Constructor. Initializes all WordPress hooks for the Plugin Settings.
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
*/ */
public function __construct() { public function __construct() {
// iterate through each class define in the current script // iterate through each class define in the current script
foreach(get_declared_classes() as $l_str_ClassName) { foreach(get_declared_classes() as $l_str_ClassName) {
// accept only child classes of the layout engine // accept only child classes of the layout engine
if(is_subclass_of($l_str_ClassName, 'MCI_Footnotes_LayoutEngine')) { if(is_subclass_of($l_str_ClassName, 'MCI_Footnotes_LayoutEngine')) {
/** @var MCI_Footnotes_LayoutEngine $l_obj_Class */ /** @var MCI_Footnotes_LayoutEngine $l_obj_Class */
$l_obj_Class = new $l_str_ClassName(); $l_obj_Class = new $l_str_ClassName();
// append new instance of the layout engine sub class // append new instance of the layout engine sub class
$this->a_arr_SubPageClasses[$l_obj_Class->getPriority()] = $l_obj_Class; $this->a_arr_SubPageClasses[$l_obj_Class->getPriority()] = $l_obj_Class;
} }
} }
ksort($this->a_arr_SubPageClasses); ksort($this->a_arr_SubPageClasses);
// register hooks/actions // register hooks/actions
add_action('admin_init', array($this, 'initializeSettings')); add_action('admin_init', array($this, 'initializeSettings'));
add_action('admin_menu', array($this, 'registerMainMenu')); add_action('admin_menu', array($this, 'registerMainMenu'));
// register AJAX callbacks for Plugin information // register AJAX callbacks for Plugin information
add_action("wp_ajax_nopriv_footnotes_getPluginInfo", array($this, "getPluginMetaInformation")); add_action("wp_ajax_nopriv_footnotes_getPluginInfo", array($this, "getPluginMetaInformation"));
add_action("wp_ajax_footnotes_getPluginInfo", array($this, "getPluginMetaInformation")); add_action("wp_ajax_footnotes_getPluginInfo", array($this, "getPluginMetaInformation"));
} }
/** /**
* Initializes all sub pages and registers the settings. * Initializes all sub pages and registers the settings.
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
*/ */
public function initializeSettings() { public function initializeSettings() {
MCI_Footnotes_Settings::instance()->RegisterSettings(); MCI_Footnotes_Settings::instance()->RegisterSettings();
// iterate though each sub class of the layout engine and register their sections // iterate though each sub class of the layout engine and register their sections
/** @var MCI_Footnotes_LayoutEngine $l_obj_LayoutEngineSubClass */ /** @var MCI_Footnotes_LayoutEngine $l_obj_LayoutEngineSubClass */
foreach($this->a_arr_SubPageClasses as $l_obj_LayoutEngineSubClass) { foreach($this->a_arr_SubPageClasses as $l_obj_LayoutEngineSubClass) {
$l_obj_LayoutEngineSubClass->registerSections(); $l_obj_LayoutEngineSubClass->registerSections();
} }
} }
/** /**
* Registers the new main menu for the WordPress dashboard. * Registers the new main menu for the WordPress dashboard.
* Registers all sub menu pages for the new main menu. * Registers all sub menu pages for the new main menu.
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
* @see http://codex.wordpress.org/Function_Reference/add_menu_page * @see http://codex.wordpress.org/Function_Reference/add_menu_page
*/ */
public function registerMainMenu() { public function registerMainMenu() {
global $menu; global $menu;
// iterate through each main menu // iterate through each main menu
foreach($menu as $l_arr_MainMenu) { foreach($menu as $l_arr_MainMenu) {
// iterate through each main menu attribute // iterate through each main menu attribute
foreach($l_arr_MainMenu as $l_str_Attribute) { foreach($l_arr_MainMenu as $l_str_Attribute) {
// main menu already added, append sub pages and stop // main menu already added, append sub pages and stop
if ($l_str_Attribute == self::C_STR_MAIN_MENU_SLUG) { if ($l_str_Attribute == self::C_STR_MAIN_MENU_SLUG) {
$this->registerSubPages(); $this->registerSubPages();
return; return;
} }
} }
} }
// add a new main menu page to the WordPress dashboard // add a new main menu page to the WordPress dashboard
add_menu_page( add_menu_page(
self::C_STR_MAIN_MENU_TITLE, // page title self::C_STR_MAIN_MENU_TITLE, // page title
self::C_STR_MAIN_MENU_TITLE, // menu title self::C_STR_MAIN_MENU_TITLE, // menu title
'manage_options', // capability 'manage_options', // capability
self::C_STR_MAIN_MENU_SLUG, // menu slug self::C_STR_MAIN_MENU_SLUG, // menu slug
array($this, "displayOtherPlugins"), // function array($this, "displayOtherPlugins"), // function
plugins_url('footnotes/img/main-menu.png'), // icon url plugins_url('footnotes/img/main-menu.png'), // icon url
null // position null // position
); );
$this->registerSubPages(); $this->registerSubPages();
} }
/** /**
* Registers all SubPages for this Plugin. * Registers all SubPages for this Plugin.
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
*/ */
private function registerSubPages() { private function registerSubPages() {
// first registered sub menu page MUST NOT contain a unique slug suffix // 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 // iterate though each sub class of the layout engine and register their sub page
/** @var MCI_Footnotes_LayoutEngine $l_obj_LayoutEngineSubClass */ /** @var MCI_Footnotes_LayoutEngine $l_obj_LayoutEngineSubClass */
foreach($this->a_arr_SubPageClasses as $l_obj_LayoutEngineSubClass) { foreach($this->a_arr_SubPageClasses as $l_obj_LayoutEngineSubClass) {
$l_obj_LayoutEngineSubClass->registerSubPage(); $l_obj_LayoutEngineSubClass->registerSubPage();
} }
} }
/** /**
* Displays other Plugins from the developers. * Displays other Plugins from the developers.
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
*/ */
public function displayOtherPlugins() { public function displayOtherPlugins() {
printf("<br/><br/>"); printf("<br/><br/>");
// load template file // load template file
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "manfisher"); $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "manfisher");
echo $l_obj_Template->getContent(); echo $l_obj_Template->getContent();
printf('<em>visit <a href="https://cheret.de/plugins/footnotes-2/" target="_blank">Mark Cheret</a></em>'); printf('<em>visit <a href="https://cheret.de/plugins/footnotes-2/" target="_blank">Mark Cheret</a></em>');
printf("<br/><br/>"); printf("<br/><br/>");
printf('</div>'); printf('</div>');
} }
/** /**
* AJAX call. returns a JSON string containing meta information about a specific WordPress Plugin. * AJAX call. returns a JSON string containing meta information about a specific WordPress Plugin.
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
*/ */
public function getPluginMetaInformation() { public function getPluginMetaInformation() {
// get plugin internal name from POST data // get plugin internal name from POST data
$l_str_PluginName = array_key_exists("plugin", $_POST) ? $_POST["plugin"] : null; $l_str_PluginName = array_key_exists("plugin", $_POST) ? $_POST["plugin"] : null;
if (empty($l_str_PluginName)) { if (empty($l_str_PluginName)) {
echo json_encode(array("error" => "Plugin name invalid.")); echo json_encode(array("error" => "Plugin name invalid."));
exit; exit;
} }
$l_str_Url = "https://api.wordpress.org/plugins/info/1.0/".$l_str_PluginName.".json"; $l_str_Url = "https://api.wordpress.org/plugins/info/1.0/".$l_str_PluginName.".json";
// call URL and collect data // call URL and collect data
$l_arr_Response = wp_remote_get($l_str_Url); $l_arr_Response = wp_remote_get($l_str_Url);
// check if response is valid // check if response is valid
if (is_wp_error($l_arr_Response)) { if (is_wp_error($l_arr_Response)) {
echo json_encode(array("error" => "Error receiving Plugin Information from WordPress.")); echo json_encode(array("error" => "Error receiving Plugin Information from WordPress."));
exit; exit;
} }
if (!array_key_exists("body", $l_arr_Response)) { if (!array_key_exists("body", $l_arr_Response)) {
echo json_encode(array("error" => "Error reading WordPress API response message.")); echo json_encode(array("error" => "Error reading WordPress API response message."));
exit; exit;
} }
// get the body of the response // get the body of the response
$l_str_Response = $l_arr_Response["body"]; $l_str_Response = $l_arr_Response["body"];
// get plugin object // get plugin object
$l_arr_Plugin = json_decode($l_str_Response, true); $l_arr_Plugin = json_decode($l_str_Response, true);
if (empty($l_arr_Plugin)) { if (empty($l_arr_Plugin)) {
echo json_encode(array("error" => "Error reading Plugin meta information.<br/>URL: " . $l_str_Url . "<br/>Response: " . $l_str_Response)); echo json_encode(array("error" => "Error reading Plugin meta information.<br/>URL: " . $l_str_Url . "<br/>Response: " . $l_str_Response));
exit; exit;
} }
$l_int_NumRatings = array_key_exists("num_ratings", $l_arr_Plugin) ? intval($l_arr_Plugin["num_ratings"]) : 0; $l_int_NumRatings = array_key_exists("num_ratings", $l_arr_Plugin) ? intval($l_arr_Plugin["num_ratings"]) : 0;
$l_int_Rating = array_key_exists("rating", $l_arr_Plugin) ? floatval($l_arr_Plugin["rating"]) : 0.0; $l_int_Rating = array_key_exists("rating", $l_arr_Plugin) ? floatval($l_arr_Plugin["rating"]) : 0.0;
$l_int_Stars = round(5 * $l_int_Rating / 100.0, 1); $l_int_Stars = round(5 * $l_int_Rating / 100.0, 1);
// return Plugin information as JSON encoded string // return Plugin information as JSON encoded string
echo json_encode( echo json_encode(
array( array(
"error" => "", "error" => "",
"PluginDescription" => array_key_exists("short_description", $l_arr_Plugin) ? html_entity_decode($l_arr_Plugin["short_description"]) : "Error reading Plugin information", "PluginDescription" => array_key_exists("short_description", $l_arr_Plugin) ? html_entity_decode($l_arr_Plugin["short_description"]) : "Error reading Plugin information",
"PluginAuthor" => array_key_exists("author", $l_arr_Plugin) ? html_entity_decode($l_arr_Plugin["author"]) : "unknown", "PluginAuthor" => array_key_exists("author", $l_arr_Plugin) ? html_entity_decode($l_arr_Plugin["author"]) : "unknown",
"PluginRatingText" => $l_int_Stars . " " . __("rating based on", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . " " . $l_int_NumRatings . " " . __("ratings", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "PluginRatingText" => $l_int_Stars . " " . __("rating based on", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . " " . $l_int_NumRatings . " " . __("ratings", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"PluginRating1" => $l_int_Stars >= 0.5 ? "star-full" : "star-empty", "PluginRating1" => $l_int_Stars >= 0.5 ? "star-full" : "star-empty",
"PluginRating2" => $l_int_Stars >= 1.5 ? "star-full" : "star-empty", "PluginRating2" => $l_int_Stars >= 1.5 ? "star-full" : "star-empty",
"PluginRating3" => $l_int_Stars >= 2.5 ? "star-full" : "star-empty", "PluginRating3" => $l_int_Stars >= 2.5 ? "star-full" : "star-empty",
@ -205,8 +205,8 @@ class MCI_Footnotes_Layout_Init {
"PluginRating" => $l_int_NumRatings, "PluginRating" => $l_int_NumRatings,
"PluginLastUpdated" => array_key_exists("last_updated", $l_arr_Plugin) ? $l_arr_Plugin["last_updated"] : "unknown", "PluginLastUpdated" => array_key_exists("last_updated", $l_arr_Plugin) ? $l_arr_Plugin["last_updated"] : "unknown",
"PluginDownloads" => array_key_exists("downloaded", $l_arr_Plugin) ? $l_arr_Plugin["downloaded"] : "---" "PluginDownloads" => array_key_exists("downloaded", $l_arr_Plugin) ? $l_arr_Plugin["downloaded"] : "---"
) )
); );
exit; exit;
} }
} }

View file

@ -10,9 +10,9 @@
* 2.1.2 add versioning of settings.css for cache busting 2020-11-19T1456+0100 * 2.1.2 add versioning of settings.css for cache busting 2020-11-19T1456+0100
* 2.1.4 automate passing version number for cache busting 2020-11-30T0648+0100 * 2.1.4 automate passing version number for cache busting 2020-11-30T0648+0100
* 2.1.4 optional step argument and support for floating in numbox 2020-12-05T0540+0100 * 2.1.4 optional step argument and support for floating in numbox 2020-12-05T0540+0100
* 2.2.0 fix punctuation-related localization issue in dashboard labels 2020-12-08T1547+0100 * 2.1.6 fix punctuation-related localization issue in dashboard labels 2020-12-08T1547+0100
* *
* Last modified: 2020-12-08T1547+0100 * Last modified: 2020-12-10T1447+0100
*/ */
@ -114,7 +114,12 @@ abstract class MCI_Footnotes_LayoutEngine {
* @return array meta box description to be able to append a meta box to the output. * @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) { 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); 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
);
} }
/** /**
@ -379,8 +384,8 @@ abstract class MCI_Footnotes_LayoutEngine {
* @param string $p_str_Caption Label caption. * @param string $p_str_Caption Label caption.
* @return string * @return string
* *
* Edited 2020-12-01T0159+0100 * Edited 2020-12-01T0159+0100..
* @since #################### no colon * @since 2.1.6 no colon
*/ */
protected function addLabel($p_str_SettingName, $p_str_Caption) { protected function addLabel($p_str_SettingName, $p_str_Caption) {
if (empty($p_str_Caption)) { if (empty($p_str_Caption)) {
@ -394,6 +399,7 @@ abstract class MCI_Footnotes_LayoutEngine {
// and narrow per new school. // and narrow per new school.
// Add colon to label strings for inclusion in localization. // Add colon to label strings for inclusion in localization.
// Colon after label is widely preferred best practice, mandatory per style guides. // Colon after label is widely preferred best practice, mandatory per style guides.
// <https://softwareengineering.stackexchange.com/questions/234546/colons-in-internationalized-ui>
return sprintf('<label for="%s">%s</label>', $p_str_SettingName, $p_str_Caption); return sprintf('<label for="%s">%s</label>', $p_str_SettingName, $p_str_Caption);
// ^ here deleted colon 2020-12-08T1546+0100 // ^ here deleted colon 2020-12-08T1546+0100
} }
@ -504,14 +510,14 @@ abstract class MCI_Footnotes_LayoutEngine {
* @return string * @return string
* *
* Edited: * Edited:
* @since 2.1.4 step argument and number_format() to allow decimals 2020-12-03T0631+0100..2020-12-05T2006+0100 * @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 ) { protected function addNumBox($p_str_SettingName, $p_in_Min, $p_int_Max, $p_bool_Deci = false ) {
// collect data for given settings field // collect data for given settings field
$l_arr_Data = $this->LoadSetting($p_str_SettingName); $l_arr_Data = $this->LoadSetting($p_str_SettingName);
if ($p_bool_Deci) { if ($p_bool_Deci) {
$l_str_Value = number_format($l_arr_Data["value"], 1); $l_str_Value = number_format(floatval($l_arr_Data["value"]), 1);
return sprintf('<input type="number" name="%s" id="%s" value="%s" step="0.1" min="%d" max="%d"/>', return sprintf('<input type="number" name="%s" id="%s" value="%s" step="0.1" min="%d" max="%d"/>',
$l_arr_Data["name"], $l_arr_Data["id"], $l_str_Value, $p_in_Min, $p_int_Max); $l_arr_Data["name"], $l_arr_Data["id"], $l_str_Value, $p_in_Min, $p_int_Max);
} else { } else {

View file

@ -11,11 +11,12 @@
* 2.1.0 read-on button label 2020-11-08T2148+0100 * 2.1.0 read-on button label 2020-11-08T2148+0100
* 2.1.1 options for ref container and alternative tooltips 2020-11-16T2152+0100 * 2.1.1 options for ref container and alternative tooltips 2020-11-16T2152+0100
* 2.1.4 settings for ref container, tooltips and scrolling 2020-12-03T0950+0100 * 2.1.4 settings for ref container, tooltips and scrolling 2020-12-03T0950+0100
* 2.2.0 slight UI reordering 2020-12-09T1114+0100 * 2.1.6 slight UI reordering 2020-12-09T1114+0100
* 2.2.0 option to disable URL line wrapping 2020-12-09T1604+0100 * 2.1.6 option to disable URL line wrapping 2020-12-09T1604+0100
* 2.2.0 remove expert mode setting as irrelevant 2020-12-09T2105+0100 * 2.1.6 remove expert mode setting as irrelevant 2020-12-09T2105+0100
* 2.2.0 add options, redistribute, update strings 2020-12-12T2135+0100
* *
* Last modified: 2020-12-09T2105+0100 * Last modified: 2020-12-12T2202+0100
*/ */
/** /**
@ -65,13 +66,20 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
* @return array * @return array
*
* Edited:
* 2.1.6 tabs reordered and renamed
* @see customization vs configuration
* <https://www.linkedin.com/pulse/20140610191154-4746170-configuration-vs-customization-when-and-why-would-i-implement-each>
*
* 2.1.6 removed if statement around expert tab
*/ */
protected function getSections() { protected function getSections() {
$l_arr_Tabs = array(); $l_arr_Tabs = array();
$l_arr_Tabs[] = $this->addSection("settings", __("Settings", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 0, true); $l_arr_Tabs[] = $this->addSection("settings", __("General settings", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 0, true);
$l_arr_Tabs[] = $this->addSection("expert", __("Priority", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 2, true); $l_arr_Tabs[] = $this->addSection("customize", __("Referrers and tooltips", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 1, true);
$l_arr_Tabs[] = $this->addSection("customize", __("Configure", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 1, true); $l_arr_Tabs[] = $this->addSection("expert", __("Priority and CSS", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 2, true);
$l_arr_Tabs[] = $this->addSection("how-to", __("How to", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), null, false); $l_arr_Tabs[] = $this->addSection("how-to", __("Quick start guide", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), null, false);
return $l_arr_Tabs; return $l_arr_Tabs;
} }
@ -82,27 +90,37 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
* @since 1.5.0 * @since 1.5.0
* @return array * @return array
* *
* Edited for v2.0.4 to reflect changes in display since WPv5.5 * Edited for 2.0.0 and later.
* Details in class/config.php *
* 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 doesnt 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() { protected function getMetaBoxes() {
return array( return array(
// Change string "%s styling" to "Footnotes styling" to fix layout in WPv5.5: $this->addMetaBox("settings", "start-end", __("Footnote start and end short codes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "StartEnd"),
$this->addMetaBox("settings", "styling", __("Main settings", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Styling"), $this->addMetaBox("settings", "numbering", __("Footnotes numbering", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Numbering"),
$this->addMetaBox("settings", "reference-container", __("Reference Container", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "ReferenceContainer"), $this->addMetaBox("settings", "scrolling", __("Scrolling behavior", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Scrolling"),
$this->addMetaBox("settings", "other", __("Other settings", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Other"), $this->addMetaBox("settings", "reference-container", __("Reference container", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "ReferenceContainer"),
// Leave intact since this is not localized: $this->addMetaBox("settings", "excerpts", __("Footnotes in excerpts", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Excerpts"),
$this->addMetaBox("settings", "love", MCI_Footnotes_Config::C_STR_PLUGIN_HEADING_NAME . '&nbsp;' . MCI_Footnotes_Config::C_STR_LOVE_SYMBOL_HEADING, "Love"), $this->addMetaBox("settings", "love", MCI_Footnotes_Config::C_STR_PLUGIN_HEADING_NAME . '&nbsp;' . MCI_Footnotes_Config::C_STR_LOVE_SYMBOL_HEADING, "Love"),
$this->addMetaBox("customize", "superscript", __("Referrer typesetting and formatting", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Superscript"),
$this->addMetaBox("customize", "mouse-over-box-display", __("Tooltip display", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "MouseOverBoxDisplay"),
$this->addMetaBox("customize", "mouse-over-box-truncation", __("Tooltip truncation", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "MouseOverBoxTruncation"),
$this->addMetaBox("customize", "mouse-over-box-appearance", __("Tooltip appearance", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "MouseOverBoxAppearance"),
$this->addMetaBox("expert", "lookup", __("WordPress hooks and priority levels", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "lookupHooks"), $this->addMetaBox("expert", "lookup", __("WordPress hooks and priority levels", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "LookupHooks"),
$this->addMetaBox("expert", "custom-css", __("Custom CSS", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "CustomCSS"),
// The HyperlinkArrow meta box ceased for 2.0.0
// The HyperlinkArrow meta box was restored for 2.0.4 to meet user demand for arrow symbol semantics
// The HyperlinkArrow meta box ceased for 2.1.4 as its content is moved to Settings > Reference container > Display a backlink symbol
$this->addMetaBox("customize", "superscript", __("Referrer typesetting", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Superscript"),
$this->addMetaBox("customize", "mouse-over-box", __("Mouse-over box", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "MouseOverBox"),
$this->addMetaBox("customize", "custom-css", __("Custom CSS", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "CustomCSS"),
$this->addMetaBox("how-to", "help", __("Brief introduction in how to use the plugin", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Help"), $this->addMetaBox("how-to", "help", __("Brief introduction in how to use the plugin", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Help"),
$this->addMetaBox("how-to", "donate", __("Help us to improve our Plugin", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Donate") $this->addMetaBox("how-to", "donate", __("Help us to improve our Plugin", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Donate")
@ -179,6 +197,10 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
"page-layout" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT, $l_arr_PageLayoutOptions), "page-layout" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT, $l_arr_PageLayoutOptions),
"notice-page-layout" => __("Most themes dont need this fix.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "notice-page-layout" => __("Most themes dont 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 dont need this fix.", 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)), "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), "startpage" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_START_PAGE_ENABLE, $l_arr_Enabled),
@ -221,6 +243,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
"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)), "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), "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),
) )
); );
// display template with replaced placeholders // display template with replaced placeholders
@ -228,44 +251,51 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
} }
/** /**
* Displays all settings for the footnotes styling. * 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 * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
*
* Edited heading 2020-12-12T1412+0100
* @since 2.2.0 more short code options 2020-12-12T1412+0100
* @since 2.2.0 3 boxes for clarity 2020-12-12T1422+0100
*/ */
public function Styling() { public function StartEnd() {
// define some space for the output // footnotes start tag short code options:
$l_str_Space = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
// 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 start of the footnotes short code
$l_arr_ShortCodeStart = array( $l_arr_ShortCodeStart = array(
"((" => "((", "((" => "((",
"(((" => "(((",
"{{" => "{{",
"{{{" => "{{{",
"[n]" => "[n]",
"[fn]" => "[fn]",
htmlspecialchars("<fn>") => htmlspecialchars("<fn>"), htmlspecialchars("<fn>") => htmlspecialchars("<fn>"),
"[ref]" => "[ref]", "[ref]" => "[ref]",
"userdefined" => __('user defined', MCI_Footnotes_Config::C_STR_PLUGIN_NAME) htmlspecialchars("<ref>") => htmlspecialchars("<ref>"),
htmlspecialchars("<!--n>") => htmlspecialchars("<!--n>"),
// 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 end of the footnotes short code // footnotes end tag short code options:
$l_arr_ShortCodeEnd = array( $l_arr_ShortCodeEnd = array(
"))" => "))", "))" => "))",
")))" => ")))",
"}}" => "}}",
"}}}" => "}}}",
"[/n]" => "[/n]",
"[/fn]" => "[/fn]",
htmlspecialchars("</fn>") => htmlspecialchars("</fn>"), htmlspecialchars("</fn>") => htmlspecialchars("</fn>"),
"[/ref]" => "[/ref]", "[/ref]" => "[/ref]",
"userdefined" => __('user defined', MCI_Footnotes_Config::C_STR_PLUGIN_NAME) htmlspecialchars("</ref>") => htmlspecialchars("</ref>"),
); htmlspecialchars("<n-->") => htmlspecialchars("<n-->"),
// options for the counter style of the footnotes // Custom (user-defined) start and end tags bracketing the footnote text inline:
$l_arr_CounterStyle = array( "userdefined" => __('custom short code', MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
"arabic_plain" => __("Arabic Numbers - Plain", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "1, 2, 3, 4, 5, ...",
"arabic_leading" => __("Arabic Numbers - Leading 0", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "01, 02, 03, 04, 05, ...",
"latin_low" => __("Latin Character - lower case", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "a, b, c, d, e, ...",
"latin_high" => __("Latin Character - upper case", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "A, B, C, D, E, ...",
"romanic" => __("Roman Numerals", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "I, II, III, IV, V, ..."
); );
// load template file // load template file
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-styling"); $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-start-end");
// replace all placeholders // replace all placeholders
$l_obj_Template->replace( $l_obj_Template->replace(
array( array(
@ -283,12 +313,58 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
"short-code-start-user-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED, "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, "short-code-end-user-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED,
"label-counter-style" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE, __("Counter style:", 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 = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
// 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), "counter-style" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE, $l_arr_CounterStyle),
// algorithmically combine identicals: // 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)), "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), "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),
"description1-identical" => __("Even when footnotes are combined, footnote numbers keep incrementing.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"description2-identical" => __("This avoids suboptimal referrer and backlink disambiguation using a secondary numbering system.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"description3-identical" => __("Repeating the content is 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() {
// 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)), "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), "scroll-offset" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET, 0, 100),
@ -309,17 +385,31 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @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() { public function Love() {
// options for the positioning of the reference container // options for the acknowledgment display in the footer:
$l_arr_Love = array( $l_arr_Love = array(
// I love Footnotes // logo only:
"text-1" => sprintf(__('I %s %s', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_LOVE_SYMBOL, MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME),
"text-2" => sprintf(__('This site uses the awesome %s Plugin.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME),
// logo only
"text-3" => sprintf('%s', MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME), "text-3" => sprintf('%s', MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME),
"random" => __('random-driven display of either variant', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), // logo followed by heart symbol:
"no" => sprintf(__("no display of any “%s %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) "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 // load template file
@ -330,7 +420,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
"label-love" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE, sprintf(__("Tell the world youre using %s:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME)), "label-love" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE, sprintf(__("Tell the world youre 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), "love" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE, $l_arr_Love),
"label-no-love" => $this->addText(sprintf(__("Dont tell the world youre using %s on specific pages by adding the following short code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME)), "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) "no-love" => $this->addText(MCI_Footnotes_Config::C_STR_NO_LOVE_SLUG)
) )
); );
@ -339,12 +429,16 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
} }
/** /**
* Displays all settings that are not grouped in special meta boxes. * Displays the excerpt setting
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
*
* Edited heading 2020-12-12T1453+0100
* @since 2.1.1 more settings and notices
* @since 2.2.0 dedicated to the excerpt setting and its notices 2020-12-12T1454+0100
*/ */
public function Other() { public function Excerpts() {
// options for Yes/No select box: // options for Yes/No select box:
$l_arr_Enabled = array( $l_arr_Enabled = array(
"yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
@ -352,22 +446,16 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
); );
// load template file // load template file
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-other"); $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-excerpts");
// replace all placeholders // replace all placeholders
$l_obj_Template->replace( $l_obj_Template->replace(
array( array(
"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)), "label-excerpts" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT, __("Display footnotes in excerpts:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"url-wrap" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTE_URL_WRAP_ENABLED, $l_arr_Enabled), "excerpts" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT, $l_arr_Enabled),
"notice-url-wrap" => __("Unicode-conformant browsers dont need this fix.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "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.
"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)), "description1-excerpts" => sprintf(__("In some themes, the %s plugin is indispensable to display footnotes in excerpts.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), '<a href="https://wordpress.org/plugins/advanced-excerpt/" target="_blank">Advanced Excerpt</a>'),
"link" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_LINK_ELEMENT_ENABLED, $l_arr_Enabled), "description2-excerpts" => __("Footnotes cannot be disabled in excerpts. A workaround is to avoid footnotes in the first 55&nbsp;words.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"label-excerpt" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT, __("Display footnotes in excerpts:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"excerpt" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT, $l_arr_Enabled),
"notice1-excerpt" => __("This should be disabled.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"notice2-excerpt" => __("In some themes, the Advanced Excerpt plugin is indispensable to display footnotes in excerpts.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"notice3-excerpt" => __("Footnotes cannot be disabled in excerpts. A workaround is to avoid footnotes in the first 55&nbsp;words.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
) )
); );
// display template with replaced placeholders // display template with replaced placeholders
@ -375,10 +463,14 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
} }
/** /**
* Displays all settings for the footnotes Superscript. * Displays all settings for the footnote referrers
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @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() { public function Superscript() {
// options for Yes/No select box: // options for Yes/No select box:
@ -391,14 +483,18 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
// replace all placeholders // replace all placeholders
$l_obj_Template->replace( $l_obj_Template->replace(
array( array(
"label-superscript" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS, __("Enable superscript for footnote referrers:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "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), "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, __("Before the footnote referrer:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "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), "before" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE),
"label-after" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER, __("After the footnote referrer:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "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) "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)),
"link" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_LINK_ELEMENT_ENABLED, $l_arr_Enabled),
"notice-link" => __("The link element is needed to apply the themes link color.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
) )
); );
// display template with replaced placeholders // display template with replaced placeholders
@ -410,8 +506,11 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.2 * @since 1.5.2
*
* Edited:
* @since 2.2.0 3 parts to address increased settings number
*/ */
public function MouseOverBox() { public function MouseOverBoxDisplay() {
// options for Yes/No select box: // options for Yes/No select box:
$l_arr_Enabled = array( $l_arr_Enabled = array(
"yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
@ -419,53 +518,33 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
); );
// options for the Mouse-over box position // options for the Mouse-over box position
$l_arr_Position = array( $l_arr_Position = array(
"top left" => __("top left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "top left" => __("top left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"top center" => __("top center", 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), "top right" => __("top right", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"center right" => __("center 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 right" => __("bottom right", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"bottom center" => __("bottom center", 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), "bottom left" => __("bottom left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"center left" => __("center left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) "center left" => __("center left", 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 // load template file
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-mouse-over-box"); $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "mouse-over-box-display");
// replace all placeholders // replace all placeholders
$l_obj_Template->replace( $l_obj_Template->replace(
array( array(
// tooltip settings: "label-enable" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, __("Display tooltips:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"label-enable" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, __("Enable the tooltip infobox:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, $l_arr_Enabled), "enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, $l_arr_Enabled),
"label-alternative" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, __("Use alternative tooltip implementation:", 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), "alternative" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE, $l_arr_Enabled),
"notice-alternative" => __("Intended to work around a tooltip outage.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"label-activate-excerpt" => $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)),
"activate-excerpt" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, $l_arr_Enabled),
"label-excerpt-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)),
"excerpt-length" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH, 3, 10000),
"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),
"label-position" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, __("Position:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "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" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, $l_arr_Position),
"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)), "label-offset-x" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, __("Horizontal offset rightwards:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"offset-x" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, -150, 150), "offset-x" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, -150, 150),
"notice-offset-x" => __("pixels; negative value for a leftwards offset", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "notice-offset-x" => __("pixels; negative value for a leftwards offset", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
@ -477,8 +556,6 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
"max-width" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, 0, 1280), "max-width" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH, 0, 1280),
"notice-max-width" => __("pixels; 0 to disable this setting", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "notice-max-width" => __("pixels; 0 to disable this setting", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
// display durations:
"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)), "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), "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), "notice-fade-in-delay" => __("milliseconds", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
@ -495,7 +572,62 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
"fade-out-duration" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION, 0, 20000), "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), "notice-fade-out-duration" => __("milliseconds", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
// tooltip styling: )
);
// 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),
"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 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)), "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-enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_MOUSE_OVER_BOX_FONT_SIZE_ENABLED, $l_arr_Enabled),
@ -553,11 +685,12 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
* *
* Edited: * Edited:
* 2.2.0 drop localized notices, list directly in the template 2020-12-09T1113+0100 * 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 * @see templates/dashboard/customize-css.html
* 2020-12-09T1113+0100
*/ */
public function CustomCSS() { public function CustomCSS() {
// load template file // load template file
@ -596,30 +729,30 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.5 * @since 1.5.5
* *
* Edited for: * Edited:
* 2.1.1 add priority level setting for the_content 2020-11-16T2152+0100 * @since 2.1.1 priority level setting for the_content 2020-11-16T2152+0100
* 2.1.4 add priority level settings for the other hooks 2020-11-19T1421+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: <https://github.com/Modernizr/Modernizr/issues/171>
* define -1 as PHP_INT_MAX instead
*/ */
public function lookupHooks() { public function LookupHooks() {
// load template file // load template file
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "expert-lookup"); $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "expert-lookup");
// replace all placeholders // replace all placeholders
// 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: <https://github.com/Modernizr/Modernizr/issues/171>
// define -1 as PHP_INT_MAX instead
$l_obj_Template->replace( $l_obj_Template->replace(
array( 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-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" => __("For the_content, this figure must be lower than 99 so that a string added by a plugin running at 99 may not be mistaken as a footnote.", 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.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 99),
"description-3" => __("This makes also sure that the reference container displays above a feature inserted by a plugin running at 1200.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "description-3" => sprintf(__('This makes also sure that the reference container displays above a feature inserted by a plugin running at %d.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 1200),
"description-4" => __("Default 9223372036854775807 is lowest priority, 0 is highest.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "description-4" => sprintf(__('%d is lowest priority, %d is highest.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), PHP_INT_MAX, 0),
"description-5" => __("To restore default priority, set to -1, interpreted as 9223372036854775807, the constant PHP_INT_MAX.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "description-5" => sprintf(__('To set priority level to lowest, set it to %d, interpreted as %d, the constant %s.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), -1, PHP_INT_MAX, 'PHP_INT_MAX'),
"description-6" => __("The widget_text hook must be disabled, because a footnotes container is inserted at the bottom of each widget, but multiple containers in a page are not disambiguated.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "description-6" => __('The widget_text hook must be disabled, because a footnotes container is inserted at the bottom of each widget, but multiple containers in a page are not disambiguated.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"head-hook" => __("WordPress hook function name", 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-checkbox" => __("Activate", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),

View file

@ -5,6 +5,9 @@
* @filesource * @filesource
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 12.09.14 10:56 * @since 1.5.0 12.09.14 10:56
*
* Edited:
* @since 2.2.0 2020-12-12T1223+0100
*/ */
/** /**
@ -15,74 +18,77 @@
*/ */
class MCI_Footnotes_Hooks { class MCI_Footnotes_Hooks {
/** /**
* Registers all WordPress hooks. * Registers all WordPress hooks.
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
*/ */
public static function registerHooks() { public static function registerHooks() {
register_activation_hook(dirname(__FILE__) . "/../footnotes.php", array("MCI_Footnotes_Hooks", "activatePlugin")); register_activation_hook(dirname(__FILE__) . "/../footnotes.php", array("MCI_Footnotes_Hooks", "activatePlugin"));
register_deactivation_hook(dirname(__FILE__) . "/../footnotes.php", array("MCI_Footnotes_Hooks", "deactivatePlugin")); register_deactivation_hook(dirname(__FILE__) . "/../footnotes.php", array("MCI_Footnotes_Hooks", "deactivatePlugin"));
register_uninstall_hook(dirname(__FILE__) . "/../footnotes.php", array("MCI_Footnotes_Hooks", "uninstallPlugin")); register_uninstall_hook(dirname(__FILE__) . "/../footnotes.php", array("MCI_Footnotes_Hooks", "uninstallPlugin"));
} }
/** /**
* Executed when the Plugin gets activated. * Executed when the Plugin gets activated.
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
*/ */
public static function activatePlugin() { public static function activatePlugin() {
// currently unused // currently unused
} }
/** /**
* Executed when the Plugin gets deactivated. * Executed when the Plugin gets deactivated.
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
*/ */
public static function deactivatePlugin() { public static function deactivatePlugin() {
// currently unused // currently unused
} }
/** /**
* Executed when the Plugin gets uninstalled. * Executed when the Plugin gets uninstalled.
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
*/ *
public static function uninstallPlugin() { * Edit: ClearAll didnt actually work.
// WordPress User has to be logged in * @since 2.2.0 this function is not called any longer when deleting the plugin
if (!is_user_logged_in()) { */
wp_die(__('You must be logged in to run this script.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME)); public static function uninstallPlugin() {
} // WordPress User has to be logged in
// WordPress User needs the permission to (un)install plugins if (!is_user_logged_in()) {
if (!current_user_can('install_plugins')) { wp_die(__('You must be logged in to run this script.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME));
wp_die(__('You do not have permission to run this script.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME)); }
} // WordPress User needs the permission to (un)install plugins
// deletes all settings and restore the default values if (!current_user_can('install_plugins')) {
MCI_Footnotes_Settings::instance()->ClearAll(); wp_die(__('You do not have permission to run this script.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME));
} }
// deletes all settings and restore the default values
// MCI_Footnotes_Settings::instance()->ClearAll();
}
/** /**
* Add Links to the Plugin in the "installed Plugins" page. * Add Links to the Plugin in the "installed Plugins" page.
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
* @param array $p_arr_Links Current Links. * @param array $p_arr_Links Current Links.
* @param string $p_str_PluginFileName Plugins init file name. * @param string $p_str_PluginFileName Plugins init file name.
* @return array * @return array
*/ */
public static function PluginLinks($p_arr_Links, $p_str_PluginFileName) { public static function PluginLinks($p_arr_Links, $p_str_PluginFileName) {
// append link to the WordPress Plugin page // append link to the WordPress Plugin page
$p_arr_Links[] = sprintf('<a href="http://wordpress.org/support/plugin/footnotes" target="_blank">%s</a>', __('Support', MCI_Footnotes_Config::C_STR_PLUGIN_NAME)); $p_arr_Links[] = sprintf('<a href="http://wordpress.org/support/plugin/footnotes" target="_blank">%s</a>', __('Support', MCI_Footnotes_Config::C_STR_PLUGIN_NAME));
// append link to the Settings page // append link to the Settings page
$p_arr_Links[] = sprintf('<a href="%s">%s</a>', admin_url('admin.php?page=mfmmf-footnotes'), __('Settings', MCI_Footnotes_Config::C_STR_PLUGIN_NAME)); $p_arr_Links[] = sprintf('<a href="%s">%s</a>', admin_url('admin.php?page=mfmmf-footnotes'), __('Settings', MCI_Footnotes_Config::C_STR_PLUGIN_NAME));
// append link to the PlayPal Donate function // append link to the PlayPal Donate function
$p_arr_Links[] = sprintf('<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6Z6CZDW8PPBBJ" target="_blank">%s</a>', __('Donate', MCI_Footnotes_Config::C_STR_PLUGIN_NAME)); $p_arr_Links[] = sprintf('<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6Z6CZDW8PPBBJ" target="_blank">%s</a>', __('Donate', MCI_Footnotes_Config::C_STR_PLUGIN_NAME));
// return new links // return new links
return $p_arr_Links; return $p_arr_Links;
} }
} }

View file

@ -159,28 +159,28 @@ class MCI_Footnotes {
// not use '-css' in the handle, is appended automatically; // not use '-css' in the handle, is appended automatically;
// constant FOOTNOTES_VERSION defined in footnotes.php, media all is default // constant FOOTNOTES_VERSION defined in footnotes.php, media all is default
wp_enqueue_style( wp_enqueue_style(
'mci-footnotes-public', 'mci-footnotes-public',
plugins_url( plugins_url(
MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/public.css' MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/public.css'
), ),
array(), array(),
FOOTNOTES_VERSION, FOOTNOTES_VERSION,
'all' 'all'
); );
// optional layout fix by lack of layout support: // optional layout fix by lack of layout support:
// since 2.1.4 2020-12-05T1417+0100 // since 2.1.4 2020-12-05T1417+0100
$l_str_LayoutOption = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT); $l_str_LayoutOption = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_PAGE_LAYOUT_SUPPORT);
if ($l_str_LayoutOption != 'none') { if ($l_str_LayoutOption != 'none') {
wp_enqueue_style( wp_enqueue_style(
'mci-footnotes-layout-' . $l_str_LayoutOption, 'mci-footnotes-layout-' . $l_str_LayoutOption,
plugins_url( plugins_url(
MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/layout-' . $l_str_LayoutOption . '.css' MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/css/layout-' . $l_str_LayoutOption . '.css'
), ),
array(), array(),
FOOTNOTES_VERSION, FOOTNOTES_VERSION,
'all' 'all'
); );
} }
} }
} }

View file

@ -7,7 +7,9 @@
* *
* Edited for: * Edited for:
* 2.0.0 PHP-related bug fix thanks to MatKus (@matkus) 2020-10-26T1609+0100 * 2.0.0 PHP-related bug fix thanks to MatKus (@matkus) 2020-10-26T1609+0100
* 2.2.0 conform to WordPress plugin language file name scheme 2020-12-08T1931+0100 * 2.1.6 conform to WordPress plugin language file name scheme 2020-12-08T1931+0100
*
* Last modified: 2020-12-11T1449+0100
*/ */
/** /**
@ -65,7 +67,7 @@ class MCI_Footnotes_Language {
return load_plugin_textdomain( return load_plugin_textdomain(
MCI_Footnotes_Config::C_STR_PLUGIN_NAME, MCI_Footnotes_Config::C_STR_PLUGIN_NAME,
false, // This argument only fills the gap left by a deprecated argument (since WP2.7). false, // This argument only fills the gap left by a deprecated argument (since WP2.7).
MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/languages' // The plugin basedir is provided. MCI_Footnotes_Config::C_STR_PLUGIN_NAME . '/languages' // The plugin basedir is provided; trailing slash will be clipped.
); );
} }
} }

View file

@ -21,7 +21,7 @@
* 2.1.6 option to disable URL line wrapping 2020-12-09T1606+0100 * 2.1.6 option to disable URL line wrapping 2020-12-09T1606+0100
* 2.1.6 set default priority level of the_content to 98 2020-12-10T0447+0100 * 2.1.6 set default priority level of the_content to 98 2020-12-10T0447+0100
* *
* Last modified: 2020-12-10T0447+0100 * Last modified: 2020-12-12T1224+0100
*/ */
@ -145,8 +145,8 @@ class MCI_Footnotes_Settings {
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.5 * @since 1.5.5
* @var string * @var string
* *
* @since 2.1.6: this setting removed as irrelevant since priority level setting is permanently visible 2020-12-09T2107+0100 * @since 2.1.6: this setting removed as irrelevant since priority level setting is permanently visible 2020-12-09T2107+0100
*/ */
const C_BOOL_FOOTNOTES_EXPERT_MODE = "footnote_inputfield_enable_expert_mode"; const C_BOOL_FOOTNOTES_EXPERT_MODE = "footnote_inputfield_enable_expert_mode";
@ -466,10 +466,10 @@ class MCI_Footnotes_Settings {
/** /**
* Settings Container Key for URL wrap option * Settings Container Key for URL wrap option
* *
* This is made optional because it may cause issues when the regex catches too much; * This is made optional because it may cause issues when the regex catches too much;
* alongside the regex now contains a catch-all negative lookbehind excluding every URL * alongside the regex now contains a catch-all negative lookbehind excluding every URL
* preceded by '\w=.' * preceded by '\w=.'
* *
* @since 2.1.6 * @since 2.1.6
* @var bool * @var bool
@ -672,13 +672,12 @@ class MCI_Footnotes_Settings {
// empty should be interpreted as PHP_INT_MAX, but a numbox cannot be set to empty: // empty should be interpreted as PHP_INT_MAX, but a numbox cannot be set to empty:
// <https://github.com/Modernizr/Modernizr/issues/171> // <https://github.com/Modernizr/Modernizr/issues/171>
// define -1 as PHP_INT_MAX instead // define -1 as PHP_INT_MAX instead
self::C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL => PHP_INT_MAX, self::C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL => PHP_INT_MAX,
// Priority level of the_content as the only relevant one // Priority level of the_content as the only relevant one
// must be less than 99 because that is the level of Super Socializer, // must be less than 99 because social icons may yield scripts that
// and the Pinterest button code contains at least one instance of '((' // contain the strings '((' and '))', i.e. the default footnote start
// and one of '))', i.e. the default footnote start and end short codes, // and end short codes, causing issues with fake footnotes.
// causing an issue with two fake footnotes messing up the whole website.
self::C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL => 98, 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_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_TITLE_PRIORITY_LEVEL => PHP_INT_MAX,
@ -833,6 +832,9 @@ class MCI_Footnotes_Settings {
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
*
* Edit: This didnt actually work.
* @since 2.2.0 this function is not called any longer when deleting the plugin
*/ */
public function ClearAll() { public function ClearAll() {
// iterate through each Settings Container // iterate through each Settings Container

View file

@ -28,7 +28,7 @@
* 2.1.6 option to disable URL line wrapping 2020-12-09T1606+0100 * 2.1.6 option to disable URL line wrapping 2020-12-09T1606+0100
* 2.1.6 add catch-all exclusion to fix URL line wrapping 2020-12-09T1921+0100 * 2.1.6 add catch-all exclusion to fix URL line wrapping 2020-12-09T1921+0100
* *
* Last modified: 2020-12-10T1006+0100 * Last modified: 2020-12-11T1437+0100
*/ */
// If called directly, abort: // If called directly, abort:
@ -282,6 +282,9 @@ class MCI_Footnotes_Task {
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
*
* Edited:
* @since 2.2.0 more options 2020-12-11T0506+0100
*/ */
public function wp_footer() { public function wp_footer() {
if (MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "footer") { if (MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "footer") {
@ -294,22 +297,20 @@ class MCI_Footnotes_Task {
return; return;
} }
// set a hyperlink to the word "footnotes" in the Love slug // set a hyperlink to the word "footnotes" in the Love slug
$l_str_LinkedName = sprintf('<a href="http://wordpress.org/plugins/footnotes/" target="_blank" style="text-decoration:none;">%s</a>',MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME); $l_str_LinkedName = sprintf('<a href="https://wordpress.org/plugins/footnotes/" target="_blank" style="text-decoration:none;">%s</a>', MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME);
// get random love me text // get random love me text
if (strtolower($l_str_LoveMeIndex) == "random") { if (strtolower($l_str_LoveMeIndex) == "random") {
$l_str_LoveMeIndex = "text-" . rand(1,3); $l_str_LoveMeIndex = "text-" . rand(1,7);
} }
switch ($l_str_LoveMeIndex) { switch ($l_str_LoveMeIndex) {
case "text-1": // options named wrt backcompat, simplest is default:
$l_str_LoveMeText = sprintf(__('I %s %s', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_LOVE_SYMBOL, $l_str_LinkedName); 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;
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-2": case "text-4": $l_str_LoveMeText = sprintf('%s %s', $l_str_LinkedName, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL); break;
$l_str_LoveMeText = sprintf(__('this site uses the awesome %s Plugin', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), $l_str_LinkedName); case "text-5": $l_str_LoveMeText = sprintf('%s %s', MCI_Footnotes_Config::C_STR_LOVE_SYMBOL, $l_str_LinkedName); break;
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-3": case "text-7": $l_str_LoveMeText = sprintf(__('This website uses the %s plugin.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), $l_str_LinkedName); break;
default: case "text-3": default: $l_str_LoveMeText = sprintf('%s', $l_str_LinkedName); break;
$l_str_LoveMeText = sprintf(__('extra smooth %s', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), $l_str_LinkedName);
break;
} }
echo sprintf('<div style="text-align:center; color:#acacac;">%s</div>', $l_str_LoveMeText); echo sprintf('<div style="text-align:center; color:#acacac;">%s</div>', $l_str_LoveMeText);
} }
@ -518,7 +519,7 @@ class MCI_Footnotes_Task {
$l_str_FootnoteText = substr($p_str_Content, $l_int_PosStart + strlen($l_str_StartingTag), $l_int_Length - strlen($l_str_StartingTag)); $l_str_FootnoteText = substr($p_str_Content, $l_int_PosStart + strlen($l_str_StartingTag), $l_int_Length - strlen($l_str_StartingTag));
// fix line wrapping of URLs (hyperlinked or not) based on pattern, not link element, // fix line wrapping of URLs (hyperlinked or not) based on pattern, not link element,
// to prevent them from hanging out of the tooltip in non-Unicode-compliant user agents // to prevent them from hanging out of the tooltip in non-Unicode-compliant user agents.
// spare however values of the href and the src arguments! // spare however values of the href and the src arguments!
// Even ARIA labels may take an URL as value, so use \w=[\'"] as a catch-all 2020-12-10T1005+0100 // Even ARIA labels may take an URL as value, so use \w=[\'"] as a catch-all 2020-12-10T1005+0100
// see public.css // see public.css

View file

@ -5,6 +5,8 @@
* @filesource * @filesource
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 14.09.14 14:26 * @since 1.5.0 14.09.14 14:26
*
* Edited 2.2.0 2020-12-12T2131+0100
*/ */
@ -16,64 +18,68 @@
*/ */
class MCI_Footnotes_Widget_ReferenceContainer extends MCI_Footnotes_WidgetBase { class MCI_Footnotes_Widget_ReferenceContainer extends MCI_Footnotes_WidgetBase {
/** /**
* Returns an unique ID as string used for the Widget Base ID. * Returns an unique ID as string used for the Widget Base ID.
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
* @return string * @return string
*/ */
protected function getID() { protected function getID() {
return "footnotes_widget"; return "footnotes_widget";
} }
/** /**
* Returns the Public name of the Widget to be displayed in the Configuration page. * Returns the Public name of the Widget to be displayed in the Configuration page.
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
* @return string * @return string
*/ */
protected function getName() { protected function getName() {
return MCI_Footnotes_Config::C_STR_PLUGIN_NAME; return MCI_Footnotes_Config::C_STR_PLUGIN_NAME;
} }
/** /**
* Returns the Description of the child widget. * Returns the Description of the child widget.
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
* @return string * @return string
*/ *
protected function getDescription() { * Edit: curly quotes 2.2.0 2020-12-12T2130+0100
return __('The widget defines the position of the reference container if set to "widget area".', MCI_Footnotes_Config::C_STR_PLUGIN_NAME); */
} protected function getDescription() {
return __('The widget defines the position of the reference container if set to “widget area”.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME);
}
/** /**
* Outputs the Settings of the Widget. * Outputs the Settings of the Widget.
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
* @param mixed $instance * @param mixed $instance
* @return void * @return void
*/ *
public function form($instance) { * Edit: curly quotes 2.2.0 2020-12-12T2130+0100
echo __('The widget defines the position of the reference container if set to "widget area".', MCI_Footnotes_Config::C_STR_PLUGIN_NAME); */
} public function form($instance) {
echo __('The widget defines the position of the reference container if set to “widget area”.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME);
}
/** /**
* Outputs the Content of the Widget. * Outputs the Content of the Widget.
* *
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
* @param mixed $args * @param mixed $args
* @param mixed $instance * @param mixed $instance
*/ */
public function widget($args, $instance) { public function widget($args, $instance) {
global $g_obj_MCI_Footnotes; global $g_obj_MCI_Footnotes;
// reference container positioning is set to "widget area" // reference container positioning is set to "widget area"
if (MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "widget") { if (MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "widget") {
echo $g_obj_MCI_Footnotes->a_obj_Task->ReferenceContainer(); echo $g_obj_MCI_Footnotes->a_obj_Task->ReferenceContainer();
} }
} }
} }

View file

@ -5,9 +5,14 @@
* Created-Time: 16:21 * Created-Time: 16:21
* Since: 1.0 * Since: 1.0
* *
* Version: 2.2.0d6 * Version: 2.2.0d8
* *
* Last modified: 2020-12-10T1320+0100 * Classes added to public.css may be added to the
* list documenting CSS classes for Custom CSS if
* recommended for general use.
* List in templates/dashboard/customize-css.html
*
* Last modified: 2020-12-12T2203+0100
*/ */
@ -99,12 +104,11 @@ Classes:
.footnote_tooltip { .footnote_tooltip {
display: none; display: none;
z-index: 2147483647; z-index: 2147483647 !important;
cursor: auto; cursor: auto;
text-align: left; text-align: left;
padding: 12px; padding: 12px;
line-height: 1.2; line-height: 1.2;
/*font-size: inherit; moved to settings since 2.1.4 */
font-weight: normal; font-weight: normal;
font-style: normal; font-style: normal;
} }

View file

@ -5,9 +5,9 @@
* Created-Time: 16:21 * Created-Time: 16:21
* Since: 1.0 * Since: 1.0
* *
* Version: 2.2.0d6 * Version: 2.2.0d8
* *
* Last modified: 2020-12-10T1320+0100 * Last modified: 2020-12-12T2203+0100
*/ */
@ -182,22 +182,19 @@ IE doesnt support nth child, but these are not critical
white-space: nowrap; white-space: nowrap;
} }
/*
Other settings
*/
#settings_other tr td:nth-child(2) {
width: 30%;
}
/* /*
Custom CSS Custom CSS
Localized notices are dropped to ease translators task.
16 CSS classes are listed directly in the template 16 CSS classes are listed directly in the template
templates/dashboard/customize-css.html templates/dashboard/customize-css.html
Localized notices are dropped to ease translators task. </p> end tags are omitted per HTML5 standard, to improve
maintainability and readability of the source list.
<https://stackoverflow.com/questions/8460993/p-end-tag-p-is-not-needed-in-html>
The textarea has monospace font but no tab support. The textarea has monospace font, but no other features
helping edit CSS, as tab support and syntactic colors.
*/ */
#customize_css tr td:first-child { #customize_css tr td:first-child {
width: 44% !important; width: 44% !important;
@ -227,10 +224,18 @@ The textarea has monospace font but no tab support.
/************************************************************ /************************************************************
Notices Notices
span previously formatted as em element These spans were previously formatted using the em element.
but emphasis is not the correct semantics, But the intended semantics was not emphasis.
as it is rendered as bold in other scripts In locales using boldface to emphasize, the effect is the
so we need an explicit italic style: exact opposite of the intention.
So we must use spans with explicit italic font style.
Scripts not featuring italic fonts fall back to normal,
and that is just fine, as italic is only needed here for
scripts that do have italic, and failing to use it would
look weird.
since 2.1.4
*/ */
.footnotes_notice { .footnotes_notice {
font-style: italic; font-style: italic;
@ -239,12 +244,15 @@ so we need an explicit italic style:
/************************************************************ /************************************************************
Descriptions Descriptions
fullwidth div above or below settings tables: padded div above or below a settings table
Use case: more extensive information not fitting into a brief
notice after the end of the settings box.
*/ */
.footnotes_description { .footnotes_description {
padding: 0 10%; padding: 0 6%;
} }
.footnotes_description p { .footnotes_description p {
font-size: 1.4em; font-size: 1.2em;
font-style: italic; font-style: italic;
} }

View file

@ -4,12 +4,12 @@
Plugin URI: https://wordpress.org/plugins/footnotes/ Plugin URI: https://wordpress.org/plugins/footnotes/
Description: time to bring footnotes to your website! footnotes are known from offline publishing and everybody takes them for granted when reading a magazine. Description: time to bring footnotes to your website! footnotes are known from offline publishing and everybody takes them for granted when reading a magazine.
Author: Mark Cheret Author: Mark Cheret
Version: 2.2.0d6 Version: 2.2.0d8
Author URI: http://cheret.de/plugins/footnotes-2/ Author URI: http://cheret.de/plugins/footnotes-2/
Text Domain: footnotes Text Domain: footnotes
Domain Path: /languages Domain Path: /languages
*/ */
define( 'FOOTNOTES_VERSION', '2.2.0d6' ); define( 'FOOTNOTES_VERSION', '2.2.0d8' );
/* /*
Copyright 2020 Mark Cheret (email: mark@cheret.de) Copyright 2020 Mark Cheret (email: mark@cheret.de)

View file

@ -1,5 +1,8 @@
/** /**
* Created by Stefan on 24.05.14. * Created by Stefan on 24.05.14.
*
*
* Edit: be careful to maintain version number near EOF 2020-12-11T1225+0100
*/ */
(function() { (function() {
@ -57,18 +60,20 @@
* The current keys are longname, author, authorurl, infourl and version. * The current keys are longname, author, authorurl, infourl and version.
* *
* @return {Object} Name/value array containing information about the plugin. * @return {Object} Name/value array containing information about the plugin.
*
* Edit: needs update the version number manually 2020-12-11T1224+0100
*/ */
getInfo : function() { getInfo : function() {
return { return {
longname : 'Inserts the Footnotes short code.', longname : 'Inserts the Footnotes short code.',
author : 'Mark Cheret', author : 'Mark Cheret',
authorurl : 'https://cheret.de', authorurl : 'https://cheret.de',
infourl : 'http://wordpress.org/plugins/footnotes/', infourl : 'https://wordpress.org/plugins/footnotes/',
version : "2.0.0" version : "2.1.6"
}; };
} }
}); });
// Register plugin // Register plugin
tinymce.PluginManager.add('footnotes', tinymce.plugins.Footnotes); tinymce.PluginManager.add('footnotes', tinymce.plugins.Footnotes);
})(); })();

View file

@ -2,7 +2,7 @@
Contributors: mark.cheret, lolzim, pewgeuges, dartiss Contributors: mark.cheret, lolzim, pewgeuges, dartiss
Tags: footnote, footnotes, bibliography, formatting, notes, Post, posts, reference, referencing Tags: footnote, footnotes, bibliography, formatting, notes, Post, posts, reference, referencing
Requires at least: 3.9 Requires at least: 3.9
Tested up to: 5.5 Tested up to: 5.6
Requires PHP: 5.6 Requires PHP: 5.6
Stable Tag: 2.1.6 Stable Tag: 2.1.6
License: GPLv3 or later License: GPLv3 or later
@ -80,21 +80,33 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest**
== Changelog == == Changelog ==
= 2.2.0d6 = = 2.2.0d7 =
- Add: Start/end short codes: more predefined options
- Add: Numbering styles: lowercase Roman numerals support
- Update: Dashboard: Tooltip settings: grouped into 3 thematic containers
- Update: Dashboard: Main settings: grouped into 3 specific containers
- Update: Dashboard: moved link element option to the Referrers options
- Update: Dashboard: moved URL wrap option to the Reference container options
- Update: Dashboard: grouped both Custom CSS and priority level settings
- Update: Dashboard: renamed tabs
- Bugfix: Tooltips: add 'important' property to z-index to fix display overlay issue
- Bugfix: Localization: correct arguments for plugin textdomain load function - Bugfix: Localization: correct arguments for plugin textdomain load function
- Update: Priority levels: update the notice in the dashboard Priority tab
- Bugfix: Reference container, tooltips: URL wrap: specifically catch the quotation mark
- Add: Footnotes mention in the footer: more options
= 2.1.6 = = 2.1.6 =
- Bugfix: Priority levels: set the_content priority level to 98 to prevent plugin conflict - Bugfix: Priority levels: set the_content priority level to 98 to prevent plugin conflict
- Bugfix: Tooltips: set z-index to maximum 2147483647 to address display issues with overlay content - Bugfix: Tooltips: set z-index to maximum 2147483647 to address display issues with overlay content
- Bugfix: Reference container, tooltips: fix issues with URL wrap span by catch-all negative lookbehind - Bugfix: Reference container, tooltips: URL wrap: fix issues with span by catch-all negative lookbehind
- Bugfix: Reference container, tooltips: add option to disable URL line wrapping added for browser support - Bugfix: Dashboard: URL wrap: add option to properly enable/disable URL wrap
- Update: Dashboard: reorder tabs and update tab labels - Update: Dashboard: reorder tabs and update tab labels
- Bugfix: Dashboard: remove Expert mode enable setting since permanently enabled as 'Priority' - Bugfix: Dashboard: remove Expert mode enable setting since permanently enabled as 'Priority'
- Bugfix: Dashboard: fix punctuation-related localization issue by including colon in labels - Bugfix: Dashboard: fix punctuation-related localization issue by including colon in labels
- Bugfix: Localization: conform to WordPress plugin language file name scheme - Bugfix: Localization: conform to WordPress plugin language file name scheme
= 2.1.5 = = 2.1.5 =
- Bugfix: Reference container, tooltips: exclude image source too from URL line wrapping span - Bugfix: Reference container, tooltips: URL wrap: exclude image source too
= 2.1.4 = = 2.1.4 =
- Add: Dashboard: Main settings: add settings for scroll offset and duration - Add: Dashboard: Main settings: add settings for scroll offset and duration

View file

@ -2,7 +2,7 @@
<tbody> <tbody>
<tr> <tr>
<td><span>[[headline]]</span><br /> <td><span>[[headline]]</span><br />
<div class="list"> <div class="list">
<p>.footnote_referrer = enclosing &lt;span> <p>.footnote_referrer = enclosing &lt;span>
<p>.footnote_plugin_tooltip_text = inner &lt;sup>, not tooltip <p>.footnote_plugin_tooltip_text = inner &lt;sup>, not tooltip
<p> <p>
@ -22,8 +22,8 @@
<p>.footnote_backlink = &lt;a> or &lt;span> if identical footnotes are combined, or in second &lt;td> in 3-column table <p>.footnote_backlink = &lt;a> or &lt;span> if identical footnotes are combined, or in second &lt;td> in 3-column table
<p>.footnote_index_arrow = nested &lt;span>, symbol only <p>.footnote_index_arrow = nested &lt;span>, symbol only
<p>.footnote_plugin_text = second &lt;td>, or third &lt;td> in 3-column table <p>.footnote_plugin_text = second &lt;td>, or third &lt;td> in 3-column table
</div> </div>
</td> </td>
<td>[[css]]</td> <td>[[css]]</td>
</tr> </tr>
</tbody> </tbody>

View file

@ -1,84 +0,0 @@
<table id="customize_mouse_over_box" class="widefat fixed">
<tbody>
<tr>
<td>[[label-enable]]</td>
<td>[[enable]]</td>
</tr>
<tr>
<td>[[label-alternative]]</td>
<td>[[alternative]]</td>
</tr>
<tr>
<td>[[label-activate-excerpt]]</td>
<td>[[activate-excerpt]]</td>
</tr>
<tr>
<td>[[label-excerpt-length]]</td>
<td>[[excerpt-length]]</td>
</tr>
<tr>
<td>[[label-readon]]</td>
<td>[[readon]]</td>
</tr>
<tr>
<td>[[label-position]]</td>
<td>[[position]]</td>
</tr>
<tr>
<td>[[label-offset-x]]</td>
<td>[[offset-x]] <span class="footnotes_notice">[[notice-offset-x]]</span></td>
</tr>
<tr>
<td>[[label-offset-y]]</td>
<td>[[offset-y]] <span class="footnotes_notice">[[notice-offset-y]]</span></td>
</tr>
<tr>
<td>[[label-max-width]]</td>
<td>[[max-width]] <span class="footnotes_notice">[[notice-max-width]]</span></td>
</tr>
<tr>
<td>[[label-fade-in-delay]]</td>
<td>[[fade-in-delay]] <span class="footnotes_notice">[[notice-fade-in-delay]]</span></td>
</tr>
<tr>
<td>[[label-fade-in-duration]]</td>
<td>[[fade-in-duration]] <span class="footnotes_notice">[[notice-fade-in-duration]]</span></td>
</tr>
<tr>
<td>[[label-fade-out-delay]]</td>
<td>[[fade-out-delay]] <span class="footnotes_notice">[[notice-fade-out-delay]]</span></td>
</tr>
<tr>
<td>[[label-fade-out-duration]]</td>
<td>[[fade-out-duration]] <span class="footnotes_notice">[[notice-fade-out-duration]]</span></td>
</tr>
<tr>
<td>[[label-font-size]]</td>
<td>[[font-size-enable]][[font-size-scalar]][[font-size-unit]] <span class="footnotes_notice">[[notice-font-size]]</span></td>
</tr>
<tr>
<td>[[label-color]]</td>
<td>[[color]] <span class="footnotes_notice">[[notice-color]]</span></td>
</tr>
<tr>
<td>[[label-background]]</td>
<td>[[background]] <span class="footnotes_notice">[[notice-background]]</span></td>
</tr>
<tr>
<td>[[label-border-width]]</td>
<td>[[border-width]] <span class="footnotes_notice">[[notice-border-width]]</span></td>
</tr>
<tr>
<td>[[label-border-color]]</td>
<td>[[border-color]] <span class="footnotes_notice">[[notice-border-color]]</span></td>
</tr>
<tr>
<td>[[label-border-radius]]</td>
<td>[[border-radius]] <span class="footnotes_notice">[[notice-border-radius]]</span></td>
</tr>
<tr>
<td>[[label-box-shadow-color]]</td>
<td>[[box-shadow-color]] <span class="footnotes_notice">[[notice-box-shadow-color]]</span></td>
</tr>
</tbody>
</table>

View file

@ -12,5 +12,9 @@
<td>[[label-after]]</td> <td>[[label-after]]</td>
<td>[[after]]</td> <td>[[after]]</td>
</tr> </tr>
<tr>
<td>[[label-link]]</td>
<td>[[link]] <span class="footnotes_notice">[[notice-link]]</span></td>
</tr>
</tbody> </tbody>
</table> </table>

View file

@ -0,0 +1,32 @@
<table id="mouse_over_box_appearance" class="widefat fixed">
<tbody>
<tr>
<td>[[label-font-size]]</td>
<td>[[font-size-enable]][[font-size-scalar]][[font-size-unit]] <span class="footnotes_notice">[[notice-font-size]]</span></td>
</tr>
<tr>
<td>[[label-color]]</td>
<td>[[color]] <span class="footnotes_notice">[[notice-color]]</span></td>
</tr>
<tr>
<td>[[label-background]]</td>
<td>[[background]] <span class="footnotes_notice">[[notice-background]]</span></td>
</tr>
<tr>
<td>[[label-border-width]]</td>
<td>[[border-width]] <span class="footnotes_notice">[[notice-border-width]]</span></td>
</tr>
<tr>
<td>[[label-border-color]]</td>
<td>[[border-color]] <span class="footnotes_notice">[[notice-border-color]]</span></td>
</tr>
<tr>
<td>[[label-border-radius]]</td>
<td>[[border-radius]] <span class="footnotes_notice">[[notice-border-radius]]</span></td>
</tr>
<tr>
<td>[[label-box-shadow-color]]</td>
<td>[[box-shadow-color]] <span class="footnotes_notice">[[notice-box-shadow-color]]</span></td>
</tr>
</tbody>
</table>

View file

@ -0,0 +1,44 @@
<table id="mouse_over_box_display" class="widefat fixed">
<tbody>
<tr>
<td>[[label-enable]]</td>
<td>[[enable]]</td>
</tr>
<tr>
<td>[[label-alternative]]</td>
<td>[[alternative]] <span class="footnotes_notice">[[notice-alternative]]</span></td>
</tr>
<tr>
<td>[[label-position]]</td>
<td>[[position]]</td>
</tr>
<tr>
<td>[[label-offset-x]]</td>
<td>[[offset-x]] <span class="footnotes_notice">[[notice-offset-x]]</span></td>
</tr>
<tr>
<td>[[label-offset-y]]</td>
<td>[[offset-y]] <span class="footnotes_notice">[[notice-offset-y]]</span></td>
</tr>
<tr>
<td>[[label-max-width]]</td>
<td>[[max-width]] <span class="footnotes_notice">[[notice-max-width]]</span></td>
</tr>
<tr>
<td>[[label-fade-in-delay]]</td>
<td>[[fade-in-delay]] <span class="footnotes_notice">[[notice-fade-in-delay]]</span></td>
</tr>
<tr>
<td>[[label-fade-in-duration]]</td>
<td>[[fade-in-duration]] <span class="footnotes_notice">[[notice-fade-in-duration]]</span></td>
</tr>
<tr>
<td>[[label-fade-out-delay]]</td>
<td>[[fade-out-delay]] <span class="footnotes_notice">[[notice-fade-out-delay]]</span></td>
</tr>
<tr>
<td>[[label-fade-out-duration]]</td>
<td>[[fade-out-duration]] <span class="footnotes_notice">[[notice-fade-out-duration]]</span></td>
</tr>
</tbody>
</table>

View file

@ -0,0 +1,16 @@
<table id="mouse_over_box_truncation" class="widefat fixed">
<tbody>
<tr>
<td>[[label-truncation]]</td>
<td>[[truncation]]</td>
</tr>
<tr>
<td>[[label-max-length]]</td>
<td>[[max-length]]</td>
</tr>
<tr>
<td>[[label-readon]]</td>
<td>[[readon]]</td>
</tr>
</tbody>
</table>

View file

@ -0,0 +1,11 @@
<table id="settings_excerpts" class="widefat fixed">
<tbody>
<tr>
<td>[[label-excerpts]]</td>
<td>[[excerpts]] <span class="footnotes_notice">[[notice-excerpts]]</span></td>
</tr>
</tbody>
</table>
<div class="footnotes_description">
<p>[[description1-excerpts]] [[description2-excerpts]]</p>
</div>

View file

@ -0,0 +1,15 @@
<table id="settings_numbering" class="widefat fixed">
<tbody>
<tr>
<td>[[label-counter-style]]</td>
<td>[[counter-style]]</td>
</tr>
<tr>
<td>[[label-identical]]</td>
<td>[[identical]] <span class="footnotes_notice">[[notice-identical]]</span></td>
</tr>
</tbody>
</table>
<div class="footnotes_description">
<p>[[description1-identical]] [[description2-identical]] [[description3-identical]]</p>
</div>

View file

@ -1,19 +0,0 @@
<table id="settings_other" class="widefat fixed">
<tbody>
<tr>
<td>[[label-url-wrap]]</td>
<td>[[url-wrap]]<span class="footnotes_notice"> [[notice-url-wrap]]</span></td>
</tr>
<tr>
<td>[[label-link]]</td>
<td>[[link]]</td>
</tr>
<tr>
<td>[[label-excerpt]]</td>
<td>[[excerpt]]<span class="footnotes_notice"> [[notice1-excerpt]]</span></td>
</tr>
</tbody>
</table>
<div class="footnotes_description">
<p>[[notice2-excerpt]] [[notice3-excerpt]]</p>
</div>

View file

@ -16,6 +16,10 @@
<td>[[label-page-layout]]</td> <td>[[label-page-layout]]</td>
<td>[[page-layout]] <span class="footnotes_notice">[[notice-page-layout]]</span></td> <td>[[page-layout]] <span class="footnotes_notice">[[notice-page-layout]]</span></td>
</tr> </tr>
<tr>
<td>[[label-url-wrap]]</td>
<td>[[url-wrap]] <span class="footnotes_notice">[[notice-url-wrap]]</span></td>
</tr>
<tr> <tr>
<td>[[label-startpage]]</td> <td>[[label-startpage]]</td>
<td>[[startpage]]</td> <td>[[startpage]]</td>
@ -78,7 +82,9 @@
</tr> </tr>
<tr> <tr>
<td>[[label-line-break]]</td> <td>[[label-line-break]]</td>
<td>[[line-break]]</td> <td>[[line-break]]
<span class="footnotes_notice">[[notice-line-break]]</span>
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View file

@ -0,0 +1,12 @@
<table id="settings_scrolling" class="widefat fixed">
<tbody>
<tr>
<td>[[label-scroll-offset]]</td>
<td>[[scroll-offset]] <span class="footnotes_notice">[[notice-scroll-offset]]</span></td>
</tr>
<tr>
<td>[[label-scroll-duration]]</td>
<td>[[scroll-duration]] <span class="footnotes_notice">[[notice-scroll-duration]]</span></td>
</tr>
</tbody>
</table>

View file

@ -14,22 +14,6 @@
<span>[[short-code-end-user]]</span> <span>[[short-code-end-user]]</span>
</td> </td>
</tr> </tr>
<tr>
<td>[[label-counter-style]]</td>
<td>[[counter-style]]</td>
</tr>
<tr>
<td>[[label-identical]]</td>
<td>[[identical]]</td>
</tr>
<tr>
<td>[[label-scroll-offset]]</td>
<td>[[scroll-offset]] <span class="footnotes_notice">[[notice-scroll-offset]]</span></td>
</tr>
<tr>
<td>[[label-scroll-duration]]</td>
<td>[[scroll-duration]] <span class="footnotes_notice">[[notice-scroll-duration]]</span></td>
</tr>
</tbody> </tbody>
</table> </table>
<script type="text/javascript"> <script type="text/javascript">