Version 1.0.3
* New setting to use personal starting and ending tag for the footnotes * Updated translations for the new setting * Updated reading settings and fallback to default values (bugfix) git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@917813 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
parent
ab368ba787
commit
5d475abfc3
11 changed files with 144 additions and 63 deletions
|
@ -1,5 +1,4 @@
|
||||||
footnotes
|
![footnotes](https://raw.githubusercontent.com/media-competence-institute/footnotes/master/assets/footnotes.png)
|
||||||
=========
|
|
||||||
|
|
||||||
**footnotes** WordPress Plugin
|
**footnotes** WordPress Plugin
|
||||||
|
|
||||||
|
@ -7,6 +6,7 @@ footnotes
|
||||||
|
|
||||||
**footnotes** gives you the ability to display decently-formated footnotes on your WordPress Pages or Posts.
|
**footnotes** gives you the ability to display decently-formated footnotes on your WordPress Pages or Posts.
|
||||||
|
|
||||||
|
|
||||||
The syntax is based on the common DokuWiki syntax for footnotes. So, to include a footnote with the text "with a footnote," you use:
|
The syntax is based on the common DokuWiki syntax for footnotes. So, to include a footnote with the text "with a footnote," you use:
|
||||||
|
|
||||||
Your awesome text((with a footnote))
|
Your awesome text((with a footnote))
|
||||||
|
|
|
@ -21,7 +21,9 @@ class Class_FootnotesSettings
|
||||||
public static $a_arr_Default_Settings = array(
|
public static $a_arr_Default_Settings = array(
|
||||||
FOOTNOTE_INPUTFIELD_COMBINE_IDENTICAL => 'yes',
|
FOOTNOTE_INPUTFIELD_COMBINE_IDENTICAL => 'yes',
|
||||||
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_END => '))'
|
||||||
);
|
);
|
||||||
/*
|
/*
|
||||||
* resulting pagehook for adding a new sub menu page to the settings
|
* resulting pagehook for adding a new sub menu page to the settings
|
||||||
|
@ -45,10 +47,8 @@ class Class_FootnotesSettings
|
||||||
*/
|
*/
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
/* validates the settings of the plugin and replaces them with the default settings if invalid */
|
|
||||||
add_option( FOOTNOTE_SETTINGS_CONTAINER, self::$a_arr_Default_Settings );
|
|
||||||
/* 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 );
|
$this->a_arr_Options = footnotes_filter_options( FOOTNOTE_SETTINGS_CONTAINER, self::$a_arr_Default_Settings );
|
||||||
|
|
||||||
/* 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' ) );
|
||||||
|
@ -208,9 +208,11 @@ class Class_FootnotesSettings
|
||||||
* outputs a input type=text
|
* outputs a input type=text
|
||||||
* @param string $p_str_SettingsID [id of the settings field]
|
* @param string $p_str_SettingsID [id of the settings field]
|
||||||
* @param string $p_str_ClassName [css class name]
|
* @param string $p_str_ClassName [css class name]
|
||||||
|
* @param int $p_str_MaxLength [max length for the input value]
|
||||||
|
* @param string $p_str_Label [label text]
|
||||||
* @since 1.0-beta
|
* @since 1.0-beta
|
||||||
*/
|
*/
|
||||||
function AddTextbox($p_str_SettingsID, $p_str_ClassName="")
|
function AddTextbox($p_str_SettingsID, $p_str_ClassName="", $p_str_MaxLength=0, $p_str_Label="")
|
||||||
{
|
{
|
||||||
/* collect data for given settings field */
|
/* collect data for given settings field */
|
||||||
$l_arr_Data = $this->LoadSetting( $p_str_SettingsID );
|
$l_arr_Data = $this->LoadSetting( $p_str_SettingsID );
|
||||||
|
@ -219,9 +221,17 @@ class Class_FootnotesSettings
|
||||||
if (!empty($p_str_ClassName)) {
|
if (!empty($p_str_ClassName)) {
|
||||||
$p_str_ClassName = 'class="' . $p_str_ClassName . '"';
|
$p_str_ClassName = 'class="' . $p_str_ClassName . '"';
|
||||||
}
|
}
|
||||||
|
/* optional add a maxlength to the input field */
|
||||||
|
if (!empty($p_str_MaxLength)) {
|
||||||
|
$p_str_MaxLength = ' maxlength="'.$p_str_MaxLength.'"';
|
||||||
|
}
|
||||||
|
/* optional add a label in front of the input field */
|
||||||
|
if (!empty($p_str_Label)) {
|
||||||
|
echo '<label for="'.$l_arr_Data[ "id" ].'">'.$p_str_Label.'</label>';
|
||||||
|
}
|
||||||
|
|
||||||
/* outputs an input field type TEXT */
|
/* outputs an input field type TEXT */
|
||||||
echo '<input type="text" '.$p_str_ClassName.' name="'.$l_arr_Data[ "name" ].'" id="'.$l_arr_Data[ "id" ].'" value="'.$l_arr_Data[ "value" ].'"/>';
|
echo '<input type="text" '.$p_str_ClassName.$p_str_MaxLength.' name="'.$l_arr_Data[ "name" ].'" id="'.$l_arr_Data[ "id" ].'" value="'.$l_arr_Data[ "value" ].'"/>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -301,6 +311,7 @@ class Class_FootnotesSettings
|
||||||
add_settings_field( 'Register_References_Label', __( "References label:", FOOTNOTES_PLUGIN_NAME ), array( $this, 'Register_References_Label' ), FOOTNOTE_SETTINGS_LABEL_GENERAL, $l_str_SectionName );
|
add_settings_field( 'Register_References_Label', __( "References label:", FOOTNOTES_PLUGIN_NAME ), array( $this, 'Register_References_Label' ), 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_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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -348,6 +359,20 @@ class Class_FootnotesSettings
|
||||||
$this->AddSelectbox(FOOTNOTE_INPUTFIELD_COMBINE_IDENTICAL, $l_arr_Options, "footnote_plugin_25");
|
$this->AddSelectbox(FOOTNOTE_INPUTFIELD_COMBINE_IDENTICAL, $l_arr_Options, "footnote_plugin_25");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* outputs the settings fields for the footnote starting and ending tag
|
||||||
|
* @since 1.0-gamma
|
||||||
|
*/
|
||||||
|
function Register_Placeholder_Tags()
|
||||||
|
{
|
||||||
|
/* add a textbox to the output */
|
||||||
|
$this->AddTextbox(FOOTNOTE_INPUTFIELD_PLACEHOLDER_START, "", 14, __( "starts with:", FOOTNOTES_PLUGIN_NAME ));
|
||||||
|
/* small space between the two input fields */
|
||||||
|
echo ' ';
|
||||||
|
/* add a textbox to the output */
|
||||||
|
$this->AddTextbox(FOOTNOTE_INPUTFIELD_PLACEHOLDER_END, "", 14, __( "ends with:", FOOTNOTES_PLUGIN_NAME ));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* initialize howto settings tab
|
* initialize howto settings tab
|
||||||
* called in class constructor @ admin_init
|
* called in class constructor @ admin_init
|
||||||
|
@ -379,25 +404,27 @@ class Class_FootnotesSettings
|
||||||
*/
|
*/
|
||||||
function Register_Howto_Box()
|
function Register_Howto_Box()
|
||||||
{
|
{
|
||||||
|
$l_arr_Footnote_StartingTag = $this->LoadSetting(FOOTNOTE_INPUTFIELD_PLACEHOLDER_START);
|
||||||
|
$l_arr_Footnote_EndingTag = $this->LoadSetting(FOOTNOTE_INPUTFIELD_PLACEHOLDER_END);
|
||||||
?>
|
?>
|
||||||
<div style="text-align:center;">
|
<div style="text-align:center;">
|
||||||
<div class="footnote_placeholder_box_container">
|
<div class="footnote_placeholder_box_container">
|
||||||
<p>
|
<p>
|
||||||
<?php echo __( "Start your footnote with the following shortcode:", FOOTNOTES_PLUGIN_NAME ); ?>
|
<?php echo __( "Start your footnote with the following shortcode:", FOOTNOTES_PLUGIN_NAME ); ?>
|
||||||
<span class="footnote_highlight_placeholder"><?php echo FOOTNOTE_PLACEHOLDER_START; ?></span>
|
<span class="footnote_highlight_placeholder"><?php echo $l_arr_Footnote_StartingTag["value"]; ?></span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<?php echo __( "...and end your footnote with this shortcode:", FOOTNOTES_PLUGIN_NAME ); ?>
|
<?php echo __( "...and end your footnote with this shortcode:", FOOTNOTES_PLUGIN_NAME ); ?>
|
||||||
<span class="footnote_highlight_placeholder"><?php echo FOOTNOTE_PLACEHOLDER_END; ?></span>
|
<span class="footnote_highlight_placeholder"><?php echo $l_arr_Footnote_EndingTag["value"]; ?></span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="footnote_placeholder_box_example">
|
<div class="footnote_placeholder_box_example">
|
||||||
<p>
|
<p>
|
||||||
<span class="footnote_highlight_placeholder"><?php echo FOOTNOTE_PLACEHOLDER_START . __( "example string", FOOTNOTES_PLUGIN_NAME ) . FOOTNOTE_PLACEHOLDER_END; ?></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 ); ?>
|
||||||
|
|
||||||
<?php echo footnotes_replaceFootnotes( FOOTNOTE_PLACEHOLDER_START . __( "example string", FOOTNOTES_PLUGIN_NAME ) . FOOTNOTE_PLACEHOLDER_END, true ); ?>
|
<?php echo footnotes_replaceFootnotes( $l_arr_Footnote_StartingTag["value"] . __( "example string", FOOTNOTES_PLUGIN_NAME ) . $l_arr_Footnote_EndingTag["value"], true ); ?>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,8 @@ define( "FOOTNOTE_SETTINGS_LABEL_HOWTO", "footnotes_howto" ); /* internal label
|
||||||
define( "FOOTNOTE_INPUTFIELD_COMBINE_IDENTICAL", "footnote_inputfield_combine_identical" ); /* id of input field for the combine identical setting */
|
define( "FOOTNOTE_INPUTFIELD_COMBINE_IDENTICAL", "footnote_inputfield_combine_identical" ); /* id of input field for the combine identical setting */
|
||||||
define( "FOOTNOTE_INPUTFIELD_REFERENCES_LABEL", "footnote_inputfield_references_label" ); /* id of input field for the references label setting */
|
define( "FOOTNOTE_INPUTFIELD_REFERENCES_LABEL", "footnote_inputfield_references_label" ); /* id of input field for the references label setting */
|
||||||
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 */
|
||||||
/* PLUGIN DEFAULT PLACEHOLDER */
|
define( "FOOTNOTE_INPUTFIELD_PLACEHOLDER_END", "footnote_inputfield_placeholder_end"); /* id of input field for the "placeholder ending tag" setting */
|
||||||
define( "FOOTNOTE_PLACEHOLDER_START", "((" ); /* defines the default start tag for the placeholder */
|
|
||||||
define( "FOOTNOTE_PLACEHOLDER_END", "))" ); /* defines the default end tag for the placeholder */
|
|
||||||
|
|
||||||
/* 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 */
|
||||||
|
|
|
@ -29,16 +29,28 @@ function footnotes_plugin_settings_link( $links, $file )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* reads a option field, filters the values and returns the filtered option array
|
* reads a option field, filters the values and returns the filtered option array
|
||||||
|
* fallback to default value since 1.0-gamma
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
* @param string $p_str_OptionsField
|
* @param string $p_str_OptionsField
|
||||||
|
* @param array $p_arr_DefaultValues
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function footnotes_filter_options( $p_str_OptionsField )
|
function footnotes_filter_options( $p_str_OptionsField, $p_arr_DefaultValues )
|
||||||
{
|
{
|
||||||
$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 ) {
|
||||||
$l_arr_Options[ $l_str_Key ] = stripcslashes( $l_str_Value );
|
/* removes special chars from the settings value */
|
||||||
|
$l_str_Value = stripcslashes( $l_str_Value );
|
||||||
|
/* 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)) {
|
||||||
|
$l_arr_Options[ $l_str_Key ] = stripcslashes( $l_str_Value );
|
||||||
|
/* check if default value is defined */
|
||||||
|
} else if (array_key_exists($l_str_Key, $p_arr_DefaultValues)) {
|
||||||
|
$l_arr_Options[ $l_str_Key ] = $p_arr_DefaultValues[$l_str_Key];
|
||||||
|
} else {
|
||||||
|
$l_arr_Options[ $l_str_Key ] = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* returns the filtered array */
|
/* returns the filtered array */
|
||||||
return $l_arr_Options;
|
return $l_arr_Options;
|
||||||
|
|
|
@ -34,7 +34,7 @@ function footnotes_startReplacing( $p_str_Content )
|
||||||
/* 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 */
|
/* load footnote settings */
|
||||||
$g_arr_FootnotesSettings = footnotes_filter_options( FOOTNOTE_SETTINGS_CONTAINER );
|
$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;
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,7 @@ function footnotes_StopReplacing()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* replaces all footnotes in the given content
|
* replaces all footnotes in the given content
|
||||||
|
* 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]
|
||||||
|
@ -73,6 +74,13 @@ function footnotes_replaceFootnotes( $p_str_Content, $p_bool_OutputReferences =
|
||||||
{
|
{
|
||||||
/* 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 */
|
||||||
|
global $g_arr_FootnotesSettings;
|
||||||
|
/* check if settings are already loaded, otherwise load them */
|
||||||
|
if (empty($g_arr_FootnotesSettings)) {
|
||||||
|
/* 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 );
|
||||||
|
@ -89,6 +97,7 @@ function footnotes_replaceFootnotes( $p_str_Content, $p_bool_OutputReferences =
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* replace all footnotes in the given string and adds them to an array
|
* replace all footnotes in the given string and adds them to an array
|
||||||
|
* using a personal starting and ending tag for the footnotes since 1.0-gamma
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
* @param string $p_str_Content
|
* @param string $p_str_Content
|
||||||
* @return string
|
* @return string
|
||||||
|
@ -97,32 +106,38 @@ function footnotes_getFromString( $p_str_Content )
|
||||||
{
|
{
|
||||||
/* get access to the global array to store footnotes */
|
/* get access to the global array to store footnotes */
|
||||||
global $g_arr_Footnotes;
|
global $g_arr_Footnotes;
|
||||||
|
/* access to the global settings collection */
|
||||||
|
global $g_arr_FootnotesSettings;
|
||||||
/* contains the index for the next footnote on this page */
|
/* contains the index for the next footnote on this page */
|
||||||
$l_int_FootnoteIndex = 1;
|
$l_int_FootnoteIndex = 1;
|
||||||
/* contains the starting position for the lookup of a footnote */
|
/* contains the starting position for the lookup of a footnote */
|
||||||
$l_int_PosStart = 0;
|
$l_int_PosStart = 0;
|
||||||
/* contains the footnote template */
|
/* contains the footnote template */
|
||||||
$l_str_FootnoteTemplate = file_get_contents( FOOTNOTES_TEMPLATES_DIR . "footnote.html" );
|
$l_str_FootnoteTemplate = file_get_contents( FOOTNOTES_TEMPLATES_DIR . "footnote.html" );
|
||||||
|
/* get footnote starting tag */
|
||||||
|
$l_str_StartingTag = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_PLACEHOLDER_START];
|
||||||
|
/*get footnote ending tag */
|
||||||
|
$l_str_EndingTag = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_PLACEHOLDER_END];
|
||||||
|
|
||||||
/* check for a footnote placeholder in the current page */
|
/* check for a footnote placeholder in the current page */
|
||||||
do {
|
do {
|
||||||
/* get first occurence of a footnote starting tag */
|
/* get first occurence of a footnote starting tag */
|
||||||
$l_int_PosStart = strpos( $p_str_Content, FOOTNOTE_PLACEHOLDER_START, $l_int_PosStart );
|
$l_int_PosStart = strpos( $p_str_Content, $l_str_StartingTag, $l_int_PosStart );
|
||||||
/* tag found */
|
/* tag found */
|
||||||
if ( $l_int_PosStart !== false ) {
|
if ( $l_int_PosStart !== false ) {
|
||||||
/* get first occurence of a footnote ending tag after the starting tag */
|
/* get first occurence of a footnote ending tag after the starting tag */
|
||||||
$l_int_PosEnd = strpos( $p_str_Content, FOOTNOTE_PLACEHOLDER_END, $l_int_PosStart );
|
$l_int_PosEnd = strpos( $p_str_Content, $l_str_EndingTag, $l_int_PosStart );
|
||||||
/* tag found */
|
/* tag found */
|
||||||
if ( $l_int_PosEnd !== false ) {
|
if ( $l_int_PosEnd !== false ) {
|
||||||
/* get length of footnote text */
|
/* get length of footnote text */
|
||||||
$l_int_Length = $l_int_PosEnd - $l_int_PosStart;
|
$l_int_Length = $l_int_PosEnd - $l_int_PosStart;
|
||||||
/* get text inside footnote */
|
/* get text inside footnote */
|
||||||
$l_str_FootnoteText = substr( $p_str_Content, $l_int_PosStart + strlen( FOOTNOTE_PLACEHOLDER_START ), $l_int_Length - strlen( FOOTNOTE_PLACEHOLDER_START ) );
|
$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]]", $l_int_FootnoteIndex, $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( FOOTNOTE_PLACEHOLDER_END ) );
|
$p_str_Content = substr_replace( $p_str_Content, $l_str_ReplaceText, $l_int_PosStart, $l_int_Length + strlen( $l_str_EndingTag ) );
|
||||||
/* set footnote to the output box at the end */
|
/* set footnote to the output box at the end */
|
||||||
$g_arr_Footnotes[ ] = $l_str_FootnoteText;
|
$g_arr_Footnotes[ ] = $l_str_FootnoteText;
|
||||||
/* increase footnote index */
|
/* increase footnote index */
|
||||||
|
|
12
index.php
12
index.php
|
@ -4,7 +4,7 @@
|
||||||
Plugin URI: http://www.herndler.org
|
Plugin URI: http://www.herndler.org
|
||||||
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.2
|
Version: 1.0.3
|
||||||
Author URI: http://www.cheret.de
|
Author URI: http://www.cheret.de
|
||||||
Text Domain: footnotes
|
Text Domain: footnotes
|
||||||
Domain Path: /languages
|
Domain Path: /languages
|
||||||
|
@ -47,6 +47,11 @@ require_once( dirname( __FILE__ ) . "/includes/scripts.php" );
|
||||||
/* include script and stylesheet functions */
|
/* include script and stylesheet functions */
|
||||||
require_once( dirname( __FILE__ ) . "/includes/replacer.php" );
|
require_once( dirname( __FILE__ ) . "/includes/replacer.php" );
|
||||||
|
|
||||||
|
/* require plugin class */
|
||||||
|
require_once( dirname( __FILE__ ) . "/classes/footnotes.php" );
|
||||||
|
/* require plugin settings class */
|
||||||
|
require_once( dirname( __FILE__ ) . "/classes/footnotes_settings.php" );
|
||||||
|
|
||||||
/* calls the wordpress filter function to replace page content before displayed on public pages */
|
/* calls the wordpress filter function to replace page content before displayed on public pages */
|
||||||
add_filter( 'the_content', 'footnotes_startReplacing' );
|
add_filter( 'the_content', 'footnotes_startReplacing' );
|
||||||
add_filter( 'the_excerpt', 'footnotes_DummyReplacing' );
|
add_filter( 'the_excerpt', 'footnotes_DummyReplacing' );
|
||||||
|
@ -68,11 +73,6 @@ if ( !function_exists( 'is_admin' ) ) {
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* require plugin class */
|
|
||||||
require_once( dirname( __FILE__ ) . "/classes/footnotes.php" );
|
|
||||||
/* require plugin settings class */
|
|
||||||
require_once( dirname( __FILE__ ) . "/classes/footnotes_settings.php" );
|
|
||||||
|
|
||||||
/* action to locate language and load the wordpress-specific language file */
|
/* action to locate language and load the wordpress-specific language file */
|
||||||
add_action( 'plugins_loaded', 'footnotes_load_language' );
|
add_action( 'plugins_loaded', 'footnotes_load_language' );
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -1,8 +1,8 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: footnotes\n"
|
"Project-Id-Version: footnotes\n"
|
||||||
"POT-Creation-Date: 2014-05-16 21:52+0100\n"
|
"POT-Creation-Date: 2014-05-16 22:36+0100\n"
|
||||||
"PO-Revision-Date: 2014-05-16 21:53+0100\n"
|
"PO-Revision-Date: 2014-05-16 22:37+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,59 +18,71 @@ 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:298
|
#: classes/footnotes_settings.php:308
|
||||||
msgid "General"
|
msgid "General"
|
||||||
msgstr "Allgemein"
|
msgstr "Allgemein"
|
||||||
|
|
||||||
#: classes/footnotes_settings.php:300 includes/plugin-settings.php:22
|
#: classes/footnotes_settings.php:310 includes/plugin-settings.php:22
|
||||||
msgid "Settings"
|
msgid "Settings"
|
||||||
msgstr "Einstellungen"
|
msgstr "Einstellungen"
|
||||||
|
|
||||||
#: classes/footnotes_settings.php:301
|
#: classes/footnotes_settings.php:311
|
||||||
msgid "References label:"
|
msgid "References label:"
|
||||||
msgstr "Überschrift \"Einzelnachweis\":"
|
msgstr "Überschrift \"Einzelnachweis\":"
|
||||||
|
|
||||||
#: classes/footnotes_settings.php:302
|
#: classes/footnotes_settings.php:312
|
||||||
msgid "Collapse references by default:"
|
msgid "Collapse references by default:"
|
||||||
msgstr "Verstecke Einzelnachweise standardmäßig:"
|
msgstr "Verstecke Einzelnachweise standardmäßig:"
|
||||||
|
|
||||||
#: classes/footnotes_settings.php:303
|
#: classes/footnotes_settings.php:313
|
||||||
msgid "Combine identical footnotes:"
|
msgid "Combine identical footnotes:"
|
||||||
msgstr "Kombiniere meine Fußnoten:"
|
msgstr "Kombiniere meine Fußnoten:"
|
||||||
|
|
||||||
#: classes/footnotes_settings.php:344
|
#: classes/footnotes_settings.php:314
|
||||||
|
msgid "Footnote tag:"
|
||||||
|
msgstr "Fußzeile einbinden:"
|
||||||
|
|
||||||
|
#: classes/footnotes_settings.php:355
|
||||||
msgid "Yes"
|
msgid "Yes"
|
||||||
msgstr "Ja"
|
msgstr "Ja"
|
||||||
|
|
||||||
#: classes/footnotes_settings.php:345
|
#: classes/footnotes_settings.php:356
|
||||||
msgid "No"
|
msgid "No"
|
||||||
msgstr "Nein"
|
msgstr "Nein"
|
||||||
|
|
||||||
#: classes/footnotes_settings.php:360 classes/footnotes_settings.php:362
|
#: classes/footnotes_settings.php:369
|
||||||
|
msgid "starts with:"
|
||||||
|
msgstr "beginnt mit:"
|
||||||
|
|
||||||
|
#: classes/footnotes_settings.php:373
|
||||||
|
msgid "ends with:"
|
||||||
|
msgstr "endet mit:"
|
||||||
|
|
||||||
|
#: classes/footnotes_settings.php:385 classes/footnotes_settings.php:387
|
||||||
msgid "HowTo"
|
msgid "HowTo"
|
||||||
msgstr "Hilfe"
|
msgstr "Hilfe"
|
||||||
|
|
||||||
#: classes/footnotes_settings.php:373
|
#: classes/footnotes_settings.php:398
|
||||||
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:386
|
#: classes/footnotes_settings.php:413
|
||||||
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:391
|
#: classes/footnotes_settings.php:418
|
||||||
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:397 classes/footnotes_settings.php:400
|
#: classes/footnotes_settings.php:424 classes/footnotes_settings.php:427
|
||||||
msgid "example string"
|
msgid "example string"
|
||||||
msgstr "Beispieltext"
|
msgstr "Beispieltext"
|
||||||
|
|
||||||
#: classes/footnotes_settings.php:398
|
#: classes/footnotes_settings.php:425
|
||||||
msgid "will be displayed as:"
|
msgid "will be displayed as:"
|
||||||
msgstr "wird dargestellt als:"
|
msgstr "wird dargestellt als:"
|
||||||
|
|
||||||
#: classes/footnotes_settings.php:405
|
#: classes/footnotes_settings.php:432
|
||||||
#, 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."
|
||||||
|
|
Binary file not shown.
|
@ -1,8 +1,8 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: footnotes\n"
|
"Project-Id-Version: footnotes\n"
|
||||||
"POT-Creation-Date: 2014-05-16 21:52+0100\n"
|
"POT-Creation-Date: 2014-05-16 22:36+0100\n"
|
||||||
"PO-Revision-Date: 2014-05-16 21:52+0100\n"
|
"PO-Revision-Date: 2014-05-16 22:36+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,59 +18,71 @@ 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:298
|
#: classes/footnotes_settings.php:308
|
||||||
msgid "General"
|
msgid "General"
|
||||||
msgstr "General"
|
msgstr "General"
|
||||||
|
|
||||||
#: classes/footnotes_settings.php:300 includes/plugin-settings.php:22
|
#: classes/footnotes_settings.php:310 includes/plugin-settings.php:22
|
||||||
msgid "Settings"
|
msgid "Settings"
|
||||||
msgstr "Settings"
|
msgstr "Settings"
|
||||||
|
|
||||||
#: classes/footnotes_settings.php:301
|
#: classes/footnotes_settings.php:311
|
||||||
msgid "References label:"
|
msgid "References label:"
|
||||||
msgstr "References label:"
|
msgstr "References label:"
|
||||||
|
|
||||||
#: classes/footnotes_settings.php:302
|
#: classes/footnotes_settings.php:312
|
||||||
msgid "Collapse references by default:"
|
msgid "Collapse references by default:"
|
||||||
msgstr "Collapse references by default:"
|
msgstr "Collapse references by default:"
|
||||||
|
|
||||||
#: classes/footnotes_settings.php:303
|
#: classes/footnotes_settings.php:313
|
||||||
msgid "Combine identical footnotes:"
|
msgid "Combine identical footnotes:"
|
||||||
msgstr "Combine identical footnotes:"
|
msgstr "Combine identical footnotes:"
|
||||||
|
|
||||||
#: classes/footnotes_settings.php:344
|
#: classes/footnotes_settings.php:314
|
||||||
|
msgid "Footnote tag:"
|
||||||
|
msgstr "Footnote tag:"
|
||||||
|
|
||||||
|
#: classes/footnotes_settings.php:355
|
||||||
msgid "Yes"
|
msgid "Yes"
|
||||||
msgstr "Yes"
|
msgstr "Yes"
|
||||||
|
|
||||||
#: classes/footnotes_settings.php:345
|
#: classes/footnotes_settings.php:356
|
||||||
msgid "No"
|
msgid "No"
|
||||||
msgstr "No"
|
msgstr "No"
|
||||||
|
|
||||||
#: classes/footnotes_settings.php:360 classes/footnotes_settings.php:362
|
#: classes/footnotes_settings.php:369
|
||||||
|
msgid "starts with:"
|
||||||
|
msgstr "starts with:"
|
||||||
|
|
||||||
|
#: classes/footnotes_settings.php:373
|
||||||
|
msgid "ends with:"
|
||||||
|
msgstr "ends with:"
|
||||||
|
|
||||||
|
#: classes/footnotes_settings.php:385 classes/footnotes_settings.php:387
|
||||||
msgid "HowTo"
|
msgid "HowTo"
|
||||||
msgstr "HowTo"
|
msgstr "HowTo"
|
||||||
|
|
||||||
#: classes/footnotes_settings.php:373
|
#: classes/footnotes_settings.php:398
|
||||||
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:386
|
#: classes/footnotes_settings.php:413
|
||||||
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:391
|
#: classes/footnotes_settings.php:418
|
||||||
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:397 classes/footnotes_settings.php:400
|
#: classes/footnotes_settings.php:424 classes/footnotes_settings.php:427
|
||||||
msgid "example string"
|
msgid "example string"
|
||||||
msgstr "example string"
|
msgstr "example string"
|
||||||
|
|
||||||
#: classes/footnotes_settings.php:398
|
#: classes/footnotes_settings.php:425
|
||||||
msgid "will be displayed as:"
|
msgid "will be displayed as:"
|
||||||
msgstr "will be displayed as:"
|
msgstr "will be displayed as:"
|
||||||
|
|
||||||
#: classes/footnotes_settings.php:405
|
#: classes/footnotes_settings.php:432
|
||||||
#, 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."
|
||||||
|
|
|
@ -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.2
|
Stable Tag: 1.0.3
|
||||||
|
|
||||||
== Description ==
|
== Description ==
|
||||||
|
|
||||||
|
@ -35,6 +35,11 @@ coming soon
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
|
= 1.0.3 =
|
||||||
|
* New setting to use personal starting and ending tag for the footnotes
|
||||||
|
* Updated translations for the new setting
|
||||||
|
* Updated reading settings and fallback to default values (bugfix)
|
||||||
|
|
||||||
= 1.0.2 =
|
= 1.0.2 =
|
||||||
* New setting to collapse the reference container by default
|
* New setting to collapse the reference container by default
|
||||||
* Added link behind the footnotes to automatically jump to the reference container
|
* Added link behind the footnotes to automatically jump to the reference container
|
||||||
|
@ -49,7 +54,7 @@ coming soon
|
||||||
* Updated translations for EN and DE
|
* Updated translations for EN and DE
|
||||||
* Changed version number from 3 digits to 2 digits
|
* Changed version number from 3 digits to 2 digits
|
||||||
|
|
||||||
= 1.0 =
|
= 1.0.0 =
|
||||||
* First development Version of the Plugin
|
* First development Version of the Plugin
|
||||||
|
|
||||||
== Feedback ==
|
== Feedback ==
|
||||||
|
|
Reference in a new issue