Removing pre-update

git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@1445711 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
David Artiss 2016-06-29 12:51:01 +00:00
parent 1f3a8545cd
commit e5fe6ba3b3
3 changed files with 0 additions and 904 deletions

View file

@ -1,502 +0,0 @@
<?php
/**
* Includes the core function of the Plugin - Search and Replace the Footnotes.
*
* @filesource
* @author Stefan Herndler
* @since 1.5.0
*/
/**
* Looks for Footnotes short codes and replaces them. Also displays the Reference Container.
*
* @author Stefan Herndler
* @since 1.5.0
*/
class MCI_Footnotes_Task {
/**
* Contains all footnotes found on current public page.
*
* @author Stefan Herndler
* @since 1.5.0
* @var array
*/
public static $a_arr_Footnotes = array();
/**
* Flag if the display of 'LOVE FOOTNOTES' is allowed on the current public page.
*
* @author Stefan Herndler
* @since 1.5.0
* @var bool
*/
public static $a_bool_AllowLoveMe = true;
/**
* Prefix for the Footnote html element ID.
*
* @author Stefan Herndler
* @since 1.5.8
* @var string
*/
public static $a_str_Prefix = "";
/**
* Register WordPress Hooks to replace Footnotes in the content of a public page.
*
* @author Stefan Herndler
* @since 1.5.0
*/
public function registerHooks() {
// 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"), PHP_INT_MAX);
}
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"), PHP_INT_MAX);
}
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"), PHP_INT_MAX);
}
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"), PHP_INT_MAX);
}
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"), PHP_INT_MAX);
}
if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_POST))) {
add_filter('the_post', array($this, "the_post"), PHP_INT_MAX);
}
// 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
*/
public function wp_head() {
$l_str_Color = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR);
$l_str_Background = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND);
$l_int_BorderWidth = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH);
$l_str_BorderColor = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR);
$l_int_BorderRadius = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS);
$l_int_MaxWidth = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH);
$l_str_BoxShadowColor = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR);
?>
<style type="text/css" media="screen">
<?php
echo MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_CUSTOM_CSS);
echo '.footnote_tooltip { display: none; padding: 12px; font-size: 13px;';
if (!empty($l_str_Color)) {
printf(" color: %s;", $l_str_Color);
}
if (!empty($l_str_Background)) {
printf(" background-color: %s;", $l_str_Background);
}
if (!empty($l_int_BorderWidth) && intval($l_int_BorderWidth) > 0) {
printf(" border-width: %dpx; border-style: solid;", $l_int_BorderWidth);
}
if (!empty($l_str_BorderColor)) {
printf(" border-color: %s;", $l_str_BorderColor);
}
if (!empty($l_int_BorderRadius) && intval($l_int_BorderRadius) > 0) {
printf(" border-radius: %dpx;", $l_int_BorderRadius);
}
if (!empty($l_int_MaxWidth) && intval($l_int_MaxWidth) > 0) {
printf(" max-width: %dpx;", $l_int_MaxWidth);
}
if (!empty($l_str_BoxShadowColor)) {
printf(" -webkit-box-shadow: 2px 2px 11px %s;", $l_str_BoxShadowColor);
printf(" -moz-box-shadow: 2px 2px 11px %s;", $l_str_BoxShadowColor);
printf(" box-shadow: 2px 2px 11px %s;", $l_str_BoxShadowColor);
}
echo '}';
?>
</style>
<?php
}
/**
* Displays the 'LOVE FOOTNOTES' slug if enabled.
*
* @author Stefan Herndler
* @since 1.5.0
*/
public function wp_footer() {
if (MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "footer") {
echo $this->ReferenceContainer();
}
// get setting for love and share this plugin
$l_str_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('<a href="http://wordpress.org/plugins/footnotes/" target="_blank" style="text-decoration:none;">%s</a>',MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME);
// get random love me text
if (strtolower($l_str_LoveMeIndex) == "random") {
$l_str_LoveMeIndex = "text-" . rand(1,3);
}
switch ($l_str_LoveMeIndex) {
case "text-1":
$l_str_LoveMeText = sprintf(__('I %s %s', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_LOVE_SYMBOL, $l_str_LinkedName);
break;
case "text-2":
$l_str_LoveMeText = sprintf(__('this site uses the awesome %s Plugin', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), $l_str_LinkedName);
break;
case "text-3":
default:
$l_str_LoveMeText = sprintf(__('extra smooth %s', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), $l_str_LinkedName);
break;
}
echo sprintf('<div style="text-align:center; color:#acacac;">%s</div>', $l_str_LoveMeText);
}
/**
* 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) {
// 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
*/
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);
// append the reference container
if ($p_bool_OutputReferences) {
$p_str_Content = $p_str_Content . $this->ReferenceContainer();
}
// 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 append
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
*/
public function search($p_str_Content, $p_bool_ConvertHtmlChars, $p_bool_HideFootnotesText) {
// 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;
}
if (!$p_bool_HideFootnotesText) {
// load template file
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "footnote");
$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 short code [start]
$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 a footnote short code [end]
$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));
// Text to be displayed instead of the footnote
$l_str_FootnoteReplaceText = "";
// display the footnote as mouse-over box
if (!$p_bool_HideFootnotesText) {
$l_str_Index = MCI_Footnotes_Convert::Index($l_int_FootnoteIndex, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE));
// display only an excerpt of the footnotes text if enabled
$l_str_ExcerptText = $l_str_FootnoteText;
$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));
if ($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 .= " ..." . sprintf(__("%scontinue%s", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), '<a href="" onclick="footnote_moveToAnchor(\'footnote_plugin_reference_'.$l_str_Index.'\');">', '</a>');
}
}
// fill the footnotes template
$l_obj_Template->replace(
array(
"id" => self::$a_str_Prefix . $l_str_Index,
"index" => $l_str_Index,
"text" => MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED)) ? $l_str_ExcerptText : "",
"before" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE),
"after" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER)
)
);
$l_str_FootnoteReplaceText = $l_obj_Template->getContent();
// reset the template
$l_obj_Template->reload();
if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED))) {
$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_obj_TemplateTooltip->replace(
array(
"id" => self::$a_str_Prefix . $l_str_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
)
);
$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++;
}
// 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
*/
public function ReferenceContainer() {
// no footnotes has been replaced on this page
if (empty(self::$a_arr_Footnotes)) {
return "";
}
// 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;
}
// load template file
$l_str_Body = "";
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container-body");
// loop through all footnotes found in the page
for ($l_str_Index = 0; $l_str_Index < count(self::$a_arr_Footnotes); $l_str_Index++) {
// get footnote text
$l_str_FootnoteText = self::$a_arr_Footnotes[$l_str_Index];
// if footnote is empty, get to the next one
if (empty($l_str_FootnoteText)) {
continue;
}
// get footnote index
$l_str_FirstFootnoteIndex = ($l_str_Index + 1);
$l_str_FootnoteIndex = MCI_Footnotes_Convert::Index(($l_str_Index + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE));
// check if it isn't the last footnote in the array
if ($l_str_FirstFootnoteIndex < count(self::$a_arr_Footnotes) && MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES))) {
// get all footnotes that I haven't passed yet
for ($l_str_CheckIndex = $l_str_FirstFootnoteIndex; $l_str_CheckIndex < count(self::$a_arr_Footnotes); $l_str_CheckIndex++) {
// check if a further footnote is the same as the actual one
if ($l_str_FootnoteText == self::$a_arr_Footnotes[$l_str_CheckIndex]) {
// set the further footnote as empty so it won't be displayed later
self::$a_arr_Footnotes[$l_str_CheckIndex] = "";
// add the footnote index to the actual index
$l_str_FootnoteIndex .= ", " . MCI_Footnotes_Convert::Index(($l_str_CheckIndex + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE));
}
}
}
// replace all placeholders in the template
$l_obj_Template->replace(
array(
"index" => $l_str_FootnoteIndex,
"id" => self::$a_str_Prefix . MCI_Footnotes_Convert::Index($l_str_FirstFootnoteIndex, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)),
"arrow" => $l_str_Arrow,
"text" => $l_str_FootnoteText
)
);
$l_str_Body .= $l_obj_Template->getContent();
$l_obj_Template->reload();
}
// load template file
$l_obj_TemplateContainer = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container");
$l_obj_TemplateContainer->replace(
array(
"label" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME),
"button-style" => !MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE)) ? 'display: none;' : '',
"id" => "footnote_references_container",
"style" => MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE)) ? 'display: none;' : '',
"content" => $l_str_Body
)
);
// free all found footnotes if reference container will be displayed
self::$a_arr_Footnotes = array();
self::$a_str_Prefix = rand(1000, 9999) . "_";
return $l_obj_TemplateContainer->getContent();
}
}

