Version 1.0.4

* Updated 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
* New setting to allow footnotes on Summarized Posts
* New setting to tell the world you're using footnotes plugin
* New 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
* Updated translations for the new settings
* re-changed the version number to have 3 digits

git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@917816 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
Aricura 2014-05-20 11:44:38 +00:00
parent 5d475abfc3
commit 660d32edc3
14 changed files with 288 additions and 88 deletions

View file

@ -23,7 +23,10 @@ class Class_FootnotesSettings
FOOTNOTE_INPUTFIELD_REFERENCES_LABEL => 'References', FOOTNOTE_INPUTFIELD_REFERENCES_LABEL => 'References',
FOOTNOTE_INPUTFIELD_COLLAPSE_REFERENCES => '', FOOTNOTE_INPUTFIELD_COLLAPSE_REFERENCES => '',
FOOTNOTE_INPUTFIELD_PLACEHOLDER_START => '((', FOOTNOTE_INPUTFIELD_PLACEHOLDER_START => '((',
FOOTNOTE_INPUTFIELD_PLACEHOLDER_END => '))' FOOTNOTE_INPUTFIELD_PLACEHOLDER_END => '))',
FOOTNOTE_INPUTFIELD_SEARCH_IN_EXCERPT => 'yes',
FOOTNOTE_INPUTFIELD_LOVE => 'yes',
FOOTNOTE_INPUTFIELD_COUNTER_STYLE => 'arabic_plain'
); );
/* /*
* resulting pagehook for adding a new sub menu page to the settings * resulting pagehook for adding a new sub menu page to the settings
@ -48,7 +51,7 @@ class Class_FootnotesSettings
function __construct() function __construct()
{ {
/* loads and filters the settings for this plugin */ /* loads and filters the settings for this plugin */
$this->a_arr_Options = footnotes_filter_options( FOOTNOTE_SETTINGS_CONTAINER, self::$a_arr_Default_Settings ); $this->a_arr_Options = footnotes_filter_options( FOOTNOTE_SETTINGS_CONTAINER, self::$a_arr_Default_Settings, true );
/* execute class includes on action-even: init, admin_init and admin_menu */ /* execute class includes on action-even: init, admin_init and admin_menu */
add_action( 'init', array( $this, 'LoadScriptsAndStylesheets' ) ); add_action( 'init', array( $this, 'LoadScriptsAndStylesheets' ) );
@ -312,6 +315,9 @@ class Class_FootnotesSettings
add_settings_field( 'Register_Collapse_References', __( "Collapse references by default:", FOOTNOTES_PLUGIN_NAME ), array( $this, 'Register_Collapse_References' ), FOOTNOTE_SETTINGS_LABEL_GENERAL, $l_str_SectionName ); add_settings_field( 'Register_Collapse_References', __( "Collapse references by default:", FOOTNOTES_PLUGIN_NAME ), array( $this, 'Register_Collapse_References' ), FOOTNOTE_SETTINGS_LABEL_GENERAL, $l_str_SectionName );
add_settings_field( 'Register_Combine_Identical', __( "Combine identical footnotes:", FOOTNOTES_PLUGIN_NAME ), array( $this, 'Register_Combine_Identical' ), FOOTNOTE_SETTINGS_LABEL_GENERAL, $l_str_SectionName ); add_settings_field( 'Register_Combine_Identical', __( "Combine identical footnotes:", FOOTNOTES_PLUGIN_NAME ), array( $this, 'Register_Combine_Identical' ), FOOTNOTE_SETTINGS_LABEL_GENERAL, $l_str_SectionName );
add_settings_field( 'Register_Placeholder_Tags', __( "Footnote tag:", FOOTNOTES_PLUGIN_NAME ), array( $this, 'Register_Placeholder_Tags' ), FOOTNOTE_SETTINGS_LABEL_GENERAL, $l_str_SectionName ); add_settings_field( 'Register_Placeholder_Tags', __( "Footnote tag:", FOOTNOTES_PLUGIN_NAME ), array( $this, 'Register_Placeholder_Tags' ), FOOTNOTE_SETTINGS_LABEL_GENERAL, $l_str_SectionName );
add_settings_field( 'Register_CounterStyle', __( "Counter style:", FOOTNOTES_PLUGIN_NAME ), array( $this, 'Register_CounterStyle' ), FOOTNOTE_SETTINGS_LABEL_GENERAL, $l_str_SectionName );
add_settings_field( 'Register_SearchExcerpt', __( "Allow footnotes on Summarized Posts:", FOOTNOTES_PLUGIN_NAME ), array( $this, 'Register_SearchExcerpt' ), FOOTNOTE_SETTINGS_LABEL_GENERAL, $l_str_SectionName );
add_settings_field( 'Register_LoveAndShare', sprintf(__( "Tell the world you're using %sfootnotes%s:", FOOTNOTES_PLUGIN_NAME ), '<span style="color:#ff524b">', '</span>'), array( $this, 'Register_LoveAndShare' ), FOOTNOTE_SETTINGS_LABEL_GENERAL, $l_str_SectionName );
} }
/** /**
@ -373,6 +379,55 @@ class Class_FootnotesSettings
$this->AddTextbox(FOOTNOTE_INPUTFIELD_PLACEHOLDER_END, "", 14, __( "ends with:", FOOTNOTES_PLUGIN_NAME )); $this->AddTextbox(FOOTNOTE_INPUTFIELD_PLACEHOLDER_END, "", 14, __( "ends with:", FOOTNOTES_PLUGIN_NAME ));
} }
/**
* outouts the settings field for the counter style
* @since 1.0-gamma
*/
function Register_CounterStyle()
{
$l_str_Space = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
/* get array with option elements */
$l_arr_Options = array(
"arabic_plain" => __( "Arabic Numbers - Plain", FOOTNOTES_PLUGIN_NAME ) .$l_str_Space. "1, 2, 3, 4, 5, ...",
"arabic_leading" => __( "Arabic Numbers - Leading 0", FOOTNOTES_PLUGIN_NAME ) .$l_str_Space. "01, 02, 03, 04, 05, ...",
"latin_low" => __( "Latin Character - lower case", FOOTNOTES_PLUGIN_NAME ) .$l_str_Space. "a, b, c, d, e, ...",
"latin_high" => __( "Latin Character - upper case", FOOTNOTES_PLUGIN_NAME ) .$l_str_Space. "A, B, C, D, E, ...",
"romanic" => __( "Roman Numerals", FOOTNOTES_PLUGIN_NAME ) .$l_str_Space. "I, II, III, IV, V, ..."
);
/* add a select box to the output */
$this->AddSelectbox(FOOTNOTE_INPUTFIELD_COUNTER_STYLE, $l_arr_Options, "footnote_plugin_50");
}
/**
* outputs the settings field for "allow searching in summarized posts"
* @since 1.0-gamma
*/
function Register_SearchExcerpt()
{
/* get array with option elements */
$l_arr_Options = array(
"yes" => __( "Yes", FOOTNOTES_PLUGIN_NAME ),
"no" => __( "No", FOOTNOTES_PLUGIN_NAME )
);
/* add a select box to the output */
$this->AddSelectbox(FOOTNOTE_INPUTFIELD_SEARCH_IN_EXCERPT, $l_arr_Options, "footnote_plugin_25");
}
/**
* outputs the settings field for "love and share this plugin"
* @since 1.0-gamma
*/
function Register_LoveAndShare()
{
/* get array with option elements */
$l_arr_Options = array(
"yes" => __( "Yes", FOOTNOTES_PLUGIN_NAME ),
"no" => __( "No", FOOTNOTES_PLUGIN_NAME )
);
/* add a select box to the output */
$this->AddSelectbox(FOOTNOTE_INPUTFIELD_LOVE, $l_arr_Options, "footnote_plugin_25");
}
/** /**
* initialize howto settings tab * initialize howto settings tab
* called in class constructor @ admin_init * called in class constructor @ admin_init
@ -424,7 +479,7 @@ class Class_FootnotesSettings
<span class="footnote_highlight_placeholder"><?php echo $l_arr_Footnote_StartingTag["value"] . __( "example string", FOOTNOTES_PLUGIN_NAME ) . $l_arr_Footnote_EndingTag["value"]; ?></span> <span class="footnote_highlight_placeholder"><?php echo $l_arr_Footnote_StartingTag["value"] . __( "example string", FOOTNOTES_PLUGIN_NAME ) . $l_arr_Footnote_EndingTag["value"]; ?></span>
<?php echo __( "will be displayed as:", FOOTNOTES_PLUGIN_NAME ); ?> <?php echo __( "will be displayed as:", FOOTNOTES_PLUGIN_NAME ); ?>
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
<?php echo footnotes_replaceFootnotes( $l_arr_Footnote_StartingTag["value"] . __( "example string", FOOTNOTES_PLUGIN_NAME ) . $l_arr_Footnote_EndingTag["value"], true ); ?> <?php echo footnotes_replaceFootnotes( $l_arr_Footnote_StartingTag["value"] . __( "example string", FOOTNOTES_PLUGIN_NAME ) . $l_arr_Footnote_EndingTag["value"], true, true ); ?>
</p> </p>
</div> </div>

View file

@ -79,32 +79,33 @@
} }
/* tooltip */ /* tooltip */
a.footnote_plugin_tooltip { .footnote_plugin_tooltip {
outline: none !important; outline: none !important;
color: #4777ff !important; color: #4777ff !important;
text-decoration: none !important; text-decoration: none !important;
cursor: pointer !important; cursor: pointer !important;
} }
a.footnote_plugin_tooltip strong { .footnote_plugin_tooltip strong {
line-height: 30px !important; line-height: 30px !important;
} }
a.footnote_plugin_tooltip:hover { .footnote_plugin_tooltip:hover {
text-decoration: none !important; text-decoration: none !important;
} }
a.footnote_plugin_tooltip span { .footnote_plugin_tooltip span {
z-index: 10 !important; z-index: 10 !important;
display: none !important; display: none !important;
padding: 14px 20px !important; padding: 14px 20px !important;
margin-top: -30px !important; margin-top: -30px !important;
margin-left: 28px !important; /*margin-left: 28px !important;*/
/*width: 240px;*/ /*width: 240px;*/
line-height: 16px !important; line-height: 16px !important;
cursor: default;
} }
a.footnote_plugin_tooltip:hover span { .footnote_plugin_tooltip:hover span, .footnote_plugin_tooltip span:hover {
display: inline !important; display: inline !important;
position: absolute !important; position: absolute !important;
color: #474747 !important; color: #474747 !important;
@ -121,7 +122,7 @@ a.footnote_plugin_tooltip:hover span {
} }
/*CSS3 extras*/ /*CSS3 extras*/
a.footnote_plugin_tooltip span { .footnote_plugin_tooltip span {
border-radius: 4px !important; border-radius: 4px !important;
-moz-border-radius: 4px !important; -moz-border-radius: 4px !important;
-webkit-border-radius: 4px !important; -webkit-border-radius: 4px !important;

View file

@ -9,7 +9,7 @@
/* overwrite some styling for inputs [type=text] and select-boxes */ /* overwrite some styling for inputs [type=text] and select-boxes */
input[type=text], input[type=checkbox], input[type=password], textarea, select { input[type=text], input[type=checkbox], input[type=password], textarea, select {
margin-left: 12px !important; /*margin-left: 12px !important;*/
} }
input[type=text], input[type=password], textarea, select { input[type=text], input[type=password], textarea, select {
padding-left: 8px !important; padding-left: 8px !important;

View file

@ -25,6 +25,9 @@ define( "FOOTNOTE_INPUTFIELD_REFERENCES_LABEL", "footnote_inputfield_references_
define( "FOOTNOTE_INPUTFIELD_COLLAPSE_REFERENCES", "footnote_inputfield_collapse_references" ); /* id of input field for the "collapse references" setting */ define( "FOOTNOTE_INPUTFIELD_COLLAPSE_REFERENCES", "footnote_inputfield_collapse_references" ); /* id of input field for the "collapse references" setting */
define( "FOOTNOTE_INPUTFIELD_PLACEHOLDER_START", "footnote_inputfield_placeholder_start"); /* id of input field for the "placeholder starting tag" setting */ define( "FOOTNOTE_INPUTFIELD_PLACEHOLDER_START", "footnote_inputfield_placeholder_start"); /* id of input field for the "placeholder starting tag" setting */
define( "FOOTNOTE_INPUTFIELD_PLACEHOLDER_END", "footnote_inputfield_placeholder_end"); /* id of input field for the "placeholder ending tag" setting */ define( "FOOTNOTE_INPUTFIELD_PLACEHOLDER_END", "footnote_inputfield_placeholder_end"); /* id of input field for the "placeholder ending tag" setting */
define( "FOOTNOTE_INPUTFIELD_SEARCH_IN_EXCERPT", "footnote_inputfield_search_in_excerpt"); /* id of input field for the "allow footnotes in the excerpt" setting */
define( "FOOTNOTE_INPUTFIELD_LOVE", "footnote_inputfield_love"); /* id of input field for "love and share this plugin" setting */
define( "FOOTNOTE_INPUTFIELD_COUNTER_STYLE", "footnote_inputfield_counter_style"); /* id of input field for "counter style of footnote index" setting */
/* PLUGIN REFERENCES CONTAINER ID */ /* PLUGIN REFERENCES CONTAINER ID */
define( "FOOTNOTE_REFERENCES_CONTAINER_ID", "footnote_references_container" ); /* id for the div surrounding the footnotes */ define( "FOOTNOTE_REFERENCES_CONTAINER_ID", "footnote_references_container" ); /* id for the div surrounding the footnotes */

View file

@ -33,15 +33,20 @@ function footnotes_plugin_settings_link( $links, $file )
* @since 1.0 * @since 1.0
* @param string $p_str_OptionsField * @param string $p_str_OptionsField
* @param array $p_arr_DefaultValues * @param array $p_arr_DefaultValues
* @param bool $p_bool_ConvertHtmlChars
* @return array * @return array
*/ */
function footnotes_filter_options( $p_str_OptionsField, $p_arr_DefaultValues ) function footnotes_filter_options( $p_str_OptionsField, $p_arr_DefaultValues, $p_bool_ConvertHtmlChars=true )
{ {
$l_arr_Options = get_option( $p_str_OptionsField ); $l_arr_Options = get_option( $p_str_OptionsField );
/* loop through all keys in the array and filters them */ /* loop through all keys in the array and filters them */
foreach ( $l_arr_Options as $l_str_Key => $l_str_Value ) { foreach ( $l_arr_Options as $l_str_Key => $l_str_Value ) {
/* removes special chars from the settings value */ /* removes special chars from the settings value */
$l_str_Value = stripcslashes( $l_str_Value ); $l_str_Value = stripcslashes( $l_str_Value );
/* if set, convert html special chars */
if ($p_bool_ConvertHtmlChars) {
$l_str_Value = htmlspecialchars( $l_str_Value );
}
/* check if settings value is not empty, otherwise load the default value, or empty string if no default is defined */ /* check if settings value is not empty, otherwise load the default value, or empty string if no default is defined */
if (!empty($l_str_Value)) { if (!empty($l_str_Value)) {
$l_arr_Options[ $l_str_Key ] = stripcslashes( $l_str_Value ); $l_arr_Options[ $l_str_Key ] = stripcslashes( $l_str_Value );

View file

@ -20,6 +20,41 @@ $g_arr_Footnotes = array();
*/ */
$g_arr_FootnotesSettings = array(); $g_arr_FootnotesSettings = array();
/**
* register all functions needed for the replacement in the wordpress core
* @since 1.0-gamma
*/
function footnotes_RegisterReplacementFunctions() {
/* access to the global settings collection */
global $g_arr_FootnotesSettings;
/* load footnote settings */
$g_arr_FootnotesSettings = footnotes_filter_options( FOOTNOTE_SETTINGS_CONTAINER, Class_FootnotesSettings::$a_arr_Default_Settings, false );
/* get setting for accepting footnotes in the excerpt and convert it to boolean */
$l_bool_SearchExcerpt = footnotes_ConvertToBool($g_arr_FootnotesSettings[ FOOTNOTE_INPUTFIELD_SEARCH_IN_EXCERPT ]);
/* calls the wordpress filter function to replace page content before displayed on public pages */
add_filter( 'the_content', 'footnotes_startReplacing' );
/* search in the excerpt only if activated */
if ($l_bool_SearchExcerpt) {
add_filter( 'the_excerpt', 'footnotes_DummyReplacing' );
}
/* calls the wordpress filter function to replace widget text before displayed on public pages */
add_filter( 'widget_title', 'footnotes_DummyReplacing' );
add_filter( 'widget_text', 'footnotes_DummyReplacing' );
/* calls the wordpress action to display the footer */
add_action( 'get_footer', 'footnotes_StopReplacing' );
/* get setting for love and share this plugin and convert it to boolean */
$l_bool_LoveMe = footnotes_ConvertToBool($g_arr_FootnotesSettings[ FOOTNOTE_INPUTFIELD_LOVE ]);
/* check if the admin allows to add a link to the footer */
if ($l_bool_LoveMe) {
/* calls the wordpress action to hook to the footer */
add_filter('wp_footer', 'footnotes_LoveAndShareMe', 0);
}
}
/** /**
* starts listening for footnotes to be replaced * starts listening for footnotes to be replaced
* output will be buffered and not displayed * output will be buffered and not displayed
@ -29,12 +64,8 @@ $g_arr_FootnotesSettings = array();
*/ */
function footnotes_startReplacing( $p_str_Content ) function footnotes_startReplacing( $p_str_Content )
{ {
/* access to the global settings collection */
global $g_arr_FootnotesSettings;
/* stop the output and move it to a buffer instead, defines a callback function */ /* stop the output and move it to a buffer instead, defines a callback function */
ob_start( "footnotes_replaceFootnotes" ); ob_start( "footnotes_replaceFootnotes" );
/* load footnote settings */
$g_arr_FootnotesSettings = footnotes_filter_options( FOOTNOTE_SETTINGS_CONTAINER, Class_FootnotesSettings::$a_arr_Default_Settings );
/* return unchanged content */ /* return unchanged content */
return $p_str_Content; return $p_str_Content;
} }
@ -62,26 +93,36 @@ function footnotes_StopReplacing()
ob_end_flush(); ob_end_flush();
} }
/**
* outputs a link to love and share this awesome plugin
* @since 1.0-gamma
*/
function footnotes_LoveAndShareMe()
{
echo '
<div style="text-align:center; color:#acacac;">'.
sprintf(__("Hey there, I'm using the awesome WordPress Plugin called %sfootnotes%s", FOOTNOTES_PLUGIN_NAME), '<a href="https://github.com/media-competence-institute/footnotes" target="_blank">', '</a>').
'</div>'
;
}
/** /**
* replaces all footnotes in the given content * replaces all footnotes in the given content
* loading settings if not happened yet since 1.0-gamma * loading settings if not happened yet since 1.0-gamma
* @since 1.0 * @since 1.0
* @param string $p_str_Content * @param string $p_str_Content
* @param bool $p_bool_OutputReferences [default: true] * @param bool $p_bool_OutputReferences [default: true]
* @param bool $p_bool_ReplaceHtmlChars [ default: false]
* @return string * @return string
*/ */
function footnotes_replaceFootnotes( $p_str_Content, $p_bool_OutputReferences = true ) function footnotes_replaceFootnotes( $p_str_Content, $p_bool_OutputReferences = true, $p_bool_ReplaceHtmlChars = false )
{ {
/* get access to the global array */ /* get access to the global array */
global $g_arr_Footnotes; global $g_arr_Footnotes;
/* access to the global settings collection */ /* access to the global settings collection */
global $g_arr_FootnotesSettings; global $g_arr_FootnotesSettings;
/* check if settings are already loaded, otherwise load them */ /* load footnote settings */
if (empty($g_arr_FootnotesSettings)) { $g_arr_FootnotesSettings = footnotes_filter_options( FOOTNOTE_SETTINGS_CONTAINER, Class_FootnotesSettings::$a_arr_Default_Settings, $p_bool_ReplaceHtmlChars );
/* load footnote settings */
$g_arr_FootnotesSettings = footnotes_filter_options( FOOTNOTE_SETTINGS_CONTAINER, Class_FootnotesSettings::$a_arr_Default_Settings );
}
/* replace all footnotes in the content */ /* replace all footnotes in the content */
$p_str_Content = footnotes_getFromString( $p_str_Content ); $p_str_Content = footnotes_getFromString( $p_str_Content );
@ -118,6 +159,8 @@ function footnotes_getFromString( $p_str_Content )
$l_str_StartingTag = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_PLACEHOLDER_START]; $l_str_StartingTag = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_PLACEHOLDER_START];
/*get footnote ending tag */ /*get footnote ending tag */
$l_str_EndingTag = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_PLACEHOLDER_END]; $l_str_EndingTag = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_PLACEHOLDER_END];
/*get footnote counter style */
$l_str_CounterStyle = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_COUNTER_STYLE];
/* check for a footnote placeholder in the current page */ /* check for a footnote placeholder in the current page */
do { do {
@ -134,7 +177,7 @@ function footnotes_getFromString( $p_str_Content )
/* get text inside footnote */ /* get text inside footnote */
$l_str_FootnoteText = substr( $p_str_Content, $l_int_PosStart + strlen( $l_str_StartingTag ), $l_int_Length - strlen( $l_str_StartingTag ) ); $l_str_FootnoteText = substr( $p_str_Content, $l_int_PosStart + strlen( $l_str_StartingTag ), $l_int_Length - strlen( $l_str_StartingTag ) );
/* set replacer for the footnote */ /* set replacer for the footnote */
$l_str_ReplaceText = str_replace( "[[FOOTNOTE INDEX]]", $l_int_FootnoteIndex, $l_str_FootnoteTemplate ); $l_str_ReplaceText = str_replace( "[[FOOTNOTE INDEX]]", footnote_convert_index($l_int_FootnoteIndex,$l_str_CounterStyle), $l_str_FootnoteTemplate );
$l_str_ReplaceText = str_replace( "[[FOOTNOTE TEXT]]", $l_str_FootnoteText, $l_str_ReplaceText ); $l_str_ReplaceText = str_replace( "[[FOOTNOTE TEXT]]", $l_str_FootnoteText, $l_str_ReplaceText );
/* replace footnote in content */ /* replace footnote in content */
$p_str_Content = substr_replace( $p_str_Content, $l_str_ReplaceText, $l_int_PosStart, $l_int_Length + strlen( $l_str_EndingTag ) ); $p_str_Content = substr_replace( $p_str_Content, $l_str_ReplaceText, $l_int_PosStart, $l_int_Length + strlen( $l_str_EndingTag ) );
@ -184,9 +227,11 @@ function footnotes_OutputReferenceContainer()
$l_str_ReferencesLabel = $g_arr_FootnotesSettings[ FOOTNOTE_INPUTFIELD_REFERENCES_LABEL ]; $l_str_ReferencesLabel = $g_arr_FootnotesSettings[ FOOTNOTE_INPUTFIELD_REFERENCES_LABEL ];
/* get setting for collapse reference footnotes and convert it to boolean */ /* get setting for collapse reference footnotes and convert it to boolean */
$l_bool_CollapseReference = footnotes_ConvertToBool($g_arr_FootnotesSettings[ FOOTNOTE_INPUTFIELD_COLLAPSE_REFERENCES ]); $l_bool_CollapseReference = footnotes_ConvertToBool($g_arr_FootnotesSettings[ FOOTNOTE_INPUTFIELD_COLLAPSE_REFERENCES ]);
/*get footnote counter style */
$l_str_CounterStyle = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_COUNTER_STYLE];
/* output string, prepare it with the reference label as headline */ /* output string, prepare it with the reference label as headline */
$l_str_Output = '<div class="footnote_container_prepare"><p><span onclick="footnote_expand_reference_container();">' . $l_str_ReferencesLabel . '</span></p></div>'; $l_str_Output = '<div class="footnote_container_prepare"><p><span onclick="footnote_expand_reference_container(\"\");">' . $l_str_ReferencesLabel . '</span></p></div>';
/* add a box around the footnotes */ /* add a box around the footnotes */
$l_str_Output .= '<div id="'.FOOTNOTE_REFERENCES_CONTAINER_ID.'"'; $l_str_Output .= '<div id="'.FOOTNOTE_REFERENCES_CONTAINER_ID.'"';
/* add class to hide the references by default, if the user wants it */ /* add class to hide the references by default, if the user wants it */
@ -208,7 +253,7 @@ function footnotes_OutputReferenceContainer()
} }
/* get footnote index */ /* get footnote index */
$l_str_FirstFootnoteIndex = ( $l_str_Index + 1 ); $l_str_FirstFootnoteIndex = ( $l_str_Index + 1 );
$l_str_FootnoteIndex = ( $l_str_Index + 1 ); $l_str_FootnoteIndex = footnote_convert_index(( $l_str_Index + 1 ),$l_str_CounterStyle);
/* check if it isn't the last footnote in the array */ /* check if it isn't the last footnote in the array */
if ( $l_str_FirstFootnoteIndex < count( $g_arr_Footnotes ) && $l_bool_CombineIdentical ) { if ( $l_str_FirstFootnoteIndex < count( $g_arr_Footnotes ) && $l_bool_CombineIdentical ) {
@ -219,7 +264,7 @@ function footnotes_OutputReferenceContainer()
/* set the further footnote as empty so it won't be displayed later */ /* set the further footnote as empty so it won't be displayed later */
$g_arr_Footnotes[ $l_str_CheckIndex ] = ""; $g_arr_Footnotes[ $l_str_CheckIndex ] = "";
/* add the footnote index to the actual index */ /* add the footnote index to the actual index */
$l_str_FootnoteIndex .= ", " . ( $l_str_CheckIndex + 1 ); $l_str_FootnoteIndex .= ", " . footnote_convert_index(( $l_str_CheckIndex + 1 ),$l_str_CounterStyle);
} }
} }
} }
@ -236,8 +281,11 @@ function footnotes_OutputReferenceContainer()
/* add a javascript to expand the reference container when clicking on a footnote or the reference label */ /* add a javascript to expand the reference container when clicking on a footnote or the reference label */
$l_str_Output .= ' $l_str_Output .= '
<script type="text/javascript"> <script type="text/javascript">
function footnote_expand_reference_container() { function footnote_expand_reference_container(p_str_ID) {
jQuery("#'.FOOTNOTE_REFERENCES_CONTAINER_ID.'").show(); jQuery("#'.FOOTNOTE_REFERENCES_CONTAINER_ID.'").show();
if (p_str_ID.length > 0) {
jQuery(p_str_ID).focus();
}
} }
</script> </script>
'; ';

View file

@ -1,11 +1,11 @@
<?php <?php
/* /*
Plugin Name: footnotes Plugin Name: footnotes
Plugin URI: http://www.herndler.org Plugin URI: https://github.com/media-competence-institute/footnotes
Description: simple adding footnotes to your pages Description: simple adding footnotes to your pages
Author: Mark Cheret, Stefan Herndler Author: Mark Cheret, Stefan Herndler
Version: 1.0.3 Version: 1.0.4
Author URI: http://www.cheret.de Author URI: https://github.com/media-competence-institute/footnotes
Text Domain: footnotes Text Domain: footnotes
Domain Path: /languages Domain Path: /languages
*/ */
@ -45,6 +45,8 @@ require_once( dirname( __FILE__ ) . "/includes/plugin-settings.php" );
/* include script and stylesheet functions */ /* include script and stylesheet functions */
require_once( dirname( __FILE__ ) . "/includes/scripts.php" ); require_once( dirname( __FILE__ ) . "/includes/scripts.php" );
/* include script and stylesheet functions */ /* include script and stylesheet functions */
require_once( dirname( __FILE__ ) . "/includes/convert.php" );
/* include script and stylesheet functions */
require_once( dirname( __FILE__ ) . "/includes/replacer.php" ); require_once( dirname( __FILE__ ) . "/includes/replacer.php" );
/* require plugin class */ /* require plugin class */
@ -52,16 +54,8 @@ require_once( dirname( __FILE__ ) . "/classes/footnotes.php" );
/* require plugin settings class */ /* require plugin settings class */
require_once( dirname( __FILE__ ) . "/classes/footnotes_settings.php" ); require_once( dirname( __FILE__ ) . "/classes/footnotes_settings.php" );
/* calls the wordpress filter function to replace page content before displayed on public pages */ /* register functions for the footnote replacement */
add_filter( 'the_content', 'footnotes_startReplacing' ); footnotes_RegisterReplacementFunctions();
add_filter( 'the_excerpt', 'footnotes_DummyReplacing' );
/* calls the wordpress filter function to replace widget text before displayed on public pages */
add_filter( 'widget_title', 'footnotes_DummyReplacing' );
add_filter( 'widget_text', 'footnotes_DummyReplacing' );
/* calls the wordpress action to display the footer */
add_action( 'get_footer', 'footnotes_StopReplacing' );
/* adds javascript and stylesheets to the public page */ /* adds javascript and stylesheets to the public page */
add_action( 'wp_enqueue_scripts', 'footnotes_add_public_stylesheet' ); add_action( 'wp_enqueue_scripts', 'footnotes_add_public_stylesheet' );

Binary file not shown.

View file

@ -1,8 +1,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: footnotes\n" "Project-Id-Version: footnotes\n"
"POT-Creation-Date: 2014-05-16 22:36+0100\n" "POT-Creation-Date: 2014-05-17 01:03+0100\n"
"PO-Revision-Date: 2014-05-16 22:37+0100\n" "PO-Revision-Date: 2014-05-17 01:03+0100\n"
"Last-Translator: SHE <s.herndler@methis.at>\n" "Last-Translator: SHE <s.herndler@methis.at>\n"
"Language-Team: SHE <s.herndler@methis.at>\n" "Language-Team: SHE <s.herndler@methis.at>\n"
"Language: de\n" "Language: de\n"
@ -18,75 +18,115 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-SearchPath-0: .\n" "X-Poedit-SearchPath-0: .\n"
#: classes/footnotes_settings.php:308 #: classes/footnotes_settings.php:311
msgid "General" msgid "General"
msgstr "Allgemein" msgstr "Allgemein"
#: classes/footnotes_settings.php:310 includes/plugin-settings.php:22 #: classes/footnotes_settings.php:313 includes/plugin-settings.php:22
msgid "Settings" msgid "Settings"
msgstr "Einstellungen" msgstr "Einstellungen"
#: classes/footnotes_settings.php:311 #: classes/footnotes_settings.php:314
msgid "References label:" msgid "References label:"
msgstr "Überschrift \"Einzelnachweis\":" msgstr "Überschrift \"Einzelnachweis\":"
#: classes/footnotes_settings.php:312 #: classes/footnotes_settings.php:315
msgid "Collapse references by default:" msgid "Collapse references by default:"
msgstr "Verstecke Einzelnachweise standardmäßig:" msgstr "Verstecke Einzelnachweise standardmäßig:"
#: classes/footnotes_settings.php:313 #: classes/footnotes_settings.php:316
msgid "Combine identical footnotes:" msgid "Combine identical footnotes:"
msgstr "Kombiniere meine Fußnoten:" msgstr "Kombiniere meine Fußnoten:"
#: classes/footnotes_settings.php:314 #: classes/footnotes_settings.php:317
msgid "Footnote tag:" msgid "Footnote tag:"
msgstr "Fußzeile einbinden:" msgstr "Fußzeile einbinden:"
#: classes/footnotes_settings.php:355 #: classes/footnotes_settings.php:318
msgid "Counter style:"
msgstr "Fußnoten Zähler:"
#: classes/footnotes_settings.php:319
msgid "Allow footnotes on Summarized Posts:"
msgstr "Erlaube Fußnoten in Zusammenfassungen:"
#: classes/footnotes_settings.php:320
#, php-format
msgid "Tell the world you're using %sfootnotes%s:"
msgstr "Teil der Community mit dass Ich %sfootnotes%s verwende:"
#: classes/footnotes_settings.php:361 classes/footnotes_settings.php:409
#: classes/footnotes_settings.php:424
msgid "Yes" msgid "Yes"
msgstr "Ja" msgstr "Ja"
#: classes/footnotes_settings.php:356 #: classes/footnotes_settings.php:362 classes/footnotes_settings.php:410
#: classes/footnotes_settings.php:425
msgid "No" msgid "No"
msgstr "Nein" msgstr "Nein"
#: classes/footnotes_settings.php:369 #: classes/footnotes_settings.php:375
msgid "starts with:" msgid "starts with:"
msgstr "beginnt mit:" msgstr "beginnt mit:"
#: classes/footnotes_settings.php:373 #: classes/footnotes_settings.php:379
msgid "ends with:" msgid "ends with:"
msgstr "endet mit:" msgstr "endet mit:"
#: classes/footnotes_settings.php:385 classes/footnotes_settings.php:387 #: classes/footnotes_settings.php:391
msgid "Arabic Numbers - Plain"
msgstr "arabische Ziffern"
#: classes/footnotes_settings.php:392
msgid "Arabic Numbers - Leading 0"
msgstr "arabisch Ziffern - führende Null"
#: classes/footnotes_settings.php:393
msgid "Latin Character - lower case"
msgstr "alphabetisch - Kleinschreibung"
#: classes/footnotes_settings.php:394
msgid "Latin Character - upper case"
msgstr "alphabetisch - Großschreibung"
#: classes/footnotes_settings.php:395
msgid "Roman Numerals"
msgstr "Römische Ziffern"
#: classes/footnotes_settings.php:440 classes/footnotes_settings.php:442
msgid "HowTo" msgid "HowTo"
msgstr "Hilfe" msgstr "Hilfe"
#: classes/footnotes_settings.php:398 #: classes/footnotes_settings.php:453
msgid "This is a brief introduction in how to use the plugin." msgid "This is a brief introduction in how to use the plugin."
msgstr "Eine kurze Anleitung für die Verwendung des Plugins." msgstr "Eine kurze Anleitung für die Verwendung des Plugins."
#: classes/footnotes_settings.php:413 #: classes/footnotes_settings.php:468
msgid "Start your footnote with the following shortcode:" msgid "Start your footnote with the following shortcode:"
msgstr "Starten Sie eine Fußnote mit:" msgstr "Starten Sie eine Fußnote mit:"
#: classes/footnotes_settings.php:418 #: classes/footnotes_settings.php:473
msgid "...and end your footnote with this shortcode:" msgid "...and end your footnote with this shortcode:"
msgstr "...und beenden Sie diese mit:" msgstr "...und beenden Sie diese mit:"
#: classes/footnotes_settings.php:424 classes/footnotes_settings.php:427 #: classes/footnotes_settings.php:479 classes/footnotes_settings.php:482
msgid "example string" msgid "example string"
msgstr "Beispieltext" msgstr "Beispieltext"
#: classes/footnotes_settings.php:425 #: classes/footnotes_settings.php:480
msgid "will be displayed as:" msgid "will be displayed as:"
msgstr "wird dargestellt als:" msgstr "wird dargestellt als:"
#: classes/footnotes_settings.php:432 #: classes/footnotes_settings.php:487
#, php-format #, php-format
msgid "If you have any questions, please don't hesitate to %smail us%s." msgid "If you have any questions, please don't hesitate to %smail us%s."
msgstr "Bei Fragen können Sie uns gerne eine %se-Mail%s senden." msgstr "Bei Fragen können Sie uns gerne eine %se-Mail%s senden."
#: includes/replacer.php:104
#, php-format
msgid "Hey there, I'm using the awesome WordPress Plugin called %sfootnotes%s"
msgstr "Hey Community, ich verwende nun das WordPress Plugin %sfootnotes%s"
#: includes/uninstall.php:20 #: includes/uninstall.php:20
msgid "You must be logged in to run this script." msgid "You must be logged in to run this script."
msgstr "Sie müssen angemeldet sein um diese Funktion ausführen zu können." msgstr "Sie müssen angemeldet sein um diese Funktion ausführen zu können."

Binary file not shown.

View file

@ -1,8 +1,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: footnotes\n" "Project-Id-Version: footnotes\n"
"POT-Creation-Date: 2014-05-16 22:36+0100\n" "POT-Creation-Date: 2014-05-17 01:01+0100\n"
"PO-Revision-Date: 2014-05-16 22:36+0100\n" "PO-Revision-Date: 2014-05-17 01:01+0100\n"
"Last-Translator: SHE <s.herndler@methis.at>\n" "Last-Translator: SHE <s.herndler@methis.at>\n"
"Language-Team: SHE <s.herndler@methis.at>\n" "Language-Team: SHE <s.herndler@methis.at>\n"
"Language: en\n" "Language: en\n"
@ -18,75 +18,115 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-SearchPath-0: .\n" "X-Poedit-SearchPath-0: .\n"
#: classes/footnotes_settings.php:308 #: classes/footnotes_settings.php:311
msgid "General" msgid "General"
msgstr "General" msgstr "General"
#: classes/footnotes_settings.php:310 includes/plugin-settings.php:22 #: classes/footnotes_settings.php:313 includes/plugin-settings.php:22
msgid "Settings" msgid "Settings"
msgstr "Settings" msgstr "Settings"
#: classes/footnotes_settings.php:311 #: classes/footnotes_settings.php:314
msgid "References label:" msgid "References label:"
msgstr "References label:" msgstr "References label:"
#: classes/footnotes_settings.php:312 #: classes/footnotes_settings.php:315
msgid "Collapse references by default:" msgid "Collapse references by default:"
msgstr "Collapse references by default:" msgstr "Collapse references by default:"
#: classes/footnotes_settings.php:313 #: classes/footnotes_settings.php:316
msgid "Combine identical footnotes:" msgid "Combine identical footnotes:"
msgstr "Combine identical footnotes:" msgstr "Combine identical footnotes:"
#: classes/footnotes_settings.php:314 #: classes/footnotes_settings.php:317
msgid "Footnote tag:" msgid "Footnote tag:"
msgstr "Footnote tag:" msgstr "Footnote tag:"
#: classes/footnotes_settings.php:355 #: classes/footnotes_settings.php:318
msgid "Counter style:"
msgstr "Counter style:"
#: classes/footnotes_settings.php:319
msgid "Allow footnotes on Summarized Posts:"
msgstr "Allow footnotes on Summarized Posts:"
#: classes/footnotes_settings.php:320
#, php-format
msgid "Tell the world you're using %sfootnotes%s:"
msgstr "Tell the world you're using %sfootnotes%s:"
#: classes/footnotes_settings.php:361 classes/footnotes_settings.php:409
#: classes/footnotes_settings.php:424
msgid "Yes" msgid "Yes"
msgstr "Yes" msgstr "Yes"
#: classes/footnotes_settings.php:356 #: classes/footnotes_settings.php:362 classes/footnotes_settings.php:410
#: classes/footnotes_settings.php:425
msgid "No" msgid "No"
msgstr "No" msgstr "No"
#: classes/footnotes_settings.php:369 #: classes/footnotes_settings.php:375
msgid "starts with:" msgid "starts with:"
msgstr "starts with:" msgstr "starts with:"
#: classes/footnotes_settings.php:373 #: classes/footnotes_settings.php:379
msgid "ends with:" msgid "ends with:"
msgstr "ends with:" msgstr "ends with:"
#: classes/footnotes_settings.php:385 classes/footnotes_settings.php:387 #: classes/footnotes_settings.php:391
msgid "Arabic Numbers - Plain"
msgstr "Arabic Numbers - Plain"
#: classes/footnotes_settings.php:392
msgid "Arabic Numbers - Leading 0"
msgstr "Arabic Numbers - Leading 0"
#: classes/footnotes_settings.php:393
msgid "Latin Character - lower case"
msgstr "Latin Character - lower case"
#: classes/footnotes_settings.php:394
msgid "Latin Character - upper case"
msgstr "Latin Character - upper case"
#: classes/footnotes_settings.php:395
msgid "Roman Numerals"
msgstr "Roman Numerals"
#: classes/footnotes_settings.php:440 classes/footnotes_settings.php:442
msgid "HowTo" msgid "HowTo"
msgstr "HowTo" msgstr "HowTo"
#: classes/footnotes_settings.php:398 #: classes/footnotes_settings.php:453
msgid "This is a brief introduction in how to use the plugin." msgid "This is a brief introduction in how to use the plugin."
msgstr "This is a brief introduction in how to use the plugin." msgstr "This is a brief introduction in how to use the plugin."
#: classes/footnotes_settings.php:413 #: classes/footnotes_settings.php:468
msgid "Start your footnote with the following shortcode:" msgid "Start your footnote with the following shortcode:"
msgstr "Start your footnote with the following shortcode:" msgstr "Start your footnote with the following shortcode:"
#: classes/footnotes_settings.php:418 #: classes/footnotes_settings.php:473
msgid "...and end your footnote with this shortcode:" msgid "...and end your footnote with this shortcode:"
msgstr "...and end your footnote with this shortcode:" msgstr "...and end your footnote with this shortcode:"
#: classes/footnotes_settings.php:424 classes/footnotes_settings.php:427 #: classes/footnotes_settings.php:479 classes/footnotes_settings.php:482
msgid "example string" msgid "example string"
msgstr "example string" msgstr "example string"
#: classes/footnotes_settings.php:425 #: classes/footnotes_settings.php:480
msgid "will be displayed as:" msgid "will be displayed as:"
msgstr "will be displayed as:" msgstr "will be displayed as:"
#: classes/footnotes_settings.php:432 #: classes/footnotes_settings.php:487
#, php-format #, php-format
msgid "If you have any questions, please don't hesitate to %smail us%s." msgid "If you have any questions, please don't hesitate to %smail us%s."
msgstr "If you have any questions, please don't hesitate to %smail us%s." msgstr "If you have any questions, please don't hesitate to %smail us%s."
#: includes/replacer.php:104
#, php-format
msgid "Hey there, I'm using the awesome WordPress Plugin called %sfootnotes%s"
msgstr "Hey there, I'm using the awesome WordPress Plugin called %sfootnotes%s"
#: includes/uninstall.php:20 #: includes/uninstall.php:20
msgid "You must be logged in to run this script." msgid "You must be logged in to run this script."
msgstr "You must be logged in to run this script." msgstr "You must be logged in to run this script."

View file

@ -5,7 +5,7 @@ Requires at least: 3.9
Tested up to: 3.9.1 Tested up to: 3.9.1
License: GPLv3 or later License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html License URI: http://www.gnu.org/licenses/gpl-3.0.html
Stable Tag: 1.0.3 Stable Tag: 1.0.4
== Description == == Description ==
@ -35,6 +35,22 @@ coming soon
== Changelog == == Changelog ==
= 1.0.4 =
* Updated 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
* New setting to allow footnotes on Summarized Posts
* New setting to tell the world you're using footnotes plugin
* New 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
* Updated translations for the new settings
* re-changed the version number to have 3 digits
= 1.0.3 = = 1.0.3 =
* New setting to use personal starting and ending tag for the footnotes * New setting to use personal starting and ending tag for the footnotes
* Updated translations for the new setting * Updated translations for the new setting

View file

@ -3,7 +3,7 @@
[[FOOTNOTE INDEX]]. [[FOOTNOTE INDEX]].
</div> </div>
<div class="footnote_plugin_text"> <div class="footnote_plugin_text">
<a class="footnote_plugin_link" href="#footnote_plugin_tooltip_[[FOOTNOTE INDEX SHORT]]" name="footnote_plugin_reference_[[FOOTNOTE INDEX SHORT]]"> <a class="footnote_plugin_link" href="#footnote_plugin_tooltip_[[FOOTNOTE INDEX SHORT]]" name="footnote_plugin_reference_[[FOOTNOTE INDEX SHORT]]" id="footnote_plugin_reference_[[FOOTNOTE INDEX SHORT]]">
&#8593; &#8593;
</a> </a>
&nbsp; &nbsp;

View file

@ -1,8 +1,6 @@
<sup> <sup class="footnote_plugin_tooltip" name="footnote_plugin_tooltip_[[FOOTNOTE INDEX]]" onclick="footnote_expand_reference_container('#footnote_plugin_reference_[[FOOTNOTE INDEX]]');">
<a href="#footnote_plugin_reference_[[FOOTNOTE INDEX]]" class="footnote_plugin_tooltip" name="footnote_plugin_tooltip_[[FOOTNOTE INDEX]]" onclick="footnote_expand_reference_container();"> [[FOOTNOTE INDEX]])
[[FOOTNOTE INDEX]]) <span>
<span> [[FOOTNOTE TEXT]]
[[FOOTNOTE TEXT]] </span>
</span>
</a>
</sup> </sup>