diff --git a/class/config.php b/class/config.php index 8f02119..cb9b7bd 100644 --- a/class/config.php +++ b/class/config.php @@ -1,74 +1,83 @@ -foot'; - - /** - * Public Plugin name for dashboard heading - * - * After properly displaying in dashboard headings until WPv5.4, the above started - * in WPv5.5 being torn apart as if the headline was text-align:justify and not - * the last line. That ugly display bug badly affected the plugin’s communication. - * The only working solution found so far is using position:fixed in one heading - * that isn’t translated, and dropping the logo in another, translatable heading. - * - * @since 2.0.4 - * @var string - */ - const C_STR_PLUGIN_HEADING_NAME = 'footnotes'; - - /** - * Html tag for the LOVE symbol. - * - * @since 1.5.0 - * @var string - */ - const C_STR_LOVE_SYMBOL = ''; - - /** - * HTML code for the 'love' symbol used in dashboard heading - * - * @since 2.0.4 - * @var string - */ - const C_STR_LOVE_SYMBOL_HEADING = ''; - - /** - * Short code to DON'T display the 'LOVE ME' slug on certain pages. - * - * @since 1.5.0 - * @var string - */ - const C_STR_NO_LOVE_SLUG = '[[no footnotes: love]]'; -} +foot'; + + /** + * Public Plugin name for dashboard heading + * + * After properly displaying in dashboard headings until WPv5.4, the above started + * in WPv5.5 being torn apart as if the headline was text-align:justify and not + * the last line. That ugly display bug badly affected the plugin’s communication. + * The only working solution found so far is using position:fixed in one heading + * that isn’t translated, and dropping the logo in another, translatable heading. + * + * @since 2.0.4 + * @var string + */ + const C_STR_PLUGIN_HEADING_NAME = 'footnotes'; + + /** + * Html tag for the LOVE symbol. + * + * @author Stefan Herndler + * @since 1.5.0 + * @var string + */ + const C_STR_LOVE_SYMBOL = ''; + + /** + * HTML code for the 'love' symbol used in dashboard heading + * + * @since 2.0.4 + * @var string + */ + const C_STR_LOVE_SYMBOL_HEADING = ''; + + /** + * Short code to DON'T display the 'LOVE ME' slug on certain pages. + * + * @author Stefan Herndler + * @since 1.5.0 + * @var string + */ + const C_STR_NO_LOVE_SLUG = '[[no footnotes: love]]'; +} diff --git a/class/convert.php b/class/convert.php index 3adb313..767d25c 100644 --- a/class/convert.php +++ b/class/convert.php @@ -1,223 +1,229 @@ - 26 ) { - // Increase offset and reduce counter. - $l_int_offset++; - $p_int_value -= 26; - } - // If offset set (more then Z), then add a new letter in front. - if ( $l_int_offset > 0 ) { - $l_str_return = chr( $l_int_offset + 64 ); - } - // Add the origin letter. - $l_str_return .= chr( $p_int_value + 64 ); - // Return the latin character representing the integer. - if ( $p_bool_upper_case ) { - return strtoupper( $l_str_return ); - } - return strtolower( $l_str_return ); - } - - /** - * Converts an integer to a leading-0 integer. - * - * @since 1.0-gamma - * @param int $p_int_value Value/Index to be converted. - * @return string Value with a leading zero. - */ - private static function to_arabic_leading( $p_int_value ) { - // Add a leading 0 if number lower then 10. - if ( $p_int_value < 10 ) { - return '0' . $p_int_value; - } - return $p_int_value; - } - - /** - * Converts an integer to a romanic letter. - * - * @since 1.0-gamma - * @param int $p_int_value Value/Index to be converted. - * @param bool $p_bool_upper_case Whether to uppercase. - * @return string - * - * Edited: - * @since 2.2.0 optionally lowercase (code from Latin) 2020-12-12T1538+0100 - */ - private static function to_romanic( $p_int_value, $p_bool_upper_case ) { - // Table containing all necessary romanic letters. - $l_arr_romanic_letters = array( - 'M' => 1000, - 'CM' => 900, - 'D' => 500, - 'CD' => 400, - 'C' => 100, - 'XC' => 90, - 'L' => 50, - 'XL' => 40, - 'X' => 10, - 'IX' => 9, - 'V' => 5, - 'IV' => 4, - 'I' => 1, - ); - // Return value. - $l_str_return = ''; - // Iterate through integer value until it is reduced to 0. - while ( $p_int_value > 0 ) { - foreach ( $l_arr_romanic_letters as $l_str_romanic => $l_int_arabic ) { - if ( $p_int_value >= $l_int_arabic ) { - $p_int_value -= $l_int_arabic; - $l_str_return .= $l_str_romanic; - break; - } - } - } - // Return romanic letters as string. - if ( $p_bool_upper_case ) { - return strtoupper( $l_str_return ); - } - return strtolower( $l_str_return ); - } - - /** - * Converts a string depending on its value to a boolean. - * - * @since 1.0-beta - * @param string $p_str_value String to be converted to boolean. - * @return bool Boolean representing the string. - */ - public static function to_bool( $p_str_value ) { - // Convert string to lower-case to make it easier. - $p_str_value = strtolower( $p_str_value ); - // Check if string seems to contain a "true" value. - switch ( $p_str_value ) { - case 'checked': - case 'yes': - case 'true': - case 'on': - case '1': - return true; - } - // Nothing found that says "true", so we return false. - return false; - } - - /** - * Get a html Array short code depending on Arrow-Array key index. - * - * @since 1.3.2 - * @param int $p_int_index Index representing the Arrow. If empty all Arrows are specified. - * @return array|string Array of all Arrows if Index is empty otherwise html tag of a specific arrow. - */ - public static function get_arrow( $p_int_index = -1 ) { - // Define all possible arrows. - $l_arr_arrows = array( '↑', '↥', '↟', '↩', '↲', '↵', '⇑', '⇡', '⇧', '↑' ); - // Convert index to an integer. - if ( ! is_int( $p_int_index ) ) { - $p_int_index = intval( $p_int_index ); - } - // Return the whole arrow array. - if ( $p_int_index < 0 || $p_int_index > count( $l_arr_arrows ) ) { - return $l_arr_arrows; - } - // Return a single arrow. - return $l_arr_arrows[ $p_int_index ]; - } - - // phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_var_dump - // phpcs:disable WordPress.PHP.DevelopmentFunctions.error_log_print_r - /** - * Displays a Variable. - * - * @since 1.5.0 - * @param mixed $p_mixed_value The variable to display. - * @return void - */ - public static function debug( $p_mixed_value ) { - if ( empty( $p_mixed_value ) ) { - var_dump( $p_mixed_value ); - - } elseif ( is_array( $p_mixed_value ) ) { - printf( '
' );
-			print_r( $p_mixed_value );
-			printf( '
' ); - - } elseif ( is_object( $p_mixed_value ) ) { - printf( '
' );
-			print_r( $p_mixed_value );
-			printf( '
' ); - - } elseif ( is_numeric( $p_mixed_value ) || is_int( $p_mixed_value ) ) { - var_dump( $p_mixed_value ); - - } elseif ( is_date( $p_mixed_value ) ) { - var_dump( $p_mixed_value ); - - } else { - var_dump( $p_mixed_value ); - } - echo '
'; - } - // phpcs:disable -} + 26) { + // increase offset and reduce counter + $l_int_Offset++; + $p_int_Value -= 26; + } + // if offset set (more then Z), then add a new letter in front + if ($l_int_Offset > 0) { + $l_str_Return = chr($l_int_Offset + 64); + } + // add the origin letter + $l_str_Return .= chr($p_int_Value + 64); + // return the latin character representing the integer + if ($p_bool_UpperCase) { + return strtoupper($l_str_Return); + } + return strtolower($l_str_Return); + } + + /** + * Converts an integer to a leading-0 integer. + * + * @author Stefan Herndler + * @since 1.0-gamma + * @param int $p_int_Value Value/Index to be converted. + * @return string Value with a leading zero. + */ + private static function toArabicLeading($p_int_Value) { + // add a leading 0 if number lower then 10 + if ($p_int_Value < 10) { + return "0" . $p_int_Value; + } + return $p_int_Value; + } + + /** + * Converts an integer to a romanic letter. + * + * @author Stefan Herndler + * @since 1.0-gamma + * @param int $p_int_Value Value/Index to be converted. + * @return string + * + * Edited: + * @since 2.2.0 optionally lowercase (code from Latin) 2020-12-12T1538+0100 + */ + private static function toRomanic($p_int_Value, $p_bool_UpperCase) { + // table containing all necessary romanic letters + $l_arr_RomanicLetters = array( + 'M' => 1000, + 'CM' => 900, + 'D' => 500, + 'CD' => 400, + 'C' => 100, + 'XC' => 90, + 'L' => 50, + 'XL' => 40, + 'X' => 10, + 'IX' => 9, + 'V' => 5, + 'IV' => 4, + 'I' => 1 + ); + // return value + $l_str_Return = ''; + // iterate through integer value until it is reduced to 0 + while ($p_int_Value > 0) { + foreach ($l_arr_RomanicLetters as $l_str_Romanic => $l_int_Arabic) { + if ($p_int_Value >= $l_int_Arabic) { + $p_int_Value -= $l_int_Arabic; + $l_str_Return .= $l_str_Romanic; + break; + } + } + } + // return romanic letters as string + if ($p_bool_UpperCase) { + return strtoupper($l_str_Return); + } + return strtolower($l_str_Return); + } + + /** + * Converts a string depending on its value to a boolean. + * + * @author Stefan Herndler + * @since 1.0-beta + * @param string $p_str_Value String to be converted to boolean. + * @return bool Boolean representing the string. + */ + public static function toBool($p_str_Value) { + // convert string to lower-case to make it easier + $p_str_Value = strtolower($p_str_Value); + // check if string seems to contain a "true" value + switch ($p_str_Value) { + case "checked": + case "yes": + case "true": + case "on": + case "1": + return true; + } + // nothing found that says "true", so we return false + return false; + } + + /** + * Get a html Array short code depending on Arrow-Array key index. + * + * @author Stefan Herndler + * @since 1.3.2 + * @param int $p_int_Index Index representing the Arrow. If empty all Arrows are specified. + * @return array|string Array of all Arrows if Index is empty otherwise html tag of a specific arrow. + */ + public static function getArrow($p_int_Index = -1) { + // define all possible arrows + $l_arr_Arrows = array("↑", "↥", "↟", "↩", "↲", "↵", "⇑", "⇡", "⇧", "↑"); + // convert index to an integer + if (!is_int($p_int_Index)) { + $p_int_Index = intval($p_int_Index); + } + // return the whole arrow array + if ($p_int_Index < 0 || $p_int_Index > count($l_arr_Arrows)) { + return $l_arr_Arrows; + } + // return a single arrow + return $l_arr_Arrows[$p_int_Index]; + } + + /** + * Displays a Variable. + * + * @author Stefan Herndler + * @since 1.5.0 + * @param mixed $p_mixed_Value + */ + public static function debug($p_mixed_Value) { + if (empty($p_mixed_Value)) { + var_dump($p_mixed_Value); + + } else if (is_array($p_mixed_Value)) { + printf("
");
+			print_r($p_mixed_Value);
+			printf("
"); + + } else if (is_object($p_mixed_Value)) { + printf("
");
+			print_r($p_mixed_Value);
+			printf("
"); + + } else if (is_numeric($p_mixed_Value) || is_int($p_mixed_Value)) { + var_dump($p_mixed_Value); + + } else if (is_date($p_mixed_Value)) { + var_dump($p_mixed_Value); + + } else { + var_dump($p_mixed_Value); + } + echo "
"; + } +} diff --git a/class/dashboard/init.php b/class/dashboard/init.php index b18e77c..2adbbbf 100644 --- a/class/dashboard/init.php +++ b/class/dashboard/init.php @@ -1,212 +1,212 @@ -a_arr_SubPageClasses[$l_obj_Class->getPriority()] = $l_obj_Class; - } - } - ksort($this->a_arr_SubPageClasses); - - // register hooks/actions - add_action('admin_init', array($this, 'initializeSettings')); - add_action('admin_menu', array($this, 'registerMainMenu')); - // register AJAX callbacks for Plugin information - add_action("wp_ajax_nopriv_footnotes_getPluginInfo", array($this, "getPluginMetaInformation")); - add_action("wp_ajax_footnotes_getPluginInfo", array($this, "getPluginMetaInformation")); - } - - /** - * Initializes all sub pages and registers the settings. - * - * @author Stefan Herndler - * @since 1.5.0 - */ - public function initializeSettings() { - MCI_Footnotes_Settings::instance()->RegisterSettings(); - // iterate though each sub class of the layout engine and register their sections - /** @var MCI_Footnotes_LayoutEngine $l_obj_LayoutEngineSubClass */ - foreach($this->a_arr_SubPageClasses as $l_obj_LayoutEngineSubClass) { - $l_obj_LayoutEngineSubClass->registerSections(); - } - } - - /** - * Registers the new main menu for the WordPress dashboard. - * Registers all sub menu pages for the new main menu. - * - * @author Stefan Herndler - * @since 1.5.0 - * @see http://codex.wordpress.org/Function_Reference/add_menu_page - */ - public function registerMainMenu() { - global $menu; - // iterate through each main menu - foreach($menu as $l_arr_MainMenu) { - // iterate through each main menu attribute - foreach($l_arr_MainMenu as $l_str_Attribute) { - // main menu already added, append sub pages and stop - if ($l_str_Attribute == self::C_STR_MAIN_MENU_SLUG) { - $this->registerSubPages(); - return; - } - } - } - - // add a new main menu page to the WordPress dashboard - add_menu_page( - self::C_STR_MAIN_MENU_TITLE, // page title - self::C_STR_MAIN_MENU_TITLE, // menu title - 'manage_options', // capability - self::C_STR_MAIN_MENU_SLUG, // menu slug - array($this, "displayOtherPlugins"), // function - plugins_url('footnotes/img/main-menu.png'), // icon url - null // position - ); - $this->registerSubPages(); - } - - /** - * Registers all SubPages for this Plugin. - * - * @author Stefan Herndler - * @since 1.5.0 - */ - private function registerSubPages() { - // first registered sub menu page MUST NOT contain a unique slug suffix - // iterate though each sub class of the layout engine and register their sub page - /** @var MCI_Footnotes_LayoutEngine $l_obj_LayoutEngineSubClass */ - foreach($this->a_arr_SubPageClasses as $l_obj_LayoutEngineSubClass) { - $l_obj_LayoutEngineSubClass->registerSubPage(); - } - } - - /** - * Displays other Plugins from the developers. - * - * @author Stefan Herndler - * @since 1.5.0 - */ - public function displayOtherPlugins() { - printf("

"); - // load template file - $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "manfisher"); - echo $l_obj_Template->getContent(); - - printf('visit Mark Cheret'); - printf("

"); - - printf(''); - } - - /** - * AJAX call. returns a JSON string containing meta information about a specific WordPress Plugin. - * - * @author Stefan Herndler - * @since 1.5.0 - */ - public function getPluginMetaInformation() { - // get plugin internal name from POST data - $l_str_PluginName = array_key_exists("plugin", $_POST) ? $_POST["plugin"] : null; - if (empty($l_str_PluginName)) { - echo json_encode(array("error" => "Plugin name invalid.")); - exit; - } - $l_str_Url = "https://api.wordpress.org/plugins/info/1.0/".$l_str_PluginName.".json"; - // call URL and collect data - $l_arr_Response = wp_remote_get($l_str_Url); - // check if response is valid - if (is_wp_error($l_arr_Response)) { - echo json_encode(array("error" => "Error receiving Plugin Information from WordPress.")); - exit; - } - if (!array_key_exists("body", $l_arr_Response)) { - echo json_encode(array("error" => "Error reading WordPress API response message.")); - exit; - } - // get the body of the response - $l_str_Response = $l_arr_Response["body"]; - // get plugin object - $l_arr_Plugin = json_decode($l_str_Response, true); - if (empty($l_arr_Plugin)) { - echo json_encode(array("error" => "Error reading Plugin meta information.
URL: " . $l_str_Url . "
Response: " . $l_str_Response)); - exit; - } - - $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_Stars = round(5 * $l_int_Rating / 100.0, 1); - - // return Plugin information as JSON encoded string - echo json_encode( - array( - "error" => "", - "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", - "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", - "PluginRating2" => $l_int_Stars >= 1.5 ? "star-full" : "star-empty", - "PluginRating3" => $l_int_Stars >= 2.5 ? "star-full" : "star-empty", - "PluginRating4" => $l_int_Stars >= 3.5 ? "star-full" : "star-empty", - "PluginRating5" => $l_int_Stars >= 4.5 ? "star-full" : "star-empty", - "PluginRating" => $l_int_NumRatings, - "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"] : "---" - ) - ); - exit; - } -} +a_arr_SubPageClasses[$l_obj_Class->getPriority()] = $l_obj_Class; + } + } + ksort($this->a_arr_SubPageClasses); + + // register hooks/actions + add_action('admin_init', array($this, 'initializeSettings')); + add_action('admin_menu', array($this, 'registerMainMenu')); + // register AJAX callbacks for Plugin information + add_action("wp_ajax_nopriv_footnotes_getPluginInfo", array($this, "getPluginMetaInformation")); + add_action("wp_ajax_footnotes_getPluginInfo", array($this, "getPluginMetaInformation")); + } + + /** + * Initializes all sub pages and registers the settings. + * + * @author Stefan Herndler + * @since 1.5.0 + */ + public function initializeSettings() { + MCI_Footnotes_Settings::instance()->RegisterSettings(); + // iterate though each sub class of the layout engine and register their sections + /** @var MCI_Footnotes_LayoutEngine $l_obj_LayoutEngineSubClass */ + foreach($this->a_arr_SubPageClasses as $l_obj_LayoutEngineSubClass) { + $l_obj_LayoutEngineSubClass->registerSections(); + } + } + + /** + * Registers the new main menu for the WordPress dashboard. + * Registers all sub menu pages for the new main menu. + * + * @author Stefan Herndler + * @since 1.5.0 + * @see http://codex.wordpress.org/Function_Reference/add_menu_page + */ + public function registerMainMenu() { + global $menu; + // iterate through each main menu + foreach($menu as $l_arr_MainMenu) { + // iterate through each main menu attribute + foreach($l_arr_MainMenu as $l_str_Attribute) { + // main menu already added, append sub pages and stop + if ($l_str_Attribute == self::C_STR_MAIN_MENU_SLUG) { + $this->registerSubPages(); + return; + } + } + } + + // add a new main menu page to the WordPress dashboard + add_menu_page( + self::C_STR_MAIN_MENU_TITLE, // page title + self::C_STR_MAIN_MENU_TITLE, // menu title + 'manage_options', // capability + self::C_STR_MAIN_MENU_SLUG, // menu slug + array($this, "displayOtherPlugins"), // function + plugins_url('footnotes/img/main-menu.png'), // icon url + null // position + ); + $this->registerSubPages(); + } + + /** + * Registers all SubPages for this Plugin. + * + * @author Stefan Herndler + * @since 1.5.0 + */ + private function registerSubPages() { + // first registered sub menu page MUST NOT contain a unique slug suffix + // iterate though each sub class of the layout engine and register their sub page + /** @var MCI_Footnotes_LayoutEngine $l_obj_LayoutEngineSubClass */ + foreach($this->a_arr_SubPageClasses as $l_obj_LayoutEngineSubClass) { + $l_obj_LayoutEngineSubClass->registerSubPage(); + } + } + + /** + * Displays other Plugins from the developers. + * + * @author Stefan Herndler + * @since 1.5.0 + */ + public function displayOtherPlugins() { + printf("

"); + // load template file + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "manfisher"); + echo $l_obj_Template->getContent(); + + printf('visit Mark Cheret'); + printf("

"); + + printf(''); + } + + /** + * AJAX call. returns a JSON string containing meta information about a specific WordPress Plugin. + * + * @author Stefan Herndler + * @since 1.5.0 + */ + public function getPluginMetaInformation() { + // get plugin internal name from POST data + $l_str_PluginName = array_key_exists("plugin", $_POST) ? $_POST["plugin"] : null; + if (empty($l_str_PluginName)) { + echo json_encode(array("error" => "Plugin name invalid.")); + exit; + } + $l_str_Url = "https://api.wordpress.org/plugins/info/1.0/".$l_str_PluginName.".json"; + // call URL and collect data + $l_arr_Response = wp_remote_get($l_str_Url); + // check if response is valid + if (is_wp_error($l_arr_Response)) { + echo json_encode(array("error" => "Error receiving Plugin Information from WordPress.")); + exit; + } + if (!array_key_exists("body", $l_arr_Response)) { + echo json_encode(array("error" => "Error reading WordPress API response message.")); + exit; + } + // get the body of the response + $l_str_Response = $l_arr_Response["body"]; + // get plugin object + $l_arr_Plugin = json_decode($l_str_Response, true); + if (empty($l_arr_Plugin)) { + echo json_encode(array("error" => "Error reading Plugin meta information.
URL: " . $l_str_Url . "
Response: " . $l_str_Response)); + exit; + } + + $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_Stars = round(5 * $l_int_Rating / 100.0, 1); + + // return Plugin information as JSON encoded string + echo json_encode( + array( + "error" => "", + "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", + "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", + "PluginRating2" => $l_int_Stars >= 1.5 ? "star-full" : "star-empty", + "PluginRating3" => $l_int_Stars >= 2.5 ? "star-full" : "star-empty", + "PluginRating4" => $l_int_Stars >= 3.5 ? "star-full" : "star-empty", + "PluginRating5" => $l_int_Stars >= 4.5 ? "star-full" : "star-empty", + "PluginRating" => $l_int_NumRatings, + "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"] : "---" + ) + ); + exit; + } +} diff --git a/class/dashboard/layout.php b/class/dashboard/layout.php index d16ad8b..57b63c9 100644 --- a/class/dashboard/layout.php +++ b/class/dashboard/layout.php @@ -1,552 +1,552 @@ - MCI_Footnotes_Config::C_STR_PLUGIN_NAME . "-" . $p_str_ID, "title" => $p_str_Title, "submit" => $p_bool_hasSubmitButton, "container" => $p_int_SettingsContainerIndex); - } - - /** - * Returns an array describing a meta box. - * - * @author Stefan Herndler - * @since 1.5.0 - * @param string $p_str_SectionID Parent Section ID. - * @param string $p_str_ID Unique ID suffix. - * @param string $p_str_Title Title for the meta box. - * @param string $p_str_CallbackFunctionName Class method name for callback. - * @return array meta box description to be able to append a meta box to the output. - */ - protected function addMetaBox($p_str_SectionID, $p_str_ID, $p_str_Title, $p_str_CallbackFunctionName) { - return array( - "parent" => MCI_Footnotes_Config::C_STR_PLUGIN_NAME . "-" . $p_str_SectionID, - "id" => $p_str_ID, - "title" => $p_str_Title, - "callback" => $p_str_CallbackFunctionName - ); - } - - /** - * Registers a sub page. - * - * @author Stefan Herndler - * @since 1.5.0 - */ - public function registerSubPage() { - global $submenu; - // any sub menu for our main menu exists - if (array_key_exists(plugin_basename(MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG), $submenu)) { - // iterate through all sub menu entries of the ManFisher main menu - foreach($submenu[plugin_basename(MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG)] as $l_arr_SubMenu) { - if ($l_arr_SubMenu[2] == plugin_basename(MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->getSubPageSlug())) { - // remove that sub menu and add it again to move it to the bottom - remove_submenu_page(MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG, MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG .$this->getSubPageSlug()); - } - } - } - - $this->a_str_SubPageHook = add_submenu_page( - MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG, // parent slug - $this->getSubPageTitle(), // page title - $this->getSubPageTitle(), // menu title - 'manage_options', // capability - MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->getSubPageSlug(), // menu slug - array($this, 'displayContent') // function - ); - } - - /** - * Registers all sections for a sub page. - * - * @author Stefan Herndler - * @since 1.5.0 - */ - public function registerSections() { - // iterate through each section - foreach($this->getSections() as $l_arr_Section) { - // append tab to the tab-array - $this->a_arr_Sections[$l_arr_Section["id"]] = $l_arr_Section; - add_settings_section( - $l_arr_Section["id"], // unique id - "", //$l_arr_Section["title"], // title - array($this, 'Description'), // callback function for the description - $l_arr_Section["id"] // parent sub page slug - ); - $this->registerMetaBoxes($l_arr_Section["id"]); - } - } - - /** - * Registers all Meta boxes for a sub page. - * - * @author Stefan Herndler - * @since 1.5.0 - * @param string $p_str_ParentID Parent section unique id. - */ - private function registerMetaBoxes($p_str_ParentID) { - // iterate through each meta box - foreach($this->getMetaBoxes() as $l_arr_MetaBox) { - if ($l_arr_MetaBox["parent"] != $p_str_ParentID) { - continue; - } - add_meta_box( - $p_str_ParentID. "-" . $l_arr_MetaBox["id"], // unique id - $l_arr_MetaBox["title"], // meta box title - array($this, $l_arr_MetaBox["callback"]), // callback function to display (echo) the content - $p_str_ParentID, // post type = parent section id - 'main' // context - ); - } - } - - /** - * Append javascript and css files for specific sub page. - * - * @author Stefan Herndler - * @since 1.5.0 - */ - private function appendScripts() { - // enable meta boxes layout and close functionality - wp_enqueue_script('postbox'); - // add WordPress color picker layout - wp_enqueue_style('wp-color-picker'); - // add WordPress color picker function - wp_enqueue_script('wp-color-picker'); - - - /** - * Registers and enqueues the dashboard stylesheet. - * - * - Bugfix: Stylesheets: minify to shrink the carbon footprint, increase speed and implement best practice, thanks to @docteurfitness issue report. - * - * @since 2.5.5 - * @date 2021-02-14T1928+0100 - * - * @reporter @docteurfitness - * @link https://wordpress.org/support/topic/simply-speed-optimisation/ - * - * See the public stylesheet enqueuing: - * @see class/init.php - * - * added version # after changes started to settings.css from 2.1.2 on. - * automated update of version number for cache busting. - * No need to use '-styles' in the handle, as '-css' is appended automatically. - */ - if ( C_BOOL_CSS_PRODUCTION_MODE === true ) { - - wp_register_style( 'mci-footnotes-admin', plugins_url( 'footnotes/css/settings.min.css' ), array(), C_STR_FOOTNOTES_VERSION ); - - } else { - - wp_register_style( 'mci-footnotes-admin', plugins_url( 'footnotes/css/settings.css' ), array(), C_STR_FOOTNOTES_VERSION ); - - } - - wp_enqueue_style('mci-footnotes-admin'); - } - - /** - * Displays the content of specific sub page. - * - * @author Stefan Herndler - * @since 1.5.0 - */ - public function displayContent() { - // register and enqueue scripts and styling - $this->appendScripts(); - // get current section - reset($this->a_arr_Sections); - $l_str_ActiveSectionID = isset($_GET['t']) ? $_GET['t'] : key($this->a_arr_Sections); - $l_arr_ActiveSection = $this->a_arr_Sections[$l_str_ActiveSectionID]; - // store settings - $l_bool_SettingsUpdated = false; - if (array_key_exists("save-settings", $_POST)) { - if ($_POST["save-settings"] == "save") { - unset($_POST["save-settings"]); - unset($_POST["submit"]); - $l_bool_SettingsUpdated = $this->saveSettings(); - } - } - - // display all sections and highlight the active section - echo '
'; - echo '
'; - - if ($l_bool_SettingsUpdated) { - echo sprintf('
%s
', __("Settings saved", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)); - } - - // form to submit the active section - echo '
'; - //settings_fields($l_arr_ActiveSection["container"]); - echo ''; - // outputs the settings field of the active section - do_settings_sections($l_arr_ActiveSection["id"]); - do_meta_boxes($l_arr_ActiveSection["id"], 'main', NULL); - - // add submit button to active section if defined - if ($l_arr_ActiveSection["submit"]) { - submit_button(); - } - // close the form to submit data - echo '
'; - // close container for the settings page - echo '
'; - // output special javascript for the expand/collapse function of the meta boxes - echo ''; - } - - /** - * Save all Plugin settings. - * - * @author Stefan Herndler - * @since 1.5.0 - * @return bool - */ - private function saveSettings() { - $l_arr_newSettings = array(); - // get current section - reset($this->a_arr_Sections); - $l_str_ActiveSectionID = isset($_GET['t']) ? $_GET['t'] : key($this->a_arr_Sections); - $l_arr_ActiveSection = $this->a_arr_Sections[$l_str_ActiveSectionID]; - - // iterate through each value that has to be in the specific container - foreach(MCI_Footnotes_Settings::instance()->getDefaults($l_arr_ActiveSection["container"]) as $l_str_Key => $l_mixed_Value) { - // setting is available in the POST array, use it - if (array_key_exists($l_str_Key, $_POST)) { - $l_arr_newSettings[$l_str_Key] = $_POST[$l_str_Key]; - } else { - // setting is not defined in the POST array, define it to avoid the Default value - $l_arr_newSettings[$l_str_Key] = ""; - } - } - // update settings - return MCI_Footnotes_Settings::instance()->saveOptions($l_arr_ActiveSection["container"], $l_arr_newSettings); - } - - /** - * Output the Description of a section. May be overwritten in any section. - * - * @author Stefan Herndler - * @since 1.5.0 - */ - public function Description() { - // default no description will be displayed - } - - /** - * Loads specific setting and returns an array with the keys [id, name, value]. - * - * @author Stefan Herndler - * @since 1.5.0 - * @param string $p_str_SettingKeyName Settings Array key name. - * @return array Contains Settings ID, Settings Name and Settings Value. - */ - protected function LoadSetting($p_str_SettingKeyName) { - // get current section - reset($this->a_arr_Sections); - $p_arr_Return = array(); - $p_arr_Return["id"] = sprintf('%s', $p_str_SettingKeyName); - $p_arr_Return["name"] = sprintf('%s', $p_str_SettingKeyName); - $p_arr_Return["value"] = esc_attr(MCI_Footnotes_Settings::instance()->get($p_str_SettingKeyName)); - return $p_arr_Return; - } - - /** - * Returns a line break to start a new line. - * - * @author Stefan Herndler - * @since 1.5.0 - * @return string - */ - protected function addNewline() { - return '
'; - } - - /** - * Returns a line break to have a space between two lines. - * - * @author Stefan Herndler - * @since 1.5.0 - * @return string - */ - protected function addLineSpace() { - return '

'; - } - - /** - * Returns a simple text inside html text. - * - * @author Stefan Herndler - * @since 1.5.0 - * @param string $p_str_Text Message to be surrounded with simple html tag (span). - * @return string - */ - protected function addText($p_str_Text) { - return sprintf('%s', $p_str_Text); - } - - /** - * Returns the html tag for an input/select label. - * - * @author Stefan Herndler - * @since 1.5.0 - * @param string $p_str_SettingName Name of the Settings key to connect the Label with the input/select field. - * @param string $p_str_Caption Label caption. - * @return string - * - * Edited 2020-12-01T0159+0100.. - * @since 2.1.6 no colon - */ - protected function addLabel($p_str_SettingName, $p_str_Caption) { - if (empty($p_str_Caption)) { - return ""; - } - // remove the colon causing localization issues with French, - // and with languages not using punctuation at all, - // and with languages using other punctuation marks instead of colon, - // e.g. Greek using a raised dot. - // In French, colon is preceded by a space, forcibly non-breaking, - // and narrow per new school. - // Add colon to label strings for inclusion in localization. - // Colon after label is widely preferred best practice, mandatory per style guides. - // - return sprintf('', $p_str_SettingName, $p_str_Caption); - // ^ here deleted colon 2020-12-08T1546+0100 - } - - /** - * Returns the html tag for an input [type = text]. - * - * @author Stefan Herndler - * @since 1.5.0 - * @param string $p_str_SettingName Name of the Settings key to pre load the input field. - * @param int $p_str_MaxLength Maximum length of the input, default 999 characters. - * @param bool $p_bool_Readonly Set the input to be read only, default false. - * @param bool $p_bool_Hidden Set the input to be hidden, default false. - * @return string - */ - protected function addTextBox($p_str_SettingName, $p_str_MaxLength = 999, $p_bool_Readonly = false, $p_bool_Hidden = false) { - $l_str_Style = ""; - // collect data for given settings field - $l_arr_Data = $this->LoadSetting($p_str_SettingName); - if ($p_bool_Hidden) { - $l_str_Style .= 'display:none;'; - } - return sprintf('', - $l_arr_Data["name"], $l_arr_Data["id"], $p_str_MaxLength, - $l_str_Style, $l_arr_Data["value"], $p_bool_Readonly ? 'readonly="readonly"' : ''); - } - - /** - * Returns the html tag for an input [type = checkbox]. - * - * @author Stefan Herndler - * @since 1.5.0 - * @param string $p_str_SettingName Name of the Settings key to pre load the input field. - * @return string - */ - protected function addCheckbox($p_str_SettingName) { - // collect data for given settings field - $l_arr_Data = $this->LoadSetting($p_str_SettingName); - return sprintf('', - $l_arr_Data["name"], $l_arr_Data["id"], - MCI_Footnotes_Convert::toBool($l_arr_Data["value"]) ? 'checked="checked"' : ''); - } - - /** - * Returns the html tag for a select box. - * - * @author Stefan Herndler - * @since 1.5.0 - * @param string $p_str_SettingName Name of the Settings key to pre select the current value. - * @param array $p_arr_Options Possible options to be selected. - * @return string - */ - protected function addSelectBox($p_str_SettingName, $p_arr_Options) { - // collect data for given settings field - $l_arr_Data = $this->LoadSetting($p_str_SettingName); - $l_str_Options = ""; - - /* loop through all array keys */ - foreach ($p_arr_Options as $l_str_Value => $l_str_Caption) { - $l_str_Options .= sprintf('', - $l_str_Value, - $l_arr_Data["value"] == $l_str_Value ? "selected" : "", - $l_str_Caption); - } - return sprintf('', - $l_arr_Data["name"], $l_arr_Data["id"], $l_str_Options); - } - - /** - * Returns the html tag for a text area. - * - * @author Stefan Herndler - * @since 1.5.0 - * @param string $p_str_SettingName Name of the Settings key to pre fill the text area. - * @return string - */ - protected function addTextArea($p_str_SettingName) { - // collect data for given settings field - $l_arr_Data = $this->LoadSetting($p_str_SettingName); - return sprintf('', - $l_arr_Data["name"], $l_arr_Data["id"], $l_arr_Data["value"]); - } - - /** - * Returns the html tag for an input [type = text] with color selection class. - * - * @author Stefan Herndler - * @since 1.5.6 - * @param string $p_str_SettingName Name of the Settings key to pre load the input field. - * @return string - */ - protected function addColorSelection($p_str_SettingName) { - // collect data for given settings field - $l_arr_Data = $this->LoadSetting($p_str_SettingName); - return sprintf('', - $l_arr_Data["name"], $l_arr_Data["id"], $l_arr_Data["value"]); - } - - /** - * Returns the html tag for an input [type = num]. - * - * @author Stefan Herndler - * @since 1.5.0 - * @param string $p_str_SettingName Name of the Settings key to pre load the input field. - * @param int $p_in_Min Minimum value. - * @param int $p_int_Max Maximum value. - * @param bool $p_bool_Deci true if 0.1 steps and floating to string, false if integer (default) - * @return string - * - * Edited: - * @since 2.1.4 step argument and number_format() to allow decimals 2020-12-03T0631+0100..2020-12-12T1110+0100 - */ - protected function addNumBox($p_str_SettingName, $p_in_Min, $p_int_Max, $p_bool_Deci = false ) { - // collect data for given settings field - $l_arr_Data = $this->LoadSetting($p_str_SettingName); - - if ($p_bool_Deci) { - $l_str_Value = number_format(floatval($l_arr_Data["value"]), 1); - return sprintf('', - $l_arr_Data["name"], $l_arr_Data["id"], $l_str_Value, $p_in_Min, $p_int_Max); - } else { - return sprintf('', - $l_arr_Data["name"], $l_arr_Data["id"], $l_arr_Data["value"], $p_in_Min, $p_int_Max); - } - } - -} // end of class + MCI_Footnotes_Config::C_STR_PLUGIN_NAME . "-" . $p_str_ID, "title" => $p_str_Title, "submit" => $p_bool_hasSubmitButton, "container" => $p_int_SettingsContainerIndex); + } + + /** + * Returns an array describing a meta box. + * + * @author Stefan Herndler + * @since 1.5.0 + * @param string $p_str_SectionID Parent Section ID. + * @param string $p_str_ID Unique ID suffix. + * @param string $p_str_Title Title for the meta box. + * @param string $p_str_CallbackFunctionName Class method name for callback. + * @return array meta box description to be able to append a meta box to the output. + */ + protected function addMetaBox($p_str_SectionID, $p_str_ID, $p_str_Title, $p_str_CallbackFunctionName) { + return array( + "parent" => MCI_Footnotes_Config::C_STR_PLUGIN_NAME . "-" . $p_str_SectionID, + "id" => $p_str_ID, + "title" => $p_str_Title, + "callback" => $p_str_CallbackFunctionName + ); + } + + /** + * Registers a sub page. + * + * @author Stefan Herndler + * @since 1.5.0 + */ + public function registerSubPage() { + global $submenu; + // any sub menu for our main menu exists + if (array_key_exists(plugin_basename(MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG), $submenu)) { + // iterate through all sub menu entries of the ManFisher main menu + foreach($submenu[plugin_basename(MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG)] as $l_arr_SubMenu) { + if ($l_arr_SubMenu[2] == plugin_basename(MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->getSubPageSlug())) { + // remove that sub menu and add it again to move it to the bottom + remove_submenu_page(MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG, MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG .$this->getSubPageSlug()); + } + } + } + + $this->a_str_SubPageHook = add_submenu_page( + MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG, // parent slug + $this->getSubPageTitle(), // page title + $this->getSubPageTitle(), // menu title + 'manage_options', // capability + MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->getSubPageSlug(), // menu slug + array($this, 'displayContent') // function + ); + } + + /** + * Registers all sections for a sub page. + * + * @author Stefan Herndler + * @since 1.5.0 + */ + public function registerSections() { + // iterate through each section + foreach($this->getSections() as $l_arr_Section) { + // append tab to the tab-array + $this->a_arr_Sections[$l_arr_Section["id"]] = $l_arr_Section; + add_settings_section( + $l_arr_Section["id"], // unique id + "", //$l_arr_Section["title"], // title + array($this, 'Description'), // callback function for the description + $l_arr_Section["id"] // parent sub page slug + ); + $this->registerMetaBoxes($l_arr_Section["id"]); + } + } + + /** + * Registers all Meta boxes for a sub page. + * + * @author Stefan Herndler + * @since 1.5.0 + * @param string $p_str_ParentID Parent section unique id. + */ + private function registerMetaBoxes($p_str_ParentID) { + // iterate through each meta box + foreach($this->getMetaBoxes() as $l_arr_MetaBox) { + if ($l_arr_MetaBox["parent"] != $p_str_ParentID) { + continue; + } + add_meta_box( + $p_str_ParentID. "-" . $l_arr_MetaBox["id"], // unique id + $l_arr_MetaBox["title"], // meta box title + array($this, $l_arr_MetaBox["callback"]), // callback function to display (echo) the content + $p_str_ParentID, // post type = parent section id + 'main' // context + ); + } + } + + /** + * Append javascript and css files for specific sub page. + * + * @author Stefan Herndler + * @since 1.5.0 + */ + private function appendScripts() { + // enable meta boxes layout and close functionality + wp_enqueue_script('postbox'); + // add WordPress color picker layout + wp_enqueue_style('wp-color-picker'); + // add WordPress color picker function + wp_enqueue_script('wp-color-picker'); + + + /** + * Registers and enqueues the dashboard stylesheet. + * + * - Bugfix: Stylesheets: minify to shrink the carbon footprint, increase speed and implement best practice, thanks to @docteurfitness issue report. + * + * @since 2.5.5 + * @date 2021-02-14T1928+0100 + * + * @reporter @docteurfitness + * @link https://wordpress.org/support/topic/simply-speed-optimisation/ + * + * See the public stylesheet enqueuing: + * @see class/init.php + * + * added version # after changes started to settings.css from 2.1.2 on. + * automated update of version number for cache busting. + * No need to use '-styles' in the handle, as '-css' is appended automatically. + */ + if ( C_BOOL_CSS_PRODUCTION_MODE === true ) { + + wp_register_style( 'mci-footnotes-admin', plugins_url( 'footnotes/css/settings.min.css' ), array(), C_STR_FOOTNOTES_VERSION ); + + } else { + + wp_register_style( 'mci-footnotes-admin', plugins_url( 'footnotes/css/settings.css' ), array(), C_STR_FOOTNOTES_VERSION ); + + } + + wp_enqueue_style('mci-footnotes-admin'); + } + + /** + * Displays the content of specific sub page. + * + * @author Stefan Herndler + * @since 1.5.0 + */ + public function displayContent() { + // register and enqueue scripts and styling + $this->appendScripts(); + // get current section + reset($this->a_arr_Sections); + $l_str_ActiveSectionID = isset($_GET['t']) ? $_GET['t'] : key($this->a_arr_Sections); + $l_arr_ActiveSection = $this->a_arr_Sections[$l_str_ActiveSectionID]; + // store settings + $l_bool_SettingsUpdated = false; + if (array_key_exists("save-settings", $_POST)) { + if ($_POST["save-settings"] == "save") { + unset($_POST["save-settings"]); + unset($_POST["submit"]); + $l_bool_SettingsUpdated = $this->saveSettings(); + } + } + + // display all sections and highlight the active section + echo '
'; + echo '
'; + + if ($l_bool_SettingsUpdated) { + echo sprintf('
%s
', __("Settings saved", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)); + } + + // form to submit the active section + echo '
'; + //settings_fields($l_arr_ActiveSection["container"]); + echo ''; + // outputs the settings field of the active section + do_settings_sections($l_arr_ActiveSection["id"]); + do_meta_boxes($l_arr_ActiveSection["id"], 'main', NULL); + + // add submit button to active section if defined + if ($l_arr_ActiveSection["submit"]) { + submit_button(); + } + // close the form to submit data + echo '
'; + // close container for the settings page + echo '
'; + // output special javascript for the expand/collapse function of the meta boxes + echo ''; + } + + /** + * Save all Plugin settings. + * + * @author Stefan Herndler + * @since 1.5.0 + * @return bool + */ + private function saveSettings() { + $l_arr_newSettings = array(); + // get current section + reset($this->a_arr_Sections); + $l_str_ActiveSectionID = isset($_GET['t']) ? $_GET['t'] : key($this->a_arr_Sections); + $l_arr_ActiveSection = $this->a_arr_Sections[$l_str_ActiveSectionID]; + + // iterate through each value that has to be in the specific container + foreach(MCI_Footnotes_Settings::instance()->getDefaults($l_arr_ActiveSection["container"]) as $l_str_Key => $l_mixed_Value) { + // setting is available in the POST array, use it + if (array_key_exists($l_str_Key, $_POST)) { + $l_arr_newSettings[$l_str_Key] = $_POST[$l_str_Key]; + } else { + // setting is not defined in the POST array, define it to avoid the Default value + $l_arr_newSettings[$l_str_Key] = ""; + } + } + // update settings + return MCI_Footnotes_Settings::instance()->saveOptions($l_arr_ActiveSection["container"], $l_arr_newSettings); + } + + /** + * Output the Description of a section. May be overwritten in any section. + * + * @author Stefan Herndler + * @since 1.5.0 + */ + public function Description() { + // default no description will be displayed + } + + /** + * Loads specific setting and returns an array with the keys [id, name, value]. + * + * @author Stefan Herndler + * @since 1.5.0 + * @param string $p_str_SettingKeyName Settings Array key name. + * @return array Contains Settings ID, Settings Name and Settings Value. + */ + protected function LoadSetting($p_str_SettingKeyName) { + // get current section + reset($this->a_arr_Sections); + $p_arr_Return = array(); + $p_arr_Return["id"] = sprintf('%s', $p_str_SettingKeyName); + $p_arr_Return["name"] = sprintf('%s', $p_str_SettingKeyName); + $p_arr_Return["value"] = esc_attr(MCI_Footnotes_Settings::instance()->get($p_str_SettingKeyName)); + return $p_arr_Return; + } + + /** + * Returns a line break to start a new line. + * + * @author Stefan Herndler + * @since 1.5.0 + * @return string + */ + protected function addNewline() { + return '
'; + } + + /** + * Returns a line break to have a space between two lines. + * + * @author Stefan Herndler + * @since 1.5.0 + * @return string + */ + protected function addLineSpace() { + return '

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

'; - $l_str_syntax_error_warning .= __( 'WARNING: unbalanced footnote start tag short code found.', 'footnotes' ); - $l_str_syntax_error_warning .= '

'; - - // Syntax validation setting in the dashboard under the General settings tab. - /* Translators: 1: General Settings 2: Footnote start and end short codes 3: Check for balanced shortcodes */ - $l_str_syntax_error_warning .= sprintf( __( 'If this warning is irrelevant, please disable the syntax validation feature in the dashboard under %1$s > %2$s > %3$s.', 'footnotes' ), __( 'General settings', 'footnotes' ), __( 'Footnote start and end short codes', 'footnotes' ), __( 'Check for balanced shortcodes', 'footnotes' ) ); - - $l_str_syntax_error_warning .= '

'; - $l_str_syntax_error_warning .= __( 'Unbalanced start tag short code found before:', 'footnotes' ); - $l_str_syntax_error_warning .= '

“'; - $l_str_syntax_error_warning .= $l_str_error_spot_string; - $l_str_syntax_error_warning .= '”

'; - - // Prepend the warning box to the content. - $p_str_content = $l_str_syntax_error_warning . $p_str_content; - - // Checked, set flag to false to prevent duplicate warning. - self::$a_bool_syntax_error_flag = false; - - return $p_str_content; - } - } - - // Load referrer templates if footnotes text not hidden. - if ( ! $p_bool_hide_footnotes_text ) { - - // Load footnote referrer template file. - if ( self::$a_bool_alternative_tooltips_enabled ) { - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'footnote-alternative' ); - } else { - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'footnote' ); - } - - /** - * Call Boolean again for robustness when priority levels don’t match any longer. - * - * - Bugfix: Tooltips: fix display in Popup Maker popups by correcting a coding error. - * - * @since 2.5.4 - * @see self::add_filter('pum_popup_content', array($this, "the_content"), $l_int_the_content_priority) - */ - self::$a_bool_tooltips_enabled = MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ENABLED ) ); - self::$a_bool_alternative_tooltips_enabled = MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE ) ); - - // Load tooltip inline script if jQuery tooltips are enabled. - if ( self::$a_bool_tooltips_enabled && ! self::$a_bool_alternative_tooltips_enabled ) { - $l_obj_template_tooltip = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'tooltip' ); - } - } else { - $l_obj_template = null; - $l_obj_template_tooltip = null; - } - - // Search footnotes short codes in the content. - do { - // Get first occurrence of the footnote start tag short code. - $i_int_len_content = strlen( $p_str_content ); - if ( $l_int_pos_start > $i_int_len_content ) { - $l_int_pos_start = $i_int_len_content; - } - $l_int_pos_start = strpos( $p_str_content, $l_str_starting_tag, $l_int_pos_start ); - // No short code found, stop here. - if ( ! $l_int_pos_start ) { - break; - } - // Get first occurrence of the footnote end tag short code. - $l_int_pos_end = strpos( $p_str_content, $l_str_ending_tag, $l_int_pos_start ); - // No short code found, stop here. - if ( ! $l_int_pos_end ) { - break; - } - // Calculate the length of the footnote. - $l_int_length = $l_int_pos_end - $l_int_pos_start; - - // Get footnote text. - $l_str_footnote_text = substr( $p_str_content, $l_int_pos_start + strlen( $l_str_starting_tag ), $l_int_length - strlen( $l_str_starting_tag ) ); - - // Get tooltip text if present. - self::$a_str_tooltip_shortcode = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER ); - self::$a_int_tooltip_shortcode_length = strlen( self::$a_str_tooltip_shortcode ); - $l_int_tooltip_text_length = strpos( $l_str_footnote_text, self::$a_str_tooltip_shortcode ); - $l_bool_has_tooltip_text = ! $l_int_tooltip_text_length ? false : true; - if ( $l_bool_has_tooltip_text ) { - $l_str_tooltip_text = substr( $l_str_footnote_text, 0, $l_int_tooltip_text_length ); - } else { - $l_str_tooltip_text = ''; - } - - /** - * URL line wrapping for Unicode non conformant browsers. - * - * @since 2.1.1 (CSS) - * @since 2.1.4 (PHP) - * - * Despite Unicode recommends to line-wrap URLs at slashes, and Firefox follows - * the Unicode standard, Chrome does not, making long URLs hang out of tooltips - * or extend reference containers, so that the end is hidden outside the window - * and may eventually be viewed after we scroll horizontally or zoom out. It is - * up to the web page to make URLs breaking anywhere by wrapping them in a span - * that is assigned appropriate CSS properties and values. - * @see css/public.css - * - * - Bugfix: Tooltips: fix line breaking for hyperlinked URLs in Unicode-non-compliant user agents, thanks to @andreasra bug report. - * - * @since 2.1.1 - * - * @reporter @andreasra - * @link https://wordpress.org/support/topic/footnotes-appearing-in-header/page/3/#post-13657398 - * - * - * - Bugfix: Reference container: fix width in mobile view by URL wrapping for Unicode-non-conformant browsers, thanks to @karolszakiel bug report. - * - * @since 2.1.3 - * @date 2020-11-23 - * - * @reporter @karolszakiel - * @link https://wordpress.org/support/topic/footnotes-on-mobile-phones/ - * - * - * - Bugfix: Reference container, tooltips: fix line wrapping of URLs (hyperlinked or not) based on pattern, not link element. - * - * @since 2.1.4 - * @date 2020-11-25T0837+0100 - * @link https://wordpress.org/support/topic/footnotes-on-mobile-phones/#post-13710682 - * - * - * - Bugfix: Reference container, tooltips: URL wrap: exclude image source too, thanks to @bjrnet21 bug report. - * - * @since 2.1.5 - * - * @reporter @bjrnet21 - * @link https://wordpress.org/support/topic/2-1-4-breaks-on-my-site-images-dont-show/ - * - * - * - Bugfix: Reference container, tooltips: URL wrap: fix regex, thanks to @a223123131 bug report. - * - * @since 2.1.6 - * @date 2020-12-09T1921+0100 - * - * @reporter @a223123131 - * @link https://wordpress.org/support/topic/broken-layout-starting-version-2-1-4/ - * - * Even ARIA labels may take a URL as value, so use \w=[\'"] as a catch-all 2020-12-10T1005+0100 - * - * - Bugfix: Dashboard: URL wrap: add option to properly enable/disable URL wrap. - * - * @since 2.1.6 - * @date 2020-12-09T1606+0100 - * - * - * - Bugfix: Reference container, tooltips: URL wrap: make the quotation mark optional wrt query parameters, thanks to @spiralofhope2 bug report. - * - * @since 2.2.6 - * @date 2020-12-23T0409+0100 - * - * @reporter @spiralofhope2 - * @link https://wordpress.org/support/topic/two-links-now-breaks-footnotes-with-blogtext/ - * - * - * - Bugfix: Reference container, tooltips: URL wrap: remove a bug introduced in the regex, thanks to @rjl20 @spaceling @lukashuggenberg @klusik @friedrichnorth @bernardzit bug reports. - * - * @since 2.2.7 - * @date 2020-12-23T1046+0100 - * - * @reporter @rjl20 - * @link https://wordpress.org/support/topic/two-links-now-breaks-footnotes-with-blogtext/#post-13825479 - * - * @reporter @spaceling - * @link https://wordpress.org/support/topic/two-links-now-breaks-footnotes-with-blogtext/#post-13825532 - * - * @reporter @lukashuggenberg - * @link https://wordpress.org/support/topic/2-2-6-breaks-all-footnotes/ - * - * @reporter @klusik - * @link https://wordpress.org/support/topic/2-2-6-breaks-all-footnotes/#post-13825885 - * - * @reporter @friedrichnorth - * @link https://wordpress.org/support/topic/footnotes-dont-show-after-update-to-2-2-6/ - * - * @reporter @bernardzit - * @link https://wordpress.org/support/topic/footnotes-dont-show-after-update-to-2-2-6/#post-13826029 - * - * @since 2.2.8 Bugfix: Reference container, tooltips: URL wrap: correctly make the quotation mark optional wrt query parameters, thanks to @spiralofhope2 bug report. - * @date 2020-12-23T1107+0100 - * - * Correct is duplicating the negative lookbehind w/o quotes: '(?get( MCI_Footnotes_Settings::C_STR_FOOTNOTE_URL_WRAP_ENABLED ) ) ) { - - $l_str_footnote_text = preg_replace( - '#(?$1
', - $l_str_footnote_text - ); - } - - // Text to be displayed instead of the footnote. - $l_str_footnote_replace_text = ''; - - // Whether hard links are enabled. - if ( self::$a_bool_hard_links_enable ) { - - // Get the configurable parts. - self::$a_str_referrer_link_slug = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERRER_FRAGMENT_ID_SLUG ); - self::$a_str_footnote_link_slug = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTE_FRAGMENT_ID_SLUG ); - self::$a_str_link_ids_separator = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_HARD_LINK_IDS_SEPARATOR ); - - // Streamline ID concatenation. - self::$a_str_post_container_id_compound = self::$a_str_link_ids_separator; - self::$a_str_post_container_id_compound .= self::$a_int_post_id; - self::$a_str_post_container_id_compound .= self::$a_str_link_ids_separator; - self::$a_str_post_container_id_compound .= self::$a_int_reference_container_id; - self::$a_str_post_container_id_compound .= self::$a_str_link_ids_separator; - - } - - // Display the footnote referrers and the tooltips. - if ( ! $p_bool_hide_footnotes_text ) { - $l_int_index = MCI_Footnotes_Convert::index( $l_int_footnote_index, MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE ) ); - - // Display only a truncated footnote text if option enabled. - $l_bool_enable_excerpt = MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED ) ); - $l_int_max_length = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH ) ); - - // Define excerpt text as footnote text by default. - $l_str_excerpt_text = $l_str_footnote_text; - - /** - * Tooltip truncation. - * - * - Adding: Tooltips: Read-on button: Label: configurable instead of localizable, thanks to @rovanov example provision. - * - * @since 2.1.0 - * @date 2020-11-08T2146+0100 - * - * @reporter @rovanov - * @link https://wordpress.org/support/topic/offset-x-axis-and-offset-y-axis-does-not-working/ - * - * If the tooltip truncation option is enabled, it’s done based on character count, - * and a trailing incomplete word is cropped. - * This is equivalent to the WordPress default excerpt generation, i.e. without a - * custom excerpt and without a delimiter. But WordPress does word count, usually 55. - */ - if ( self::$a_bool_tooltips_enabled && $l_bool_enable_excerpt ) { - $l_str_dummy_text = wp_strip_all_tags( $l_str_footnote_text ); - if ( is_int( $l_int_max_length ) && strlen( $l_str_dummy_text ) > $l_int_max_length ) { - $l_str_excerpt_text = substr( $l_str_dummy_text, 0, $l_int_max_length ); - $l_str_excerpt_text = substr( $l_str_excerpt_text, 0, strrpos( $l_str_excerpt_text, ' ' ) ); - $l_str_excerpt_text .= ' … <'; - $l_str_excerpt_text .= self::$a_bool_hard_links_enable ? 'a' : 'span'; - $l_str_excerpt_text .= ' class="footnote_tooltip_continue" '; - $l_str_excerpt_text .= 'onclick="footnote_move_to_anchor_' . self::$a_int_post_id; - $l_str_excerpt_text .= '_' . self::$a_int_reference_container_id; - $l_str_excerpt_text .= '(\'footnote_plugin_reference_' . self::$a_int_post_id; - $l_str_excerpt_text .= '_' . self::$a_int_reference_container_id; - $l_str_excerpt_text .= "_$l_int_index');\""; - - // If enabled, add the hard link fragment ID. - if ( self::$a_bool_hard_links_enable ) { - - $l_str_excerpt_text .= ' href="#'; - $l_str_excerpt_text .= self::$a_str_footnote_link_slug; - $l_str_excerpt_text .= self::$a_str_post_container_id_compound; - $l_str_excerpt_text .= $l_int_index; - $l_str_excerpt_text .= '"'; - } - - $l_str_excerpt_text .= '>'; - - /** - * Configurable read-on button label. - * - * - Adding: Tooltips: Read-on button: Label: configurable instead of localizable, thanks to @rovanov example provision. - * - * @since 2.1.0 - * @date 2020-11-08T2146+0100 - * - * @reporter @rovanov - * @link https://wordpress.org/support/topic/offset-x-axis-and-offset-y-axis-does-not-working/ - */ - $l_str_excerpt_text .= MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL ); - - $l_str_excerpt_text .= self::$a_bool_hard_links_enable ? '' : '
'; - } - } - - /** - * Referrers element superscript or baseline. - * - * Referrers: new setting for vertical align: superscript (default) or baseline (optional), thanks to @cwbayer bug report - * - * @since 2.1.1 - * - * @reporter @cwbayer - * @link https://wordpress.org/support/topic/footnote-number-in-text-superscript-disrupts-leading/ - * - * define the HTML element to use for the referrers. - */ - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS ) ) ) { - - $l_str_sup_span = 'sup'; - - } else { - - $l_str_sup_span = 'span'; - } - - // Whether hard links are enabled. - if ( self::$a_bool_hard_links_enable ) { - - self::$a_str_link_span = 'a'; - self::$a_str_link_close_tag = ''; - // Self::$a_str_link_open_tag will be defined as needed. - - // Compose hyperlink address (leading space is in template). - $l_str_footnote_link_argument = 'href="#'; - $l_str_footnote_link_argument .= self::$a_str_footnote_link_slug; - $l_str_footnote_link_argument .= self::$a_str_post_container_id_compound; - $l_str_footnote_link_argument .= $l_int_index; - $l_str_footnote_link_argument .= '" class="footnote_hard_link"'; - - /** - * Compose fragment ID anchor with offset, for use in reference container. - * Empty span, child of empty span, to avoid tall dotted rectangles in browser. - */ - $l_str_referrer_anchor_element = ''; - - } else { - - /** - * Initialize hard link variables when hard links are disabled. - * - * - Bugfix: Process: initialize hard link address variables to empty string to fix 'undefined variable' bug, thanks to @a223123131 bug report. - * - * @since 2.4.0 - * @date 2021-01-04T1622+0100 - * - * @reporter @a223123131 - * @link https://wordpress.org/support/topic/wp_debug-php-notice/ - * - * If no hyperlink nor offset anchor is needed, initialize as empty. - */ - $l_str_footnote_link_argument = ''; - $l_str_referrer_anchor_element = ''; - - // The link element is set independently as it may be needed for styling. - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_LINK_ELEMENT_ENABLED ) ) ) { - - self::$a_str_link_span = 'a'; - self::$a_str_link_open_tag = ''; - self::$a_str_link_close_tag = ''; - - } - } - - // Determine tooltip content. - if ( self::$a_bool_tooltips_enabled ) { - $l_str_tooltip_content = $l_bool_has_tooltip_text ? $l_str_tooltip_text : $l_str_excerpt_text; - } else { - $l_str_tooltip_content = ''; - } - - /** - * Determine shrink width if alternative tooltips are enabled. - * - * @since 2.5.6 - */ - $l_str_tooltip_style = ''; - if ( self::$a_bool_alternative_tooltips_enabled && self::$a_bool_tooltips_enabled ) { - $l_int_tooltip_length = strlen( wp_strip_all_tags( $l_str_tooltip_content ) ); - if ( $l_int_tooltip_length < 70 ) { - $l_str_tooltip_style = ' style="width: '; - $l_str_tooltip_style .= ( $l_int_tooltip_length * .7 ); - $l_str_tooltip_style .= 'em;"'; - } - } - - // Fill in 'templates/public/footnote.html'. - $l_obj_template->replace( - array( - 'link-span' => self::$a_str_link_span, - 'post_id' => self::$a_int_post_id, - 'container_id' => self::$a_int_reference_container_id, - 'note_id' => $l_int_index, - 'hard-link' => $l_str_footnote_link_argument, - 'sup-span' => $l_str_sup_span, - 'before' => MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE ), - 'index' => $l_int_index, - 'after' => MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER ), - 'anchor-element' => $l_str_referrer_anchor_element, - 'style' => $l_str_tooltip_style, - 'text' => $l_str_tooltip_content, - ) - ); - $l_str_footnote_replace_text = $l_obj_template->get_content(); - - // Reset the template. - $l_obj_template->reload(); - - // If standard tooltips are enabled but alternative are not. - if ( self::$a_bool_tooltips_enabled && ! self::$a_bool_alternative_tooltips_enabled ) { - - $l_int_offset_y = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y ) ); - $l_int_offset_x = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X ) ); - $l_int_fade_in_delay = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY ) ); - $l_int_fade_in_duration = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION ) ); - $l_int_fade_out_delay = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY ) ); - $l_int_fade_out_duration = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION ) ); - - // Fill in 'templates/public/tooltip.html'. - $l_obj_template_tooltip->replace( - array( - 'post_id' => self::$a_int_post_id, - 'container_id' => self::$a_int_reference_container_id, - 'note_id' => $l_int_index, - 'position' => MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION ), - 'offset-y' => ! empty( $l_int_offset_y ) ? $l_int_offset_y : 0, - 'offset-x' => ! empty( $l_int_offset_x ) ? $l_int_offset_x : 0, - 'fade-in-delay' => ! empty( $l_int_fade_in_delay ) ? $l_int_fade_in_delay : 0, - 'fade-in-duration' => ! empty( $l_int_fade_in_duration ) ? $l_int_fade_in_duration : 0, - 'fade-out-delay' => ! empty( $l_int_fade_out_delay ) ? $l_int_fade_out_delay : 0, - 'fade-out-duration' => ! empty( $l_int_fade_out_duration ) ? $l_int_fade_out_duration : 0, - ) - ); - $l_str_footnote_replace_text .= $l_obj_template_tooltip->get_content(); - $l_obj_template_tooltip->reload(); - } - } - // Replace the footnote with the template. - $p_str_content = substr_replace( $p_str_content, $l_str_footnote_replace_text, $l_int_pos_start, $l_int_length + strlen( $l_str_ending_tag ) ); - - // Add footnote only if not empty. - if ( ! empty( $l_str_footnote_text ) ) { - // Set footnote to the output box at the end. - self::$a_arr_footnotes[] = $l_str_footnote_text; - // Increase footnote index. - $l_int_footnote_index++; - } - - /** - * Fixes a footnotes numbering bug (happening under de facto rare circumstances). - * - * - Bugfix: Fixed occasional bug where footnote ordering could be out of sequence - * - * @since 1.6.4 - * @date 2016-06-29T0054+0000 - * @committer @dartiss - * @link https://plugins.trac.wordpress.org/browser/footnotes/trunk/class/task.php?rev=1445718 @dartiss’ class/task.php - * @link https://plugins.trac.wordpress.org/log/footnotes/trunk/class/task.php?rev=1445718 @dartiss re-added class/task.php - * @link https://plugins.trac.wordpress.org/browser/footnotes/trunk/class?rev=1445711 class/ w/o task.php - * @link https://plugins.trac.wordpress.org/changeset/1445711/footnotes/trunk/class @dartiss deleted class/task.php - * @link https://plugins.trac.wordpress.org/browser/footnotes/trunk/class/task.php?rev=1026210 @aricura’s latest class/task.php - * - * - * - Bugfix: Process: fix numbering bug impacting footnote #2 with footnote #1 close to start, thanks to @rumperuu bug report, thanks to @lolzim code contribution. - * - * @since 2.5.5 - * - * @contributor @lolzim - * @link https://wordpress.org/support/topic/footnotes-numbered-incorrectly/#post-14062032 - * - * @reporter @rumperuu - * @link https://wordpress.org/support/topic/footnotes-numbered-incorrectly/ - * - * This assignment was overridden by another one, causing the algorithm to jump back - * near the post start to a position calculated as the sum of the length of the last - * footnote and the length of the last footnote replace text. - * A bug disturbing the order of the footnotes depending on the text before the first - * footnote, the length of the first footnote and the length of the templates for the - * footnote and the tooltip. Moreover, it was causing non-trivial process garbage. - */ - // Add offset to the new starting position. - $l_int_pos_start += $l_int_length + strlen( $l_str_ending_tag ); - - } while ( true ); - - // Return content. - return $p_str_content; - } - - /** - * Generates the reference container. - * - * @since 1.5.0 - * @return string - * - * @since 2.0.0 Update: remove backlink symbol along with column 2 of the reference container - * @since 2.0.3 Bugfix: prepend an arrow on user request - * @since 2.0.6 Bugfix: Reference container: fix line breaking behavior in footnote number clusters. - * @since 2.0.4 Bugfix: restore the arrow select and backlink symbol input settings - * @since 2.1.1 Bugfix: Referrers, reference container: Combining identical footnotes: fix dead links and ensure referrer-backlink bijectivity, thanks to @happyches bug report. - * @since 2.1.1 Bugfix: Reference container: Backlink symbol: make optional, not suggest configuring it to invisible, thanks to @spaceling feedback. - */ - public function reference_container() { - - // No footnotes have been replaced on this page. - if ( empty( self::$a_arr_footnotes ) ) { - return ''; - } - - /** - * Footnote index backlink symbol. - * - * - Bugfix: Reference container: Backlink symbol: make optional, not suggest configuring it to invisible, thanks to @spaceling feedback. - * - * @since 2.1.1 - * - * @reporter @spaceling - * @link https://wordpress.org/support/topic/change-the-position-5/page/2/#post-13671138 - * - * If the backlink symbol is enabled. - */ - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE ) ) ) { - - // Get html arrow. - $l_str_arrow = MCI_Footnotes_Convert::get_arrow( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW ) ); - // Set html arrow to the first one if invalid index defined. - if ( is_array( $l_str_arrow ) ) { - $l_str_arrow = MCI_Footnotes_Convert::get_arrow( 0 ); - } - // Get user defined arrow. - $l_str_arrow_user_defined = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW_USER_DEFINED ); - if ( ! empty( $l_str_arrow_user_defined ) ) { - $l_str_arrow = $l_str_arrow_user_defined; - } - - // Wrap the arrow in a @media print { display:hidden } span. - $l_str_footnote_arrow = ''; - $l_str_footnote_arrow .= $l_str_arrow . ''; - - } else { - - // If the backlink symbol isn’t enabled, set it to empty. - $l_str_arrow = ''; - $l_str_footnote_arrow = ''; - - } - - /** - * Backlink separator. - * - * - Bugfix: Reference container: make separating and terminating punctuation optional and configurable, thanks to @docteurfitness issue report and code contribution. - * - * @since 2.1.4 - * @date 2020-11-28T1048+0100 - * - * @contributor @docteurfitness - * @link https://wordpress.org/support/topic/update-2-1-3/#post-13704194 - * - * @reporter @docteurfitness - * @link https://wordpress.org/support/topic/update-2-1-3/ - * - * Initially a comma was appended in this algorithm for enumerations. - * The comma in enumerations is not generally preferred. - */ - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_ENABLED ) ) ) { - - // Check if it is input-configured. - $l_str_separator = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_CUSTOM ); - - if ( empty( $l_str_separator ) ) { - - // If it is not, check which option is on. - $l_str_separator_option = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_OPTION ); - switch ( $l_str_separator_option ) { - case 'comma': - $l_str_separator = ','; - break; - case 'semicolon': - $l_str_separator = ';'; - break; - case 'en_dash': - $l_str_separator = ' –'; - break; - } - } - } else { - - $l_str_separator = ''; - } - - /** - * Backlink terminator. - * - * Initially a dot was appended in the table row template. - * - * @since 2.0.6 a dot after footnote numbers is discarded as not localizable; - * making it optional was envisaged. - * @since 2.1.4 the terminator is optional, has options, and is configurable. - */ - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_ENABLED ) ) ) { - - // Check if it is input-configured. - $l_str_terminator = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_CUSTOM ); - - if ( empty( $l_str_terminator ) ) { - - // If it is not, check which option is on. - $l_str_terminator_option = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_OPTION ); - switch ( $l_str_terminator_option ) { - case 'period': - $l_str_terminator = '.'; - break; - case 'parenthesis': - $l_str_terminator = ')'; - break; - case 'colon': - $l_str_terminator = ':'; - break; - } - } - } else { - - $l_str_terminator = ''; - } - - /** - * Line breaks. - * - * - Bugfix: Reference container: Backlinks: fix stacked enumerations by adding optional line breaks. - * - * @since 2.1.4 - * @date 2020-11-28T1049+0100 - * - * The backlinks of combined footnotes are generally preferred in an enumeration. - * But when few footnotes are identical, stacking the items in list form is better. - * Variable number length and proportional character width require explicit line breaks. - * Otherwise, an ordinary space character offering a line break opportunity is inserted. - */ - $l_str_line_break = MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_BACKLINKS_LINE_BREAKS_ENABLED ) ) ? '
' : ' '; - - /** - * Line breaks for source readability. - * - * For maintenance and support, table rows in the reference container should be - * separated by an empty line. So we add these line breaks for source readability. - * Before the first table row (breaks between rows are ~200 lines below). - */ - $l_str_body = "\r\n\r\n"; - - /** - * Reference container table row template load. - * - * - Bugfix: Reference container: option to restore pre-2.0.0 layout with the backlink symbol in an extra column. - * - * @since 2.1.1 - * @date 2020-11-16T2024+0100 - */ - - // When combining identical footnotes is turned on, another template is needed. - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_COMBINE_IDENTICAL_FOOTNOTES ) ) ) { - // The combining template allows for backlink clusters and supports cell clicking for single notes. - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'reference-container-body-combi' ); - - } else { - - // When 3-column layout is turned on (only available if combining is turned off). - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE ) ) ) { - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'reference-container-body-3column' ); - - } else { - - // When switch symbol and index is turned on, and combining and 3-columns are off. - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH ) ) ) { - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'reference-container-body-switch' ); - - } else { - - // Default is the standard template. - $l_obj_template = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'reference-container-body' ); - - } - } - } - - /** - * Switch backlink symbol and footnote number. - * - * - Bugfix: Reference container: option to append symbol (prepended by default), thanks to @spaceling code contribution. - * - * @since 2.1.1 - * @date 2020-11-16T2024+0100 - * - * @contributor @spaceling - * @link https://wordpress.org/support/topic/change-the-position-5/#post-13615994 - * - * - * - Bugfix: Reference container: Backlink symbol: support for appending when combining identicals is on. - * - * @since 2.1.4 - * @date 2020-11-26T1633+0100 - */ - $l_bool_symbol_switch = MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH ) ); - - // Loop through all footnotes found in the page. - $num_footnotes = count( self::$a_arr_footnotes ); - for ( $l_int_index = 0; $l_int_index < $num_footnotes; $l_int_index++ ) { - - // Get footnote text. - $l_str_footnote_text = self::$a_arr_footnotes[ $l_int_index ]; - - // If footnote is empty, go to the next one;. - // With combine identicals turned on, identicals will be deleted and are skipped. - if ( empty( $l_str_footnote_text ) ) { - continue; - } - - // Generate content of footnote index cell. - $l_int_first_footnote_index = ( $l_int_index + 1 ); - - // Get the footnote index string and. - // Keep supporting legacy index placeholder. - $l_str_footnote_id = MCI_Footnotes_Convert::index( ( $l_int_index + 1 ), MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE ) ); - - /** - * Case of only one backlink per table row. - * - * If enabled, and for the case the footnote is single, compose hard link. - */ - // Define anyway. - $l_str_hard_link_address = ''; - - if ( self::$a_bool_hard_links_enable ) { - - /** - * Use-Backbutton-Hint tooltip, optional and configurable. - * - * - Update: Reference container: Hard backlinks (optional): optional configurable tooltip hinting to use the backbutton instead, thanks to @theroninjedi47 bug report. - * - * @since 2.5.4 - * - * @reporter @theroninjedi47 - * @link https://wordpress.org/support/topic/hyperlinked-footnotes-creating-excessive-back-history/ - * - * When hard links are enabled, clicks on the backlinks are logged in the browsing history. - * This tooltip hints to use the backbutton instead, so the history gets streamlined again. - * @link https://wordpress.org/support/topic/making-it-amp-compatible/#post-13837359 - */ - if ( MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE ) ) ) { - $l_str_use_backbutton_hint = ' title="'; - $l_str_use_backbutton_hint .= MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT ); - $l_str_use_backbutton_hint .= '"'; - } else { - $l_str_use_backbutton_hint = ''; - } - - /** - * Compose fragment ID anchor with offset, for use in reference container. - * Empty span, child of empty span, to avoid tall dotted rectangles in browser. - */ - $l_str_footnote_anchor_element = ''; - - // Compose optional hard link address. - $l_str_hard_link_address = ' href="#'; - $l_str_hard_link_address .= self::$a_str_referrer_link_slug; - $l_str_hard_link_address .= self::$a_str_post_container_id_compound; - $l_str_hard_link_address .= $l_str_footnote_id . '"'; - $l_str_hard_link_address .= $l_str_use_backbutton_hint; - - // Compose optional opening link tag with optional hard link, mandatory for instance. - self::$a_str_link_open_tag = 'get( MCI_Footnotes_Settings::C_STR_COMBINE_IDENTICAL_FOOTNOTES ) ) ) { - - // ID, optional hard link address, and class. - $l_str_footnote_reference = '<' . self::$a_str_link_span; - $l_str_footnote_reference .= ' id="footnote_plugin_reference_'; - $l_str_footnote_reference .= self::$a_int_post_id; - $l_str_footnote_reference .= '_' . self::$a_int_reference_container_id; - $l_str_footnote_reference .= "_$l_str_footnote_id\""; - if ( self::$a_bool_hard_links_enable ) { - $l_str_footnote_reference .= ' href="#'; - $l_str_footnote_reference .= self::$a_str_referrer_link_slug; - $l_str_footnote_reference .= self::$a_str_post_container_id_compound; - $l_str_footnote_reference .= $l_str_footnote_id . '"'; - $l_str_footnote_reference .= $l_str_use_backbutton_hint; - } - $l_str_footnote_reference .= ' class="footnote_backlink"'; - - // The click event goes in the table cell if footnote remains single. - $l_str_backlink_event = ' onclick="footnote_move_to_anchor_'; - $l_str_backlink_event .= self::$a_int_post_id; - $l_str_backlink_event .= '_' . self::$a_int_reference_container_id; - $l_str_backlink_event .= "('footnote_plugin_tooltip_"; - $l_str_backlink_event .= self::$a_int_post_id; - $l_str_backlink_event .= '_' . self::$a_int_reference_container_id; - $l_str_backlink_event .= "_$l_str_footnote_id');\""; - - // The dedicated template enumerating backlinks uses another variable. - $l_str_footnote_backlinks = $l_str_footnote_reference; - - // Append the click event right to the backlink item for enumerations;. - // Else it goes in the table cell. - $l_str_footnote_backlinks .= $l_str_backlink_event . '>'; - $l_str_footnote_reference .= '>'; - - // Append the optional offset anchor for hard links. - if ( self::$a_bool_hard_links_enable ) { - $l_str_footnote_reference .= $l_str_footnote_anchor_element; - $l_str_footnote_backlinks .= $l_str_footnote_anchor_element; - } - - // Continue both single note and notes cluster, depending on switch option status. - if ( $l_bool_symbol_switch ) { - - $l_str_footnote_reference .= "$l_str_footnote_id$l_str_footnote_arrow"; - $l_str_footnote_backlinks .= "$l_str_footnote_id$l_str_footnote_arrow"; - - } else { - - $l_str_footnote_reference .= "$l_str_footnote_arrow$l_str_footnote_id"; - $l_str_footnote_backlinks .= "$l_str_footnote_arrow$l_str_footnote_id"; - - } - - // If that is the only footnote with this text, we’re almost done.. - - // Check if it isn't the last footnote in the array. - if ( $l_int_first_footnote_index < count( self::$a_arr_footnotes ) ) { - - // Get all footnotes that haven't passed yet. - $num_footnotes = count( self::$a_arr_footnotes ); - for ( $l_int_check_index = $l_int_first_footnote_index; $l_int_check_index < $num_footnotes; $l_int_check_index++ ) { - - // Check if a further footnote is the same as the actual one. - if ( self::$a_arr_footnotes[ $l_int_check_index ] === $l_str_footnote_text ) { - - // If so, set the further footnote as empty so it won't be displayed later. - self::$a_arr_footnotes[ $l_int_check_index ] = ''; - - // Set the flag to true for the combined status. - $l_bool_flag_combined = true; - - // Update the footnote ID. - $l_str_footnote_id = MCI_Footnotes_Convert::index( ( $l_int_check_index + 1 ), MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE ) ); - - // Resume composing the backlinks enumeration. - $l_str_footnote_backlinks .= "$l_str_separator'; - $l_str_footnote_backlinks .= $l_str_line_break; - $l_str_footnote_backlinks .= '<' . self::$a_str_link_span; - $l_str_footnote_backlinks .= ' id="footnote_plugin_reference_'; - $l_str_footnote_backlinks .= self::$a_int_post_id; - $l_str_footnote_backlinks .= '_' . self::$a_int_reference_container_id; - $l_str_footnote_backlinks .= "_$l_str_footnote_id\""; - - // Insert the optional hard link address. - if ( self::$a_bool_hard_links_enable ) { - $l_str_footnote_backlinks .= ' href="#'; - $l_str_footnote_backlinks .= self::$a_str_referrer_link_slug; - $l_str_footnote_backlinks .= self::$a_str_post_container_id_compound; - $l_str_footnote_backlinks .= $l_str_footnote_id . '"'; - $l_str_footnote_backlinks .= $l_str_use_backbutton_hint; - } - - $l_str_footnote_backlinks .= ' class="footnote_backlink"'; - $l_str_footnote_backlinks .= ' onclick="footnote_move_to_anchor_'; - $l_str_footnote_backlinks .= self::$a_int_post_id; - $l_str_footnote_backlinks .= '_' . self::$a_int_reference_container_id; - $l_str_footnote_backlinks .= "('footnote_plugin_tooltip_"; - $l_str_footnote_backlinks .= self::$a_int_post_id; - $l_str_footnote_backlinks .= '_' . self::$a_int_reference_container_id; - $l_str_footnote_backlinks .= "_$l_str_footnote_id');\">"; - - // Append the offset anchor for optional hard links. - if ( self::$a_bool_hard_links_enable ) { - $l_str_footnote_backlinks .= ''; - } - - $l_str_footnote_backlinks .= $l_bool_symbol_switch ? '' : $l_str_footnote_arrow; - $l_str_footnote_backlinks .= $l_str_footnote_id; - $l_str_footnote_backlinks .= $l_bool_symbol_switch ? $l_str_footnote_arrow : ''; - - } - } - } - - // Append terminator and end tag. - $l_str_footnote_reference .= $l_str_terminator . ''; - $l_str_footnote_backlinks .= $l_str_terminator . ''; - - } - - // Line wrapping of URLs already fixed, see above. - - // Get reference container item text if tooltip text goes separate. - $l_int_tooltip_text_length = strpos( $l_str_footnote_text, self::$a_str_tooltip_shortcode ); - $l_bool_has_tooltip_text = ! $l_int_tooltip_text_length ? false : true; - if ( $l_bool_has_tooltip_text ) { - $l_str_not_tooltip_text = substr( $l_str_footnote_text, ( $l_int_tooltip_text_length + self::$a_int_tooltip_shortcode_length ) ); - self::$a_bool_mirror_tooltip_text = MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE ) ); - if ( self::$a_bool_mirror_tooltip_text ) { - $l_str_tooltip_text = substr( $l_str_footnote_text, 0, $l_int_tooltip_text_length ); - $l_str_reference_text_introducer = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR ); - $l_str_reference_text = $l_str_tooltip_text . $l_str_reference_text_introducer . $l_str_not_tooltip_text; - } else { - $l_str_reference_text = $l_str_not_tooltip_text; - } - } else { - $l_str_reference_text = $l_str_footnote_text; - } - - // Replace all placeholders in table row template. - $l_obj_template->replace( - array( - - // Placeholder used in all templates. - 'text' => $l_str_reference_text, - - // Used in standard layout W/O COMBINED FOOTNOTES. - 'post_id' => self::$a_int_post_id, - 'container_id' => self::$a_int_reference_container_id, - 'note_id' => MCI_Footnotes_Convert::index( $l_int_first_footnote_index, MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE ) ), - 'link-start' => self::$a_str_link_open_tag, - 'link-end' => self::$a_str_link_close_tag, - 'link-span' => self::$a_str_link_span, - 'terminator' => $l_str_terminator, - 'anchor-element' => $l_str_footnote_anchor_element, - 'hard-link' => $l_str_hard_link_address, - - // Used in standard layout WITH COMBINED IDENTICALS TURNED ON. - 'pointer' => $l_bool_flag_combined ? '' : ' pointer', - 'event' => $l_bool_flag_combined ? '' : $l_str_backlink_event, - 'backlinks' => $l_bool_flag_combined ? $l_str_footnote_backlinks : $l_str_footnote_reference, - - // Legacy placeholders for use in legacy layout templates. - 'arrow' => $l_str_footnote_arrow, - 'index' => $l_str_footnote_id, - ) - ); - - $l_str_body .= $l_obj_template->get_content(); - - // Extra line breaks for page source readability. - $l_str_body .= "\r\n\r\n"; - - $l_obj_template->reload(); - - } - - // Call again for robustness when priority levels don’t match any longer. - self::$a_int_scroll_offset = intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET ) ); - - // Streamline. - $l_bool_collapse_default = MCI_Footnotes_Convert::to_bool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_COLLAPSE ) ); - - /** - * Reference container label. - * - * - Bugfix: Reference container: Label: set empty label to U+202F NNBSP for more robustness, thanks to @lukashuggenberg feedback. - * - * @since 2.4.0 - * @date 2021-01-04T0504+0100 - * - * @reporter @lukashuggenberg - * - * Themes may drop-cap a first letter of initial paragraphs, like this label. - * In case of empty label that would apply to the left half button character. - * Hence the point in setting an empty label to U+202F NARROW NO-BREAK SPACE. - */ - $l_str_reference_container_label = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME ); - - /** - * Select the reference container template according to the script mode. - * - * - Bugfix: Reference container: optional alternative expanding and collapsing without jQuery for use with hard links, thanks to @hopper87it @pkverma99 issue reports. - * - * @since 2.5.6 - * - * @reporter @hopper87it - * @link https://wordpress.org/support/topic/footnotes-wp-rocket/ - * - * @reporter @pkverma99 - * @link https://wordpress.org/support/topic/footnotes-wp-rocket/#post-14076188 - */ - $l_str_script_mode = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE ); - - if ( 'jquery' === $l_str_script_mode ) { - - // Load 'templates/public/reference-container.html'. - $l_obj_template_container = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'reference-container' ); - - } else { - - // Load 'templates/public/js-reference-container.html'. - $l_obj_template_container = new MCI_Footnotes_Template( MCI_Footnotes_Template::C_STR_PUBLIC, 'js-reference-container' ); - } - - $l_obj_template_container->replace( - array( - 'post_id' => self::$a_int_post_id, - 'container_id' => self::$a_int_reference_container_id, - 'element' => MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT ), - 'name' => empty( $l_str_reference_container_label ) ? ' ' : $l_str_reference_container_label, - 'button-style' => ! $l_bool_collapse_default ? 'display: none;' : '', - 'style' => $l_bool_collapse_default ? 'display: none;' : '', - 'content' => $l_str_body, - 'scroll-offset' => ( self::$a_int_scroll_offset / 100 ), - 'scroll-duration' => intval( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DURATION ) ), - ) - ); - - // Free all found footnotes if reference container will be displayed. - self::$a_arr_footnotes = array(); - - return $l_obj_template_container->get_content(); - } -} +get(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_TITLE_PRIORITY_LEVEL)); + $l_int_TheContentPriority = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_CONTENT_PRIORITY_LEVEL)); + $l_int_TheExcerptPriority = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_THE_EXCERPT_PRIORITY_LEVEL)); + $l_int_WidgetTitlePriority = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TITLE_PRIORITY_LEVEL)); + $l_int_WidgetTextPriority = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_EXPERT_LOOKUP_WIDGET_TEXT_PRIORITY_LEVEL)); + + // PHP_INT_MAX can be set by -1: + $l_int_TheTitlePriority = ($l_int_TheTitlePriority == -1) ? PHP_INT_MAX : $l_int_TheTitlePriority ; + $l_int_TheContentPriority = ($l_int_TheContentPriority == -1) ? PHP_INT_MAX : $l_int_TheContentPriority ; + $l_int_TheExcerptPriority = ($l_int_TheExcerptPriority == -1) ? PHP_INT_MAX : $l_int_TheExcerptPriority ; + $l_int_WidgetTitlePriority = ($l_int_WidgetTitlePriority == -1) ? PHP_INT_MAX : $l_int_WidgetTitlePriority; + $l_int_WidgetTextPriority = ($l_int_WidgetTextPriority == -1) ? PHP_INT_MAX : $l_int_WidgetTextPriority ; + + + // append custom css to the header + add_filter('wp_head', array($this, "wp_head"), PHP_INT_MAX); + + // append the love and share me slug to the footer + add_filter('wp_footer', array($this, "wp_footer"), PHP_INT_MAX); + + if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_TITLE))) { + add_filter('the_title', array($this, "the_title"), $l_int_TheTitlePriority); + } + + // configurable priority level for reference container relative positioning; default 98: + if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_CONTENT))) { + add_filter('the_content', array($this, "the_content"), $l_int_TheContentPriority); + + /** + * Hook for category pages + * + * - Bugfix: Hooks: support footnotes on category pages, thanks to @vitaefit bug report, thanks to @misfist code contribution. + * + * @since 2.5.0 + * @date 2021-01-05T1402+0100 + * + * @contributor @misfist + * @link https://wordpress.org/support/topic/footnote-doesntwork-on-category-page/#post-13864859 + * + * @reporter @vitaefit + * @link https://wordpress.org/support/topic/footnote-doesntwork-on-category-page/ + * + * Category pages can have rich HTML content in a term description with article status. + * For this to happen, WordPress’ built-in partial HTML blocker needs to be disabled. + * @link https://docs.woocommerce.com/document/allow-html-in-term-category-tag-descriptions/ + */ + add_filter('term_description', array($this, "the_content"), $l_int_TheContentPriority); + + /** + * Hook for popup maker popups + * + * - Bugfix: Hooks: support footnotes in Popup Maker popups, thanks to @squatcher bug report. + * + * @since 2.5.1 + * @date 2021-01-18T2038+0100 + * + * @reporter @squatcher + * @link https://wordpress.org/support/topic/footnotes-use-in-popup-maker/ + */ + add_filter('pum_popup_content', array($this, "the_content"), $l_int_TheContentPriority); + } + + if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT))) { + add_filter('the_excerpt', array($this, "the_excerpt"), $l_int_TheExcerptPriority); + } + if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE))) { + add_filter('widget_title', array($this, "widget_title"), $l_int_WidgetTitlePriority); + } + if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT))) { + add_filter('widget_text', array($this, "widget_text"), $l_int_WidgetTextPriority); + } + + + /** + * The the_post hook + * + * - Adding: Hooks: support 'the_post' in response to user request for custom post types. + * + * @since 1.5.4 + * @accountable @aricura + * @link https://wordpress.org/support/topic/doesnt-work-in-custon-post-types/#post-5339110 + * + * + * - Update: Hooks: Default-enable all hooks to prevent footnotes from seeming broken in some parts. + * + * @since 2.0.5 + * @accountable @pewgeuges + * + * + * - BUGFIX: Hooks: Default-disable 'the_post', thanks to @spaceling @markcheret @nyamachi @whichgodsaves @spiralofhope2 @mmallett @andreasra @widecast @ymorin007 @tashi1es bug reports. + * + * @since 2.0.7 + * @accountable @pewgeuges + * @link https://wordpress.org/support/topic/change-the-position-5/page/2/#post-13630114 + * @link https://wordpress.org/support/topic/footnotes-appearing-in-header/#post-13630303 + * @link https://wordpress.org/support/topic/footnotes-appearing-in-header/page/2/#post-13630799 + * @link https://wordpress.org/support/topic/no-footnotes-anymore/#post-13813233 + * + * @reporter @spaceling + * @link https://wordpress.org/support/topic/change-the-position-5/#post-13612697 + * + * @reporter @markcheret on behalf of W. Beinert + * @link https://wordpress.org/support/topic/footnotes-now-appear-in-summaries-even-though-this-is-marked-no/ + * + * @reporter @nyamachi + * @link https://wordpress.org/support/topic/footnotes-appearing-in-header/ + * + * @reporter @whichgodsaves + * @link https://wordpress.org/support/topic/footnotes-appearing-in-header/#post-13622694 + * + * @reporter @spiralofhope2 + * @link https://wordpress.org/support/topic/2-0-5-broken/ + * + * @reporter @mmallett + * @link https://wordpress.org/support/topic/2-0-5-broken/#post-13623208 + * + * @reporter @andreasra + * @link https://wordpress.org/support/topic/footnotes-appearing-in-header/#post-13624091 + * + * @reporter @widecast + * @link https://wordpress.org/support/topic/2-0-5-broken/#post-13626222 + * + * @reporter @ymorin007 + * @link https://wordpress.org/support/topic/footnotes-appearing-in-header/#post-13627050 + * + * @reporter @markcheret on behalf of L. Smith + * @link https://wordpress.org/support/topic/footnotes-appear-in-random-places-on-academic-website/ + * + * @reporter @tashi1es + * @link https://wordpress.org/support/topic/footnotes-appear-in-random-places-on-academic-website/#post-13630495 + * + * + * - UPDATE: Hooks: remove 'the_post', the plugin stops supporting this hook. + * + * @since 2.1.0 + * @date 2020-11-08T1839+0100 + * @accountable @pewgeuges + */ + + // reset stored footnotes when displaying the header + self::$a_arr_Footnotes = array(); + self::$a_bool_AllowLoveMe = true; + } + + /** + * Outputs the custom css to the header of the public page. + * + * @author Stefan Herndler + * @since 1.5.0 + * + * + * @since 2.1.1 Bugfix: Reference container: fix start pages by making its display optional, thanks to @dragon013 bug report. + * @since 2.1.1 Bugfix: Tooltips: optional alternative JS implementation with CSS transitions to fix configuration-related outage, thanks to @andreasra feedback. + * @since 2.1.3 raise settings priority to override theme stylesheets + * @since 2.1.4 Bugfix: Tooltips: Styling: fix font size issue by adding font size to settings with legacy as default. + * @since 2.1.4 Bugfix: Reference container: fix layout issues by moving backlink column width to settings. + * @since 2.2.5 Bugfix: Reference container: Label: make bottom border an option, thanks to @markhillyer issue report. + * @since 2.2.5 Bugfix: Reference container: Label: option to select paragraph or heading element, thanks to @markhillyer issue report. + * @since 2.3.0 Bugfix: Reference container: convert top padding to margin and make it a setting, thanks to @hamshe bug report. + * @since 2.5.4 Bugfix: Referrers: optional fixes to vertical alignment, font size and position (static) for in-theme consistency and cross-theme stability, thanks to @tomturowski bug report. + */ + public function wp_head() { + + // insert start tag without switching out of PHP: + echo "\r\n\r\n"; + + /** + * Alternative tooltip implementation relying on plain JS and CSS transitions. + * + * - Bugfix: Tooltips: optional alternative JS implementation with CSS transitions to fix configuration-related outage, thanks to @andreasra feedback. + * + * @since 2.1.1 + * + * @reporter @andreasra + * @link https://wordpress.org/support/topic/footnotes-appearing-in-header/page/2/#post-13632566 + * + * The script for alternative tooltips is printed formatted, not minified: + */ + if ( self::$a_bool_AlternativeTooltipsEnabled ) { + ?> + +get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "footer") { + echo $this->ReferenceContainer(); + } + // get setting for love and share this plugin + $l_str_LoveMeIndex = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE); + // check if the admin allows to add a link to the footer + if (empty($l_str_LoveMeIndex) || strtolower($l_str_LoveMeIndex) == "no" || !self::$a_bool_AllowLoveMe) { + return; + } + // set a hyperlink to the word "footnotes" in the Love slug + $l_str_LinkedName = sprintf('%s', MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME); + // get random love me text + if (strtolower($l_str_LoveMeIndex) == "random") { + $l_str_LoveMeIndex = "text-" . rand(1,7); + } + switch ($l_str_LoveMeIndex) { + // options named wrt backcompat, simplest is default: + case "text-1": $l_str_LoveMeText = sprintf(__('I %2$s %1$s', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), $l_str_LinkedName, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL); break; + case "text-2": $l_str_LoveMeText = sprintf(__('This website uses the awesome %s plugin.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), $l_str_LinkedName); break; + case "text-4": $l_str_LoveMeText = sprintf('%s %s', $l_str_LinkedName, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL); break; + case "text-5": $l_str_LoveMeText = sprintf('%s %s', MCI_Footnotes_Config::C_STR_LOVE_SYMBOL, $l_str_LinkedName); break; + case "text-6": $l_str_LoveMeText = sprintf(__('This website uses %s.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), $l_str_LinkedName); break; + case "text-7": $l_str_LoveMeText = sprintf(__('This website uses the %s plugin.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), $l_str_LinkedName); break; + case "text-3": default: $l_str_LoveMeText = sprintf('%s', $l_str_LinkedName); break; + } + echo sprintf('
%s
', $l_str_LoveMeText); + } + + /** + * Replaces footnotes in the post/page title. + * + * @author Stefan Herndler + * @since 1.5.0 + * @param string $p_str_Content Widget content. + * @return string Content with replaced footnotes. + */ + public function the_title($p_str_Content) { + // appends the reference container if set to "post_end" + return $this->exec($p_str_Content, false); + } + + /** + * Replaces footnotes in the content of the current page/post. + * + * @author Stefan Herndler + * @since 1.5.0 + * @param string $p_str_Content Page/Post content. + * @return string Content with replaced footnotes. + */ + public function the_content($p_str_Content) { + + /** + * Empties the footnotes list every time Footnotes is run when the_content hook is called. + * + * - Bugfix: Process: fix footnote duplication by emptying the footnotes list every time the search algorithm is run on the content, thanks to @inoruhana bug report. + * + * @since 2.5.7 + * + * @reporter @inoruhana + * @link https://wordpress.org/support/topic/footnote-duplicated-in-the-widget/ + * + * Under certain circumstances, footnotes were duplicated, because the footnotes list was + * not emptied every time before the search algorithm was run. That happened eg when both + * the reference container resides in the widget area, and the YOAST SEO plugin is active + * and calls the hook the_content to generate the Open Graph description, while Footnotes + * is set to avoid missing out on the footnotes (in the content) by hooking in as soon as + * the_content is called, whereas at post end Footnotes seems to hook in the_content only + * the time it’s the blog engine processing the post for display and appending the refs. + */ + self::$a_arr_Footnotes = array(); + // appends the reference container if set to "post_end" + return $this->exec($p_str_Content, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "post_end" ? true : false); + } + + /** + * Replaces footnotes in the excerpt of the current page/post. + * + * @author Stefan Herndler + * @since 1.5.0 + * @param string $p_str_Content Page/Post content. + * @return string Content with replaced footnotes. + */ + public function the_excerpt($p_str_Content) { + return $this->exec($p_str_Content, false, !MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT))); + } + + /** + * Replaces footnotes in the widget title. + * + * @author Stefan Herndler + * @since 1.5.0 + * @param string $p_str_Content Widget content. + * @return string Content with replaced footnotes. + */ + public function widget_title($p_str_Content) { + // appends the reference container if set to "post_end" + return $this->exec($p_str_Content, false); + } + + /** + * Replaces footnotes in the content of the current widget. + * + * @author Stefan Herndler + * @since 1.5.0 + * @param string $p_str_Content Widget content. + * @return string Content with replaced footnotes. + */ + public function widget_text($p_str_Content) { + // appends the reference container if set to "post_end" + return $this->exec($p_str_Content, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "post_end" ? true : false); + } + + /** + * Replaces footnotes in each Content var of the current Post object. + * + * @author Stefan Herndler + * @since 1.5.4 + * @param array|WP_Post $p_mixed_Posts + */ + public function the_post(&$p_mixed_Posts) { + // single WP_Post object received + if (!is_array($p_mixed_Posts)) { + $p_mixed_Posts = $this->replacePostObject($p_mixed_Posts); + return; + } + // array of WP_Post objects received + for($l_int_Index = 0; $l_int_Index < count($p_mixed_Posts); $l_int_Index++) { + $p_mixed_Posts[$l_int_Index] = $this->replacePostObject($p_mixed_Posts[$l_int_Index]); + } + } + + /** + * Replace all Footnotes in a WP_Post object. + * + * @author Stefan Herndler + * @since 1.5.6 + * @param WP_Post $p_obj_Post + * @return WP_Post + */ + private function replacePostObject($p_obj_Post) { + //MCI_Footnotes_Convert::debug($p_obj_Post); + $p_obj_Post->post_content = $this->exec($p_obj_Post->post_content); + $p_obj_Post->post_content_filtered = $this->exec($p_obj_Post->post_content_filtered); + $p_obj_Post->post_excerpt = $this->exec($p_obj_Post->post_excerpt); + return $p_obj_Post; + } + + /** + * Replaces all footnotes that occur in the given content. + * + * @author Stefan Herndler + * @since 1.5.0 + * @param string $p_str_Content Any string that may contain footnotes to be replaced. + * @param bool $p_bool_OutputReferences Appends the Reference Container to the output if set to true, default true. + * @param bool $p_bool_HideFootnotesText Hide footnotes found in the string. + * @return string + * + * + * @since 2.2.0 Adding: Reference container: support for custom position shortcode, thanks to @hamshe issue report. + * @since 2.2.5 Bugfix: Reference container: delete position shortcode if unused because position may be widget or footer, thanks to @hamshe bug report. + */ + public function exec($p_str_Content, $p_bool_OutputReferences = false, $p_bool_HideFootnotesText = false) { + + // replace all footnotes in the content, settings are converted to html characters + $p_str_Content = $this->search($p_str_Content, true, $p_bool_HideFootnotesText); + // replace all footnotes in the content, settings are NOT converted to html characters + $p_str_Content = $this->search($p_str_Content, false, $p_bool_HideFootnotesText); + + /** + * Reference container customized positioning through shortcode + * + * - Adding: Reference container: support for custom position shortcode, thanks to @hamshe issue report. + * + * @since 2.2.0 + * @date 2020-12-13T2057+0100 + * + * @reporter @hamshe + * @link https://wordpress.org/support/topic/reference-container-in-elementor/ + * + * + * - Bugfix: Reference container: delete position shortcode if unused because position may be widget or footer, thanks to @hamshe bug report. + * + * @since 2.2.5 + * @date 2020-12-18T1434+0100 + * + * @reporter @hamshe + * @link https://wordpress.org/support/topic/reference-container-in-elementor/#post-13784126 + * + */ + // append the reference container or insert at shortcode: + $l_str_ReferenceContainerPositionShortcode = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION_SHORTCODE); + if ( empty( $l_str_ReferenceContainerPositionShortcode ) ) { + $l_str_ReferenceContainerPositionShortcode = '[[references]]'; + } + + if ( $p_bool_OutputReferences ) { + + if ( strpos( $p_str_Content, $l_str_ReferenceContainerPositionShortcode ) !== false ) { + + $p_str_Content = str_replace( $l_str_ReferenceContainerPositionShortcode, $this->ReferenceContainer(), $p_str_Content ); + + } else { + + $p_str_Content .= $this->ReferenceContainer(); + + } + + // increment the container ID: + self::$a_int_ReferenceContainerId++; + } + + // delete position shortcode should any remain: + $p_str_Content = str_replace( $l_str_ReferenceContainerPositionShortcode, '', $p_str_Content ); + + // take a look if the LOVE ME slug should NOT be displayed on this page/post, remove the short code if found + if (strpos($p_str_Content, MCI_Footnotes_Config::C_STR_NO_LOVE_SLUG) !== false) { + self::$a_bool_AllowLoveMe = false; + $p_str_Content = str_replace(MCI_Footnotes_Config::C_STR_NO_LOVE_SLUG, "", $p_str_Content); + } + // return the content with replaced footnotes and optional reference container appended: + return $p_str_Content; + } + + /** + * Replaces all footnotes in the given content and appends them to the static property. + * + * @author Stefan Herndler + * @since 1.5.0 + * @param string $p_str_Content Content to be searched for footnotes. + * @param bool $p_bool_ConvertHtmlChars html encode settings, default true. + * @param bool $p_bool_HideFootnotesText Hide footnotes found in the string. + * @return string + * + * @since 2.0.0 various. + * @since 2.4.0 Adding: Footnote delimiters: syntax validation for balanced footnote start and end tag short codes. + * @since 2.5.0 Bugfix: Footnote delimiters: Syntax validation: exclude certain cases involving scripts, thanks to @andreasra bug report. + * @since 2.5.0 Bugfix: Footnote delimiters: Syntax validation: complete message with hint about setting, thanks to @andreasra bug report. + * @since 2.5.0 Bugfix: Footnote delimiters: Syntax validation: limit length of quoted string to 300 characters, thanks to @andreasra bug report. + */ + public function search($p_str_Content, $p_bool_ConvertHtmlChars, $p_bool_HideFootnotesText) { + + // post ID to make everything unique wrt infinite scroll and archive view + self::$a_int_PostId = get_the_id(); + + // contains the index for the next footnote on this page + $l_int_FootnoteIndex = count(self::$a_arr_Footnotes) + 1; + + // contains the starting position for the lookup of a footnote + $l_int_PosStart = 0; + + // get start and end tag for the footnotes short code + $l_str_StartingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START); + $l_str_EndingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END); + if ($l_str_StartingTag == "userdefined" || $l_str_EndingTag == "userdefined") { + $l_str_StartingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED); + $l_str_EndingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED); + } + // decode html special chars + if ($p_bool_ConvertHtmlChars) { + $l_str_StartingTag = htmlspecialchars($l_str_StartingTag); + $l_str_EndingTag = htmlspecialchars($l_str_EndingTag); + } + + // if footnotes short code is empty, return the content without changes + if (empty($l_str_StartingTag) || empty($l_str_EndingTag)) { + return $p_str_Content; + } + + /** + * Footnote delimiter syntax validation + * + * - Adding: Footnote delimiters: syntax validation for balanced footnote start and end tag short codes. + * + * @since 2.4.0 + * + * + * - Bugfix: Footnote delimiters: Syntax validation: exclude certain cases involving scripts, thanks to @andreasra bug report. + * - Bugfix: Footnote delimiters: Syntax validation: complete message with hint about setting, thanks to @andreasra bug report. + * - Bugfix: Footnote delimiters: Syntax validation: limit length of quoted string to 300 characters, thanks to @andreasra bug report. + * + * @since 2.5.0 + * @date 2021-01-07T0824+0100 + * + * @reporter @andreasra + * @link https://wordpress.org/support/topic/warning-unbalanced-footnote-start-tag-short-code-before/ + * + * + * If footnotes short codes are unbalanced, and syntax validation is not disabled, + * prepend a warning to the content; displays de facto beneath the post title. + */ + if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTE_SHORTCODE_SYNTAX_VALIDATION_ENABLE))) { + + // make shortcodes conform to regex syntax: + $l_str_StartTagRegex = preg_replace( '#([\(\)\{\}\[\]\*\.\?\!])#', '\\\\$1', $l_str_StartingTag ); + $l_str_EndTagRegex = preg_replace( '#([\(\)\{\}\[\]\*\.\?\!])#', '\\\\$1', $l_str_EndingTag ); + + // apply different regex depending on whether start shortcode is double/triple opening parenthesis: + if ( $l_str_StartingTag == '((' || $l_str_StartingTag == '(((' ) { + + // this prevents from catching a script containing e.g. a double opening parenthesis: + $l_str_ValidationRegex = '#' . $l_str_StartTagRegex . '(((?!' . $l_str_EndTagRegex . ')[^\{\}])*?)(' . $l_str_StartTagRegex . '|$)#s'; + + } else { + + // catch all only if the start shortcode is not double/triple opening parenthesis, i.e. is unlikely to occur in scripts: + $l_str_ValidationRegex = '#' . $l_str_StartTagRegex . '(((?!' . $l_str_EndTagRegex . ').)*?)(' . $l_str_StartTagRegex . '|$)#s'; + } + + // check syntax and get error locations: + preg_match( $l_str_ValidationRegex, $p_str_Content, $p_arr_ErrorLocation ); + if ( empty( $p_arr_ErrorLocation ) ) { + self::$a_bool_SyntaxErrorFlag = false; + } + + // prevent generating and inserting the warning multiple times: + if ( self::$a_bool_SyntaxErrorFlag ) { + + // get plain text string for error location: + $l_str_ErrorSpotString = strip_tags( $p_arr_ErrorLocation[1] ); + + // limit string length to 300 characters: + if ( strlen( $l_str_ErrorSpotString ) > 300 ) { + $l_str_ErrorSpotString = substr( $l_str_ErrorSpotString, 0, 299 ) . '…'; + } + + // compose warning box: + $l_str_SyntaxErrorWarning = '

'; + $l_str_SyntaxErrorWarning .= __("WARNING: unbalanced footnote start tag short code found.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME); + $l_str_SyntaxErrorWarning .= '

'; + + // syntax validation setting in the dashboard under the General settings tab: + $l_str_SyntaxErrorWarning .= sprintf( __("If this warning is irrelevant, please disable the syntax validation feature in the dashboard under %s > %s > %s.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), __("General settings", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), __("Footnote start and end short codes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), __("Check for balanced shortcodes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) ); + + $l_str_SyntaxErrorWarning .= '

'; + $l_str_SyntaxErrorWarning .= __("Unbalanced start tag short code found before:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME); + $l_str_SyntaxErrorWarning .= '

“'; + $l_str_SyntaxErrorWarning .= $l_str_ErrorSpotString; + $l_str_SyntaxErrorWarning .= '”

'; + + // prepend the warning box to the content: + $p_str_Content = $l_str_SyntaxErrorWarning . $p_str_Content; + + // checked, set flag to false to prevent duplicate warning: + self::$a_bool_SyntaxErrorFlag = false; + + return $p_str_Content; + } + } + + + // load referrer templates if footnotes text not hidden: + if (!$p_bool_HideFootnotesText) { + + // load footnote referrer template file: + if (self::$a_bool_AlternativeTooltipsEnabled) { + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "footnote-alternative"); + } else { + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "footnote"); + } + + /** + * Call Boolean again for robustness when priority levels don’t match any longer. + * + * - Bugfix: Tooltips: fix display in Popup Maker popups by correcting a coding error. + * + * @since 2.5.4 + * @see self::add_filter('pum_popup_content', array($this, "the_content"), $l_int_TheContentPriority) + */ + self::$a_bool_TooltipsEnabled = MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED)); + self::$a_bool_AlternativeTooltipsEnabled = MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ALTERNATIVE)); + + // load tooltip inline script if jQuery tooltips are enabled: + if (self::$a_bool_TooltipsEnabled && ! self::$a_bool_AlternativeTooltipsEnabled) { + $l_obj_TemplateTooltip = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "tooltip"); + } + + } else { + $l_obj_Template = null; + $l_obj_TemplateTooltip = null; + } + + // search footnotes short codes in the content + do { + // get first occurrence of the footnote start tag short code: + $i_int_LenContent = strlen($p_str_Content); + if ($l_int_PosStart > $i_int_LenContent) $l_int_PosStart = $i_int_LenContent; + $l_int_PosStart = strpos($p_str_Content, $l_str_StartingTag, $l_int_PosStart); + // no short code found, stop here + if ($l_int_PosStart === false) { + break; + } + // get first occurrence of the footnote end tag short code: + $l_int_PosEnd = strpos($p_str_Content, $l_str_EndingTag, $l_int_PosStart); + // no short code found, stop here + if ($l_int_PosEnd === false) { + break; + } + // calculate the length of the footnote + $l_int_Length = $l_int_PosEnd - $l_int_PosStart; + + // get footnote text + $l_str_FootnoteText = substr($p_str_Content, $l_int_PosStart + strlen($l_str_StartingTag), $l_int_Length - strlen($l_str_StartingTag)); + + // get tooltip text if present: + self::$a_str_TooltipShortcode = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_DELIMITER); + self::$a_int_TooltipShortcodeLength = strlen( self::$a_str_TooltipShortcode ); + $l_int_TooltipTextLength = strpos( $l_str_FootnoteText, self::$a_str_TooltipShortcode ); + $l_bool_HasTooltipText = $l_int_TooltipTextLength === false ? false : true; + if ( $l_bool_HasTooltipText ) { + $l_str_TooltipText = substr( $l_str_FootnoteText, 0, $l_int_TooltipTextLength ); + } else { + $l_str_TooltipText = ''; + } + + /** + * URL line wrapping for Unicode non conformant browsers + * + * @since 2.1.1 (CSS) + * @since 2.1.4 (PHP) + * + * Despite Unicode recommends to line-wrap URLs at slashes, and Firefox follows + * the Unicode standard, Chrome does not, making long URLs hang out of tooltips + * or extend reference containers, so that the end is hidden outside the window + * and may eventually be viewed after we scroll horizontally or zoom out. It is + * up to the web page to make URLs breaking anywhere by wrapping them in a span + * that is assigned appropriate CSS properties and values. + * @see css/public.css + * + * - Bugfix: Tooltips: fix line breaking for hyperlinked URLs in Unicode-non-compliant user agents, thanks to @andreasra bug report. + * + * @since 2.1.1 + * + * @reporter @andreasra + * @link https://wordpress.org/support/topic/footnotes-appearing-in-header/page/3/#post-13657398 + * + * + * - Bugfix: Reference container: fix width in mobile view by URL wrapping for Unicode-non-conformant browsers, thanks to @karolszakiel bug report. + * + * @since 2.1.3 + * @date 2020-11-23 + * + * @reporter @karolszakiel + * @link https://wordpress.org/support/topic/footnotes-on-mobile-phones/ + * + * + * - Bugfix: Reference container, tooltips: fix line wrapping of URLs (hyperlinked or not) based on pattern, not link element. + * + * @since 2.1.4 + * @date 2020-11-25T0837+0100 + * @link https://wordpress.org/support/topic/footnotes-on-mobile-phones/#post-13710682 + * + * + * - Bugfix: Reference container, tooltips: URL wrap: exclude image source too, thanks to @bjrnet21 bug report. + * + * @since 2.1.5 + * + * @reporter @bjrnet21 + * @link https://wordpress.org/support/topic/2-1-4-breaks-on-my-site-images-dont-show/ + * + * + * - Bugfix: Reference container, tooltips: URL wrap: fix regex, thanks to @a223123131 bug report. + * + * @since 2.1.6 + * @date 2020-12-09T1921+0100 + * + * @reporter @a223123131 + * @link https://wordpress.org/support/topic/broken-layout-starting-version-2-1-4/ + * + * Even ARIA labels may take a URL as value, so use \w=[\'"] as a catch-all 2020-12-10T1005+0100 + * + * - Bugfix: Dashboard: URL wrap: add option to properly enable/disable URL wrap. + * + * @since 2.1.6 + * @date 2020-12-09T1606+0100 + * + * + * - Bugfix: Reference container, tooltips: URL wrap: make the quotation mark optional wrt query parameters, thanks to @spiralofhope2 bug report. + * + * @since 2.2.6 + * @date 2020-12-23T0409+0100 + * + * @reporter @spiralofhope2 + * @link https://wordpress.org/support/topic/two-links-now-breaks-footnotes-with-blogtext/ + * + * + * - Bugfix: Reference container, tooltips: URL wrap: remove a bug introduced in the regex, thanks to @rjl20 @spaceling @lukashuggenberg @klusik @friedrichnorth @bernardzit bug reports. + * + * @since 2.2.7 + * @date 2020-12-23T1046+0100 + * + * @reporter @rjl20 + * @link https://wordpress.org/support/topic/two-links-now-breaks-footnotes-with-blogtext/#post-13825479 + * + * @reporter @spaceling + * @link https://wordpress.org/support/topic/two-links-now-breaks-footnotes-with-blogtext/#post-13825532 + * + * @reporter @lukashuggenberg + * @link https://wordpress.org/support/topic/2-2-6-breaks-all-footnotes/ + * + * @reporter @klusik + * @link https://wordpress.org/support/topic/2-2-6-breaks-all-footnotes/#post-13825885 + * + * @reporter @friedrichnorth + * @link https://wordpress.org/support/topic/footnotes-dont-show-after-update-to-2-2-6/ + * + * @reporter @bernardzit + * @link https://wordpress.org/support/topic/footnotes-dont-show-after-update-to-2-2-6/#post-13826029 + * + * + * @since 2.2.8 Bugfix: Reference container, tooltips: URL wrap: correctly make the quotation mark optional wrt query parameters, thanks to @spiralofhope2 bug report. + * @date 2020-12-23T1107+0100 + * + * Correct is duplicating the negative lookbehind w/o quotes: '(?get( MCI_Footnotes_Settings::C_BOOL_FOOTNOTE_URL_WRAP_ENABLED ) ) ) { + + $l_str_FootnoteText = preg_replace( + '#(?$1', + $l_str_FootnoteText + ); + } + + // Text to be displayed instead of the footnote + $l_str_FootnoteReplaceText = ""; + + // whether hard links are enabled: + if (self::$a_bool_HardLinksEnable) { + + // get the configurable parts: + self::$a_str_ReferrerLinkSlug = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERRER_FRAGMENT_ID_SLUG); + self::$a_str_FootnoteLinkSlug = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTE_FRAGMENT_ID_SLUG); + self::$a_str_LinkIdsSeparator = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_HARD_LINK_IDS_SEPARATOR); + + // streamline ID concatenation: + self::$a_str_PostContainerIdCompound = self::$a_str_LinkIdsSeparator; + self::$a_str_PostContainerIdCompound .= self::$a_int_PostId; + self::$a_str_PostContainerIdCompound .= self::$a_str_LinkIdsSeparator; + self::$a_str_PostContainerIdCompound .= self::$a_int_ReferenceContainerId; + self::$a_str_PostContainerIdCompound .= self::$a_str_LinkIdsSeparator; + + } + + // display the footnote referrers and the tooltips: + if (!$p_bool_HideFootnotesText) { + $l_int_Index = MCI_Footnotes_Convert::Index($l_int_FootnoteIndex, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); + + // display only a truncated footnote text if option enabled: + $l_bool_EnableExcerpt = MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED)); + $l_int_MaxLength = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH)); + + // define excerpt text as footnote text by default: + $l_str_ExcerptText = $l_str_FootnoteText; + + /** + * Tooltip truncation + * + * - Adding: Tooltips: Read-on button: Label: configurable instead of localizable, thanks to @rovanov example provision. + * + * @since 2.1.0 + * @date 2020-11-08T2146+0100 + * + * @reporter @rovanov + * @link https://wordpress.org/support/topic/offset-x-axis-and-offset-y-axis-does-not-working/ + * + * If the tooltip truncation option is enabled, it’s done based on character count, + * and a trailing incomplete word is cropped. + * This is equivalent to the WordPress default excerpt generation, i.e. without a + * custom excerpt and without a delimiter. But WordPress does word count, usually 55. + */ + if (self::$a_bool_TooltipsEnabled && $l_bool_EnableExcerpt) { + $l_str_DummyText = strip_tags($l_str_FootnoteText); + if (is_int($l_int_MaxLength) && strlen($l_str_DummyText) > $l_int_MaxLength) { + $l_str_ExcerptText = substr($l_str_DummyText, 0, $l_int_MaxLength); + $l_str_ExcerptText = substr($l_str_ExcerptText, 0, strrpos($l_str_ExcerptText, ' ')); + $l_str_ExcerptText .= ' … <'; + $l_str_ExcerptText .= self::$a_bool_HardLinksEnable ? 'a' : 'span'; + $l_str_ExcerptText .= ' class="footnote_tooltip_continue" '; + $l_str_ExcerptText .= 'onclick="footnote_moveToAnchor_' . self::$a_int_PostId; + $l_str_ExcerptText .= '_' . self::$a_int_ReferenceContainerId; + $l_str_ExcerptText .= '(\'footnote_plugin_reference_' . self::$a_int_PostId; + $l_str_ExcerptText .= '_' . self::$a_int_ReferenceContainerId; + $l_str_ExcerptText .= "_$l_int_Index');\""; + + // if enabled, add the hard link fragment ID: + if (self::$a_bool_HardLinksEnable) { + + $l_str_ExcerptText .= ' href="#'; + $l_str_ExcerptText .= self::$a_str_FootnoteLinkSlug; + $l_str_ExcerptText .= self::$a_str_PostContainerIdCompound; + $l_str_ExcerptText .= $l_int_Index; + $l_str_ExcerptText .= '"'; + } + + $l_str_ExcerptText .= '>'; + + /** + * Configurable read-on button label + * + * - Adding: Tooltips: Read-on button: Label: configurable instead of localizable, thanks to @rovanov example provision. + * + * @since 2.1.0 + * @date 2020-11-08T2146+0100 + * + * @reporter @rovanov + * @link https://wordpress.org/support/topic/offset-x-axis-and-offset-y-axis-does-not-working/ + */ + $l_str_ExcerptText .= MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_READON_LABEL); + + $l_str_ExcerptText .= self::$a_bool_HardLinksEnable ? '' : ''; + } + } + + /** + * Referrers element superscript or baseline + * + * Referrers: new setting for vertical align: superscript (default) or baseline (optional), thanks to @cwbayer bug report + * @since 2.1.1 + * + * @reporter @cwbayer + * @link https://wordpress.org/support/topic/footnote-number-in-text-superscript-disrupts-leading/ + * + * define the HTML element to use for the referrers: + */ + if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_REFERRER_SUPERSCRIPT_TAGS))) { + + $l_str_SupSpan = 'sup'; + + } else { + + $l_str_SupSpan = 'span'; + } + + // whether hard links are enabled: + if (self::$a_bool_HardLinksEnable) { + + self::$a_str_LinkSpan = 'a'; + self::$a_str_LinkCloseTag = ''; + // self::$a_str_LinkOpenTag will be defined as needed + + // compose hyperlink address (leading space is in template): + $l_str_FootnoteLinkArgument = 'href="#'; + $l_str_FootnoteLinkArgument .= self::$a_str_FootnoteLinkSlug; + $l_str_FootnoteLinkArgument .= self::$a_str_PostContainerIdCompound; + $l_str_FootnoteLinkArgument .= $l_int_Index; + $l_str_FootnoteLinkArgument .= '" class="footnote_hard_link"'; + + /** + * Compose fragment ID anchor with offset, for use in reference container. + * Empty span, child of empty span, to avoid tall dotted rectangles in browser. + */ + $l_str_ReferrerAnchorElement = ''; + + } else { + + /** + * Initialize hard link variables when hard links are disabled. + * + * - Bugfix: Process: initialize hard link address variables to empty string to fix 'undefined variable' bug, thanks to @a223123131 bug report. + * + * @since 2.4.0 + * @date 2021-01-04T1622+0100 + * + * @reporter @a223123131 + * @link https://wordpress.org/support/topic/wp_debug-php-notice/ + * + * If no hyperlink nor offset anchor is needed, initialize as empty. + */ + $l_str_FootnoteLinkArgument = ''; + $l_str_ReferrerAnchorElement = ''; + + // The link element is set independently as it may be needed for styling: + if ( MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_LINK_ELEMENT_ENABLED)) ) { + + self::$a_str_LinkSpan = 'a'; + self::$a_str_LinkOpenTag = ''; + self::$a_str_LinkCloseTag = ''; + + } + } + + // determine tooltip content: + if ( self::$a_bool_TooltipsEnabled ) { + $l_str_TooltipContent = $l_bool_HasTooltipText ? $l_str_TooltipText : $l_str_ExcerptText; + } else { + $l_str_TooltipContent = ''; + } + + /** + * Determine shrink width if alternative tooltips are enabled. + * + * @since 2.5.6 + */ + $l_str_TooltipStyle = ''; + if ( self::$a_bool_AlternativeTooltipsEnabled && self::$a_bool_TooltipsEnabled ) { + $l_int_TooltipLength = strlen( strip_tags( $l_str_TooltipContent ) ); + if ( $l_int_TooltipLength < 70 ) { + $l_str_TooltipStyle = ' style="width: '; + $l_str_TooltipStyle .= ( $l_int_TooltipLength * .7 ); + $l_str_TooltipStyle .= 'em;"'; + } + } + + // fill in 'templates/public/footnote.html': + $l_obj_Template->replace( + array( + "link-span" => self::$a_str_LinkSpan, + "post_id" => self::$a_int_PostId, + "container_id" => self::$a_int_ReferenceContainerId, + "note_id" => $l_int_Index, + "hard-link" => $l_str_FootnoteLinkArgument, + "sup-span" => $l_str_SupSpan, + "before" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE), + "index" => $l_int_Index, + "after" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER), + "anchor-element" => $l_str_ReferrerAnchorElement, + "style" => $l_str_TooltipStyle, + "text" => $l_str_TooltipContent, + ) + ); + $l_str_FootnoteReplaceText = $l_obj_Template->getContent(); + + // reset the template + $l_obj_Template->reload(); + + // if standard tooltips are enabled but alternative are not: + if (self::$a_bool_TooltipsEnabled && ! self::$a_bool_AlternativeTooltipsEnabled) { + + $l_int_OffsetY = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y)); + $l_int_OffsetX = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X)); + $l_int_FadeInDelay = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DELAY )); + $l_int_FadeInDuration = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_IN_DURATION )); + $l_int_FadeOutDelay = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DELAY )); + $l_int_FadeOutDuration = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_MOUSE_OVER_BOX_FADE_OUT_DURATION)); + + // fill in 'templates/public/tooltip.html': + $l_obj_TemplateTooltip->replace( + array( + "post_id" => self::$a_int_PostId, + "container_id" => self::$a_int_ReferenceContainerId, + "note_id" => $l_int_Index, + "position" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION), + "offset-y" => !empty($l_int_OffsetY) ? $l_int_OffsetY : 0, + "offset-x" => !empty($l_int_OffsetX) ? $l_int_OffsetX : 0, + "fade-in-delay" => !empty($l_int_FadeInDelay ) ? $l_int_FadeInDelay : 0, + "fade-in-duration" => !empty($l_int_FadeInDuration ) ? $l_int_FadeInDuration : 0, + "fade-out-delay" => !empty($l_int_FadeOutDelay ) ? $l_int_FadeOutDelay : 0, + "fade-out-duration" => !empty($l_int_FadeOutDuration) ? $l_int_FadeOutDuration : 0, + ) + ); + $l_str_FootnoteReplaceText .= $l_obj_TemplateTooltip->getContent(); + $l_obj_TemplateTooltip->reload(); + } + } + // replace the footnote with the template + $p_str_Content = substr_replace($p_str_Content, $l_str_FootnoteReplaceText, $l_int_PosStart, $l_int_Length + strlen($l_str_EndingTag)); + + // add footnote only if not empty + if (!empty($l_str_FootnoteText)) { + // set footnote to the output box at the end + self::$a_arr_Footnotes[] = $l_str_FootnoteText; + // increase footnote index + $l_int_FootnoteIndex++; + } + + /** + * Fixes a footnotes numbering bug (happening under de facto rare circumstances). + * + * - Bugfix: Fixed occasional bug where footnote ordering could be out of sequence + * + * @since 1.6.4 + * @date 2016-06-29T0054+0000 + * @committer @dartiss + * @link https://plugins.trac.wordpress.org/browser/footnotes/trunk/class/task.php?rev=1445718 @dartiss’ class/task.php + * @link https://plugins.trac.wordpress.org/log/footnotes/trunk/class/task.php?rev=1445718 @dartiss re-added class/task.php + * @link https://plugins.trac.wordpress.org/browser/footnotes/trunk/class?rev=1445711 class/ w/o task.php + * @link https://plugins.trac.wordpress.org/changeset/1445711/footnotes/trunk/class @dartiss deleted class/task.php + * @link https://plugins.trac.wordpress.org/browser/footnotes/trunk/class/task.php?rev=1026210 @aricura’s latest class/task.php + * + * + * - Bugfix: Process: fix numbering bug impacting footnote #2 with footnote #1 close to start, thanks to @rumperuu bug report, thanks to @lolzim code contribution. + * + * @since 2.5.5 + * + * @contributor @lolzim + * @link https://wordpress.org/support/topic/footnotes-numbered-incorrectly/#post-14062032 + * + * @reporter @rumperuu + * @link https://wordpress.org/support/topic/footnotes-numbered-incorrectly/ + * + * This assignment was overridden by another one, causing the algorithm to jump back + * near the post start to a position calculated as the sum of the length of the last + * footnote and the length of the last footnote replace text. + * A bug disturbing the order of the footnotes depending on the text before the first + * footnote, the length of the first footnote and the length of the templates for the + * footnote and the tooltip. Moreover, it was causing non-trivial process garbage. + */ + // add offset to the new starting position + $l_int_PosStart += $l_int_Length + strlen($l_str_EndingTag); + + } while (true); + + // return content + return $p_str_Content; + } + + /** + * Generates the reference container. + * + * @author Stefan Herndler + * @since 1.5.0 + * @return string + * + * @since 2.0.0 Update: remove backlink symbol along with column 2 of the reference container + * @since 2.0.3 Bugfix: prepend an arrow on user request + * @since 2.0.6 Bugfix: Reference container: fix line breaking behavior in footnote number clusters. + * @since 2.0.4 Bugfix: restore the arrow select and backlink symbol input settings + * @since 2.1.1 Bugfix: Referrers, reference container: Combining identical footnotes: fix dead links and ensure referrer-backlink bijectivity, thanks to @happyches bug report. + * @since 2.1.1 Bugfix: Reference container: Backlink symbol: make optional, not suggest configuring it to invisible, thanks to @spaceling feedback. + */ + public function ReferenceContainer() { + + // no footnotes have been replaced on this page: + if (empty(self::$a_arr_Footnotes)) { + return ""; + } + + + /** + * Footnote index backlink symbol + * + * - Bugfix: Reference container: Backlink symbol: make optional, not suggest configuring it to invisible, thanks to @spaceling feedback. + * + * @since 2.1.1 + * + * @reporter @spaceling + * @link https://wordpress.org/support/topic/change-the-position-5/page/2/#post-13671138 + * + * If the backlink symbol is enabled: + */ + if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_ENABLE))) { + + // get html arrow + $l_str_Arrow = MCI_Footnotes_Convert::getArrow(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW)); + // set html arrow to the first one if invalid index defined + if (is_array($l_str_Arrow)) { + $l_str_Arrow = MCI_Footnotes_Convert::getArrow(0); + } + // get user defined arrow + $l_str_ArrowUserDefined = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW_USER_DEFINED); + if (!empty($l_str_ArrowUserDefined)) { + $l_str_Arrow = $l_str_ArrowUserDefined; + } + + // wrap the arrow in a @media print { display:hidden } span: + $l_str_FootnoteArrow = ''; + $l_str_FootnoteArrow .= $l_str_Arrow . ''; + + } else { + + // If the backlink symbol isn’t enabled, set it to empty: + $l_str_Arrow = ''; + $l_str_FootnoteArrow = ''; + + } + + + /** + * Backlink separator + * + * - Bugfix: Reference container: make separating and terminating punctuation optional and configurable, thanks to @docteurfitness issue report and code contribution. + * + * @since 2.1.4 + * @date 2020-11-28T1048+0100 + * + * @contributor @docteurfitness + * @link https://wordpress.org/support/topic/update-2-1-3/#post-13704194 + * + * @reporter @docteurfitness + * @link https://wordpress.org/support/topic/update-2-1-3/ + * + * Initially a comma was appended in this algorithm for enumerations. + * The comma in enumerations is not generally preferred. + */ + if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_SEPARATOR_ENABLED))) { + + // check if it is input-configured: + $l_str_Separator = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_CUSTOM); + + if (empty($l_str_Separator)) { + + // if it is not, check which option is on: + $l_str_SeparatorOption = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_BACKLINKS_SEPARATOR_OPTION); + switch ($l_str_SeparatorOption) { + case 'comma' : $l_str_Separator = ','; break; + case 'semicolon': $l_str_Separator = ';'; break; + case 'en_dash' : $l_str_Separator = ' –'; break; + } + } + + } else { + + $l_str_Separator = ''; + } + + /** + * Backlink terminator + * + * Initially a dot was appended in the table row template. + * @since 2.0.6 a dot after footnote numbers is discarded as not localizable; + * making it optional was envisaged. + * @since 2.1.4 the terminator is optional, has options, and is configurable: + */ + if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_TERMINATOR_ENABLED))) { + + // check if it is input-configured: + $l_str_Terminator = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_CUSTOM); + + if (empty($l_str_Terminator)) { + + // if it is not, check which option is on: + $l_str_TerminatorOption = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_BACKLINKS_TERMINATOR_OPTION); + switch ($l_str_TerminatorOption) { + case 'period' : $l_str_Terminator = '.'; break; + case 'parenthesis': $l_str_Terminator = ')'; break; + case 'colon' : $l_str_Terminator = ':'; break; + } + } + + } else { + + $l_str_Terminator = ''; + } + + + /** + * Line breaks + * + * - Bugfix: Reference container: Backlinks: fix stacked enumerations by adding optional line breaks. + * + * @since 2.1.4 + * @date 2020-11-28T1049+0100 + * + * The backlinks of combined footnotes are generally preferred in an enumeration. + * But when few footnotes are identical, stacking the items in list form is better. + * Variable number length and proportional character width require explicit line breaks. + * Otherwise, an ordinary space character offering a line break opportunity is inserted. + */ + $l_str_LineBreak = MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_BACKLINKS_LINE_BREAKS_ENABLED)) ? '
' : ' '; + + /** + * For maintenance and support, table rows in the reference container should be + * separated by an empty line. So we add these line breaks for source readability. + * Before the first table row (breaks between rows are ~200 lines below): + */ + $l_str_Body = "\r\n\r\n"; + + + /** + * Reference container table row template load + * + * - Bugfix: Reference container: option to restore pre-2.0.0 layout with the backlink symbol in an extra column. + * + * @since 2.1.1 + * @date 2020-11-16T2024+0100 + */ + + // when combining identical footnotes is turned on, another template is needed: + if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES))) { + // the combining template allows for backlink clusters and supports cell clicking for single notes: + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container-body-combi"); + + } else { + + // when 3-column layout is turned on (only available if combining is turned off): + if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_3COLUMN_LAYOUT_ENABLE))) { + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container-body-3column"); + + } else { + + // when switch symbol and index is turned on, and combining and 3-columns are off: + if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH))) { + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container-body-switch"); + + } else { + + // default is the standard template: + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container-body"); + + } + } + } + + /** + * Switch backlink symbol and footnote number + * + * - Bugfix: Reference container: option to append symbol (prepended by default), thanks to @spaceling code contribution. + * + * @since 2.1.1 + * @date 2020-11-16T2024+0100 + * + * @contributor @spaceling + * @link https://wordpress.org/support/topic/change-the-position-5/#post-13615994 + * + * + * - Bugfix: Reference container: Backlink symbol: support for appending when combining identicals is on. + * + * @since 2.1.4 + * @date 2020-11-26T1633+0100 + */ + $l_bool_SymbolSwitch = MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_BACKLINK_SYMBOL_SWITCH)); + + // loop through all footnotes found in the page + for ($l_int_Index = 0; $l_int_Index < count(self::$a_arr_Footnotes); $l_int_Index++) { + + // get footnote text + $l_str_FootnoteText = self::$a_arr_Footnotes[$l_int_Index]; + + // if footnote is empty, go to the next one; + // With combine identicals turned on, identicals will be deleted and are skipped: + if (empty($l_str_FootnoteText)) { + continue; + } + + // generate content of footnote index cell + $l_int_FirstFootnoteIndex = ($l_int_Index + 1); + + // get the footnote index string and + // keep supporting legacy index placeholder: + $l_str_FootnoteId = MCI_Footnotes_Convert::Index(($l_int_Index + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); + + /** + * Case of only one backlink per table row + * + * If enabled, and for the case the footnote is single, compose hard link: + */ + // define anyway: + $l_str_HardLinkAddress = ''; + + if (self::$a_bool_HardLinksEnable) { + + /** + * Use-Backbutton-Hint tooltip, optional and configurable. + * + * - Update: Reference container: Hard backlinks (optional): optional configurable tooltip hinting to use the backbutton instead, thanks to @theroninjedi47 bug report. + * + * @since 2.5.4 + * + * @reporter @theroninjedi47 + * @link https://wordpress.org/support/topic/hyperlinked-footnotes-creating-excessive-back-history/ + * + * When hard links are enabled, clicks on the backlinks are logged in the browsing history. + * This tooltip hints to use the backbutton instead, so the history gets streamlined again. + * @link https://wordpress.org/support/topic/making-it-amp-compatible/#post-13837359 + */ + if ( MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_BACKLINK_TOOLTIP_ENABLE ) ) ) { + $l_str_UseBackbuttonHint = ' title="'; + $l_str_UseBackbuttonHint .= MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_BACKLINK_TOOLTIP_TEXT); + $l_str_UseBackbuttonHint .= '"'; + } else { + $l_str_UseBackbuttonHint = ''; + } + + /** + * Compose fragment ID anchor with offset, for use in reference container. + * Empty span, child of empty span, to avoid tall dotted rectangles in browser. + */ + $l_str_FootnoteAnchorElement = ''; + + // compose optional hard link address: + $l_str_HardLinkAddress = ' href="#'; + $l_str_HardLinkAddress .= self::$a_str_ReferrerLinkSlug; + $l_str_HardLinkAddress .= self::$a_str_PostContainerIdCompound; + $l_str_HardLinkAddress .= $l_str_FootnoteId . '"'; + $l_str_HardLinkAddress .= $l_str_UseBackbuttonHint; + + // compose optional opening link tag with optional hard link, mandatory for instance: + self::$a_str_LinkOpenTag = 'get(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES))) { + + // ID, optional hard link address, and class: + $l_str_FootnoteReference = '<' . self::$a_str_LinkSpan; + $l_str_FootnoteReference .= ' id="footnote_plugin_reference_'; + $l_str_FootnoteReference .= self::$a_int_PostId; + $l_str_FootnoteReference .= '_' . self::$a_int_ReferenceContainerId; + $l_str_FootnoteReference .= "_$l_str_FootnoteId\""; + if (self::$a_bool_HardLinksEnable) { + $l_str_FootnoteReference .= ' href="#'; + $l_str_FootnoteReference .= self::$a_str_ReferrerLinkSlug; + $l_str_FootnoteReference .= self::$a_str_PostContainerIdCompound; + $l_str_FootnoteReference .= $l_str_FootnoteId . '"'; + $l_str_FootnoteReference .= $l_str_UseBackbuttonHint; + } + $l_str_FootnoteReference .= ' class="footnote_backlink"'; + + // the click event goes in the table cell if footnote remains single: + $l_str_BacklinkEvent = ' onclick="footnote_moveToAnchor_'; + $l_str_BacklinkEvent .= self::$a_int_PostId; + $l_str_BacklinkEvent .= '_' . self::$a_int_ReferenceContainerId; + $l_str_BacklinkEvent .= "('footnote_plugin_tooltip_"; + $l_str_BacklinkEvent .= self::$a_int_PostId; + $l_str_BacklinkEvent .= '_' . self::$a_int_ReferenceContainerId; + $l_str_BacklinkEvent .= "_$l_str_FootnoteId');\""; + + + // the dedicated template enumerating backlinks uses another variable: + $l_str_FootnoteBacklinks = $l_str_FootnoteReference; + + // append the click event right to the backlink item for enumerations; + // else it goes in the table cell: + $l_str_FootnoteBacklinks .= $l_str_BacklinkEvent . '>'; + $l_str_FootnoteReference .= '>'; + + // append the optional offset anchor for hard links: + if (self::$a_bool_HardLinksEnable) { + $l_str_FootnoteReference .= $l_str_FootnoteAnchorElement; + $l_str_FootnoteBacklinks .= $l_str_FootnoteAnchorElement; + } + + // continue both single note and notes cluster, depending on switch option status: + if ($l_bool_SymbolSwitch) { + + $l_str_FootnoteReference .= "$l_str_FootnoteId$l_str_FootnoteArrow"; + $l_str_FootnoteBacklinks .= "$l_str_FootnoteId$l_str_FootnoteArrow"; + + } else { + + $l_str_FootnoteReference .= "$l_str_FootnoteArrow$l_str_FootnoteId"; + $l_str_FootnoteBacklinks .= "$l_str_FootnoteArrow$l_str_FootnoteId"; + + } + + // If that is the only footnote with this text, we’re almost done. + + // check if it isn't the last footnote in the array: + if ($l_int_FirstFootnoteIndex < count(self::$a_arr_Footnotes)) { + + // get all footnotes that haven't passed yet: + for ($l_int_CheckIndex = $l_int_FirstFootnoteIndex; $l_int_CheckIndex < count(self::$a_arr_Footnotes); $l_int_CheckIndex++) { + + // check if a further footnote is the same as the actual one: + if ($l_str_FootnoteText == self::$a_arr_Footnotes[$l_int_CheckIndex]) { + + // if so, set the further footnote as empty so it won't be displayed later: + self::$a_arr_Footnotes[$l_int_CheckIndex] = ""; + + // set the flag to true for the combined status: + $l_bool_FlagCombined = true; + + // update the footnote ID: + $l_str_FootnoteId = MCI_Footnotes_Convert::Index(($l_int_CheckIndex + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); + + // resume composing the backlinks enumeration: + $l_str_FootnoteBacklinks .= "$l_str_Separator'; + $l_str_FootnoteBacklinks .= $l_str_LineBreak; + $l_str_FootnoteBacklinks .= '<' . self::$a_str_LinkSpan; + $l_str_FootnoteBacklinks .= ' id="footnote_plugin_reference_'; + $l_str_FootnoteBacklinks .= self::$a_int_PostId; + $l_str_FootnoteBacklinks .= '_' . self::$a_int_ReferenceContainerId; + $l_str_FootnoteBacklinks .= "_$l_str_FootnoteId\""; + + // insert the optional hard link address: + if (self::$a_bool_HardLinksEnable) { + $l_str_FootnoteBacklinks .= ' href="#'; + $l_str_FootnoteBacklinks .= self::$a_str_ReferrerLinkSlug; + $l_str_FootnoteBacklinks .= self::$a_str_PostContainerIdCompound; + $l_str_FootnoteBacklinks .= $l_str_FootnoteId . '"'; + $l_str_FootnoteBacklinks .= $l_str_UseBackbuttonHint; + } + + $l_str_FootnoteBacklinks .= ' class="footnote_backlink"'; + $l_str_FootnoteBacklinks .= ' onclick="footnote_moveToAnchor_'; + $l_str_FootnoteBacklinks .= self::$a_int_PostId; + $l_str_FootnoteBacklinks .= '_' . self::$a_int_ReferenceContainerId; + $l_str_FootnoteBacklinks .= "('footnote_plugin_tooltip_"; + $l_str_FootnoteBacklinks .= self::$a_int_PostId; + $l_str_FootnoteBacklinks .= '_' . self::$a_int_ReferenceContainerId; + $l_str_FootnoteBacklinks .= "_$l_str_FootnoteId');\">"; + + // append the offset anchor for optional hard links: + if (self::$a_bool_HardLinksEnable) { + $l_str_FootnoteBacklinks .= ''; + } + + $l_str_FootnoteBacklinks .= $l_bool_SymbolSwitch ? '' : $l_str_FootnoteArrow; + $l_str_FootnoteBacklinks .= $l_str_FootnoteId; + $l_str_FootnoteBacklinks .= $l_bool_SymbolSwitch ? $l_str_FootnoteArrow : ''; + + } + } + } + + // append terminator and end tag: + $l_str_FootnoteReference .= $l_str_Terminator . ''; + $l_str_FootnoteBacklinks .= $l_str_Terminator . ''; + + } + + // line wrapping of URLs already fixed, see above + + // get reference container item text if tooltip text goes separate: + $l_int_TooltipTextLength = strpos( $l_str_FootnoteText, self::$a_str_TooltipShortcode ); + $l_bool_HasTooltipText = $l_int_TooltipTextLength === false ? false : true; + if ( $l_bool_HasTooltipText ) { + $l_str_NotTooltipText = substr( $l_str_FootnoteText, ( $l_int_TooltipTextLength + self::$a_int_TooltipShortcodeLength ) ); + self::$a_bool_MirrorTooltipText = MCI_Footnotes_Convert::toBool( MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_ENABLE ) ); + if ( self::$a_bool_MirrorTooltipText ) { + $l_str_TooltipText = substr( $l_str_FootnoteText, 0, $l_int_TooltipTextLength ); + $l_str_ReferenceTextIntroducer = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_TOOLTIP_EXCERPT_MIRROR_SEPARATOR); + $l_str_ReferenceText = $l_str_TooltipText . $l_str_ReferenceTextIntroducer . $l_str_NotTooltipText; + } else { + $l_str_ReferenceText = $l_str_NotTooltipText; + } + } else { + $l_str_ReferenceText = $l_str_FootnoteText; + } + + // replace all placeholders in table row template: + $l_obj_Template->replace( + array( + + // placeholder used in all templates: + "text" => $l_str_ReferenceText, + + // used in standard layout W/O COMBINED FOOTNOTES: + "post_id" => self::$a_int_PostId, + "container_id" => self::$a_int_ReferenceContainerId, + "note_id" => MCI_Footnotes_Convert::Index($l_int_FirstFootnoteIndex, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)), + "link-start" => self::$a_str_LinkOpenTag, + "link-end" => self::$a_str_LinkCloseTag, + "link-span" => self::$a_str_LinkSpan, + "terminator" => $l_str_Terminator, + "anchor-element" => $l_str_FootnoteAnchorElement, + "hard-link" => $l_str_HardLinkAddress, + + // used in standard layout WITH COMBINED IDENTICALS TURNED ON: + "pointer" => $l_bool_FlagCombined ? '' : ' pointer', + "event" => $l_bool_FlagCombined ? '' : $l_str_BacklinkEvent, + "backlinks" => $l_bool_FlagCombined ? $l_str_FootnoteBacklinks : $l_str_FootnoteReference, + + // Legacy placeholders for use in legacy layout templates: + "arrow" => $l_str_FootnoteArrow, + "index" => $l_str_FootnoteId, + ) + ); + + $l_str_Body .= $l_obj_Template->getContent(); + + // extra line breaks for page source readability: + $l_str_Body .= "\r\n\r\n"; + + $l_obj_Template->reload(); + + } + + // call again for robustness when priority levels don’t match any longer: + self::$a_int_ScrollOffset = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_OFFSET)); + + // streamline: + $l_bool_CollapseDefault = MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE)); + + /** + * Reference container label + * + * - Bugfix: Reference container: Label: set empty label to U+202F NNBSP for more robustness, thanks to @lukashuggenberg feedback. + * + * @since 2.4.0 + * @date 2021-01-04T0504+0100 + * + * @reporter @lukashuggenberg + * + * Themes may drop-cap a first letter of initial paragraphs, like this label. + * In case of empty label that would apply to the left half button character. + * Hence the point in setting an empty label to U+202F NARROW NO-BREAK SPACE. + */ + $l_str_ReferenceContainerLabel = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME); + + /** + * Select the reference container template according to the script mode. + * + * - Bugfix: Reference container: optional alternative expanding and collapsing without jQuery for use with hard links, thanks to @hopper87it @pkverma99 issue reports. + * + * @since 2.5.6 + * + * @reporter @hopper87it + * @link https://wordpress.org/support/topic/footnotes-wp-rocket/ + * + * @reporter @pkverma99 + * @link https://wordpress.org/support/topic/footnotes-wp-rocket/#post-14076188 + */ + $l_str_ScriptMode = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_REFERENCE_CONTAINER_SCRIPT_MODE); + + if ( $l_str_ScriptMode == 'jquery' ) { + + // load 'templates/public/reference-container.html': + $l_obj_TemplateContainer = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container"); + + } else { + + // load 'templates/public/js-reference-container.html': + $l_obj_TemplateContainer = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "js-reference-container"); + } + + $l_obj_TemplateContainer->replace( + array( + "post_id" => self::$a_int_PostId, + "container_id" => self::$a_int_ReferenceContainerId, + "element" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_LABEL_ELEMENT), + "name" => empty($l_str_ReferenceContainerLabel) ? ' ' : $l_str_ReferenceContainerLabel, + "button-style" => !$l_bool_CollapseDefault ? 'display: none;' : '', + "style" => $l_bool_CollapseDefault ? 'display: none;' : '', + "content" => $l_str_Body, + "scroll-offset" => (self::$a_int_ScrollOffset / 100), + "scroll-duration" => intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_SCROLL_DURATION)), + ) + ); + + // free all found footnotes if reference container will be displayed + self::$a_arr_Footnotes = array(); + + return $l_obj_TemplateContainer->getContent(); + } +} diff --git a/class/template.php b/class/template.php index 236734c..d8c19b9 100644 --- a/class/template.php +++ b/class/template.php @@ -1,235 +1,261 @@ -plugin_directory = plugin_dir_path( dirname( __FILE__ ) ); - - /** - * Modularize functions. - * - * @since 2.4.0d3 - */ - $template = $this->get_template( $p_str_file_type, $p_str_file_name, $p_str_extension ); - if ( $template ) { - $this->process_template( $template ); - } else { - return; - } - - } - - /** - * Replace all placeholders specified in array. - * - * @since 1.5.0 - * @param array $p_arr_placeholders Placeholders (key = placeholder, value = value). - * @return bool True on Success, False if Placeholders invalid. - */ - public function replace( $p_arr_placeholders ) { - // No placeholders set. - if ( empty( $p_arr_placeholders ) ) { - return false; - } - // Template content is empty. - if ( empty( $this->a_str_replaced_content ) ) { - return false; - } - // Iterate through each placeholder and replace it with its value. - foreach ( $p_arr_placeholders as $l_str_placeholder => $l_str_value ) { - $this->a_str_replaced_content = str_replace( '[[' . $l_str_placeholder . ']]', $l_str_value, $this->a_str_replaced_content ); - } - // Success. - return true; - } - - /** - * Reloads the original content of the template file. - * - * @since 1.5.0 - */ - public function reload() { - $this->a_str_replaced_content = $this->a_str_original_content; - } - - /** - * Returns the content of the template file with replaced placeholders. - * - * @since 1.5.0 - * @return string Template content with replaced placeholders. - */ - public function get_content() { - return $this->a_str_replaced_content; - } - - /** - * Process template file. - * - * @since 2.4.0d3 - * - * @param string $template The template to be processed. - * @return void - * - * @since 2.0.3 Replace tab with a space. - * @since 2.0.3 Replace 2 spaces with 1. - * @since 2.0.4 Collapse multiple spaces. - * @since 2.2.6 Delete a space before a closing pointy bracket. - * @since 2.5.4 Collapse HTML comments and PHP/JS docblocks (only). - */ - public function process_template( $template ) { - // phpcs:disable WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents - $this->a_str_original_content = preg_replace( '##s', '', file_get_contents( $template ) ); - // phpcs:enable - $this->a_str_original_content = preg_replace( '#/\*\*.+?\*/#s', '', $this->a_str_original_content ); - $this->a_str_original_content = str_replace( "\n", '', $this->a_str_original_content ); - $this->a_str_original_content = str_replace( "\r", '', $this->a_str_original_content ); - $this->a_str_original_content = str_replace( "\t", ' ', $this->a_str_original_content ); - $this->a_str_original_content = preg_replace( '# +#', ' ', $this->a_str_original_content ); - $this->a_str_original_content = str_replace( ' >', '>', $this->a_str_original_content ); - $this->reload(); - } - - /** - * Get the template. - * - * - Adding: Templates: Enable template location stack, thanks to @misfist code contribution. - * - * @since 2.4.0d3 Contribution. - * @since 2.5.0 Release. - * - * @contributor @misfist - * @link https://wordpress.org/support/topic/template-override-filter/#post-13864301 - * - * @param string $p_str_file_type The file type of the template. - * @param string $p_str_file_name The file name of the template. - * @param string $p_str_extension The file extension of the template. - * @return mixed false | template path - */ - public function get_template( $p_str_file_type, $p_str_file_name, $p_str_extension = 'html' ) { - $located = false; - - /** - * The directory can be changed. - * - * @usage to change location of templates to 'template_parts/footnotes/': - * add_filter( 'mci_footnotes_template_directory', function( $directory ) { - * return 'template_parts/footnotes/'; - * } ); - */ - $template_directory = apply_filters( 'mci_footnotes_template_directory', 'footnotes/templates/' ); - $custom_directory = apply_filters( 'mci_footnotes_custom_template_directory', 'footnotes-custom/' ); - $template_name = $p_str_file_type . '/' . $p_str_file_name . '.' . $p_str_extension; - - /** - * Look in active theme. - */ - if ( file_exists( trailingslashit( get_stylesheet_directory() ) . $template_directory . $template_name ) ) { - $located = trailingslashit( get_stylesheet_directory() ) . $template_directory . $template_name; - - /** - * Look in parent theme in case active is child. - */ - } elseif ( file_exists( trailingslashit( get_template_directory() ) . $template_directory . $template_name ) ) { - $located = trailingslashit( get_template_directory() ) . $template_directory . $template_name; - - /** - * Look in custom plugin directory. - */ - } elseif ( file_exists( trailingslashit( WP_PLUGIN_DIR ) . $custom_directory . 'templates/' . $template_name ) ) { - $located = trailingslashit( WP_PLUGIN_DIR ) . $custom_directory . 'templates/' . $template_name; - - /** - * Fall back to the templates shipped with the plugin. - */ - } elseif ( file_exists( $this->plugin_directory . 'templates/' . $template_name ) ) { - $located = $this->plugin_directory . 'templates/' . $template_name; - } - - return $located; - } - -} +plugin_directory = plugin_dir_path( dirname( __FILE__ ) ); + + /** + * Modularize functions + * + * @since 2.4.0d3 + * + * @author Patrizia Lutz @misfist + */ + if( $template = $this->get_template( $p_str_FileType, $p_str_FileName, $p_str_Extension ) ) { + $this->process_template( $template ); + } else { + return; + } + + } + + /** + * Replace all placeholders specified in array. + * + * @author Stefan Herndler + * @since 1.5.0 + * @param array $p_arr_Placeholders Placeholders (key = placeholder, value = value). + * @return bool True on Success, False if Placeholders invalid. + */ + public function replace($p_arr_Placeholders) { + // no placeholders set + if (empty($p_arr_Placeholders)) { + return false; + } + // template content is empty + if (empty($this->a_str_ReplacedContent)) { + return false; + } + // iterate through each placeholder and replace it with its value + foreach($p_arr_Placeholders as $l_str_Placeholder => $l_str_Value) { + $this->a_str_ReplacedContent = str_replace("[[" . $l_str_Placeholder . "]]", $l_str_Value, $this->a_str_ReplacedContent); + } + // success + return true; + } + + /** + * Reloads the original content of the template file. + * + * @author Stefan Herndler + * @since 1.5.0 + */ + public function reload() { + $this->a_str_ReplacedContent = $this->a_str_OriginalContent; + } + + /** + * Returns the content of the template file with replaced placeholders. + * + * @author Stefan Herndler + * @since 1.5.0 + * @return string Template content with replaced placeholders. + */ + public function getContent() { + return $this->a_str_ReplacedContent; + } + + /** + * Process template file + * + * @author Patrizia Lutz @misfist + * + * @since 2.4.0d3 + * + * @param string $template + * @return void + * + * + * @since 2.0.3 replace tab with a space + * @since 2.0.3 replace 2 spaces with 1 + * @since 2.0.4 collapse multiple spaces + * @since 2.2.6 delete a space before a closing pointy bracket + * @since 2.5.4 collapse HTML comments and PHP/JS docblocks (only) + */ + public function process_template( $template ) { + $this->a_str_OriginalContent = preg_replace( '##s', "", file_get_contents( $template ) ); + $this->a_str_OriginalContent = preg_replace( '#/\*\*.+?\*/#s', "", $this->a_str_OriginalContent ); + $this->a_str_OriginalContent = str_replace( "\n", "", $this->a_str_OriginalContent ); + $this->a_str_OriginalContent = str_replace( "\r", "", $this->a_str_OriginalContent ); + $this->a_str_OriginalContent = str_replace( "\t", " ", $this->a_str_OriginalContent ); + $this->a_str_OriginalContent = preg_replace( '# +#', " ", $this->a_str_OriginalContent ); + $this->a_str_OriginalContent = str_replace( " >", ">", $this->a_str_OriginalContent ); + $this->reload(); + } + + /** + * Get the template + * + * @author Patrizia Lutz @misfist + * + * @since 2.4.0d3 + * + * @param string $p_str_FileType + * @param string $p_str_FileName + * @param string $p_str_Extension + * @return mixed false | template path + */ + public function get_template( $p_str_FileType, $p_str_FileName, $p_str_Extension = "html" ) { + $located = false; + + /** + * The directory change be modified + * @usage to change location of templates to `template_parts/footnotes/': + * add_filter( 'mci_footnotes_template_directory', function( $directory ) { + * return 'template_parts/footnotes/; + * } ); + */ + $template_directory = apply_filters( 'mci_footnotes_template_directory', 'footnotes/templates/' ); + $custom_directory = apply_filters( 'mci_footnotes_custom_template_directory', 'footnotes-custom/' ); + $template_name = $p_str_FileType . '/' . $p_str_FileName . '.' . $p_str_Extension; + + /** + * Look in active (child) theme + */ + if ( file_exists( trailingslashit( get_stylesheet_directory() ) . $template_directory . $template_name ) ) { + $located = trailingslashit( get_stylesheet_directory() ) . $template_directory . $template_name; + + /** + * Look in parent theme + */ + } elseif ( file_exists( trailingslashit( get_template_directory() ) . $template_directory . $template_name ) ) { + $located = trailingslashit( get_template_directory() ) . $template_directory . $template_name; + + /** + * Look in custom directory + */ + } elseif ( file_exists( trailingslashit( WP_PLUGIN_DIR ) . $custom_directory . 'templates/' . $template_name ) ) { + $located = trailingslashit( WP_PLUGIN_DIR ) . $custom_directory . 'templates/' . $template_name; + + /** + * Look in plugin + */ + } elseif ( file_exists( $this->plugin_directory . 'templates/' . $template_name ) ) { + $located = $this->plugin_directory . 'templates/' . $template_name; + } + + return $located; + } + +} // end of class diff --git a/class/widgets/base.php b/class/widgets/base.php index 6618f28..7e8ece1 100644 --- a/class/widgets/base.php +++ b/class/widgets/base.php @@ -1,87 +1,88 @@ - echo the Widget Content - * **public function form($instance)** -> echo the Settings of the Widget - * - * @author Stefan Herndler - * @since 1.5.0 - */ -abstract class MCI_Footnotes_Widget_Base extends WP_Widget { - - /** - * Returns an unique ID as string used for the Widget Base ID. - * - * @since 1.5.0 - * @return string - */ - abstract protected function get_id(); - - /** - * Returns the Public name of child Widget to be displayed in the Configuration page. - * - * @since 1.5.0 - * @return string - */ - abstract protected function get_name(); - - /** - * Returns the Description of the child widget. - * - * @since 1.5.0 - * @return string - */ - abstract protected function get_description(); - - /** - * Returns the width of the Widget. Default width is 250 pixel. - * - * @since 1.5.0 - * @return int - */ - protected function get_widget_width() { - return 250; - } - - /** - * Class Constructor. Registers the child Widget to WordPress. - * - * @since 1.5.0 - * - * - Update: replace deprecated function WP_Widget() with recommended __construct(), thanks to @dartiss code contribution. - * - * @since 1.6.4 - * @contributor @dartiss - * @link https://plugins.trac.wordpress.org/browser/footnotes/trunk/class/widgets/base.php?rev=1445720 - * “The called constructor method for WP_Widget in MCI_Footnotes_Widget_ReferenceContainer is deprecated since version 4.3.0! Use __construct() instead.” - */ - public function __construct() { - $l_arr_widget_options = array( - 'classname' => __CLASS__, - 'description' => $this->get_description(), - ); - $l_arr_control_options = array( - 'id_base' => strtolower( $this->get_id() ), - 'width' => $this->get_widget_width(), - ); - // Registers the Widget. - parent::__construct( - strtolower( $this->get_id() ), // Unique ID for the widget, has to be lowercase. - $this->get_name(), // Plugin name to be displayed. - $l_arr_widget_options, // Optional Widget Options. - $l_arr_control_options // Optional Widget Control Options. - ); - } -} + echo the Widget Content + * **public function form($instance)** -> echo the Settings of the Widget + * + * @author Stefan Herndler + * @since 1.5.0 + */ +abstract class MCI_Footnotes_WidgetBase extends WP_Widget { + + /** + * Returns an unique ID as string used for the Widget Base ID. + * + * @author Stefan Herndler + * @since 1.5.0 + * @return string + */ + abstract protected function getID(); + + /** + * Returns the Public name of child Widget to be displayed in the Configuration page. + * + * @author Stefan Herndler + * @since 1.5.0 + * @return string + */ + abstract protected function getName(); + + /** + * Returns the Description of the child widget. + * + * @author Stefan Herndler + * @since 1.5.0 + * @return string + */ + abstract protected function getDescription(); + + /** + * Returns the width of the Widget. Default width is 250 pixel. + * + * @author Stefan Herndler + * @since 1.5.0 + * @return int + */ + protected function getWidgetWidth() { + return 250; + } + + /** + * Class Constructor. Registers the child Widget to WordPress. + * + * @author Stefan Herndler + * @since 1.5.0 + * + * - Update: replace deprecated function WP_Widget() with recommended __construct(), thanks to @dartiss code contribution. + * + * @since 1.6.4 + * @contributor @dartiss + * @link https://plugins.trac.wordpress.org/browser/footnotes/trunk/class/widgets/base.php?rev=1445720 + * “The called constructor method for WP_Widget in MCI_Footnotes_Widget_ReferenceContainer is deprecated since version 4.3.0! Use __construct() instead.” + */ + public function __construct() { + $l_arr_WidgetOptions = array("classname" => __CLASS__, "description" => $this->getDescription()); + $l_arr_ControlOptions = array("id_base" => strtolower($this->getID()), "width" => $this->getWidgetWidth()); + // registers the Widget + parent::__construct( + strtolower($this->getID()), // unique ID for the widget, has to be lowercase + $this->getName(), // Plugin name to be displayed + $l_arr_WidgetOptions, // Optional Widget Options + $l_arr_ControlOptions // Optional Widget Control Options + ); + } +} diff --git a/class/widgets/reference-container.php b/class/widgets/reference-container.php index 1a628a7..693ef58 100644 --- a/class/widgets/reference-container.php +++ b/class/widgets/reference-container.php @@ -1,81 +1,85 @@ -get( MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION ) ) { - // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped - echo $g_obj_mci_footnotes->a_obj_task->Reference_Container(); - // phpcs:enable - } - } -} +get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "widget") { + echo $g_obj_MCI_Footnotes->a_obj_Task->ReferenceContainer(); + } + } +} diff --git a/class/wysiwyg.php b/class/wysiwyg.php index 898f133..d8b558b 100644 --- a/class/wysiwyg.php +++ b/class/wysiwyg.php @@ -1,92 +1,83 @@ -get_content(); - // phpcs:enable - } - - /** - * Includes the Plugins WYSIWYG editor script. - * - * @since 1.5.0 - * @param array $p_arr_plugins Scripts to be included to the editor. - * @return array - */ - public static function include_scripts( $p_arr_plugins ) { - $p_arr_plugins[ MCI_Footnotes_Config::C_STR_PLUGIN_NAME ] = plugins_url( '/../js/wysiwyg-editor.js', __FILE__ ); - return $p_arr_plugins; - } - - /** - * AJAX Callback function when the Footnotes Button is clicked. Either in the Plain text or Visual editor. - * Returns an JSON encoded array with the Footnotes start and end short code. - * - * @since 1.5.0 - */ - public static function ajax_callback() { - // Get start and end tag for the footnotes short code. - $l_str_starting_tag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START ); - $l_str_ending_tag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END ); - if ( 'userdefined' === $l_str_starting_tag || 'userdefined' === $l_str_ending_tag ) { - $l_str_starting_tag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED ); - $l_str_ending_tag = MCI_Footnotes_Settings::instance()->get( MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED ); - } - echo wp_json_encode( - array( - 'start' => htmlspecialchars( $l_str_starting_tag ), - 'end' => htmlspecialchars( $l_str_ending_tag ), - ) - ); - exit; - } -} +getContent(); + } + + /** + * Includes the Plugins WYSIWYG editor script. + * + * @author Stefan Herndler + * @since 1.5.0 + * @param array $p_arr_Plugins Scripts to be included to the editor. + * @return array + */ + public static function includeScripts($p_arr_Plugins) { + $p_arr_Plugins[MCI_Footnotes_Config::C_STR_PLUGIN_NAME] = plugins_url('/../js/wysiwyg-editor.js', __FILE__); + return $p_arr_Plugins; + } + + /** + * AJAX Callback function when the Footnotes Button is clicked. Either in the Plain text or Visual editor. + * Returns an JSON encoded array with the Footnotes start and end short code. + * + * @author Stefan Herndler + * @since 1.5.0 + */ + public static function ajaxCallback() { + // get start and end tag for the footnotes short code + $l_str_StartingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START); + $l_str_EndingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END); + if ($l_str_StartingTag == "userdefined" || $l_str_EndingTag == "userdefined") { + $l_str_StartingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED); + $l_str_EndingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED); + } + echo json_encode(array("start" => htmlspecialchars($l_str_StartingTag), "end" => htmlspecialchars($l_str_EndingTag))); + exit; + } +} \ No newline at end of file diff --git a/css/dev-common.css b/css/dev-common.css index 8bd2548..155d738 100644 --- a/css/dev-common.css +++ b/css/dev-common.css @@ -1,532 +1,532 @@ -/* - * .footnote_plugin_tooltip_text = inner - * .footnote_tooltip = inner - */ - -.footnote_referrer, -.footnote_referrer:link, -.footnote_referrer:hover, -.footnote_referrer > a, -.footnote_referrer > a:link, -.footnote_referrer > a:hover, -.footnote_plugin_tooltip_text, -.footnote_plugin_tooltip_text:hover, -.main-content .footnote_referrer, -.main-content .footnote_referrer:link, -.main-content .footnote_referrer:hover, -.main-content .footnote_referrer > a, -.main-content .footnote_referrer > a:link, -.main-content .footnote_referrer > a:hover, -.main-content .footnote_plugin_tooltip_text, -.main-content .footnote_plugin_tooltip_text:hover { - text-decoration: none !important; - border-bottom: none !important; - box-shadow: none !important; -} - -/** - * Footnote referrer (not “tooltip text”) - * - * - Bugfix: Referrers: line height 0 to fix superscript, thanks to @cwbayer bug report. - * - * @since 2.1.1 - * @reporter @cwbayer - * @link https://wordpress.org/support/topic/footnote-number-in-text-superscript-disrupts-leading/ - * - * - Bugfix: Tooltips: fix jQuery positioning bug moving tooltips out of view and affecting (TablePress tables in) some themes, thanks to @wisenilesh bug report. - * - * @since 2.5.4 - * @reporter @wisenilesh - * @link https://wordpress.org/support/topic/footnotes-not-working-properly-inside-the-tables-of-tablepress-plugin/ - */ - -.footnote_plugin_tooltip_text { - line-height: 0; - position: relative !important; - cursor: pointer; -} - - -/***************************************************** -Footnote reference container - -Templates: -templates/public/reference-container.html -templates/public/reference-container-body.html -templates/public/reference-container-combi.html -templates/public/reference-container-switch.html -templates/public/reference-container-3column.html - -Optional responsive basic page layout support -stylesheets: -css/layout-reference-container.css -css/layout-main-content.css -css/layout-page-content.css - -Classes: -.footnotes_reference_container = enclosing
-.footnote_container_prepare = label
-.footnote_reference_container_label = -.footnote_reference_container_collapse_button = sibling -.footnote-reference-container = misleading and inconsistent; alias: -.footnotes_table = -.footnotes_plugin_reference_row = -.footnote_plugin_index_combi = first
if identical footnotes are combined -.footnote_plugin_index = first if not -.footnote_index = or in first in 3-column table -.footnote_plugin_symbol = second in 3-column table -.footnote_plugin_link = or (identical footnotes not combined) -.footnote_backlink = or -.footnote_index_arrow = nested , symbol only -.footnote_plugin_text = second , or third in 3-column table -*/ - -.footnotes_reference_container { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} - -/** - * Reference container label. - * - * - Bugfix: Layout: support right-to-left writing direction by replacing remaining CSS values 'left' with 'start', thanks to @arahmanshaalan bug report. - * - * @since 2.5.8 - * @reporter @arahmanshaalan - * @link https://wordpress.org/support/topic/right-to-left-text-problem/ - */ - -.footnote_container_prepare { - display: block !important; - padding-top: 24px !important; -} - -.footnote_container_prepare > p { - line-height: 1.3 !important; - margin-top: 1em !important; - margin-bottom: 0.25em !important; - padding: 0 !important; - font-weight: normal !important; - /* bottom border optional since 2.2.5 */ - display: block !important; - -webkit-margin-before: 0.83em !important; - -webkit-margin-after: 0.83em !important; - -webkit-margin-start: 0px !important; - -webkit-margin-end: 0px !important; - text-align: start !important; - vertical-align: middle; -} - -.footnote_container_prepare > p > span:first-child, - .footnote_container_prepare > p > span:nth-child(3) { - text-align: start !important; - font-size: 1.5em !important; -} - -/* -collapse button -fully clickable, not sign only -*/ - -.footnote_reference_container_collapse_button { - cursor: pointer; - padding: 0 0.5em; - font-size: 1.3em !important; - vertical-align: 2px; - text-decoration: none !important; -} - -h2 > .footnote_reference_container_collapse_button, -h3 > .footnote_reference_container_collapse_button, -h4 > .footnote_reference_container_collapse_button, -h5 > .footnote_reference_container_collapse_button, -h6 > .footnote_reference_container_collapse_button { - font-size: inherit !important; -} - -.footnote_container_prepare > p > span:last-child a, -.footnote_reference_container_collapse_button a { - text-decoration: none !important; -} - -/* -table -*/ - -.footnote-reference-container, -.footnotes_table { - width: 100%; - border: none; -} - -/** - * Footnotes list. - * - * - Bugfix: Reference container: no borders around footnotes, thanks to @ragonesi bug report. - * - * @since 2.0.0 - * @reporter @ragonesi - * @link https://wordpress.org/support/topic/thin-box-around-notes-in-reference-container/ - * - * - Bugfix: Reference container: enforce borderless table cells, thanks to @ragonesi bug report. - * - * @since 2.0.1 - * @reporter @ragonesi - * @link https://wordpress.org/support/topic/box-around-c-references-container/ - * - * - Bugfix: Layout: support right-to-left writing direction by replacing remaining CSS values 'left' with 'start', thanks to @arahmanshaalan bug report. - * - Bugfix: Layout: support right-to-left writing direction by enabling mirrored paddings on HTML dir="rtl" pages, thanks to @arahmanshaalan bug report. - * - * @since 2.5.8 - * @reporter @arahmanshaalan - * @link https://wordpress.org/support/topic/right-to-left-text-problem/ - */ - -.footnote_plugin_index, -.footnote_plugin_index_combi, -.footnote_plugin_symbol, -.footnote_plugin_text { - border: none !important; - text-align: start !important; - vertical-align: top !important; - padding: 5px 6px 10px 0 !important; -} - -html[dir="rtl"] .footnote_plugin_index, -html[dir="rtl"] .footnote_plugin_index_combi, -html[dir="rtl"] .footnote_plugin_symbol, -html[dir="rtl"] .footnote_plugin_text { - padding: 5px 0 10px 6px !important; -} - -.footnote_backlink, -.footnote_backlink:link, -.footnote_plugin_link, -.footnote_plugin_link:link, -.main-content .footnote_backlink, -.main-content .footnote_backlink:link, -.main-content .footnote_plugin_link, -.main-content .footnote_plugin_link:link { - text-decoration: none !important; - border-bottom: none !important; -} - -.footnote_backlink, -.footnote_plugin_link { - white-space: nowrap; -} - -.pointer, -.footnote_index, -.footnote_backlink { - cursor: pointer; -} - -/* -These rules when enabled cause the backlink to take an overline -when hovered in some themes, not in others: -.footnote_plugin_index:hover, -.footnote_plugin_index_combi:hover, -.footnote_plugin_index.pointer:hover, -.footnote_plugin_index_combi.pointer:hover, -*/ - -.footnote_backlink:hover, -.footnote_plugin_link:hover, -.footnote_plugin_text a:hover { - text-decoration: unset; - text-decoration: underline; /*deprioritized to ease customization*/ -} - -.footnote_plugin_text { - width: unset; /*unset width of text column to fix site issues*/ -} - -/* -These rules are just defaults preventing the table from filling the width. -They are not very effective by lack of table-layout: fixed; -since 2.1.4 settings are optionally available, with table-layout: fixed; - -By default, the backlink column is auto-expanding to fit widest. -Not using 'max-content' as that causes no-wrap and overflows. -These are overridden if settings are enabled. -*/ - -.footnote_plugin_index, -.footnote_plugin_index_combi { - max-width: 100px; - width: 2.5em; -} - -/* -Responsive -*/ - -@media only screen and (max-width: 768px) { - - .footnote_plugin_index, - .footnote_plugin_index_combi { - max-width: 80px; - } -} - - -/**************************************************************** -Footnotes printing style rules - -Printing a table, browsers tend to avoid page breaks inside, -but it takes a wrapper to avoid a page break before the table -just after the reference container headline. - -UI elements (expand/collapse button, backlink arrows) are hidden. - -Link color set to inherit, so referrers/numbers are not grayed out. - -@since 2.0.0 Tooltips: fix bug displaying content inline when page is printed, thanks to @gernsheim bug report -@see - */ - -.footnotes_reference_container { - page-break-inside: avoid; -} - -@media print { - - .footnote_tooltip, - .footnote_reference_container_collapse_button, - .footnote_index_arrow { - display: none; - } - - .footnote_plugin_tooltip_text { - color: inherit; - } - - .footnote_plugin_index a, - .footnote_plugin_index_combi a { - color: inherit; - text-decoration: none !important; - } - - /* Edit button in WP2020 (added as a service) */ - div.post-meta-edit-link-wrapper { - display: none; - } -} - -/** - * MCI Footnotes logo - * - * The classes with 'heading' fixing display in dashboard - * have all their rules moved to settings.css so as to alleviate - * the common stylesheet. Still these rules are only used if the - * Footnotes ad link logo is present in the page footer per user - * dashboard setting. Making these rules conditional like those - * pertaining to tooltips, either jQuery or alternative, would - * double the number of united minified stylesheets shipped with - * the plugin. Hence these are present by default at the bottom. - * - * @see class/config.php - * @see css/settings.css - */ - -.footnotes_logo, -.footnotes_logo:hover { - text-decoration: none; - font-weight: normal; -} - -.footnotes_logo_part1 { - color: #2bb975; -} - -.footnotes_logo_part2 { - color: #545f5a; -} +/* + * .footnote_plugin_tooltip_text = inner + * .footnote_tooltip = inner + */ + +.footnote_referrer, +.footnote_referrer:link, +.footnote_referrer:hover, +.footnote_referrer > a, +.footnote_referrer > a:link, +.footnote_referrer > a:hover, +.footnote_plugin_tooltip_text, +.footnote_plugin_tooltip_text:hover, +.main-content .footnote_referrer, +.main-content .footnote_referrer:link, +.main-content .footnote_referrer:hover, +.main-content .footnote_referrer > a, +.main-content .footnote_referrer > a:link, +.main-content .footnote_referrer > a:hover, +.main-content .footnote_plugin_tooltip_text, +.main-content .footnote_plugin_tooltip_text:hover { + text-decoration: none !important; + border-bottom: none !important; + box-shadow: none !important; +} + +/** + * Footnote referrer (not “tooltip text”) + * + * - Bugfix: Referrers: line height 0 to fix superscript, thanks to @cwbayer bug report. + * + * @since 2.1.1 + * @reporter @cwbayer + * @link https://wordpress.org/support/topic/footnote-number-in-text-superscript-disrupts-leading/ + * + * - Bugfix: Tooltips: fix jQuery positioning bug moving tooltips out of view and affecting (TablePress tables in) some themes, thanks to @wisenilesh bug report. + * + * @since 2.5.4 + * @reporter @wisenilesh + * @link https://wordpress.org/support/topic/footnotes-not-working-properly-inside-the-tables-of-tablepress-plugin/ + */ + +.footnote_plugin_tooltip_text { + line-height: 0; + position: relative !important; + cursor: pointer; +} + + +/***************************************************** +Footnote reference container + +Templates: +templates/public/reference-container.html +templates/public/reference-container-body.html +templates/public/reference-container-combi.html +templates/public/reference-container-switch.html +templates/public/reference-container-3column.html + +Optional responsive basic page layout support +stylesheets: +css/layout-reference-container.css +css/layout-main-content.css +css/layout-page-content.css + +Classes: +.footnotes_reference_container = enclosing
+.footnote_container_prepare = label
+.footnote_reference_container_label = +.footnote_reference_container_collapse_button = sibling +.footnote-reference-container = misleading and inconsistent; alias: +.footnotes_table = +.footnotes_plugin_reference_row = +.footnote_plugin_index_combi = first - - - - + + + + + + diff --git a/templates/public/reference-container-body-combi.html b/templates/public/reference-container-body-combi.html index b69a453..49f9b8f 100644 --- a/templates/public/reference-container-body-combi.html +++ b/templates/public/reference-container-body-combi.html @@ -1,14 +1,14 @@ - - - - - + + + + + diff --git a/templates/public/reference-container-body-switch.html b/templates/public/reference-container-body-switch.html index 1f824e3..c3127d4 100644 --- a/templates/public/reference-container-body-switch.html +++ b/templates/public/reference-container-body-switch.html @@ -1,19 +1,19 @@ - - - - - + + + + + diff --git a/templates/public/reference-container-body.html b/templates/public/reference-container-body.html index f7158fd..bcd3ec4 100755 --- a/templates/public/reference-container-body.html +++ b/templates/public/reference-container-body.html @@ -1,24 +1,24 @@ - - - - - + + + + + diff --git a/templates/public/reference-container.html b/templates/public/reference-container.html index 05d9052..9ce0632 100644 --- a/templates/public/reference-container.html +++ b/templates/public/reference-container.html @@ -1,83 +1,83 @@ - -
-
<[[element]] - >[[name]][+]
-
-
if identical footnotes are combined +.footnote_plugin_index = first if not +.footnote_index = or in first in 3-column table +.footnote_plugin_symbol = second in 3-column table +.footnote_plugin_link = or (identical footnotes not combined) +.footnote_backlink = or +.footnote_index_arrow = nested , symbol only +.footnote_plugin_text = second , or third in 3-column table +*/ + +.footnotes_reference_container { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +/** + * Reference container label. + * + * - Bugfix: Layout: support right-to-left writing direction by replacing remaining CSS values 'left' with 'start', thanks to @arahmanshaalan bug report. + * + * @since 2.5.8 + * @reporter @arahmanshaalan + * @link https://wordpress.org/support/topic/right-to-left-text-problem/ + */ + +.footnote_container_prepare { + display: block !important; + padding-top: 24px !important; +} + +.footnote_container_prepare > p { + line-height: 1.3 !important; + margin-top: 1em !important; + margin-bottom: 0.25em !important; + padding: 0 !important; + font-weight: normal !important; + /* bottom border optional since 2.2.5 */ + display: block !important; + -webkit-margin-before: 0.83em !important; + -webkit-margin-after: 0.83em !important; + -webkit-margin-start: 0px !important; + -webkit-margin-end: 0px !important; + text-align: start !important; + vertical-align: middle; +} + +.footnote_container_prepare > p > span:first-child, + .footnote_container_prepare > p > span:nth-child(3) { + text-align: start !important; + font-size: 1.5em !important; +} + +/* +collapse button +fully clickable, not sign only +*/ + +.footnote_reference_container_collapse_button { + cursor: pointer; + padding: 0 0.5em; + font-size: 1.3em !important; + vertical-align: 2px; + text-decoration: none !important; +} + +h2 > .footnote_reference_container_collapse_button, +h3 > .footnote_reference_container_collapse_button, +h4 > .footnote_reference_container_collapse_button, +h5 > .footnote_reference_container_collapse_button, +h6 > .footnote_reference_container_collapse_button { + font-size: inherit !important; +} + +.footnote_container_prepare > p > span:last-child a, +.footnote_reference_container_collapse_button a { + text-decoration: none !important; +} + +/* +table +*/ + +.footnote-reference-container, +.footnotes_table { + width: 100%; + border: none; +} + +/** + * Footnotes list. + * + * - Bugfix: Reference container: no borders around footnotes, thanks to @ragonesi bug report. + * + * @since 2.0.0 + * @reporter @ragonesi + * @link https://wordpress.org/support/topic/thin-box-around-notes-in-reference-container/ + * + * - Bugfix: Reference container: enforce borderless table cells, thanks to @ragonesi bug report. + * + * @since 2.0.1 + * @reporter @ragonesi + * @link https://wordpress.org/support/topic/box-around-c-references-container/ + * + * - Bugfix: Layout: support right-to-left writing direction by replacing remaining CSS values 'left' with 'start', thanks to @arahmanshaalan bug report. + * - Bugfix: Layout: support right-to-left writing direction by enabling mirrored paddings on HTML dir="rtl" pages, thanks to @arahmanshaalan bug report. + * + * @since 2.5.8 + * @reporter @arahmanshaalan + * @link https://wordpress.org/support/topic/right-to-left-text-problem/ + */ + +.footnote_plugin_index, +.footnote_plugin_index_combi, +.footnote_plugin_symbol, +.footnote_plugin_text { + border: none !important; + text-align: start !important; + vertical-align: top !important; + padding: 5px 6px 10px 0 !important; +} + +html[dir="rtl"] .footnote_plugin_index, +html[dir="rtl"] .footnote_plugin_index_combi, +html[dir="rtl"] .footnote_plugin_symbol, +html[dir="rtl"] .footnote_plugin_text { + padding: 5px 0 10px 6px !important; +} + +.footnote_backlink, +.footnote_backlink:link, +.footnote_plugin_link, +.footnote_plugin_link:link, +.main-content .footnote_backlink, +.main-content .footnote_backlink:link, +.main-content .footnote_plugin_link, +.main-content .footnote_plugin_link:link { + text-decoration: none !important; + border-bottom: none !important; +} + +.footnote_backlink, +.footnote_plugin_link { + white-space: nowrap; +} + +.pointer, +.footnote_index, +.footnote_backlink { + cursor: pointer; +} + +/* +These rules when enabled cause the backlink to take an overline +when hovered in some themes, not in others: +.footnote_plugin_index:hover, +.footnote_plugin_index_combi:hover, +.footnote_plugin_index.pointer:hover, +.footnote_plugin_index_combi.pointer:hover, +*/ + +.footnote_backlink:hover, +.footnote_plugin_link:hover, +.footnote_plugin_text a:hover { + text-decoration: unset; + text-decoration: underline; /*deprioritized to ease customization*/ +} + +.footnote_plugin_text { + width: unset; /*unset width of text column to fix site issues*/ +} + +/* +These rules are just defaults preventing the table from filling the width. +They are not very effective by lack of table-layout: fixed; +since 2.1.4 settings are optionally available, with table-layout: fixed; + +By default, the backlink column is auto-expanding to fit widest. +Not using 'max-content' as that causes no-wrap and overflows. +These are overridden if settings are enabled. +*/ + +.footnote_plugin_index, +.footnote_plugin_index_combi { + max-width: 100px; + width: 2.5em; +} + +/* +Responsive +*/ + +@media only screen and (max-width: 768px) { + + .footnote_plugin_index, + .footnote_plugin_index_combi { + max-width: 80px; + } +} + + +/**************************************************************** +Footnotes printing style rules + +Printing a table, browsers tend to avoid page breaks inside, +but it takes a wrapper to avoid a page break before the table +just after the reference container headline. + +UI elements (expand/collapse button, backlink arrows) are hidden. + +Link color set to inherit, so referrers/numbers are not grayed out. + +@since 2.0.0 Tooltips: fix bug displaying content inline when page is printed, thanks to @gernsheim bug report +@see + */ + +.footnotes_reference_container { + page-break-inside: avoid; +} + +@media print { + + .footnote_tooltip, + .footnote_reference_container_collapse_button, + .footnote_index_arrow { + display: none; + } + + .footnote_plugin_tooltip_text { + color: inherit; + } + + .footnote_plugin_index a, + .footnote_plugin_index_combi a { + color: inherit; + text-decoration: none !important; + } + + /* Edit button in WP2020 (added as a service) */ + div.post-meta-edit-link-wrapper { + display: none; + } +} + +/** + * MCI Footnotes logo + * + * The classes with 'heading' fixing display in dashboard + * have all their rules moved to settings.css so as to alleviate + * the common stylesheet. Still these rules are only used if the + * Footnotes ad link logo is present in the page footer per user + * dashboard setting. Making these rules conditional like those + * pertaining to tooltips, either jQuery or alternative, would + * double the number of united minified stylesheets shipped with + * the plugin. Hence these are present by default at the bottom. + * + * @see class/config.php + * @see css/settings.css + */ + +.footnotes_logo, +.footnotes_logo:hover { + text-decoration: none; + font-weight: normal; +} + +.footnotes_logo_part1 { + color: #2bb975; +} + +.footnotes_logo_part2 { + color: #545f5a; +} diff --git a/css/dev-tooltips-alternative.css b/css/dev-tooltips-alternative.css index d12e639..e22944a 100644 --- a/css/dev-tooltips-alternative.css +++ b/css/dev-tooltips-alternative.css @@ -1,63 +1,63 @@ -/* -*/ -/*input[type=text], input[type=password], textarea, select*/ -#footnote_inputfield_readon_label, -#footnote_inputfield_references_label, -#footnote_inputfield_love { - padding-left: 8px !important; - padding-right: 8px !important; - width: 80% !important; -} - -#footnote_inputfield_reference_container_place { - width: 310px; -} - -#footnote_inputfield_counter_style, -#footnotes_inputfield_page_layout_support { - width: 505px; -} - -#footnote_inputfield_placeholder_start, -#footnote_inputfield_placeholder_end, -#footnote_inputfield_custom_mouse_over_box_excerpt_length { - width: 180px; -} -#footnote_inputfield_placeholder_start_user_defined, -#footnote_inputfield_placeholder_end_user_defined { - width: 320px; -} - -#footnote_inputfield_combine_identical, -#footnotes_inputfield_scroll_offset, -#footnotes_inputfield_scroll_duration, -#footnote_inputfield_custom_mouse_over_box_excerpt_enabled, -#footnote_inputfield_custom_mouse_over_box_offset_x, -#footnote_inputfield_custom_mouse_over_box_offset_y, -#footnote_inputfield_custom_mouse_over_box_max_width, -#footnotes_inputfield_alternative_mouse_over_box_offset_x, -#footnotes_inputfield_alternative_mouse_over_box_offset_y, -#footnotes_inputfield_alternative_mouse_over_box_width, -#footnotes_inputfield_mouse_over_box_fade_in_delay, -#footnotes_inputfield_mouse_over_box_fade_in_duration, -#footnotes_inputfield_mouse_over_box_fade_out_delay, -#footnotes_inputfield_mouse_over_box_fade_out_duration, -#footnote_inputfield_custom_mouse_over_box_border_width, -#footnote_inputfield_custom_mouse_over_box_border_radius { - width: 80px; -} - -#footnote_inputfield_custom_hyperlink_symbol, -#footnotes_inputfield_backlinks_terminator_option, -#footnotes_inputfield_backlinks_separator_option { - width: 230px; -} - -#footnotes_inputfield_reference_container_top_margin, -#footnotes_inputfield_reference_container_bottom_margin, -#footnotes_inputfield_backlinks_column_width_scalar, -#footnotes_inputfield_backlinks_column_max_width_scalar, -#footnotes_inputfield_mouse_over_box_font_size_scalar { - width: 85px; -} - -#footnotes_inputfield_backlinks_column_width_unit, -#footnotes_inputfield_backlinks_column_max_width_unit, -#footnotes_inputfield_mouse_over_box_font_size_unit { - width: 140px; -} - -/************************************************************ -Headings and labels -*/ - -label { - display: inline-block; -} - -.postbox > h3 { - height: 32px !important; - line-height: 32px !important; -} - -.postbox > h3 > span { - padding: 0 10px; -} - -.postbox > .inside > table { - border: none !important; -} - -.postbox > .inside >table > tbody > tr > td:first-child { - width: 15% !important; - font-weight: bold !important; -} - -.footnote_placeholder_box_container { - text-align: center !important; -} - -span.footnote_highlight_placeholder { - font-weight: bold !important; - padding: 0 8px !important; -} - -.footnote_placeholder_box_example { - border: 2px solid #2bb975 !important; - border-radius: 4px !important; - padding: 16px 0 !important; - width: 50% !important; - display: block !important; - margin: 20px auto !important; - text-align: center !important; -} - -/************************************************************ -Special table layout - -Hooks and priority levels: -initialized from style attributes in templates -IE doesn’t support nth child, but these are not critical -*/ -.expert_lookup tr th:first-child, -.expert_lookup tr td:first-child { - width: 170px !important; -} -.expert_lookup tr th:nth-child(2), -.expert_lookup tr td:nth-child(2) { - width: 65px !important; -} -.expert_lookup tr th:nth-child(3), -.expert_lookup tr td:nth-child(3) { - width: 200px !important; -} -.expert_lookup tr td:nth-child(3) input { - width: 190px; -} -.expert_lookup tr th:last-child, -.expert_lookup tr td:last-child { - white-space: nowrap; -} - -/* -Custom CSS - -The number of CSS classes recommended for customization -significantly increased from 4 to 18 as of v2.4.0. - -Localized notices are dropped to ease translators’ task. -CSS classes are listed directly in the template -templates/dashboard/customize-css.html - -For better maintainability and readability of the source -list, the

end tags are omitted per HTML5 standard: - - -The textarea has monospace font, but no other features -helping edit CSS, like tab support and syntactic colors. -*/ -#customize_css_new tr td:first-child { - width: 38% !important; - font-weight: normal !important; -} -.customize_css_new tr td:first-child span:first-child { - font-weight: bold !important; -} -.customize_css_new .list { - padding-top: 10px; -} -.customize_css_new .list p { - font-family: monospace; - padding: 0 10px; - text-indent: -10px; - margin: .5em 0; -} - -#footnote_inputfield_custom_css_new { - height: 500px; -} -#footnote_inputfield_custom_css, -#footnote_inputfield_custom_css_new { - width: 96%; - resize: both; - overflow: scroll; - font-family: monospace; -} - -/************************************************************ -Notices - -These spans were previously formatted using the em element. -But the intended semantics was not emphasis. -In locales using boldface to emphasize, the effect is the -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 { - font-style: italic; - display: inline-block; - text-align: end; -} - -/************************************************************ -Descriptions - -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 { - padding: 0 4%; -} -.footnotes_description p { - font-size: 1.06em; - font-style: italic; -} +/* +*/ +/*input[type=text], input[type=password], textarea, select*/ +#footnote_inputfield_readon_label, +#footnote_inputfield_references_label, +#footnote_inputfield_love { + padding-left: 8px !important; + padding-right: 8px !important; + width: 80% !important; +} + +#footnote_inputfield_reference_container_place { + width: 310px; +} + +#footnote_inputfield_counter_style, +#footnotes_inputfield_page_layout_support { + width: 505px; +} + +#footnote_inputfield_placeholder_start, +#footnote_inputfield_placeholder_end, +#footnote_inputfield_custom_mouse_over_box_excerpt_length { + width: 180px; +} +#footnote_inputfield_placeholder_start_user_defined, +#footnote_inputfield_placeholder_end_user_defined { + width: 320px; +} + +#footnote_inputfield_combine_identical, +#footnotes_inputfield_scroll_offset, +#footnotes_inputfield_scroll_duration, +#footnote_inputfield_custom_mouse_over_box_excerpt_enabled, +#footnote_inputfield_custom_mouse_over_box_offset_x, +#footnote_inputfield_custom_mouse_over_box_offset_y, +#footnote_inputfield_custom_mouse_over_box_max_width, +#footnotes_inputfield_alternative_mouse_over_box_offset_x, +#footnotes_inputfield_alternative_mouse_over_box_offset_y, +#footnotes_inputfield_alternative_mouse_over_box_width, +#footnotes_inputfield_mouse_over_box_fade_in_delay, +#footnotes_inputfield_mouse_over_box_fade_in_duration, +#footnotes_inputfield_mouse_over_box_fade_out_delay, +#footnotes_inputfield_mouse_over_box_fade_out_duration, +#footnote_inputfield_custom_mouse_over_box_border_width, +#footnote_inputfield_custom_mouse_over_box_border_radius { + width: 80px; +} + +#footnote_inputfield_custom_hyperlink_symbol, +#footnotes_inputfield_backlinks_terminator_option, +#footnotes_inputfield_backlinks_separator_option { + width: 230px; +} + +#footnotes_inputfield_reference_container_top_margin, +#footnotes_inputfield_reference_container_bottom_margin, +#footnotes_inputfield_backlinks_column_width_scalar, +#footnotes_inputfield_backlinks_column_max_width_scalar, +#footnotes_inputfield_mouse_over_box_font_size_scalar { + width: 85px; +} + +#footnotes_inputfield_backlinks_column_width_unit, +#footnotes_inputfield_backlinks_column_max_width_unit, +#footnotes_inputfield_mouse_over_box_font_size_unit { + width: 140px; +} + +/************************************************************ +Headings and labels +*/ + +label { + display: inline-block; +} + +.postbox > h3 { + height: 32px !important; + line-height: 32px !important; +} + +.postbox > h3 > span { + padding: 0 10px; +} + +.postbox > .inside > table { + border: none !important; +} + +.postbox > .inside >table > tbody > tr > td:first-child { + width: 15% !important; + font-weight: bold !important; +} + +.footnote_placeholder_box_container { + text-align: center !important; +} + +span.footnote_highlight_placeholder { + font-weight: bold !important; + padding: 0 8px !important; +} + +.footnote_placeholder_box_example { + border: 2px solid #2bb975 !important; + border-radius: 4px !important; + padding: 16px 0 !important; + width: 50% !important; + display: block !important; + margin: 20px auto !important; + text-align: center !important; +} + +/************************************************************ +Special table layout + +Hooks and priority levels: +initialized from style attributes in templates +IE doesn’t support nth child, but these are not critical +*/ +.expert_lookup tr th:first-child, +.expert_lookup tr td:first-child { + width: 170px !important; +} +.expert_lookup tr th:nth-child(2), +.expert_lookup tr td:nth-child(2) { + width: 65px !important; +} +.expert_lookup tr th:nth-child(3), +.expert_lookup tr td:nth-child(3) { + width: 200px !important; +} +.expert_lookup tr td:nth-child(3) input { + width: 190px; +} +.expert_lookup tr th:last-child, +.expert_lookup tr td:last-child { + white-space: nowrap; +} + +/* +Custom CSS + +The number of CSS classes recommended for customization +significantly increased from 4 to 18 as of v2.4.0. + +Localized notices are dropped to ease translators’ task. +CSS classes are listed directly in the template +templates/dashboard/customize-css.html + +For better maintainability and readability of the source +list, the

end tags are omitted per HTML5 standard: + + +The textarea has monospace font, but no other features +helping edit CSS, like tab support and syntactic colors. +*/ +#customize_css_new tr td:first-child { + width: 38% !important; + font-weight: normal !important; +} +.customize_css_new tr td:first-child span:first-child { + font-weight: bold !important; +} +.customize_css_new .list { + padding-top: 10px; +} +.customize_css_new .list p { + font-family: monospace; + padding: 0 10px; + text-indent: -10px; + margin: .5em 0; +} + +#footnote_inputfield_custom_css_new { + height: 500px; +} +#footnote_inputfield_custom_css, +#footnote_inputfield_custom_css_new { + width: 96%; + resize: both; + overflow: scroll; + font-family: monospace; +} + +/************************************************************ +Notices + +These spans were previously formatted using the em element. +But the intended semantics was not emphasis. +In locales using boldface to emphasize, the effect is the +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 { + font-style: italic; + display: inline-block; + text-align: end; +} + +/************************************************************ +Descriptions + +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 { + padding: 0 4%; +} +.footnotes_description p { + font-size: 1.06em; + font-style: italic; +} diff --git a/features.txt b/features.txt index 59f5368..c5a4b23 100644 --- a/features.txt +++ b/features.txt @@ -1,20 +1,20 @@ - - -== Footnotes Features == -- Performance of the task so PHP won't throw an error when there are more than 120? Footnotes on a single page - - Maybe increase PHP max execution time while processing the Footnotes task -- different background for every odd table row - -- Offer a set of pre-defined styles for the footnotes.Reference.Container -There should be 2 pre-defined styles for the footnotes.Reference.Container and the ability to customize or add templates. -the currently used one should be one of those templates and pre-defined styles offered but not the default setting. - - -== Footnotes Bugs == -- Setting "Excerpt No" doesn't work - - -== TODO == - - Statistics: How many Footnotes in each post/page - - Convert from other Footnote Plugins (e.g. ' ((' from Civil Footnotes) + + +== Footnotes Features == +- Performance of the task so PHP won't throw an error when there are more than 120? Footnotes on a single page + - Maybe increase PHP max execution time while processing the Footnotes task +- different background for every odd table row + +- Offer a set of pre-defined styles for the footnotes.Reference.Container +There should be 2 pre-defined styles for the footnotes.Reference.Container and the ability to customize or add templates. +the currently used one should be one of those templates and pre-defined styles offered but not the default setting. + + +== Footnotes Bugs == +- Setting "Excerpt No" doesn't work + + +== TODO == + - Statistics: How many Footnotes in each post/page + - Convert from other Footnote Plugins (e.g. ' ((' from Civil Footnotes) - Anonymous stats to the developers \ No newline at end of file diff --git a/footnotes.php b/footnotes.php index 22a79f6..63e144b 100755 --- a/footnotes.php +++ b/footnotes.php @@ -1,75 +1,74 @@ -run(); - -/** - * Sets the stylesheet enqueuing mode for production. - * - * @since 2.5.5 - * @var bool - * @see class/init.php - * - * In production, a minified CSS file tailored to the settings is enqueued. - * - * Developing stylesheets is meant to be easier when this is set to false. - * WARNING: This facility designed for development must NOT be used in production. - */ -define( 'C_BOOL_CSS_PRODUCTION_MODE', true ); +run(); + +/** + * Sets the stylesheet enqueuing mode for production. + * + * @since 2.5.5 + * @var bool + * @see class/init.php + * + * In production, a minified CSS file tailored to the settings is enqueued. + * + * Developing stylesheets is meant to be easier when this is set to false. + * WARNING: This facility designed for development must NOT be used in production. + */ +define( 'C_BOOL_CSS_PRODUCTION_MODE', true ); diff --git a/includes.php b/includes.php index 9501097..aa35d1c 100644 --- a/includes.php +++ b/includes.php @@ -1,39 +1,37 @@ - - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read . \ No newline at end of file diff --git a/readme.txt b/readme.txt index 64244b3..b523c6a 100755 --- a/readme.txt +++ b/readme.txt @@ -1,636 +1,632 @@ -=== footnotes === -Contributors: mark.cheret, lolzim, rumperuu, aricura, misfist, ericakfranz, dartiss, docteurfitness, felipelavinz, martinneumannat, matkus2, meglio, spaceling, vonpiernik, pewgeuges -Tags: footnote, footnotes, bibliography, formatting, notes, Post, posts, reference, referencing -Requires at least: 3.9 -Tested up to: 5.6.1 -Requires PHP: 5.6 -Stable Tag: 2.5.9d1 -License: GPLv3 or later -License URI: http://www.gnu.org/licenses/gpl-3.0.html - -== Description == - -Featured on wpmudev: http://premium.wpmudev.org/blog/12-surprisingly-useful-wordpress-plugins-you-dont-know-about/ -Cheers for the review, folks! - -https://www.youtube.com/watch?v=HzHaMAAJwbI - -**footnotes** aims to be the all-in-one solution for displaying an automatically generated list of references on your Page or Post. The Plugin ships with a set of defaults while also empowering you to control how your footnotes are being displayed. -**footnotes** gives you the ability to display well-formatted footnotes on your WordPress Pages and Posts — those footnotes we know from offline publishing. - -= Main Features = -- Fully customizable **footnotes** start and end shortcodes; -- Styled tooltips supporting hyperlinks display **footnotes** or a dedicated text; -- Responsive *Reference Container* at the end or positioned by shortcode; -- Display the **footnotes** *Reference Container* inside a Widget; -- Wide choice of numbering styles; -- Freely configurable and optional backlink symbol; -- Configure the **footnotes’** appearance by dashboard settings and Custom CSS style rules; -- Button in both the Visual and the Text editor to add shortcodes around selection. - -= Example Usage = -These are a few examples of possible ways to delimit footnotes: - -1. Your awesome text((with an awesome footnote)) -2. Your awesome text[ref]with an awesome footnote[/ref] -3. Your awesome text``with an awesome footnote`` -4. Your awesome text`custom-shortcode`with an awesome footnote`custom-shortcode` - -= Where to get footnotes? = -The current version is available on the [WordPress.org plugins platform, Footnotes](https://wordpress.org/plugins/footnotes/). - -= Support = -Please report feature requests, bugs and other support related questions in the [Footnotes section of WordPress Support Forum](https://wordpress.org/support/plugin/footnotes). - -Speak your mind, unload your burden, bring it up, and feel free to [post your rating and review!](https://wordpress.org/support/plugin/footnotes/reviews/). - -= Development = -Development of the plugin is an open process. Latest code is available in the [plugin part of WordPress SVN repository, footnotes/](https://plugins.svn.wordpress.org/footnotes/). - -== Frequently Asked Questions == - -= Is your Plugin a copy of footnotes x? = - -No, this Plugin has been written from scratch. Of course some inspirations on how to do or how to not do things were taken from other plugins. - -= Your Plugin is awesome! How do I convert my footnotes if I used one of the other footnotes plugins out there? = - -1. For anyone interested in converting from the FD Footnotes plugin: -Visit this swift write-up from a **footnotes** user by the name of **Southwest**: http://wordpress.org/support/topic/how-to-make-this-footnote-style?replies=6#post-5946306 -2. From what we've researched, all other footnotes Plugins use open and close shortcodes, which can be left as is. In the **footnotes** settings menu, you can setup **footnotes** to use the existing (=previously used) shortcodes. Too easy? Yippy Ki-Yey! - -== Installation == -- Visit your WordPress Admin area -- Navigate to `Plugins\Add` -- Search for **footnotes** and find this Plugin among others -- Install the latest version of the **footnotes** Plugin from WordPress.org -- Activate the Plugin - -== Screenshots == -1. Find the footnotes plugin settings in the newly added "ManFisher" Menu -2. Settings for the *References Container* -3. Settings for **footnotes** styling -4. Settings for **footnotes** love -5. Other Settings -6. The HowTo section in the **footnotes** settings -7. Here you can see the **footnotes** Plugin at work. Isn't that plain beautiful? - -== Changelog == - -= 2.5.9 = -- Bugfix: Dashboard: unescape quotation marks in Custom CSS text area and input boxes, thanks to @rumperuu code contribution. -- Update: Codebase: compliance to WordPress coding standards, thanks to @rumperuu code contribution. -- Adding: Documentation: additional readme in markdown format for use with GitHub, thanks to @rumperuu code contribution. -- Adding: Documentation: help and support for individual contributors through Contributing Guidelines, thanks to @rumperuu code contribution. -- Adding: Development: pre-commit hook for WordPress projects, modified from @bjornjohansen, thanks to @rumperuu code contribution. - -= 2.5.8 = -- Bugfix: Layout: support right-to-left writing direction by replacing remaining CSS values 'left' with 'start', thanks to @arahmanshaalan bug report. -- Bugfix: Layout: support right-to-left writing direction by enabling mirrored paddings on HTML dir="rtl" pages, thanks to @arahmanshaalan bug report. - -= 2.5.7 = -- Bugfix: Process: fix footnote duplication by emptying the footnotes list every time the search algorithm is run on the content, thanks to @inoruhana bug report. - -= 2.5.6 = -- Bugfix: Reference container: optional alternative expanding and collapsing without jQuery for use with hard links, thanks to @hopper87it @pkverma99 issue reports. -- Bugfix: Alternative tooltips: shrink width to short content. -- Update: Documentation: slightly revise or update the plugin’s welcome page on WordPress.org. - -= 2.5.5 = -- Update: Stylesheets: increase speed and energy efficiency by tailoring stylesheets to the needs of the instance, thanks to @docteurfitness design contribution. -- Bugfix: Stylesheets: minify to shrink the carbon footprint, increase speed and implement best practice, thanks to @docteurfitness issue report. -- Bugfix: Libraries: optimize processes by loading external and internal scripts only if needed, thanks to @docteurfitness issue report. -- Bugfix: Process: fix numbering bug impacting footnote #2 with footnote #1 close to start, thanks to @rumperuu bug report, thanks to @lolzim code contribution. -- Update: Dashboard: add or edit descriptions to the tooltips and tooltip text delimiter settings and the backlink symbol configuration setting. -- Update: Dashboard: decrease font size and padding of the descriptions. - -= 2.5.4 = -- Bugfix: Referrers: optional fixes to vertical alignment, font size and position (static) for in-theme consistency and cross-theme stability, thanks to @tomturowski bug report. -- Bugfix: Tooltips: fix jQuery positioning bug moving tooltips out of view and affecting (TablePress tables in) some themes, thanks to @wisenilesh bug report. -- Bugfix: Reference container, tooltips: URL wrap: enable the 'word-wrap: anywhere' rule, thanks to @rebelc0de bug report. -- Bugfix: Reference container, tooltips: URL wrap: account for leading space in value, thanks to @karolszakiel example provision. -- Bugfix: Dashboard: Tooltip dimensions: move from 'Tooltip position' to a dedicated metabox, thanks to @codldmac issue report. -- Update: Libraries: jQuery Tools: replace deprecated function jQuery.isFunction(), thanks to @a223123131 bug report. -- Bugfix: Editor button: Classic Editor text mode: try to fix uncaught reference error of “QTags is not defined”, thanks to @dpartridge bug report. -- Update: Reference container: Hard backlinks (optional): optional configurable tooltip hinting to use the backbutton instead, thanks to @theroninjedi47 bug report. -- Update: Tooltips: Excerpt delimiter: add configuration settings in the dashboard. -- Bugfix: Tooltips: fix display in Popup Maker popups by correcting a coding error. -- Bugfix: Editor button: Classic Editor text mode: correct label to singular. -- Bugfix: Libraries: jQuery Tools: replace double equals sign discouraged in JavaScript with recommended triple equals sign. - -= 2.5.3 = -- Bugfix: Reference container, tooltips: URL wrap: exclude URL pattern as folder name in Wayback Machine URL, thanks to @rumperuu bug report. - -= 2.5.2 = -- Update: Tooltips: Excerpt delimiter: ability to display dedicated content before `[[/tooltip]]`, thanks to @jbj2199 issue report. -- Bugfix: Localization: plugin language file name changes effective in version control system. - -= 2.5.1 = -- Bugfix: Hooks: support footnotes in Popup Maker popups, thanks to @squatcher bug report. -- Bugfix: Reference container: click on label expands but also collapses, thanks to @ahmadword bug report. -- Bugfix: Reference container: Label: cursor takes pointer shape, thanks to @ahmadword bug report. -- Bugfix: Dashboard: Custom CSS: mention validity of legacy while visible, thanks to @rkupadhya bug report. -- Bugfix: Dashboard: Custom CSS: make class list column formatting effective again. -- Update: Readme/documentation: add new contributors in the file header’s Contributors field. -- Update: Readme/documentation: update or fix URLs in Download, Support and Development sections. - -= 2.5.0 = -- Adding: Templates: Enable template location stack, thanks to @misfist code contribution. -- Bugfix: Hooks: support footnotes on category pages, thanks to @vitaefit bug report, thanks to @misfist code contribution. -- Bugfix: Footnote delimiters: Syntax validation: exclude certain cases involving scripts, thanks to @andreasra bug report. -- Bugfix: Footnote delimiters: Syntax validation: complete message with hint about setting, thanks to @andreasra bug report. -- Bugfix: Footnote delimiters: Syntax validation: limit length of quoted string to 300 characters, thanks to @andreasra bug report. -- Update: Dashboard: Footnote delimiters: Syntax validation: add more information around the setting. -- Bugfix: Dashboard: Footnote delimiters: warning about '>' escapement disruption in WordPress Block Editor. - -= 2.4.0 = -- Adding: Footnote delimiters: syntax validation for balanced footnote start and end tag short codes. -- Bugfix: Templates: optimize template load and processing based on settings, thanks to @misfist code contribution. -- Bugfix: Process: initialize hard link address variables to empty string to fix 'undefined variable' bug, thanks to @a223123131 bug report. -- Bugfix: Reference container: Label: set empty label to U+202F NNBSP for more robustness, thanks to @lukashuggenberg feedback. -- Bugfix: Scroll offset: initialize to safer one third window height for more robustness, thanks to @lukashuggenberg bug report. -- Bugfix: Footnote delimiters: Dashboard: remove new option involving HTML comment tags only usable in source mode. -- Bugfix: Reference container: Row borders: adapt left padding to the presence of an optional left border. -- Bugfix: Reference container: add class 'footnote_plugin_symbol' to disambiguate repurposed class 'footnote_plugin_link'. - -= 2.3.0 = -- Adding: Referrers and backlinks: optional hard links for AMP compatibility, thanks to @psykonevro bug report, thanks to @martinneumannat code contribution. -- Bugfix: Reference container: convert top padding to margin and make it a setting, thanks to @hamshe bug report. -- Bugfix: Referrers and backlinks: more effectively remove unwanted underline by disabling box shadow used instead of bottom border, thanks to @klusik feedback. -- Bugfix: Dashboard: Custom CSS: swap migration Boolean, meaning 'show legacy' instead of 'migration complete', due to storage data structure constraints. -- Update: Dashboard: Priority level: rename tab as 'Scope and priority', to account for the new alternative depending on widget_text hook activation. -- Bugfix: Referrers and tooltips: correct scope of the line height fix to only affect the referrers, not the tooltip content. -- Bugfix: Referrers: extend clickable area to the full line height in sync with current pointer shape. -- Bugfix: Referrers: extend scope of the underline inhibition to be more comprehensive and consistent. -- Bugfix: Reference container: Basic responsive page layout: edits to one of the optional stylesheets. - -= 2.2.10 = -- Bugfix: Reference container: add option for table borders to restore pre-2.0.0 design, thanks to @noobishh issue report. -- Bugfix: Reference container: add missing container ID in function name in default table row template for uncombined footnotes. -- Bugfix: Reference container, tooltips: URL wrap: support also file transfer protocol URLs. - -= 2.2.9 = -- Bugfix: Reference container, widget_text hook: support for multiple containers in a page, thanks to @justbecuz bug report. -- Update: Priority levels: set widget_text default to 98 and update its description in the dashboard Priority level tab. -- Bugfix: Reference container, tooltips: URL wrap: account for RFC 2396 allowed characters in parameter names. -- Bugfix: Reference container, tooltips: URL wrap: exclude URLs also where the equals sign is preceded by an entity or character reference. - -= 2.2.8 = -- Bugfix: Reference container, tooltips: URL wrap: correctly make the quotation mark optional wrt query parameters, thanks to @spiralofhope2 bug report. - -= 2.2.7 = -- Bugfix: Reference container, tooltips: URL wrap: remove a bug introduced in the regex, thanks to @rjl20 @spaceling @lukashuggenberg @klusik @friedrichnorth @bernardzit bug reports. - -= 2.2.6 = -- Bugfix: Reference container, tooltips: URL wrap: make the quotation mark optional wrt query parameters, thanks to @spiralofhope2 bug report. -- Adding: Templates: support for custom templates in sibling folder, thanks to @misfist issue report. - -= 2.2.5 = -- Bugfix: Dashboard: Footnotes numbering: add missing support for Ibid. notation to suggestions, thanks to @meglio design contribution. -- Bugfix: Reference container: Label: make bottom border an option, thanks to @markhillyer issue report. -- Bugfix: Reference container: Label: option to select paragraph or heading element, thanks to @markhillyer issue report. -- Bugfix: Reference container: delete position shortcode if unused because position may be widget or footer, thanks to @hamshe bug report. -- Update: Tooltips: Alternative tooltips: connect to position/timing settings (for themes not supporting jQuery tooltips). -- Update: Dashboard: Tooltip position/timing settings: include alternative tooltips (for themes not supporting jQuery tooltips). -- Bugfix: Dashboard: Tooltip position/timing settings: raise above tooltip truncation settings for better consistency. - -= 2.2.4 = -- Bugfix: Reference container: Backlink symbol selection: move back to previous tab “Referrers and tooltips”. -- Bugfix: Custom CSS: make inserting existing in header depend on migration complete checkbox status. - -= 2.2.3 = -- Bugfix: Custom CSS: insert new CSS in the public page header element after existing CSS. - -= 2.2.2 = -- Bugfix: Dashboard: Link element setting only under General settings > Reference container. -- Bugfix: Dashboard: Custom CSS: unearth text area and migrate to dedicated tab as designed. -- Bugfix: Reference container: edits to optional basic responsive page layout stylesheets. - -= 2.2.1 = -- Bugfix: Dashboard: duplicate moved settings under their legacy tab to account for data structure. - -= 2.2.0 = -- Adding: Reference container: support for custom position shortcode, thanks to @hamshe issue report. -- Adding: Start/end short codes: more predefined options. -- Adding: Numbering styles: lowercase Roman numerals support. -- Update: Priority levels: update the notice in the dashboard Priority tab. -- Update: Dashboard: Tooltip settings: group into 3 thematic containers. -- Update: Dashboard: Main settings: group into 3 specific containers. -- Update: Dashboard: move link element option to the Referrers options. -- Update: Dashboard: move URL wrap option to the Reference container options. -- Update: Dashboard: group both Custom CSS and priority level settings under the same tab. -- Update: Dashboard: rename tab labels 'Referrers and tooltips', 'Priority and CSS'. -- Bugfix: Tooltips: add 'important' property to z-index to fix display overlay issue. -- Bugfix: Localization: correct arguments for plugin textdomain load function. -- Bugfix: Reference container, tooltips: URL wrap: specifically catch the quotation mark. -- Adding: Footnotes mention in the footer: more options. - -= 2.1.6 = -- Bugfix: Priority levels: set the_content priority level to 98 to prevent plugin conflict, thanks to @marthalindeman bug report. -- Bugfix: Tooltips: set z-index to maximum 2147483647 to address display issues with overlay content, thanks to @russianicons bug report. -- Bugfix: Reference container, tooltips: URL wrap: fix regex, thanks to @a223123131 bug report. -- Bugfix: Dashboard: URL wrap: add option to properly enable/disable URL wrap. -- Update: Dashboard: reorder tabs and update tab labels. -- 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: Localization: conform to WordPress plugin language file name scheme, thanks to @nikelaos bug report. - -= 2.1.5 = -- Bugfix: Reference container, tooltips: URL wrap: exclude image source too, thanks to @bjrnet21 bug report. - -= 2.1.4 = -- Bugfix: Scroll offset: make configurable to fix site-dependent issues related to fixed headers. -- Bugfix: Scroll duration: make configurable to conform to website content and style requirements. -- Bugfix: Tooltips: make display delays and fade durations configurable to conform to website style. -- Bugfix: Tooltips: Styling: fix font size issue by adding font size to settings with legacy as default. -- Bugfix: Reference container: fix layout by optionally enqueuing additional stylesheet (depends on theme). -- Bugfix: Reference container: fix layout issues by moving backlink column width to settings. -- Bugfix: Reference container: make separating and terminating punctuation optional and configurable, thanks to @docteurfitness issue report and code contribution. -- Bugfix: Reference container: Backlinks: fix stacked enumerations by adding optional line breaks. -- Bugfix: Tooltips: Read-on button: Label: prevent line breaks. -- Bugfix: Referrers and backlinks: Styling: make link elements optional to fix issues, thanks to @docteurfitness issue report and code contribution. -- Bugfix: Referrers: Styling: disable hover underline. -- Bugfix: Reference container, tooltips: fix line wrapping of URLs (hyperlinked or not) based on pattern, not link element. -- Bugfix: Reference container: Backlink symbol: support for appending when combining identicals is on. -- Bugfix: Reference container: Backlinks: deprioritize hover underline to ease customization. -- Bugfix: Reference container: Backlinks: fix line breaking with respect to separators and terminators. -- Bugfix: Reference container: Label: delete overflow hidden rule. -- Bugfix: Reference container: Expand/collapse button: same padding to the right for right-to-left. -- Bugfix: Reference container: Styles: re-add the class dedicated to combined footnotes indices. -- Bugfix: Dashboard: move arrow settings from Customize to Settings > Reference container to reunite and fix issue with new heading wording. -- Bugfix: Dashboard: Main settings: fix layout, raise shortcodes to top. -- Bugfix: Dashboard: Tooltip settings: Truncation length: change input box type from text to numeric. -- Update: Dashboard: Notices: use explicit italic style. -- Bugfix: Dashboard: Other settings: Excerpt: display guidance next to select box, thanks to @nikelaos bug report. -- Bugfix: WordPress hooks: the_content: set priority to 1000 as a safeguard. -- Update: Dashboard: Expert mode: streamline and update description for hooks and priority levels. - -= 2.1.3 = -- Bugfix: Hooks: disable widget_text hook by default to fix accordions declaring headings as widgets. -- Bugfix: Hooks: disable the_excerpt hook by default to fix issues, thanks to @nikelaos bug report. -- Bugfix: Reference container: fix column width when combining turned on by reverting new CSS class to legacy. -- Bugfix: Reference container: fix width in mobile view by URL wrapping for Unicode-non-conformant browsers, thanks to @karolszakiel bug report. -- Bugfix: Reference container: table cell backlinking if index is single and combining identicals turned on. -- Bugfix: Styling: raise Custom CSS priority to override settings. -- Bugfix: Styling: Tooltips: raise settings priority to override theme stylesheets. - -= 2.1.2 = -- Bugfix: Reference container: Backlinks: no underline on hover cell when combining identicals is on. -- Bugfix: Dashboard: priority level settings for all other hooks, thanks to @nikelaos bug report. -- Update: Dashboard: WordPress documentation URLs of the hooks. -- Update: Dashboard: feature description for the hooks priority level settings, thanks to @nikelaos bug report. - -= 2.1.1 = -- Bugfix: Referrers, reference container: Combining identical footnotes: fix dead links and ensure referrer-backlink bijectivity, thanks to @happyches bug report. -- Bugfix: Dashboard: priority level setting for the_content hook, thanks to @imeson bug report. -- Update: Libraries: jQuery Tools: redact (comment out) all 6 instances of deprecated function jQuery.browser(), thanks to @bjrnet21 @cconser @vyassuresh @spaceling @widecast @olivlyon @maxident bug reports. -- Bugfix: Libraries: jQuery Tools: complete minification. -- Bugfix: Libraries: make script loads depend on tooltip implementation option. -- Bugfix: Libraries: jQuery UI: properly pick the libraries registered by WordPress needed for tooltips. -- Bugfix: Reference container: fix start pages by making its display optional, thanks to @dragon013 bug report. -- Bugfix: Reference container: Backlink symbol: make optional, not suggest configuring it to invisible, thanks to @spaceling feedback. -- Bugfix: Reference container: Footnote number links: disable bottom border for theme compatibility. -- Bugfix: Reference container: option to restore pre-2.0.0 layout with the backlink symbol in an extra column. -- Bugfix: Reference container: option to append symbol (prepended by default), thanks to @spaceling code contribution. -- Bugfix: Reference container: Table rows: fix top and bottom padding. -- Bugfix: Referrers: new setting for vertical align: superscript (default) or baseline (optional), thanks to @cwbayer bug report. -- Bugfix: Referrers: line height 0 to fix superscript, thanks to @cwbayer bug report. -- Bugfix: Tooltips: optional alternative JS implementation with CSS transitions to fix configuration-related outage, thanks to @andreasra feedback. -- Bugfix: Tooltips: add delay (400ms) before fade-out to fix UX wrt links and Read-on button. -- Bugfix: Tooltips: fix line breaking for hyperlinked URLs in Unicode-non-compliant user agents, thanks to @andreasra bug report. -- Bugfix: Formatting: disable overline showing in some themes on hovered backlinks. - -= 2.1.0 = -- Adding: Tooltips: Read-on button: Label: configurable instead of localizable, thanks to @rovanov example provision. -- Bugfix: Referrers: disable bottom border for theme compatibility. -- Update: Accessibility: add 'speaker-mute' class to reference container. -- Bugfix: Dashboard: Layout: add named selectors to limit applicability of styles. -- UPDATE: Hooks: remove 'the_post', the plugin stops supporting this hook. - -= 2.0.8 = -- BUGFIX: Priority level back to PHP_INT_MAX (need to get in touch with other plugins). - -= 2.0.7 = -- BUGFIX: Hooks: Default-disable 'the_post', thanks to @spaceling @markcheret @nyamachi @whichgodsaves @spiralofhope2 @mmallett @andreasra @widecast @ymorin007 @tashi1es bug reports. -- Update: Set priority level back to 10 assuming it is unproblematic. -- Update: Added backwards compatible support for legacy arrow and index placeholders in template. -- Update: Settings defaults adjusted for better and more up-to-date tooltip layout. - -= 2.0.6 = -- Bugfix: Infinite scroll: debug autoload by adding post ID, thanks to @docteurfitness code contribution. -- Bugfix: Referrers: delete vertical align tweaks, for cross-theme and user agent compatibility. -- Bugfix: Reference container: fix line breaking behavior in footnote number clusters. -- Bugfix: Reference container: auto-extending column to fit widest, to fix display with short note texts. -- Bugfix: Reference container: IDs: slightly increased left padding. -- Bugfix: Translations: fix spelling error and erroneously changed word in en_GB and en_US. -- Bugfix: Typesetting: discard the dot after footnote numbers as not localizable (should be optional). -- Bugfix: Reference container: Collapse button fully clickable, not sign only. -- Bugfix: Reference container: Collapse button 'collapse' with minus sign not hyphen-minus. -- Update: Tooltips: set display predelay to 0 for responsiveness (was 800 since 2.0.0, 400 before). -- Update: Tooltips: set fade duration to 200ms both ways (was 200 in and 2000 out since 2.0.0, 0 in and 100 out before). -- BUGFIX: Priority level back to PHP_INT_MAX (ref container positioning not this plugin’s responsibility). -- Update: Scroll offset: raise percentage from 12% to a safer 20% inner window height, by lack of configurability. - -= 2.0.5 = -- Bugfix: Reference container: fix relative position through priority level, thanks to @june01 @imeson @spaceling bug reports, thanks to @spaceling code contribution. -- Bugfix: Reference container: unset width of text column to fix site issues. -- Update: Hooks: Default-enable all hooks to prevent footnotes from seeming broken in some parts. -- Bugfix: Tooltips: Restore cursor shape 'pointer' over Read-on button after hard link removal. -- Bugfix: Settings stylesheet: unenqueue to fix input boxes on public pages (enqueued for 2.0.4). - -= 2.0.4 = -- Update: Restore arrow settings to customize or disable the now prepended arrow symbol. -- Update: Libraries: Load jQuery UI from WordPress, thanks to @check2020de issue report. -- Bugfix: Referrers and backlinks: remove hard links to streamline browsing history, thanks to @theroninjedi47 bug report. -- Bugfix: Reference container: remove inconvenient left/right cellpadding. -- Bugfix: Tooltips: improve layout with inherited font size by lower line height. -- Bugfix: Tooltips: 'Continue reading' button: disable default underline. -- Bugfix: Translations: review all locales (en, de, es, fr), synced ref line # with edited code. -- Bugfix: Dashboard: fix display of two headings containing the logo. - -= 2.0.3 = -- Bugfix: Reference container: Self-adjusting width of ID column but hidden overflow. -- Update: Reference container: clarify backlink semantics by prepended transitional up arrow, thanks to bug report. -- Bugfix: Fragment IDs: Prepended post ID to footnote number. -- Bugfix: External stylesheets cache busting: add plugin version number argument in enqueuing function call. -- Bugfix: Print style: prevent a page break just after the reference container label. -- Bugfix: Print style: Hide reference collapse button. -- Update: Reference container: Headline: remove padding before reference container label. -- Update: Scroll offset: raise percentage from 5% to a safer 12% inner window height, by lack of setting. - -= 2.0.2 = -- Bugfix: Reference container: restore expand/collapse button in the template, thanks to @ragonesi bug report. -- Bugfix: Dashboard: Custom CSS: Available selectors: fix display of the last item. -- Bugfix: Referrers and backlinks: restore default link color on screen, set color to inherit in print. -- Bugfix: Referrers: disable text decoration underline by default, enable underline on hover. - -= 2.0.1 = -- Bugfix: Reference container: enforce borderless table cells, thanks to @ragonesi bug report. -- Update: Translations: revised fr_FR. - -= 2.0.0 = -- Major contributions taken from WordPress user pewgeuges, all details here https://github.com/media-competence-institute/footnotes/blob/master/README.md: -- Update: **symbol for backlinks** removed -- Update: hyperlink moved to the reference number -- Update: Tooltips: fix disabling bug by loading jQuery UI library, thanks to @rajinderverma @ericcorbett2 @honlapdavid @mmallett @twellve_million bug reports, thanks to @vonpiernik code contribution. -- Update: Libraries: jQuery Tools: add condition whether deprecated function jQuery.browser() exists, thanks to @vonpiernik code contribution. -- Bugfix: Localization: correct function call apply_filters() with all required arguments after PHP 7.1 promoted warning to error, thanks to @matkus2 bug report and code contribution. -- Bugfix: footnote links script independent -- Bugfix: Get the “Continue reading” link to work in the mouse-over box -- Bugfix: Debug printed posts and pages -- Bugfix: Display of combined identical notes -- Update: Adjusted scrolling time and offset -- Bugfix: Reference container: no borders around footnotes, thanks to @ragonesi bug report. -- Bugfix: Mouse-over box display timing -- Update: Translations: revised de_AT, de_DE, en_GB, en_US, es_ES - -= 1.6.6 = -- Beginning of translation to French - -= 1.6.5 = -- Bugfix: Improve widgets registration, thanks to @felipelavinz code contribution. -- Update: Fix for deprecated PHP function create_function(), thanks to @psykonevro @daliasued bug reports, thanks to @felipelavinz code contribution. -- Update: The CSS has been modified in order to show the tooltip numbers a little less higher than text -- Bugfix: Dashboard: fix error on demo under the Preview tab. - -= 1.6.4 = -- Update: replace deprecated function WP_Widget() with recommended __construct(), thanks to @dartiss code contribution. -- Bugfix: Fixed occasional bug where footnote ordering could be out of sequence - -= 1.6.3 = -- Bugfix: We were provided a fix by a user named toma. footnotes now works in sub-folder installations of WordPress - -= 1.6.2 = -- Update: Changed the Preview tab -- Bugfix: Html tags has been removed in the Reference container when the excerpt mode is enabled - -= 1.6.1 = -- Update: Translations -- Bugfix: Move to anchor - -= 1.6.0 = -- **IMPORTANT**: Improved performance. You need to Activate the Plugin again. (Settings won't change!) -- Adding: Setting to customize the mouse-over box shadow -- Adding: Translation: United States -- Adding: Translation: Austria -- Adding: Translation: Spanish (many thanks to Pablo L.) -- Update: Translations (de_DE and en_GB) -- Update: Changed Plugins init file name to improve performance (Re-activation of the Plugin is required) -- Update: ManFisher note styling -- Update: Tested with latest nightly build of WordPress 4.1 -- Bugfix: Avoid multiple IDs for footnotes when multiple reference containers are displayed - -= 1.5.7 = -- Adding: Setting to define the positioning of the mouse-over box -- Adding: Setting to define an offset for the mouse-over box (precise positioning) -- Bugfix: Target element to move down to the reference container is the footnote index instead of the arrow (possibility to hide the arrow) -- Bugfix: Rating calculation for the 'other plugins' list - -= 1.5.6 = -- **IMPORTANT**: We have changed the html tag for the superscript. Please check and update your custom CSS. -- Adding: .pot file to enable Translations for everybody -- Adding: Settings to customize the mouse-over box (color, background color, border, max. width) -- Update: Translation file names -- Update: Translation EN and DE -- Update: Styling of the superscript (need to check custom CSS code for the superscript) -- Update: Description of CSS classes for the 'customize CSS' text area -- Bugfix: Removed 'a' tag around the superscript for Footnotes inside the content to avoid page reloads (empty href attribute) -- Bugfix: Avoid Settings fallback to its default value after submit an empty value for a setting -- Bugfix: Enable multiple WP_Post objects for the_post hook - -= 1.5.5 = -- Adding: Expert mode setting -- Adding: Activation and Deactivation of WordPress hooks to look for Footnotes (expert mode) -- Adding: WordPress hooks: 'the_title' and 'widget_title' (default: disabled) to search for Footnote short codes -- Bugfix: Default value for the WordPress hook the_post to be disabled (adds Footnotes twice to the Reference container) -- Bugfix: Activation, Deactivation and Uninstall hook class name -- Bugfix: Add submenu pages only once for each ManFisher WordPress Plugin -- Bugfix: Display the Reference container in the Footer correctly - -= 1.5.4 = -- Adding: Setting to enable an excerpt of the Footnotes mouse-over box text (default: disabled) -- Adding: Setting to define the maximum length of the excerpt displayed in the mouse-over box (default: 150 characters) -- Update: Detail information about other Plugins from ManFisher (rating, downloads, last updated, Author name/url) -- Update: Receiving list of other Plugins from the Developer Team from an external server -- Update: Translations (EN and DE) -- Bugfix: Removed hard coded position of the 'ManFisher' main menu page (avoid errors with other Plugins) -- Bugfix: Changed function name (includes.php) to be unique (avoid errors with other Plugins) -- Bugfix: Try to replace each appearance of Footnotes in the current Post object loaded from the WordPress database - -= 1.5.3 = -- Adding: Developer's homepage to the 'other Plugins' list -- Update: Smoothy scroll to an anchor using Javascript -- Bugfix: Set the vertical align for each cell in the Reference container to TOP - -= 1.5.2 = -- Adding: Setting to enable/disable the mouse-over box -- Adding: Current WordPress Theme to the Diagnostics sub page -- Adding: ManFisher note in the "other Plugins" sub page -- Update: Removed unnecessary hidden inputs from the Settings page -- Update: Merged public CSS files to reduce the output and improve the performance -- Update: Translations (EN and DE) -- Bugfix: Removed the 'trim' function to allow whitespaces at the beginning and end of each setting -- Bugfix: Convert the footnotes short code to HTML special chars when adding them into the page/post editor (visual and text) -- Bugfix: Detailed error messages if other Plugins can't be loaded. Also added empty strings as default values to avoid 'undefined' - -= 1.5.1 = -- Bugfix: Broken Settings link in the Plugin listing -- Bugfix: Translation overhaul for German - -= 1.5.0 = -- Adding: Grouped the Plugin Settings into a new Menu Page called "ManFisher Plugins" -- Adding: Sub Page to list all other Plugins of the Contributors -- Adding: Hyperlink to manfisher.eu in the "other plugins" page -- Update: Refactored the whole source code -- Update: Moved the Diagnostics Sections to into a new Sub Page called "Diagnostics" -- Bugfix: Line up Footnotes with multiple lines in the Reference container -- Bugfix: Load text domain -- Bugfix: Display the Footnotes button in the plain text editor of posts/pages - -= 1.4.0 = -- Feature: WPML Config XML file for easy multi language string translation (WPML String Translation Support File) -- Update: Changed e-Mail support address to the WordPress support forum -- Update: Language EN and DE -- Adding: Tab for Plugin Diagnostics -- Adding: Donate link to the installed Plugin overview page -- Adding: Donate button to the "HowTo" tab - -= 1.3.4 = -- Bugfix: Settings access permission vor sub-sites -- Bugfix: Setting 'combine identical footnotes' working as it should - -= 1.3.3 = -- Update: Changed the Author name from a fictitious entity towards a real registered company -- Update: Changed the Author URI - -= 1.3.2 = -- Bugfix: More security recognizing Footnotes on public pages (e.g. ignoring empty Footnote short codes) -- Bugfix: Clear old Footnotes before lookup new public page (only if no reference container displayed before) -- Update: language EN and DE -- Adding: Setting to customize the hyperlink symbol in der reference container for each footnote reference -- Adding: Setting to enter a user defined hyperlink symbol -- - -= 1.3.1 = -- Bugfix: Allow settings to be empty -- Bugfix: Removed space between the hyperlink and superscript in the footnotes index -- Adding: Setting to customize the text before and after the footnotes index in superscript - -= 1.3.0 = -- Bugfix: Changed tooltip class to be unique -- Bugfix: Changed superscript styling to not manipulate the line height -- Bugfix: Changed styling of the footnotes text in the reference container to avoid line breaks -- Update: Reformatted code -- Adding: new settings tab for custom CSS settings - -= 1.2.5 = -- Bugfix: New styling of the mouse-over box to stay in screen (thanks to Jori, France and Manuel345, undisclosed location) - -= 1.2.4 = -- Bugfix: CSS stylesheets will only be added in FootNotes settings page, nowhere else (thanks to Piet Bos, China) -- Bugfix: Styling of the reference container when the footnote text was too long (thanks to Willem Braak, undisclosed location) -- Bugfix: Added a Link to the footnote text in the reference container back to the footnote index in the page content (thanks to Willem Braak, undisclosed location) - -= 1.2.3 = -- Bugfix: Removed 'Warning output' of Plugins activation and deactivation function (thanks to Piet Bos, China) -- Bugfix: Added missing meta boxes parameter on Settings page (thanks to Piet Bos, China) -- Bugfix: Removed Widget text formatting -- Bugfix: Load default settings value of setting doesn't exist yet (first usage) -- Bugfix: Replacement of footnotes tag on public pages with html special characters in the content -- Feature: Footnotes tag color is set to the default link color depending on the current Theme (thanks to Daniel Formo, Norway) - -= 1.2.2 = -- Bugfix: WYSIWYG editor and plain text editor buttons insert footnote short code correctly (also if defined like html tag) -- Update: The admin can decide which "I love footnotes" text (or not text) will be displayed in the footer -- Adding: Buttons next to the reference label to expand/collapse the reference container if set to "collapse by default" -- Bugfix: Replace footnote short code -- Update: Combined buttons for the "collapse/expand" reference container - -= 1.2.1 = -- Bugfix: HowTo example will be displayed correctly if a user defined short code is set - -= 1.2.0 = -- Feature: New button in the WYSIWYG editor and in the plain text editor to easily implement the footnotes tag -- Feature: Icon for the WYSIWYG-editor button -- Feature: Pre defined footnote short codes -- Experimental: User defined short code for defining footnotes -- Experimental: Plugin Widget to define where the reference container should appear when set to "widget area" -- Update: Moved footnotes 'love' settings to a separate container -- Update: Translation for new settings and for the Widget description -- Bugfix: Setting for the position of the "reference container" works for the options "footer", "end of post" and "widget area" - -= 1.1.1 = -- Feature: Short code to not display the 'love me' slug on specific pages ( short code = [[no footnotes: love]] ) -- Update: Setting where the reference container appears on public pages can also be set to the widget area -- Adding: Link to the wordpress.org support page in the plugin main page -- Update: Changed plugin URL from GitHub to WordPress -- Bugfix: Uninstall function to really remove all settings done in the settings page -- Bugfix: Load default settings after plugin is installed -- Update: Translation for support link and new setting option -- Adding: Label to display the user the short code to not display the 'love me' slug - -= 1.1.0 = -- Update: Global styling for the public plugin name -- Update: Easier usage of the public plugin name in translations -- Update: New Layout for the settings page to group similar settings to get a better overview -- Update: Display settings submit button only if there is at least 1 editable setting in the current tab -- Adding: Setting where the reference container appears on public pages (needs some corrections!) -- Bugfix: Displays only one reference container in front of the footer on category pages - -= 1.0.6 = -- Bugfix: Uninstall function to delete all plugin settings -- Bugfix: Counter style internal name in the reference container to correctly link to the right footnote on the page above -- Bugfix: Footnote hover box styling to not wrap the footnote text on mouse over -- Update: 'footnotes love' text in the page footer if the admin accepts it and set its default value to 'no' - -= 1.0.5 = -- The Plugin has been submitted to wordpress.org for review and (hopefully) publication. -- Update: Plugin description for public directories (WordPress.org and GitHub) -- Feature: the footnotes WordPress Plugin now has its very own CI - - Update: Styling - - Update: Settings to support the styling -- Adding: Inspirational Screenshots for further development -- Adding: Settings screenshot -- Update: i18n fine-tuning - -= 1.0.4 = -- Update: replacing function when footnote is a link (bugfix) -- Footnote hover box remains until cursor leaves footnote or hover box -- Links in the footnote hover box are click able -- Adding: setting to allow footnotes on Summarized Posts -- Adding: setting to tell the world you're using footnotes plugin -- Adding: setting for the counter style of the footnote index - - Arabic Numbers (1, 2, 3, 4, 5, ...) - - Arabic Numbers leading 0 (01, 02, 03, 04, 05, ...) - - Latin Characters lower-case (a, b, c, d, e, ...) - - Latin Characters upper-case (A, B, C, D, E, ...) - - Roman Numerals (I, II, III, IV, V, ...) -- Adding: a link to the WordPress plugin in the footer if the WP-admin accepts it -- Update: translations for the new settings -- Switch back the version numbering scheme to have 3 digits - -= 1.0.3 = -- Adding: setting to use personal starting and ending tag for the footnotes -- Update: translations for the new setting -- Update: reading settings and fallback to default values (bugfix) - -= 1.0.2 = -- Adding: setting to collapse the reference container by default -- Adding: link behind the footnotes to automatically jump to the reference container -- Adding: function to easy output input fields for the settings page -- Update: translation for the new setting - -= 1.0.1 = -- Separated functions in different files for a better overview -- Adding: a version control to each file / class / function / variable -- Adding: layout for the settings menu, settings split in tabs and not a list-view -- Update: Replacing footnotes in widget texts will show the reference container at the end of the page (bugfix) -- Update: translations for EN and DE -- Changed version number from 3 digits to 2 digits - -= 1.0.0 = -- First development Version of the Plugin - -== Upgrade Notice == -to upgrade our plugin is simple. Just update the plugin within your WordPress installation. -To cross-upgrade from other footnotes plugins, there will be a migration assistant in the future +=== footnotes === +Contributors: mark.cheret, lolzim, rumperuu, aricura, misfist, ericakfranz, dartiss, docteurfitness, felipelavinz, martinneumannat, matkus2, meglio, spaceling, vonpiernik, pewgeuges +Tags: footnote, footnotes, bibliography, formatting, notes, Post, posts, reference, referencing +Requires at least: 3.9 +Tested up to: 5.6.1 +Requires PHP: 5.6 +Stable Tag: 2.5.10 +License: GPLv3 or later +License URI: http://www.gnu.org/licenses/gpl-3.0.html + +== Description == + +Featured on wpmudev: http://premium.wpmudev.org/blog/12-surprisingly-useful-wordpress-plugins-you-dont-know-about/ +Cheers for the review, folks! + +https://www.youtube.com/watch?v=HzHaMAAJwbI + +**footnotes** aims to be the all-in-one solution for displaying an automatically generated list of references on your Page or Post. The Plugin ships with a set of defaults while also empowering you to control how your footnotes are being displayed. +**footnotes** gives you the ability to display well-formatted footnotes on your WordPress Pages and Posts — those footnotes we know from offline publishing. + += Main Features = +- Fully customizable **footnotes** start and end shortcodes; +- Styled tooltips supporting hyperlinks display **footnotes** or a dedicated text; +- Responsive *Reference Container* at the end or positioned by shortcode; +- Display the **footnotes** *Reference Container* inside a Widget; +- Wide choice of numbering styles; +- Freely configurable and optional backlink symbol; +- Configure the **footnotes’** appearance by dashboard settings and Custom CSS style rules; +- Button in both the Visual and the Text editor to add shortcodes around selection. + += Example Usage = +These are a few examples of possible ways to delimit footnotes: + +1. Your awesome text((with an awesome footnote)) +2. Your awesome text[ref]with an awesome footnote[/ref] +3. Your awesome text``with an awesome footnote`` +4. Your awesome text`custom-shortcode`with an awesome footnote`custom-shortcode` + += Where to get footnotes? = +The current version is available on the [WordPress.org plugins platform, Footnotes](https://wordpress.org/plugins/footnotes/). + += Support = +Please report feature requests, bugs and other support related questions in the [Footnotes section of WordPress Support Forum](https://wordpress.org/support/plugin/footnotes). + +Speak your mind, unload your burden, bring it up, and feel free to [post your rating and review!](https://wordpress.org/support/plugin/footnotes/reviews/). + += Development = +Development of the plugin is an open process. Latest code is available in the [plugin part of WordPress SVN repository, footnotes/](https://plugins.svn.wordpress.org/footnotes/). + +== Frequently Asked Questions == + += Is your Plugin a copy of footnotes x? = + +No, this Plugin has been written from scratch. Of course some inspirations on how to do or how to not do things were taken from other plugins. + += Your Plugin is awesome! How do I convert my footnotes if I used one of the other footnotes plugins out there? = + +1. For anyone interested in converting from the FD Footnotes plugin: +Visit this swift write-up from a **footnotes** user by the name of **Southwest**: http://wordpress.org/support/topic/how-to-make-this-footnote-style?replies=6#post-5946306 +2. From what we've researched, all other footnotes Plugins use open and close shortcodes, which can be left as is. In the **footnotes** settings menu, you can setup **footnotes** to use the existing (=previously used) shortcodes. Too easy? Yippy Ki-Yey! + +== Installation == +- Visit your WordPress Admin area +- Navigate to `Plugins\Add` +- Search for **footnotes** and find this Plugin among others +- Install the latest version of the **footnotes** Plugin from WordPress.org +- Activate the Plugin + +== Screenshots == +1. Find the footnotes plugin settings in the newly added "ManFisher" Menu +2. Settings for the *References Container* +3. Settings for **footnotes** styling +4. Settings for **footnotes** love +5. Other Settings +6. The HowTo section in the **footnotes** settings +7. Here you can see the **footnotes** Plugin at work. Isn't that plain beautiful? + +== Changelog == + += 2.5.10 = +- Bugfix: Revert to 2.5.8. OUR APOLOGIES, PLEASE, FOR THE 2.5.9d1 PLUGIN 'Stable Tag' MISHAP. + += 2.5.8 = +- Bugfix: Layout: support right-to-left writing direction by replacing remaining CSS values 'left' with 'start', thanks to @arahmanshaalan bug report. +- Bugfix: Layout: support right-to-left writing direction by enabling mirrored paddings on HTML dir="rtl" pages, thanks to @arahmanshaalan bug report. + += 2.5.7 = +- Bugfix: Process: fix footnote duplication by emptying the footnotes list every time the search algorithm is run on the content, thanks to @inoruhana bug report. + += 2.5.6 = +- Bugfix: Reference container: optional alternative expanding and collapsing without jQuery for use with hard links, thanks to @hopper87it @pkverma99 issue reports. +- Bugfix: Alternative tooltips: shrink width to short content. +- Update: Documentation: slightly revise or update the plugin’s welcome page on WordPress.org. + += 2.5.5 = +- Update: Stylesheets: increase speed and energy efficiency by tailoring stylesheets to the needs of the instance, thanks to @docteurfitness design contribution. +- Bugfix: Stylesheets: minify to shrink the carbon footprint, increase speed and implement best practice, thanks to @docteurfitness issue report. +- Bugfix: Libraries: optimize processes by loading external and internal scripts only if needed, thanks to @docteurfitness issue report. +- Bugfix: Process: fix numbering bug impacting footnote #2 with footnote #1 close to start, thanks to @rumperuu bug report, thanks to @lolzim code contribution. +- Update: Dashboard: add or edit descriptions to the tooltips and tooltip text delimiter settings and the backlink symbol configuration setting. +- Update: Dashboard: decrease font size and padding of the descriptions. + += 2.5.4 = +- Bugfix: Referrers: optional fixes to vertical alignment, font size and position (static) for in-theme consistency and cross-theme stability, thanks to @tomturowski bug report. +- Bugfix: Tooltips: fix jQuery positioning bug moving tooltips out of view and affecting (TablePress tables in) some themes, thanks to @wisenilesh bug report. +- Bugfix: Reference container, tooltips: URL wrap: enable the 'word-wrap: anywhere' rule, thanks to @rebelc0de bug report. +- Bugfix: Reference container, tooltips: URL wrap: account for leading space in value, thanks to @karolszakiel example provision. +- Bugfix: Dashboard: Tooltip dimensions: move from 'Tooltip position' to a dedicated metabox, thanks to @codldmac issue report. +- Update: Libraries: jQuery Tools: replace deprecated function jQuery.isFunction(), thanks to @a223123131 bug report. +- Bugfix: Editor button: Classic Editor text mode: try to fix uncaught reference error of “QTags is not defined”, thanks to @dpartridge bug report. +- Update: Reference container: Hard backlinks (optional): optional configurable tooltip hinting to use the backbutton instead, thanks to @theroninjedi47 bug report. +- Update: Tooltips: Excerpt delimiter: add configuration settings in the dashboard. +- Bugfix: Tooltips: fix display in Popup Maker popups by correcting a coding error. +- Bugfix: Editor button: Classic Editor text mode: correct label to singular. +- Bugfix: Libraries: jQuery Tools: replace double equals sign discouraged in JavaScript with recommended triple equals sign. + += 2.5.3 = +- Bugfix: Reference container, tooltips: URL wrap: exclude URL pattern as folder name in Wayback Machine URL, thanks to @rumperuu bug report. + += 2.5.2 = +- Update: Tooltips: Excerpt delimiter: ability to display dedicated content before `[[/tooltip]]`, thanks to @jbj2199 issue report. +- Bugfix: Localization: plugin language file name changes effective in version control system. + += 2.5.1 = +- Bugfix: Hooks: support footnotes in Popup Maker popups, thanks to @squatcher bug report. +- Bugfix: Reference container: click on label expands but also collapses, thanks to @ahmadword bug report. +- Bugfix: Reference container: Label: cursor takes pointer shape, thanks to @ahmadword bug report. +- Bugfix: Dashboard: Custom CSS: mention validity of legacy while visible, thanks to @rkupadhya bug report. +- Bugfix: Dashboard: Custom CSS: make class list column formatting effective again. +- Update: Readme/documentation: add new contributors in the file header’s Contributors field. +- Update: Readme/documentation: update or fix URLs in Download, Support and Development sections. + += 2.5.0 = +- Adding: Templates: Enable template location stack, thanks to @misfist code contribution. +- Bugfix: Hooks: support footnotes on category pages, thanks to @vitaefit bug report, thanks to @misfist code contribution. +- Bugfix: Footnote delimiters: Syntax validation: exclude certain cases involving scripts, thanks to @andreasra bug report. +- Bugfix: Footnote delimiters: Syntax validation: complete message with hint about setting, thanks to @andreasra bug report. +- Bugfix: Footnote delimiters: Syntax validation: limit length of quoted string to 300 characters, thanks to @andreasra bug report. +- Update: Dashboard: Footnote delimiters: Syntax validation: add more information around the setting. +- Bugfix: Dashboard: Footnote delimiters: warning about '>' escapement disruption in WordPress Block Editor. + += 2.4.0 = +- Adding: Footnote delimiters: syntax validation for balanced footnote start and end tag short codes. +- Bugfix: Templates: optimize template load and processing based on settings, thanks to @misfist code contribution. +- Bugfix: Process: initialize hard link address variables to empty string to fix 'undefined variable' bug, thanks to @a223123131 bug report. +- Bugfix: Reference container: Label: set empty label to U+202F NNBSP for more robustness, thanks to @lukashuggenberg feedback. +- Bugfix: Scroll offset: initialize to safer one third window height for more robustness, thanks to @lukashuggenberg bug report. +- Bugfix: Footnote delimiters: Dashboard: remove new option involving HTML comment tags only usable in source mode. +- Bugfix: Reference container: Row borders: adapt left padding to the presence of an optional left border. +- Bugfix: Reference container: add class 'footnote_plugin_symbol' to disambiguate repurposed class 'footnote_plugin_link'. + += 2.3.0 = +- Adding: Referrers and backlinks: optional hard links for AMP compatibility, thanks to @psykonevro bug report, thanks to @martinneumannat code contribution. +- Bugfix: Reference container: convert top padding to margin and make it a setting, thanks to @hamshe bug report. +- Bugfix: Referrers and backlinks: more effectively remove unwanted underline by disabling box shadow used instead of bottom border, thanks to @klusik feedback. +- Bugfix: Dashboard: Custom CSS: swap migration Boolean, meaning 'show legacy' instead of 'migration complete', due to storage data structure constraints. +- Update: Dashboard: Priority level: rename tab as 'Scope and priority', to account for the new alternative depending on widget_text hook activation. +- Bugfix: Referrers and tooltips: correct scope of the line height fix to only affect the referrers, not the tooltip content. +- Bugfix: Referrers: extend clickable area to the full line height in sync with current pointer shape. +- Bugfix: Referrers: extend scope of the underline inhibition to be more comprehensive and consistent. +- Bugfix: Reference container: Basic responsive page layout: edits to one of the optional stylesheets. + += 2.2.10 = +- Bugfix: Reference container: add option for table borders to restore pre-2.0.0 design, thanks to @noobishh issue report. +- Bugfix: Reference container: add missing container ID in function name in default table row template for uncombined footnotes. +- Bugfix: Reference container, tooltips: URL wrap: support also file transfer protocol URLs. + += 2.2.9 = +- Bugfix: Reference container, widget_text hook: support for multiple containers in a page, thanks to @justbecuz bug report. +- Update: Priority levels: set widget_text default to 98 and update its description in the dashboard Priority level tab. +- Bugfix: Reference container, tooltips: URL wrap: account for RFC 2396 allowed characters in parameter names. +- Bugfix: Reference container, tooltips: URL wrap: exclude URLs also where the equals sign is preceded by an entity or character reference. + += 2.2.8 = +- Bugfix: Reference container, tooltips: URL wrap: correctly make the quotation mark optional wrt query parameters, thanks to @spiralofhope2 bug report. + += 2.2.7 = +- Bugfix: Reference container, tooltips: URL wrap: remove a bug introduced in the regex, thanks to @rjl20 @spaceling @lukashuggenberg @klusik @friedrichnorth @bernardzit bug reports. + += 2.2.6 = +- Bugfix: Reference container, tooltips: URL wrap: make the quotation mark optional wrt query parameters, thanks to @spiralofhope2 bug report. +- Adding: Templates: support for custom templates in sibling folder, thanks to @misfist issue report. + += 2.2.5 = +- Bugfix: Dashboard: Footnotes numbering: add missing support for Ibid. notation to suggestions, thanks to @meglio design contribution. +- Bugfix: Reference container: Label: make bottom border an option, thanks to @markhillyer issue report. +- Bugfix: Reference container: Label: option to select paragraph or heading element, thanks to @markhillyer issue report. +- Bugfix: Reference container: delete position shortcode if unused because position may be widget or footer, thanks to @hamshe bug report. +- Update: Tooltips: Alternative tooltips: connect to position/timing settings (for themes not supporting jQuery tooltips). +- Update: Dashboard: Tooltip position/timing settings: include alternative tooltips (for themes not supporting jQuery tooltips). +- Bugfix: Dashboard: Tooltip position/timing settings: raise above tooltip truncation settings for better consistency. + += 2.2.4 = +- Bugfix: Reference container: Backlink symbol selection: move back to previous tab “Referrers and tooltips”. +- Bugfix: Custom CSS: make inserting existing in header depend on migration complete checkbox status. + += 2.2.3 = +- Bugfix: Custom CSS: insert new CSS in the public page header element after existing CSS. + += 2.2.2 = +- Bugfix: Dashboard: Link element setting only under General settings > Reference container. +- Bugfix: Dashboard: Custom CSS: unearth text area and migrate to dedicated tab as designed. +- Bugfix: Reference container: edits to optional basic responsive page layout stylesheets. + += 2.2.1 = +- Bugfix: Dashboard: duplicate moved settings under their legacy tab to account for data structure. + += 2.2.0 = +- Adding: Reference container: support for custom position shortcode, thanks to @hamshe issue report. +- Adding: Start/end short codes: more predefined options. +- Adding: Numbering styles: lowercase Roman numerals support. +- Update: Priority levels: update the notice in the dashboard Priority tab. +- Update: Dashboard: Tooltip settings: group into 3 thematic containers. +- Update: Dashboard: Main settings: group into 3 specific containers. +- Update: Dashboard: move link element option to the Referrers options. +- Update: Dashboard: move URL wrap option to the Reference container options. +- Update: Dashboard: group both Custom CSS and priority level settings under the same tab. +- Update: Dashboard: rename tab labels 'Referrers and tooltips', 'Priority and CSS'. +- Bugfix: Tooltips: add 'important' property to z-index to fix display overlay issue. +- Bugfix: Localization: correct arguments for plugin textdomain load function. +- Bugfix: Reference container, tooltips: URL wrap: specifically catch the quotation mark. +- Adding: Footnotes mention in the footer: more options. + += 2.1.6 = +- Bugfix: Priority levels: set the_content priority level to 98 to prevent plugin conflict, thanks to @marthalindeman bug report. +- Bugfix: Tooltips: set z-index to maximum 2147483647 to address display issues with overlay content, thanks to @russianicons bug report. +- Bugfix: Reference container, tooltips: URL wrap: fix regex, thanks to @a223123131 bug report. +- Bugfix: Dashboard: URL wrap: add option to properly enable/disable URL wrap. +- Update: Dashboard: reorder tabs and update tab labels. +- 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: Localization: conform to WordPress plugin language file name scheme, thanks to @nikelaos bug report. + += 2.1.5 = +- Bugfix: Reference container, tooltips: URL wrap: exclude image source too, thanks to @bjrnet21 bug report. + += 2.1.4 = +- Bugfix: Scroll offset: make configurable to fix site-dependent issues related to fixed headers. +- Bugfix: Scroll duration: make configurable to conform to website content and style requirements. +- Bugfix: Tooltips: make display delays and fade durations configurable to conform to website style. +- Bugfix: Tooltips: Styling: fix font size issue by adding font size to settings with legacy as default. +- Bugfix: Reference container: fix layout by optionally enqueuing additional stylesheet (depends on theme). +- Bugfix: Reference container: fix layout issues by moving backlink column width to settings. +- Bugfix: Reference container: make separating and terminating punctuation optional and configurable, thanks to @docteurfitness issue report and code contribution. +- Bugfix: Reference container: Backlinks: fix stacked enumerations by adding optional line breaks. +- Bugfix: Tooltips: Read-on button: Label: prevent line breaks. +- Bugfix: Referrers and backlinks: Styling: make link elements optional to fix issues, thanks to @docteurfitness issue report and code contribution. +- Bugfix: Referrers: Styling: disable hover underline. +- Bugfix: Reference container, tooltips: fix line wrapping of URLs (hyperlinked or not) based on pattern, not link element. +- Bugfix: Reference container: Backlink symbol: support for appending when combining identicals is on. +- Bugfix: Reference container: Backlinks: deprioritize hover underline to ease customization. +- Bugfix: Reference container: Backlinks: fix line breaking with respect to separators and terminators. +- Bugfix: Reference container: Label: delete overflow hidden rule. +- Bugfix: Reference container: Expand/collapse button: same padding to the right for right-to-left. +- Bugfix: Reference container: Styles: re-add the class dedicated to combined footnotes indices. +- Bugfix: Dashboard: move arrow settings from Customize to Settings > Reference container to reunite and fix issue with new heading wording. +- Bugfix: Dashboard: Main settings: fix layout, raise shortcodes to top. +- Bugfix: Dashboard: Tooltip settings: Truncation length: change input box type from text to numeric. +- Update: Dashboard: Notices: use explicit italic style. +- Bugfix: Dashboard: Other settings: Excerpt: display guidance next to select box, thanks to @nikelaos bug report. +- Bugfix: WordPress hooks: the_content: set priority to 1000 as a safeguard. +- Update: Dashboard: Expert mode: streamline and update description for hooks and priority levels. + += 2.1.3 = +- Bugfix: Hooks: disable widget_text hook by default to fix accordions declaring headings as widgets. +- Bugfix: Hooks: disable the_excerpt hook by default to fix issues, thanks to @nikelaos bug report. +- Bugfix: Reference container: fix column width when combining turned on by reverting new CSS class to legacy. +- Bugfix: Reference container: fix width in mobile view by URL wrapping for Unicode-non-conformant browsers, thanks to @karolszakiel bug report. +- Bugfix: Reference container: table cell backlinking if index is single and combining identicals turned on. +- Bugfix: Styling: raise Custom CSS priority to override settings. +- Bugfix: Styling: Tooltips: raise settings priority to override theme stylesheets. + += 2.1.2 = +- Bugfix: Reference container: Backlinks: no underline on hover cell when combining identicals is on. +- Bugfix: Dashboard: priority level settings for all other hooks, thanks to @nikelaos bug report. +- Update: Dashboard: WordPress documentation URLs of the hooks. +- Update: Dashboard: feature description for the hooks priority level settings, thanks to @nikelaos bug report. + += 2.1.1 = +- Bugfix: Referrers, reference container: Combining identical footnotes: fix dead links and ensure referrer-backlink bijectivity, thanks to @happyches bug report. +- Bugfix: Dashboard: priority level setting for the_content hook, thanks to @imeson bug report. +- Update: Libraries: jQuery Tools: redact (comment out) all 6 instances of deprecated function jQuery.browser(), thanks to @bjrnet21 @cconser @vyassuresh @spaceling @widecast @olivlyon @maxident bug reports. +- Bugfix: Libraries: jQuery Tools: complete minification. +- Bugfix: Libraries: make script loads depend on tooltip implementation option. +- Bugfix: Libraries: jQuery UI: properly pick the libraries registered by WordPress needed for tooltips. +- Bugfix: Reference container: fix start pages by making its display optional, thanks to @dragon013 bug report. +- Bugfix: Reference container: Backlink symbol: make optional, not suggest configuring it to invisible, thanks to @spaceling feedback. +- Bugfix: Reference container: Footnote number links: disable bottom border for theme compatibility. +- Bugfix: Reference container: option to restore pre-2.0.0 layout with the backlink symbol in an extra column. +- Bugfix: Reference container: option to append symbol (prepended by default), thanks to @spaceling code contribution. +- Bugfix: Reference container: Table rows: fix top and bottom padding. +- Bugfix: Referrers: new setting for vertical align: superscript (default) or baseline (optional), thanks to @cwbayer bug report. +- Bugfix: Referrers: line height 0 to fix superscript, thanks to @cwbayer bug report. +- Bugfix: Tooltips: optional alternative JS implementation with CSS transitions to fix configuration-related outage, thanks to @andreasra feedback. +- Bugfix: Tooltips: add delay (400ms) before fade-out to fix UX wrt links and Read-on button. +- Bugfix: Tooltips: fix line breaking for hyperlinked URLs in Unicode-non-compliant user agents, thanks to @andreasra bug report. +- Bugfix: Formatting: disable overline showing in some themes on hovered backlinks. + += 2.1.0 = +- Adding: Tooltips: Read-on button: Label: configurable instead of localizable, thanks to @rovanov example provision. +- Bugfix: Referrers: disable bottom border for theme compatibility. +- Update: Accessibility: add 'speaker-mute' class to reference container. +- Bugfix: Dashboard: Layout: add named selectors to limit applicability of styles. +- UPDATE: Hooks: remove 'the_post', the plugin stops supporting this hook. + += 2.0.8 = +- BUGFIX: Priority level back to PHP_INT_MAX (need to get in touch with other plugins). + += 2.0.7 = +- BUGFIX: Hooks: Default-disable 'the_post', thanks to @spaceling @markcheret @nyamachi @whichgodsaves @spiralofhope2 @mmallett @andreasra @widecast @ymorin007 @tashi1es bug reports. +- Update: Set priority level back to 10 assuming it is unproblematic. +- Update: Added backwards compatible support for legacy arrow and index placeholders in template. +- Update: Settings defaults adjusted for better and more up-to-date tooltip layout. + += 2.0.6 = +- Bugfix: Infinite scroll: debug autoload by adding post ID, thanks to @docteurfitness code contribution. +- Bugfix: Referrers: delete vertical align tweaks, for cross-theme and user agent compatibility. +- Bugfix: Reference container: fix line breaking behavior in footnote number clusters. +- Bugfix: Reference container: auto-extending column to fit widest, to fix display with short note texts. +- Bugfix: Reference container: IDs: slightly increased left padding. +- Bugfix: Translations: fix spelling error and erroneously changed word in en_GB and en_US. +- Bugfix: Typesetting: discard the dot after footnote numbers as not localizable (should be optional). +- Bugfix: Reference container: Collapse button fully clickable, not sign only. +- Bugfix: Reference container: Collapse button 'collapse' with minus sign not hyphen-minus. +- Update: Tooltips: set display predelay to 0 for responsiveness (was 800 since 2.0.0, 400 before). +- Update: Tooltips: set fade duration to 200ms both ways (was 200 in and 2000 out since 2.0.0, 0 in and 100 out before). +- BUGFIX: Priority level back to PHP_INT_MAX (ref container positioning not this plugin’s responsibility). +- Update: Scroll offset: raise percentage from 12% to a safer 20% inner window height, by lack of configurability. + += 2.0.5 = +- Bugfix: Reference container: fix relative position through priority level, thanks to @june01 @imeson @spaceling bug reports, thanks to @spaceling code contribution. +- Bugfix: Reference container: unset width of text column to fix site issues. +- Update: Hooks: Default-enable all hooks to prevent footnotes from seeming broken in some parts. +- Bugfix: Tooltips: Restore cursor shape 'pointer' over Read-on button after hard link removal. +- Bugfix: Settings stylesheet: unenqueue to fix input boxes on public pages (enqueued for 2.0.4). + += 2.0.4 = +- Update: Restore arrow settings to customize or disable the now prepended arrow symbol. +- Update: Libraries: Load jQuery UI from WordPress, thanks to @check2020de issue report. +- Bugfix: Referrers and backlinks: remove hard links to streamline browsing history, thanks to @theroninjedi47 bug report. +- Bugfix: Reference container: remove inconvenient left/right cellpadding. +- Bugfix: Tooltips: improve layout with inherited font size by lower line height. +- Bugfix: Tooltips: 'Continue reading' button: disable default underline. +- Bugfix: Translations: review all locales (en, de, es, fr), synced ref line # with edited code. +- Bugfix: Dashboard: fix display of two headings containing the logo. + += 2.0.3 = +- Bugfix: Reference container: Self-adjusting width of ID column but hidden overflow. +- Update: Reference container: clarify backlink semantics by prepended transitional up arrow, thanks to bug report. +- Bugfix: Fragment IDs: Prepended post ID to footnote number. +- Bugfix: External stylesheets cache busting: add plugin version number argument in enqueuing function call. +- Bugfix: Print style: prevent a page break just after the reference container label. +- Bugfix: Print style: Hide reference collapse button. +- Update: Reference container: Headline: remove padding before reference container label. +- Update: Scroll offset: raise percentage from 5% to a safer 12% inner window height, by lack of setting. + += 2.0.2 = +- Bugfix: Reference container: restore expand/collapse button in the template, thanks to @ragonesi bug report. +- Bugfix: Dashboard: Custom CSS: Available selectors: fix display of the last item. +- Bugfix: Referrers and backlinks: restore default link color on screen, set color to inherit in print. +- Bugfix: Referrers: disable text decoration underline by default, enable underline on hover. + += 2.0.1 = +- Bugfix: Reference container: enforce borderless table cells, thanks to @ragonesi bug report. +- Update: Translations: revised fr_FR. + += 2.0.0 = +- Major contributions taken from WordPress user pewgeuges, all details here https://github.com/media-competence-institute/footnotes/blob/master/README.md: +- Update: **symbol for backlinks** removed +- Update: hyperlink moved to the reference number +- Update: Tooltips: fix disabling bug by loading jQuery UI library, thanks to @rajinderverma @ericcorbett2 @honlapdavid @mmallett @twellve_million bug reports, thanks to @vonpiernik code contribution. +- Update: Libraries: jQuery Tools: add condition whether deprecated function jQuery.browser() exists, thanks to @vonpiernik code contribution. +- Bugfix: Localization: correct function call apply_filters() with all required arguments after PHP 7.1 promoted warning to error, thanks to @matkus2 bug report and code contribution. +- Bugfix: footnote links script independent +- Bugfix: Get the “Continue reading” link to work in the mouse-over box +- Bugfix: Debug printed posts and pages +- Bugfix: Display of combined identical notes +- Update: Adjusted scrolling time and offset +- Bugfix: Reference container: no borders around footnotes, thanks to @ragonesi bug report. +- Bugfix: Mouse-over box display timing +- Update: Translations: revised de_AT, de_DE, en_GB, en_US, es_ES + += 1.6.6 = +- Beginning of translation to French + += 1.6.5 = +- Bugfix: Improve widgets registration, thanks to @felipelavinz code contribution. +- Update: Fix for deprecated PHP function create_function(), thanks to @psykonevro @daliasued bug reports, thanks to @felipelavinz code contribution. +- Update: The CSS has been modified in order to show the tooltip numbers a little less higher than text +- Bugfix: Dashboard: fix error on demo under the Preview tab. + += 1.6.4 = +- Update: replace deprecated function WP_Widget() with recommended __construct(), thanks to @dartiss code contribution. +- Bugfix: Fixed occasional bug where footnote ordering could be out of sequence + += 1.6.3 = +- Bugfix: We were provided a fix by a user named toma. footnotes now works in sub-folder installations of WordPress + += 1.6.2 = +- Update: Changed the Preview tab +- Bugfix: Html tags has been removed in the Reference container when the excerpt mode is enabled + += 1.6.1 = +- Update: Translations +- Bugfix: Move to anchor + += 1.6.0 = +- **IMPORTANT**: Improved performance. You need to Activate the Plugin again. (Settings won't change!) +- Adding: Setting to customize the mouse-over box shadow +- Adding: Translation: United States +- Adding: Translation: Austria +- Adding: Translation: Spanish (many thanks to Pablo L.) +- Update: Translations (de_DE and en_GB) +- Update: Changed Plugins init file name to improve performance (Re-activation of the Plugin is required) +- Update: ManFisher note styling +- Update: Tested with latest nightly build of WordPress 4.1 +- Bugfix: Avoid multiple IDs for footnotes when multiple reference containers are displayed + += 1.5.7 = +- Adding: Setting to define the positioning of the mouse-over box +- Adding: Setting to define an offset for the mouse-over box (precise positioning) +- Bugfix: Target element to move down to the reference container is the footnote index instead of the arrow (possibility to hide the arrow) +- Bugfix: Rating calculation for the 'other plugins' list + += 1.5.6 = +- **IMPORTANT**: We have changed the html tag for the superscript. Please check and update your custom CSS. +- Adding: .pot file to enable Translations for everybody +- Adding: Settings to customize the mouse-over box (color, background color, border, max. width) +- Update: Translation file names +- Update: Translation EN and DE +- Update: Styling of the superscript (need to check custom CSS code for the superscript) +- Update: Description of CSS classes for the 'customize CSS' text area +- Bugfix: Removed 'a' tag around the superscript for Footnotes inside the content to avoid page reloads (empty href attribute) +- Bugfix: Avoid Settings fallback to its default value after submit an empty value for a setting +- Bugfix: Enable multiple WP_Post objects for the_post hook + += 1.5.5 = +- Adding: Expert mode setting +- Adding: Activation and Deactivation of WordPress hooks to look for Footnotes (expert mode) +- Adding: WordPress hooks: 'the_title' and 'widget_title' (default: disabled) to search for Footnote short codes +- Bugfix: Default value for the WordPress hook the_post to be disabled (adds Footnotes twice to the Reference container) +- Bugfix: Activation, Deactivation and Uninstall hook class name +- Bugfix: Add submenu pages only once for each ManFisher WordPress Plugin +- Bugfix: Display the Reference container in the Footer correctly + += 1.5.4 = +- Adding: Setting to enable an excerpt of the Footnotes mouse-over box text (default: disabled) +- Adding: Setting to define the maximum length of the excerpt displayed in the mouse-over box (default: 150 characters) +- Update: Detail information about other Plugins from ManFisher (rating, downloads, last updated, Author name/url) +- Update: Receiving list of other Plugins from the Developer Team from an external server +- Update: Translations (EN and DE) +- Bugfix: Removed hard coded position of the 'ManFisher' main menu page (avoid errors with other Plugins) +- Bugfix: Changed function name (includes.php) to be unique (avoid errors with other Plugins) +- Bugfix: Try to replace each appearance of Footnotes in the current Post object loaded from the WordPress database + += 1.5.3 = +- Adding: Developer's homepage to the 'other Plugins' list +- Update: Smoothy scroll to an anchor using Javascript +- Bugfix: Set the vertical align for each cell in the Reference container to TOP + += 1.5.2 = +- Adding: Setting to enable/disable the mouse-over box +- Adding: Current WordPress Theme to the Diagnostics sub page +- Adding: ManFisher note in the "other Plugins" sub page +- Update: Removed unnecessary hidden inputs from the Settings page +- Update: Merged public CSS files to reduce the output and improve the performance +- Update: Translations (EN and DE) +- Bugfix: Removed the 'trim' function to allow whitespaces at the beginning and end of each setting +- Bugfix: Convert the footnotes short code to HTML special chars when adding them into the page/post editor (visual and text) +- Bugfix: Detailed error messages if other Plugins can't be loaded. Also added empty strings as default values to avoid 'undefined' + += 1.5.1 = +- Bugfix: Broken Settings link in the Plugin listing +- Bugfix: Translation overhaul for German + += 1.5.0 = +- Adding: Grouped the Plugin Settings into a new Menu Page called "ManFisher Plugins" +- Adding: Sub Page to list all other Plugins of the Contributors +- Adding: Hyperlink to manfisher.eu in the "other plugins" page +- Update: Refactored the whole source code +- Update: Moved the Diagnostics Sections to into a new Sub Page called "Diagnostics" +- Bugfix: Line up Footnotes with multiple lines in the Reference container +- Bugfix: Load text domain +- Bugfix: Display the Footnotes button in the plain text editor of posts/pages + += 1.4.0 = +- Feature: WPML Config XML file for easy multi language string translation (WPML String Translation Support File) +- Update: Changed e-Mail support address to the WordPress support forum +- Update: Language EN and DE +- Adding: Tab for Plugin Diagnostics +- Adding: Donate link to the installed Plugin overview page +- Adding: Donate button to the "HowTo" tab + += 1.3.4 = +- Bugfix: Settings access permission vor sub-sites +- Bugfix: Setting 'combine identical footnotes' working as it should + += 1.3.3 = +- Update: Changed the Author name from a fictitious entity towards a real registered company +- Update: Changed the Author URI + += 1.3.2 = +- Bugfix: More security recognizing Footnotes on public pages (e.g. ignoring empty Footnote short codes) +- Bugfix: Clear old Footnotes before lookup new public page (only if no reference container displayed before) +- Update: language EN and DE +- Adding: Setting to customize the hyperlink symbol in der reference container for each footnote reference +- Adding: Setting to enter a user defined hyperlink symbol +- + += 1.3.1 = +- Bugfix: Allow settings to be empty +- Bugfix: Removed space between the hyperlink and superscript in the footnotes index +- Adding: Setting to customize the text before and after the footnotes index in superscript + += 1.3.0 = +- Bugfix: Changed tooltip class to be unique +- Bugfix: Changed superscript styling to not manipulate the line height +- Bugfix: Changed styling of the footnotes text in the reference container to avoid line breaks +- Update: Reformatted code +- Adding: new settings tab for custom CSS settings + += 1.2.5 = +- Bugfix: New styling of the mouse-over box to stay in screen (thanks to Jori, France and Manuel345, undisclosed location) + += 1.2.4 = +- Bugfix: CSS stylesheets will only be added in FootNotes settings page, nowhere else (thanks to Piet Bos, China) +- Bugfix: Styling of the reference container when the footnote text was too long (thanks to Willem Braak, undisclosed location) +- Bugfix: Added a Link to the footnote text in the reference container back to the footnote index in the page content (thanks to Willem Braak, undisclosed location) + += 1.2.3 = +- Bugfix: Removed 'Warning output' of Plugins activation and deactivation function (thanks to Piet Bos, China) +- Bugfix: Added missing meta boxes parameter on Settings page (thanks to Piet Bos, China) +- Bugfix: Removed Widget text formatting +- Bugfix: Load default settings value of setting doesn't exist yet (first usage) +- Bugfix: Replacement of footnotes tag on public pages with html special characters in the content +- Feature: Footnotes tag color is set to the default link color depending on the current Theme (thanks to Daniel Formo, Norway) + += 1.2.2 = +- Bugfix: WYSIWYG editor and plain text editor buttons insert footnote short code correctly (also if defined like html tag) +- Update: The admin can decide which "I love footnotes" text (or not text) will be displayed in the footer +- Adding: Buttons next to the reference label to expand/collapse the reference container if set to "collapse by default" +- Bugfix: Replace footnote short code +- Update: Combined buttons for the "collapse/expand" reference container + += 1.2.1 = +- Bugfix: HowTo example will be displayed correctly if a user defined short code is set + += 1.2.0 = +- Feature: New button in the WYSIWYG editor and in the plain text editor to easily implement the footnotes tag +- Feature: Icon for the WYSIWYG-editor button +- Feature: Pre defined footnote short codes +- Experimental: User defined short code for defining footnotes +- Experimental: Plugin Widget to define where the reference container should appear when set to "widget area" +- Update: Moved footnotes 'love' settings to a separate container +- Update: Translation for new settings and for the Widget description +- Bugfix: Setting for the position of the "reference container" works for the options "footer", "end of post" and "widget area" + += 1.1.1 = +- Feature: Short code to not display the 'love me' slug on specific pages ( short code = [[no footnotes: love]] ) +- Update: Setting where the reference container appears on public pages can also be set to the widget area +- Adding: Link to the wordpress.org support page in the plugin main page +- Update: Changed plugin URL from GitHub to WordPress +- Bugfix: Uninstall function to really remove all settings done in the settings page +- Bugfix: Load default settings after plugin is installed +- Update: Translation for support link and new setting option +- Adding: Label to display the user the short code to not display the 'love me' slug + += 1.1.0 = +- Update: Global styling for the public plugin name +- Update: Easier usage of the public plugin name in translations +- Update: New Layout for the settings page to group similar settings to get a better overview +- Update: Display settings submit button only if there is at least 1 editable setting in the current tab +- Adding: Setting where the reference container appears on public pages (needs some corrections!) +- Bugfix: Displays only one reference container in front of the footer on category pages + += 1.0.6 = +- Bugfix: Uninstall function to delete all plugin settings +- Bugfix: Counter style internal name in the reference container to correctly link to the right footnote on the page above +- Bugfix: Footnote hover box styling to not wrap the footnote text on mouse over +- Update: 'footnotes love' text in the page footer if the admin accepts it and set its default value to 'no' + += 1.0.5 = +- The Plugin has been submitted to wordpress.org for review and (hopefully) publication. +- Update: Plugin description for public directories (WordPress.org and GitHub) +- Feature: the footnotes WordPress Plugin now has its very own CI + - Update: Styling + - Update: Settings to support the styling +- Adding: Inspirational Screenshots for further development +- Adding: Settings screenshot +- Update: i18n fine-tuning + += 1.0.4 = +- Update: replacing function when footnote is a link (bugfix) +- Footnote hover box remains until cursor leaves footnote or hover box +- Links in the footnote hover box are click able +- Adding: setting to allow footnotes on Summarized Posts +- Adding: setting to tell the world you're using footnotes plugin +- Adding: setting for the counter style of the footnote index + - Arabic Numbers (1, 2, 3, 4, 5, ...) + - Arabic Numbers leading 0 (01, 02, 03, 04, 05, ...) + - Latin Characters lower-case (a, b, c, d, e, ...) + - Latin Characters upper-case (A, B, C, D, E, ...) + - Roman Numerals (I, II, III, IV, V, ...) +- Adding: a link to the WordPress plugin in the footer if the WP-admin accepts it +- Update: translations for the new settings +- Switch back the version numbering scheme to have 3 digits + += 1.0.3 = +- Adding: setting to use personal starting and ending tag for the footnotes +- Update: translations for the new setting +- Update: reading settings and fallback to default values (bugfix) + += 1.0.2 = +- Adding: setting to collapse the reference container by default +- Adding: link behind the footnotes to automatically jump to the reference container +- Adding: function to easy output input fields for the settings page +- Update: translation for the new setting + += 1.0.1 = +- Separated functions in different files for a better overview +- Adding: a version control to each file / class / function / variable +- Adding: layout for the settings menu, settings split in tabs and not a list-view +- Update: Replacing footnotes in widget texts will show the reference container at the end of the page (bugfix) +- Update: translations for EN and DE +- Changed version number from 3 digits to 2 digits + += 1.0.0 = +- First development Version of the Plugin + +== Upgrade Notice == +to upgrade our plugin is simple. Just update the plugin within your WordPress installation. +To cross-upgrade from other footnotes plugins, there will be a migration assistant in the future diff --git a/templates/dashboard/customize-css-migration.html b/templates/dashboard/customize-css-migration.html index 25ce519..5a8ef97 100644 --- a/templates/dashboard/customize-css-migration.html +++ b/templates/dashboard/customize-css-migration.html @@ -1,18 +1,18 @@ -
-

[[description-css]]

-
- - - - - - - - - - - -
[[label-css]][[css]]
[[label-show-legacy]][[show-legacy]] [[notice-show-legacy]]
-
-

[[description-show-legacy]]

-
+
+

[[description-css]]

+
+ + + + + + + + + + + +
[[label-css]][[css]]
[[label-show-legacy]][[show-legacy]] [[notice-show-legacy]]
+
+

[[description-show-legacy]]

+
diff --git a/templates/dashboard/customize-css-new.html b/templates/dashboard/customize-css-new.html index d6dff15..4364e71 100644 --- a/templates/dashboard/customize-css-new.html +++ b/templates/dashboard/customize-css-new.html @@ -1,33 +1,33 @@ - - - - - - - -
[[headline]]
-
-

.footnote_referrer = enclosing <span> -

.footnote_referrer > a = optional <a> enclosing the <sup> -

.footnote_plugin_tooltip_text = inner <sup>, not tooltip -

-

.footnote_tooltip = inner <span> -

.footnote_tooltip_continue = nested <span> -

-

.footnotes_reference_container = enclosing <div> -

.footnote_container_prepare = label <div> -

.footnote_reference_container_label = <span> -

.footnote_reference_container_collapse_button = sibling <span> -

-

.footnotes_table = <table> -

.footnotes_plugin_reference_row = <tr> -

.footnote_plugin_index_combi = first <td> if identical footnotes are combined -

.footnote_plugin_index = first <td> if identical footnotes are not combined -

.footnote_index = <a> or <span> in first <td> in 3-column table -

.footnote_plugin_symbol = second <td> in 3-column table -

.footnote_plugin_link = <a> or <span> if identical footnotes are not combined -

.footnote_backlink = <a> or <span> if identical footnotes are combined, or in second <td> in 3-column table -

.footnote_index_arrow = nested <span>, symbol only -

.footnote_plugin_text = second <td>, or third <td> in 3-column table -

-
[[css]]
+ + + + + + + +
[[headline]]
+
+

.footnote_referrer = enclosing <span> +

.footnote_referrer > a = optional <a> enclosing the <sup> +

.footnote_plugin_tooltip_text = inner <sup>, not tooltip +

+

.footnote_tooltip = inner <span> +

.footnote_tooltip_continue = nested <span> +

+

.footnotes_reference_container = enclosing <div> +

.footnote_container_prepare = label <div> +

.footnote_reference_container_label = <span> +

.footnote_reference_container_collapse_button = sibling <span> +

+

.footnotes_table = <table> +

.footnotes_plugin_reference_row = <tr> +

.footnote_plugin_index_combi = first <td> if identical footnotes are combined +

.footnote_plugin_index = first <td> if identical footnotes are not combined +

.footnote_index = <a> or <span> in first <td> in 3-column table +

.footnote_plugin_symbol = second <td> in 3-column table +

.footnote_plugin_link = <a> or <span> if identical footnotes are not combined +

.footnote_backlink = <a> or <span> if identical footnotes are combined, or in second <td> in 3-column table +

.footnote_index_arrow = nested <span>, symbol only +

.footnote_plugin_text = second <td>, or third <td> in 3-column table +

+
[[css]]
diff --git a/templates/dashboard/customize-css.html b/templates/dashboard/customize-css.html index ab4074b..6a5152f 100644 --- a/templates/dashboard/customize-css.html +++ b/templates/dashboard/customize-css.html @@ -1,11 +1,11 @@ -
-

[[description-css]]

-
- - - - - - - -
[[label-css]][[css]]
+
+

[[description-css]]

+
+ + + + + + + +
[[label-css]][[css]]
diff --git a/templates/dashboard/customize-hyperlink-arrow.html b/templates/dashboard/customize-hyperlink-arrow.html index 297f2e5..0608266 100644 --- a/templates/dashboard/customize-hyperlink-arrow.html +++ b/templates/dashboard/customize-hyperlink-arrow.html @@ -1,15 +1,15 @@ - - - - - - - - -
-

[[description-symbol]]

-
+ + + + + + + + +
+

[[description-symbol]]

+
diff --git a/templates/dashboard/customize-superscript.html b/templates/dashboard/customize-superscript.html index 295f972..b6f5f02 100644 --- a/templates/dashboard/customize-superscript.html +++ b/templates/dashboard/customize-superscript.html @@ -1,24 +1,24 @@ - - - - - - - - - - - - - - - - - - - - - - - -
[[label-superscript]][[superscript]]
[[label-normalize]][[normalize]] [[notice-normalize]]
[[label-before]][[before]]
[[label-after]][[after]]
[[label-link]][[notice-link]]
+ + + + + + + + + + + + + + + + + + + + + + + +
[[label-superscript]][[superscript]]
[[label-normalize]][[normalize]] [[notice-normalize]]
[[label-before]][[before]]
[[label-after]][[after]]
[[label-link]][[notice-link]]
diff --git a/templates/dashboard/diagnostics.html b/templates/dashboard/diagnostics.html index 450d9e2..1c70134 100644 --- a/templates/dashboard/diagnostics.html +++ b/templates/dashboard/diagnostics.html @@ -1,37 +1,37 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [[plugins]] - -
[[label-server]][[server]]
[[label-php]][[php]]
[[label-user-agent]][[user-agent]]
[[label-max-execution-time]][[max-execution-time]]
[[label-memory-limit]][[memory-limit]]
[[label-php-extensions]][[php-extensions]]
[[label-wordpress]][[wordpress]]
[[label-theme]][[theme]]
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [[plugins]] + +
[[label-server]][[server]]
[[label-php]][[php]]
[[label-user-agent]][[user-agent]]
[[label-max-execution-time]][[max-execution-time]]
[[label-memory-limit]][[memory-limit]]
[[label-php-extensions]][[php-extensions]]
[[label-wordpress]][[wordpress]]
[[label-theme]][[theme]]
diff --git a/templates/dashboard/editor-button.html b/templates/dashboard/editor-button.html index c12624d..ca69429 100644 --- a/templates/dashboard/editor-button.html +++ b/templates/dashboard/editor-button.html @@ -1,62 +1,62 @@ - - + + diff --git a/templates/dashboard/expert-lookup.html b/templates/dashboard/expert-lookup.html index b3b3ab8..f499ef4 100644 --- a/templates/dashboard/expert-lookup.html +++ b/templates/dashboard/expert-lookup.html @@ -1,50 +1,50 @@ -
-

[[description-1]]

-

[[description-2]]

-

[[description-3]]

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[[head-hook]][[head-checkbox]][[head-numbox]][[head-url]]
[[label-the-title]][[the-title]][[priority-the-title]][[url-the-title]]
[[label-the-content]][[the-content]][[priority-the-content]][[url-the-content]]
[[label-the-excerpt]][[the-excerpt]][[priority-the-excerpt]][[url-the-excerpt]]
[[label-widget-title]][[widget-title]][[priority-widget-title]][[url-widget-title]]
[[label-widget-text]][[widget-text]][[priority-widget-text]][[url-widget-text]]
-
-

[[description-4]]

-
+
+

[[description-1]]

+

[[description-2]]

+

[[description-3]]

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
[[head-hook]][[head-checkbox]][[head-numbox]][[head-url]]
[[label-the-title]][[the-title]][[priority-the-title]][[url-the-title]]
[[label-the-content]][[the-content]][[priority-the-content]][[url-the-content]]
[[label-the-excerpt]][[the-excerpt]][[priority-the-excerpt]][[url-the-excerpt]]
[[label-widget-title]][[widget-title]][[priority-widget-title]][[url-widget-title]]
[[label-widget-text]][[widget-text]][[priority-widget-text]][[url-widget-text]]
+
+

[[description-4]]

+
diff --git a/templates/dashboard/how-to-donate.html b/templates/dashboard/how-to-donate.html index 74f737d..97c825b 100644 --- a/templates/dashboard/how-to-donate.html +++ b/templates/dashboard/how-to-donate.html @@ -1,2 +1,2 @@ - \ No newline at end of file diff --git a/templates/dashboard/how-to-help.html b/templates/dashboard/how-to-help.html index 0250fc6..ecb67a5 100644 --- a/templates/dashboard/how-to-help.html +++ b/templates/dashboard/how-to-help.html @@ -1,17 +1,17 @@ -
- [[label-start]] [[start]] -
- [[label-end]] [[end]] -
- -
- [[example-code]] -
- [[example-string]] -
- [[example]] -
- -
- [[information]] +
+ [[label-start]] [[start]] +
+ [[label-end]] [[end]] +
+ +
+ [[example-code]] +
+ [[example-string]] +
+ [[example]] +
+ +
+ [[information]]
\ No newline at end of file diff --git a/templates/dashboard/manfisher.html b/templates/dashboard/manfisher.html index 1dc464b..c1f88d0 100644 --- a/templates/dashboard/manfisher.html +++ b/templates/dashboard/manfisher.html @@ -1,11 +1,11 @@ -

ManFisher

- -
-

a note from the mastermind behind footnotes

- -

Ideology

-

You know WordPress is a great community effort and boatloads of people are involved and spending their spare time to freely (free as in money) contribute to WordPress as a platform or at the very core. Our aim as developers and those gravitating around developer's halos is to give back to the community with our own ideas which we think are great and well worth our whiles to put our own time into. For some of us, it would be a huge honour to serve the WordPress core developer team.

- -

the ManFisher menu

-

Will soon disappear as the company name changed and I believe it's overbearing to have that menu for such a simple function as footnotes

+

ManFisher

+ +
+

a note from the mastermind behind footnotes

+ +

Ideology

+

You know WordPress is a great community effort and boatloads of people are involved and spending their spare time to freely (free as in money) contribute to WordPress as a platform or at the very core. Our aim as developers and those gravitating around developer's halos is to give back to the community with our own ideas which we think are great and well worth our whiles to put our own time into. For some of us, it would be a huge honour to serve the WordPress core developer team.

+ +

the ManFisher menu

+

Will soon disappear as the company name changed and I believe it's overbearing to have that menu for such a simple function as footnotes

\ No newline at end of file diff --git a/templates/dashboard/mouse-over-box-appearance.html b/templates/dashboard/mouse-over-box-appearance.html index 3985b34..82aa401 100644 --- a/templates/dashboard/mouse-over-box-appearance.html +++ b/templates/dashboard/mouse-over-box-appearance.html @@ -1,32 +1,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[[label-font-size]][[font-size-enable]][[font-size-scalar]][[font-size-unit]] [[notice-font-size]]
[[label-color]][[color]] [[notice-color]]
[[label-background]][[background]] [[notice-background]]
[[label-border-width]][[border-width]] [[notice-border-width]]
[[label-border-color]][[border-color]] [[notice-border-color]]
[[label-border-radius]][[border-radius]] [[notice-border-radius]]
[[label-box-shadow-color]][[box-shadow-color]] [[notice-box-shadow-color]]
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
[[label-font-size]][[font-size-enable]][[font-size-scalar]][[font-size-unit]] [[notice-font-size]]
[[label-color]][[color]] [[notice-color]]
[[label-background]][[background]] [[notice-background]]
[[label-border-width]][[border-width]] [[notice-border-width]]
[[label-border-color]][[border-color]] [[notice-border-color]]
[[label-border-radius]][[border-radius]] [[notice-border-radius]]
[[label-box-shadow-color]][[box-shadow-color]] [[notice-box-shadow-color]]
diff --git a/templates/dashboard/mouse-over-box-dimensions.html b/templates/dashboard/mouse-over-box-dimensions.html index d4f7be7..3a14f80 100644 --- a/templates/dashboard/mouse-over-box-dimensions.html +++ b/templates/dashboard/mouse-over-box-dimensions.html @@ -1,8 +1,8 @@ - - - - - - - -
[[label-max-width]][[max-width]] [[width]] [[notice-max-width]]
+ + + + + + + +
[[label-max-width]][[max-width]] [[width]] [[notice-max-width]]
diff --git a/templates/dashboard/mouse-over-box-display.html b/templates/dashboard/mouse-over-box-display.html index dc42fc9..c3968c2 100644 --- a/templates/dashboard/mouse-over-box-display.html +++ b/templates/dashboard/mouse-over-box-display.html @@ -1,15 +1,15 @@ - - - - - - - - - - - -
[[label-enable]][[enable]] [[notice-enable]]
[[label-alternative]][[alternative]] [[notice-alternative]]
-
-

[[description-alternative]]

-
+ + + + + + + + + + + +
[[label-enable]][[enable]] [[notice-enable]]
[[label-alternative]][[alternative]] [[notice-alternative]]
+
+

[[description-alternative]]

+
diff --git a/templates/dashboard/mouse-over-box-position.html b/templates/dashboard/mouse-over-box-position.html index 31769c9..705c55f 100644 --- a/templates/dashboard/mouse-over-box-position.html +++ b/templates/dashboard/mouse-over-box-position.html @@ -1,16 +1,16 @@ - - - - - - - - - - - - - - - -
[[label-position]][[position]] [[position-alternative]] [[notice-position]]
[[label-offset-x]][[offset-x]] [[offset-x-alternative]] [[notice-offset-x]]
[[label-offset-y]][[offset-y]] [[offset-y-alternative]] [[notice-offset-y]]
+ + + + + + + + + + + + + + + +
[[label-position]][[position]] [[position-alternative]] [[notice-position]]
[[label-offset-x]][[offset-x]] [[offset-x-alternative]] [[notice-offset-x]]
[[label-offset-y]][[offset-y]] [[offset-y-alternative]] [[notice-offset-y]]
diff --git a/templates/dashboard/mouse-over-box-text.html b/templates/dashboard/mouse-over-box-text.html index 5579edc..c09e133 100644 --- a/templates/dashboard/mouse-over-box-text.html +++ b/templates/dashboard/mouse-over-box-text.html @@ -1,22 +1,22 @@ -
-

[[description-delimiter]]

-
- - - - - - - - - - - - - - - -
[[label-delimiter]][[delimiter]] [[notice-delimiter]]
[[label-mirror]][[mirror]] [[notice-mirror]]
[[label-separator]][[separator]] [[notice-separator]]
-
-

[[description-mirror]]

-
+
+

[[description-delimiter]]

+
+ + + + + + + + + + + + + + + +
[[label-delimiter]][[delimiter]] [[notice-delimiter]]
[[label-mirror]][[mirror]] [[notice-mirror]]
[[label-separator]][[separator]] [[notice-separator]]
+
+

[[description-mirror]]

+
diff --git a/templates/dashboard/mouse-over-box-timing.html b/templates/dashboard/mouse-over-box-timing.html index e58759e..ecbdd79 100644 --- a/templates/dashboard/mouse-over-box-timing.html +++ b/templates/dashboard/mouse-over-box-timing.html @@ -1,20 +1,20 @@ - - - - - - - - - - - - - - - - - - - -
[[label-fade-in-delay]][[fade-in-delay]] [[notice-fade-in-delay]]
[[label-fade-in-duration]][[fade-in-duration]] [[notice-fade-in-duration]]
[[label-fade-out-delay]][[fade-out-delay]] [[notice-fade-out-delay]]
[[label-fade-out-duration]][[fade-out-duration]] [[notice-fade-out-duration]]
+ + + + + + + + + + + + + + + + + + + +
[[label-fade-in-delay]][[fade-in-delay]] [[notice-fade-in-delay]]
[[label-fade-in-duration]][[fade-in-duration]] [[notice-fade-in-duration]]
[[label-fade-out-delay]][[fade-out-delay]] [[notice-fade-out-delay]]
[[label-fade-out-duration]][[fade-out-duration]] [[notice-fade-out-duration]]
diff --git a/templates/dashboard/mouse-over-box-truncation.html b/templates/dashboard/mouse-over-box-truncation.html index 283c9a9..bea6ed4 100644 --- a/templates/dashboard/mouse-over-box-truncation.html +++ b/templates/dashboard/mouse-over-box-truncation.html @@ -1,16 +1,16 @@ - - - - - - - - - - - - - - - -
[[label-truncation]][[truncation]]
[[label-max-length]][[max-length]] [[notice-max-length]]
[[label-readon]][[readon]]
+ + + + + + + + + + + + + + + +
[[label-truncation]][[truncation]]
[[label-max-length]][[max-length]] [[notice-max-length]]
[[label-readon]][[readon]]
diff --git a/templates/dashboard/other-plugins.html b/templates/dashboard/other-plugins.html index 03ad002..5e9e6df 100644 --- a/templates/dashboard/other-plugins.html +++ b/templates/dashboard/other-plugins.html @@ -1,91 +1,91 @@ -
-
- - - - - -
-

-

- -

-
-
-
-
-
- -
-
-
-
-
-
- -
-
- [[last-updated-label]]: - -
-
-
- -
-
-
- - - +
+
+ + + + + +
+

+

+ +

+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+ [[last-updated-label]]: + +
+
+
+ +
+
+
+ + + diff --git a/templates/dashboard/settings-excerpts.html b/templates/dashboard/settings-excerpts.html index 13424b6..e1a316c 100644 --- a/templates/dashboard/settings-excerpts.html +++ b/templates/dashboard/settings-excerpts.html @@ -1,11 +1,11 @@ - - - - - - - -
[[label-excerpts]][[excerpts]] [[notice-excerpts]]
-
-

[[description-excerpts]]

-
+ + + + + + + +
[[label-excerpts]][[excerpts]] [[notice-excerpts]]
+
+

[[description-excerpts]]

+
diff --git a/templates/dashboard/settings-love.html b/templates/dashboard/settings-love.html index 0b06e62..51c4a1b 100644 --- a/templates/dashboard/settings-love.html +++ b/templates/dashboard/settings-love.html @@ -1,12 +1,12 @@ - - - - - - - - - - - -
[[label-love]][[love]]
[[label-no-love]][[no-love]]
+ + + + + + + + + + + +
[[label-love]][[love]]
[[label-no-love]][[no-love]]
diff --git a/templates/dashboard/settings-numbering.html b/templates/dashboard/settings-numbering.html index 75f29c3..bd772d2 100644 --- a/templates/dashboard/settings-numbering.html +++ b/templates/dashboard/settings-numbering.html @@ -1,15 +1,15 @@ - - - - - - - - - - - -
[[label-counter-style]][[counter-style]]
[[label-identical]][[identical]] [[notice-identical]]
-
-

[[description-identical]]

-
+ + + + + + + + + + + +
[[label-counter-style]][[counter-style]]
[[label-identical]][[identical]] [[notice-identical]]
+
+

[[description-identical]]

+
diff --git a/templates/dashboard/settings-reference-container.html b/templates/dashboard/settings-reference-container.html index 0de6a3b..5bc7553 100644 --- a/templates/dashboard/settings-reference-container.html +++ b/templates/dashboard/settings-reference-container.html @@ -1,117 +1,117 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[[label-name]][[name]]
[[label-element]][[element]]
[[label-border]][[border]]
[[label-collapse]][[collapse]]
[[label-script]][[script]] [[notice-script]]
[[label-position]][[position]] [[notice-position]]
[[label-shortcode]][[shortcode]] [[notice-shortcode]]
[[label-startpage]][[startpage]]
[[label-margin-top]][[margin-top]] [[notice-margin-top]]
[[label-margin-bottom]][[margin-bottom]] [[notice-margin-bottom]]
[[label-page-layout]][[page-layout]] [[notice-page-layout]]
[[label-url-wrap]][[url-wrap]] [[notice-url-wrap]]
[[label-symbol]][[symbol-enable]] [[notice-symbol]]
[[label-switch]][[switch]]
[[label-3column]][[3column]] [[notice-3column]]
[[label-row-borders]][[row-borders]]
[[label-separator]] - [[separator-enable]] - [[separator-options]] - [[separator-custom]] - [[notice-separator]] -
[[label-terminator]] - [[terminator-enable]] - [[terminator-options]] - [[terminator-custom]] - [[notice-terminator]] -
[[label-width]] - [[width-enable]] - [[width-scalar]] - [[width-unit]] - [[notice-width]] -
[[label-max-width]] - [[max-width-enable]] - [[max-width-scalar]] - [[max-width-unit]] - [[notice-max-width]] -
[[label-line-break]][[line-break]] - [[notice-line-break]] -
[[label-link]][[link]] [[notice-link]]
-
-

[[description-link]]

-
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
[[label-name]][[name]]
[[label-element]][[element]]
[[label-border]][[border]]
[[label-collapse]][[collapse]]
[[label-script]][[script]] [[notice-script]]
[[label-position]][[position]] [[notice-position]]
[[label-shortcode]][[shortcode]] [[notice-shortcode]]
[[label-startpage]][[startpage]]
[[label-margin-top]][[margin-top]] [[notice-margin-top]]
[[label-margin-bottom]][[margin-bottom]] [[notice-margin-bottom]]
[[label-page-layout]][[page-layout]] [[notice-page-layout]]
[[label-url-wrap]][[url-wrap]] [[notice-url-wrap]]
[[label-symbol]][[symbol-enable]] [[notice-symbol]]
[[label-switch]][[switch]]
[[label-3column]][[3column]] [[notice-3column]]
[[label-row-borders]][[row-borders]]
[[label-separator]] + [[separator-enable]] + [[separator-options]] + [[separator-custom]] + [[notice-separator]] +
[[label-terminator]] + [[terminator-enable]] + [[terminator-options]] + [[terminator-custom]] + [[notice-terminator]] +
[[label-width]] + [[width-enable]] + [[width-scalar]] + [[width-unit]] + [[notice-width]] +
[[label-max-width]] + [[max-width-enable]] + [[max-width-scalar]] + [[max-width-unit]] + [[notice-max-width]] +
[[label-line-break]][[line-break]] + [[notice-line-break]] +
[[label-link]][[link]] [[notice-link]]
+
+

[[description-link]]

+
diff --git a/templates/dashboard/settings-scrolling.html b/templates/dashboard/settings-scrolling.html index 32c792d..743bdcd 100644 --- a/templates/dashboard/settings-scrolling.html +++ b/templates/dashboard/settings-scrolling.html @@ -1,36 +1,36 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[[label-scroll-offset]][[scroll-offset]] [[notice-scroll-offset]]
[[label-scroll-duration]][[scroll-duration]] [[notice-scroll-duration]]
[[label-hard-links]][[hard-links]] [[notice-hard-links]]
[[label-footnote]][[footnote]] [[notice-footnote]]
[[label-referrer]][[referrer]] [[notice-referrer]]
[[label-separator]][[separator]] [[notice-separator]]
[[label-backlink-tooltips]][[backlink-tooltips]] [[notice-backlink-tooltips]]
[[label-backlink-tooltip-text]][[backlink-tooltip-text]] [[notice-backlink-tooltip-text]]
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
[[label-scroll-offset]][[scroll-offset]] [[notice-scroll-offset]]
[[label-scroll-duration]][[scroll-duration]] [[notice-scroll-duration]]
[[label-hard-links]][[hard-links]] [[notice-hard-links]]
[[label-footnote]][[footnote]] [[notice-footnote]]
[[label-referrer]][[referrer]] [[notice-referrer]]
[[label-separator]][[separator]] [[notice-separator]]
[[label-backlink-tooltips]][[backlink-tooltips]] [[notice-backlink-tooltips]]
[[label-backlink-tooltip-text]][[backlink-tooltip-text]] [[notice-backlink-tooltip-text]]
diff --git a/templates/dashboard/settings-start-end.html b/templates/dashboard/settings-start-end.html index cf3744a..633b8df 100644 --- a/templates/dashboard/settings-start-end.html +++ b/templates/dashboard/settings-start-end.html @@ -1,63 +1,63 @@ -
-

[[description-escapement]]

-
- - - - - - - - - - - -
[[label-short-code-start]] - [[short-code-start]] - [[short-code-start-user]] -
[[label-short-code-end]] - [[short-code-end]] - [[short-code-end-user]] -
-
-

[[description-parentheses]]

-
- - - - - - - -
[[label-syntax]][[syntax]] [[notice-syntax]]
-
-

[[description-syntax]]

-
- +
+

[[description-escapement]]

+
+ + + + + + + + + + + +
[[label-short-code-start]] + [[short-code-start]] + [[short-code-start-user]] +
[[label-short-code-end]] + [[short-code-end]] + [[short-code-end-user]] +
+
+

[[description-parentheses]]

+
+ + + + + + + +
[[label-syntax]][[syntax]] [[notice-syntax]]
+
+

[[description-syntax]]

+
+ diff --git a/templates/public/footnote-alternative.html b/templates/public/footnote-alternative.html index 4e70481..50c5c2b 100644 --- a/templates/public/footnote-alternative.html +++ b/templates/public/footnote-alternative.html @@ -1,24 +1,24 @@ - -<[[link-span]] - onclick="footnote_moveToAnchor_[[post_id]]_[[container_id]]('footnote_plugin_reference_[[post_id]]_[[container_id]]_[[note_id]]');" - [[hard-link]] - ><[[sup-span]] - id="footnote_plugin_tooltip_[[post_id]]_[[container_id]]_[[note_id]]" - class="footnote_plugin_tooltip_text" - >[[before]][[index]][[after]][[anchor-element]] + +<[[link-span]] + onclick="footnote_moveToAnchor_[[post_id]]_[[container_id]]('footnote_plugin_reference_[[post_id]]_[[container_id]]_[[note_id]]');" + [[hard-link]] + ><[[sup-span]] + id="footnote_plugin_tooltip_[[post_id]]_[[container_id]]_[[note_id]]" + class="footnote_plugin_tooltip_text" + >[[before]][[index]][[after]][[anchor-element]] diff --git a/templates/public/footnote.html b/templates/public/footnote.html index 10b884c..0f0b2d9 100755 --- a/templates/public/footnote.html +++ b/templates/public/footnote.html @@ -1,20 +1,20 @@ - -<[[link-span]] - onclick="footnote_moveToAnchor_[[post_id]]_[[container_id]]('footnote_plugin_reference_[[post_id]]_[[container_id]]_[[note_id]]');" - [[hard-link]] - ><[[sup-span]] - id="footnote_plugin_tooltip_[[post_id]]_[[container_id]]_[[note_id]]" - class="footnote_plugin_tooltip_text" - >[[before]][[index]][[after]][[anchor-element]][[text]] + +<[[link-span]] + onclick="footnote_moveToAnchor_[[post_id]]_[[container_id]]('footnote_plugin_reference_[[post_id]]_[[container_id]]_[[note_id]]');" + [[hard-link]] + ><[[sup-span]] + id="footnote_plugin_tooltip_[[post_id]]_[[container_id]]_[[note_id]]" + class="footnote_plugin_tooltip_text" + >[[before]][[index]][[after]][[anchor-element]][[text]] diff --git a/templates/public/js-reference-container.html b/templates/public/js-reference-container.html index 2fdc2b9..d1ec848 100644 --- a/templates/public/js-reference-container.html +++ b/templates/public/js-reference-container.html @@ -1,88 +1,88 @@ - -
-
<[[element]] - >[[name]][+]
-
- - - [[content]] - -
-
-
- + +
+
<[[element]] + >[[name]][+]
+
+ + + [[content]] + +
+
+
+ diff --git a/templates/public/reference-container-body-3column.html b/templates/public/reference-container-body-3column.html index 1a750f7..2d5613f 100644 --- a/templates/public/reference-container-body-3column.html +++ b/templates/public/reference-container-body-3column.html @@ -1,29 +1,29 @@ - -
<[[link-span]] - id="footnote_plugin_reference_[[post_id]]_[[container_id]]_[[note_id]]" - class="footnote_index" - onclick="footnote_moveToAnchor_[[post_id]]_[[container_id]]('footnote_plugin_tooltip_[[post_id]]_[[container_id]]_[[note_id]]');" - [[hard-link]] - >[[index]][[terminator]][[anchor-element]]<[[link-span]] - onclick="footnote_moveToAnchor_[[post_id]]_[[container_id]]('footnote_plugin_tooltip_[[post_id]]_[[container_id]]_[[note_id]]');" - class="footnote_backlink" - [[hard-link]] - >[[arrow]][[text]]
<[[link-span]] + id="footnote_plugin_reference_[[post_id]]_[[container_id]]_[[note_id]]" + class="footnote_index" + onclick="footnote_moveToAnchor_[[post_id]]_[[container_id]]('footnote_plugin_tooltip_[[post_id]]_[[container_id]]_[[note_id]]');" + [[hard-link]] + >[[index]][[terminator]][[anchor-element]]<[[link-span]] + onclick="footnote_moveToAnchor_[[post_id]]_[[container_id]]('footnote_plugin_tooltip_[[post_id]]_[[container_id]]_[[note_id]]');" + class="footnote_backlink" + [[hard-link]] + >[[arrow]][[text]]
[[backlinks]][[text]]
[[backlinks]][[text]]
<[[link-span]] - class="footnote_plugin_link" - [[hard-link]] - >[[index]][[terminator]][[arrow]][[anchor-element]][[text]]
<[[link-span]] + class="footnote_plugin_link" + [[hard-link]] + >[[index]][[terminator]][[arrow]][[anchor-element]][[text]]
<[[link-span]] - class="footnote_plugin_link" - [[hard-link]] - >[[arrow]][[index]][[terminator]][[anchor-element]][[text]]
<[[link-span]] + class="footnote_plugin_link" + [[hard-link]] + >[[arrow]][[index]][[terminator]][[anchor-element]][[text]]
- - [[content]] - -
-
-
- + +
+
<[[element]] + >[[name]][+]
+
+ + + [[content]] + +
+
+
+ diff --git a/templates/public/tooltip.html b/templates/public/tooltip.html index deefba3..eab35b8 100644 --- a/templates/public/tooltip.html +++ b/templates/public/tooltip.html @@ -1,18 +1,18 @@ - - + +