View file

@ -1,75 +0,0 @@
<?php
/**
*
* @filesource
* @author Stefan Herndler
* @since x.x.x 14.09.14 14:30
*/
/**
* Base Class for all Plugin Widgets. Registers each Widget to WordPress.
* The following Methods MUST be overwritten in each sub class:
* **public function widget($args, $instance)** -> 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
*/
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
$this->WP_Widget(
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
);
}
}

View file

@ -1,327 +0,0 @@
=== Plugin Name ===
Contributors: Aricura, mark.cheret
Tags: footnote, footnotes, bibliography, formatting, notes, Post, posts, reference, referencing
Requires at least: 3.9
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BYSY26N8L8VJC
Tested up to: 4.4.2
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Stable Tag: 1.6.3
== Description ==
HELP WANTED! Dear fine footnotes community. Unpredicted challenges in the lives of the footnotes team currently make it impossible to further the development and curation of the plugin.
We are proud of you and what we could give you. Turns out our plugin's ships with some kinks, we'd like to address. We therefore need you as a developer to have a look at our code and the forum and help in solving these issues.
I'm willing to pay you for helping our users out. This plugin's got about 10% market share in all footnotes related plugins, so we serve a significant part of the community. Please get in touch and assist. Thank you.
Featured on wpmudev: http://premium.wpmudev.org/blog/12-surprisingly-useful-wordpress-plugins-you-dont-know-about/
Cheers for the review, folks!
**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 sane defaults but also gives the user control over how their footnotes are being displayed.
**footnotes** gives you the ability to display decently-formated footnotes on your WordPress Pages or Posts (those footnotes we know from offline publishing).
= Main Features =
- Fully customizable **footnotes** shortcode
- Decide, where your **footnotes** are displayed (position of the *Reference Container*)
- Add custom CSS to style the appeareance of the **footnotes**
- Responsive *Reference Container*
- Mouse-Over Box with clickable links displays your **footnotes** text
- Automatic numbering of your **footnotes**
- Choose from a list of symbols to represent your **footnotes**
- Display the **footnotes** *Reference Container* inside a Widget
- Button in both the Visual and the Text editor
- Add **footnotes** into your Page / Post with ease of use by selecting your text and clicking the button
= Example Usage =
This is an example. Please note, that you can customize the shortcode you want to use.
1. Your awesome text((with an awesome footnote))
2. Your awesome text[ref]with an awesome footnote[/ref]
3. Your awesome text`<fn>`with an awesome footnote`</fn>`
4. Your awesome text `custom-shortcode` with an awesome footnote `custom-shortcode`
= Where to get footnotes? =
The current version is available on wordpress.org:
http://downloads.wordpress.org/plugin/footnotes.zip
= Support =
Please report feature requests, bugs and other support related questions in the WordPress Forums at https://wordpress.org/support/plugin/footnotes
Speak your mind, unload your burdens. Notice how we screwed up big time? Bring it to our attention in the above mentioned WordPress Forums. Be polite, though :)
= Development =
Development of the plugin is an open process. Latest code is available on wordpress.org
== 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!
= I'm happy with how the Plugin works =
1. Pour a glass of your favourite beverage
2. Take a deep breath
3. Donate whatever amount you think is appropriate here: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BYSY26N8L8VJC
4. Enjoy how you just made a bunch of young folks even more enthusiastic about developing useful stuff
5. Now it's time to empty that glass in one go
== 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 ==
= 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!)
- Add: Setting to customize the mouse-over box shadow
- Add: Translation: United States
- Add: Translation: Austria
- Add: 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 =
- Add: Setting to define the positioning of the mouse-over box
- Add: 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.
- Add: .pot file to enable Translations for everybody
- Add: 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 =
- Add: Expert mode setting
- Add: Activation and Deactivation of WordPress hooks to look for Footnotes (expert mode)
- Add: 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 =
- Add: Setting to enable an excerpt of the Footnotes mouse-over box text (default: disabled)
- Add: 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 =
- Add: 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 =
- Add: Setting to enable/disable the mouse-over box
- Add: Current WordPress Theme to the Diagnostics sub page
- Add: 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 =
- Add: Grouped the Plugin Settings into a new Menu Page called "ManFisher Plugins"
- Add: Sub Page to list all other Plugins of the Contributors
- Add: 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
- Add: Tab for Plugin Diagnostics
- Add: Donate link to the installed Plugin overview page
- Add: 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
- Add: Setting to customize the hyperlink symbol in der reference container for each footnote reference
- Add: 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
- Add: 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
- Add: 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
- Add: 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
- Add: 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
- Add: 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
- Add: 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
- Add: Inspirational Screenshots for further development
- Add: 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
- Add: setting to allow footnotes on Summarized Posts
- Add: setting to tell the world you're using footnotes plugin
- Add: 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, ...)
- Add: 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 =
- Add: 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 =
- Add: setting to collapse the reference container by default
- Add: link behind the footnotes to automatically jump to the reference container
- Add: 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
- Add: a version control to each file / class / function / variable
- Add: 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