Prepare for release version 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

git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@1004128 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
Aricura 2014-10-08 21:36:35 +00:00
parent fdb748c86f
commit 83656a610f
9 changed files with 262 additions and 72 deletions

View file

@ -116,17 +116,17 @@ abstract class MCI_Footnotes_LayoutEngine {
* @since 1.5.0 * @since 1.5.0
*/ */
public function registerSubPage() { public function registerSubPage() {
global $submenu; global $submenu;
// iterate through each sub menu // any sub menu for our main menu exists
foreach($submenu as $l_arr_SubMenu) { if (array_key_exists(plugin_basename(MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG), $submenu)) {
// iterate through each sub menu attribute // iterate through all sub menu entries of the ManFisher main menu
foreach($l_arr_SubMenu as $l_str_Attribute) { foreach($submenu[plugin_basename(MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG)] as $l_arr_SubMenu) {
// sub menu already added, stop if ($l_arr_SubMenu[2] == plugin_basename(MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->getSubPageSlug())) {
if ($l_str_Attribute == MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG . $this->getSubPageSlug()) { // remove that sub menu and add it again to move it to the bottom
return; remove_submenu_page(MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG, MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG .$this->getSubPageSlug());
} }
} }
} }
$this->a_str_SubPageHook = add_submenu_page( $this->a_str_SubPageHook = add_submenu_page(
MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG, // parent slug MCI_Footnotes_Layout_Init::C_STR_MAIN_MENU_SLUG, // parent slug
@ -301,12 +301,8 @@ abstract class MCI_Footnotes_LayoutEngine {
protected function LoadSetting($p_str_SettingKeyName) { protected function LoadSetting($p_str_SettingKeyName) {
// get current section // get current section
reset($this->a_arr_Sections); reset($this->a_arr_Sections);
$l_str_ActiveSectionID = isset($_GET['t']) ? $_GET['t'] : key($this->a_arr_Sections);
$l_arr_ActiveSection = $this->a_arr_Sections[$l_str_ActiveSectionID];
$p_arr_Return = array(); $p_arr_Return = array();
$p_arr_Return["id"] = sprintf('%s', $p_str_SettingKeyName); $p_arr_Return["id"] = sprintf('%s', $p_str_SettingKeyName);
//$p_arr_Return["name"] = sprintf('%s[%s]', MCI_Footnotes_Settings::instance()->getContainer($l_arr_ActiveSection["container"]), $p_str_SettingKeyName);
$p_arr_Return["name"] = sprintf('%s', $p_str_SettingKeyName); $p_arr_Return["name"] = sprintf('%s', $p_str_SettingKeyName);
$p_arr_Return["value"] = esc_attr(MCI_Footnotes_Settings::instance()->get($p_str_SettingKeyName)); $p_arr_Return["value"] = esc_attr(MCI_Footnotes_Settings::instance()->get($p_str_SettingKeyName));
return $p_arr_Return; return $p_arr_Return;

View file

@ -56,11 +56,14 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
* @return array * @return array
*/ */
protected function getSections() { protected function getSections() {
return array( $l_arr_Tabs = array();
$this->addSection("settings", __("Settings", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 0, true), $l_arr_Tabs[] = $this->addSection("settings", __("Settings", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 0, true);
$this->addSection("customize", __("Customize", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 1, true), $l_arr_Tabs[] = $this->addSection("customize", __("Customize", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 1, true);
$this->addSection("how-to", __("How to", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), null, false) if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_EXPERT_MODE))) {
); $l_arr_Tabs[] = $this->addSection("expert", __("Expert mode", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 2, true);
}
$l_arr_Tabs[] = $this->addSection("how-to", __("How to", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), null, false);
return $l_arr_Tabs;
} }
/** /**
@ -82,6 +85,8 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
$this->addMetaBox("customize", "hyperlink-arrow", __("Hyperlink symbol in the Reference container", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "HyperlinkArrow"), $this->addMetaBox("customize", "hyperlink-arrow", __("Hyperlink symbol in the Reference container", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "HyperlinkArrow"),
$this->addMetaBox("customize", "custom-css", __("Add custom CSS to the public page", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "CustomCSS"), $this->addMetaBox("customize", "custom-css", __("Add custom CSS to the public page", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "CustomCSS"),
$this->addMetaBox("expert", "lookup", __("WordPress hooks to look for Footnote short codes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "lookupHooks"),
$this->addMetaBox("how-to", "help", __("Brief introduction in how to use the plugin", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Help"), $this->addMetaBox("how-to", "help", __("Brief introduction in how to use the plugin", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Help"),
$this->addMetaBox("how-to", "donate", __("Help us to improve our Plugin", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Donate") $this->addMetaBox("how-to", "donate", __("Help us to improve our Plugin", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Donate")
); );
@ -230,7 +235,7 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
*/ */
public function Other() { public function Other() {
// options for the Footnotes to be replaced in excerpt // options for the Footnotes to be replaced in excerpt
$l_arr_Excerpt = array( $l_arr_Enabled = array(
"yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)
); );
@ -241,7 +246,9 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
$l_obj_Template->replace( $l_obj_Template->replace(
array( array(
"label-excerpt" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT, __("Allow footnotes on Summarized Posts", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "label-excerpt" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT, __("Allow footnotes on Summarized Posts", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"excerpt" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT, $l_arr_Excerpt) "excerpt" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT, $l_arr_Enabled),
"label-expert-mode" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_EXPERT_MODE, __("Enable the Expert mode", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)),
"expert-mode" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_EXPERT_MODE, $l_arr_Enabled)
) )
); );
// display template with replaced placeholders // display template with replaced placeholders
@ -361,6 +368,51 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine {
echo $l_obj_Template->getContent(); echo $l_obj_Template->getContent();
} }
/**
* Displays available Hooks to look for Footnote short codes.
*
* @author Stefan Herndler
* @since 1.5.5
*/
public function lookupHooks() {
// load template file
$l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "expert-lookup");
// replace all placeholders
$l_obj_Template->replace(
array(
"head-hook" => __("WordPress hook function name", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"head-checkbox" => __("Activate", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"head-url" => __("WordPress documentation", MCI_Footnotes_Config::C_STR_PLUGIN_NAME),
"label-the-title" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_TITLE, "the_title"),
"the-title" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_TITLE),
"url-the-title" => "http://codex.wordpress.org/Plugin_API/Filter_Reference/the_title",
"label-the-content" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_CONTENT, "the_content"),
"the-content" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_CONTENT),
"url-the-content" => "http://codex.wordpress.org/Plugin_API/Filter_Reference/the_content",
"label-the-excerpt" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT, "the_excerpt"),
"the-excerpt" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT),
"url-the-excerpt" => "http://codex.wordpress.org/Function_Reference/the_excerpt",
"label-widget-title" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE, "widget_title"),
"widget-title" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE),
"url-widget-title" => "http://codex.wordpress.org/Plugin_API/Filter_Reference/widget_title",
"label-widget-text" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT, "widget_text"),
"widget-text" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT),
"url-widget-text" => "http://codex.wordpress.org/Plugin_API/Filter_Reference/widget_text",
"label-post-object" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_POST, "the_post"),
"post-object" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_POST),
"url-post-object" => "http://codex.wordpress.org/Plugin_API/Filter_Reference/the_post"
)
);
// display template with replaced placeholders
echo $l_obj_Template->getContent();
}
/** /**
* Displays a short introduction of the Plugin. * Displays a short introduction of the Plugin.
* *

View file

@ -22,9 +22,9 @@ class MCI_Footnotes_Hooks {
* @since 1.5.0 * @since 1.5.0
*/ */
public static function registerHooks() { public static function registerHooks() {
register_activation_hook(dirname(__FILE__) . "/../index.php", array("MCI_Footnotes_Hook", "activatePlugin")); register_activation_hook(dirname(__FILE__) . "/../index.php", array("MCI_Footnotes_Hooks", "activatePlugin"));
register_deactivation_hook(dirname(__FILE__) . "/../index.php", array("MCI_Footnotes_Hook", "deactivatePlugin")); register_deactivation_hook(dirname(__FILE__) . "/../index.php", array("MCI_Footnotes_Hooks", "deactivatePlugin"));
register_uninstall_hook(dirname(__FILE__) . "/../index.php", array("MCI_Footnotes_Hook", "uninstallPlugin")); register_uninstall_hook(dirname(__FILE__) . "/../index.php", array("MCI_Footnotes_Hooks", "uninstallPlugin"));
} }
/** /**

View file

@ -117,6 +117,15 @@ class MCI_Footnotes_Settings {
*/ */
const C_BOOL_FOOTNOTES_IN_EXCERPT = "footnote_inputfield_search_in_excerpt"; const C_BOOL_FOOTNOTES_IN_EXCERPT = "footnote_inputfield_search_in_excerpt";
/**
* Settings Container Key for the Expert mode.
*
* @author Stefan Herndler
* @since 1.5.5
* @var string
*/
const C_BOOL_FOOTNOTES_EXPERT_MODE = "footnote_inputfield_enable_expert_mode";
/** /**
* Settings Container Key for the styling before the footnotes index. * Settings Container Key for the styling before the footnotes index.
* *
@ -189,6 +198,60 @@ class MCI_Footnotes_Settings {
*/ */
const C_STR_CUSTOM_CSS = "footnote_inputfield_custom_css"; const C_STR_CUSTOM_CSS = "footnote_inputfield_custom_css";
/**
* Settings Container Key the activation of the_title hook.
*
* @author Stefan Herndler
* @since 1.5.5
* @var string
*/
const C_BOOL_EXPERT_LOOKUP_THE_TITLE = "footnote_inputfield_expert_lookup_the_title";
/**
* Settings Container Key the activation of the_content hook.
*
* @author Stefan Herndler
* @since 1.5.5
* @var string
*/
const C_BOOL_EXPERT_LOOKUP_THE_CONTENT = "footnote_inputfield_expert_lookup_the_content";
/**
* Settings Container Key the activation of the_excerpt hook.
*
* @author Stefan Herndler
* @since 1.5.5
* @var string
*/
const C_BOOL_EXPERT_LOOKUP_THE_EXCERPT = "footnote_inputfield_expert_lookup_the_excerpt";
/**
* Settings Container Key the activation of widget_title hook.
*
* @author Stefan Herndler
* @since 1.5.5
* @var string
*/
const C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE = "footnote_inputfield_expert_lookup_widget_title";
/**
* Settings Container Key the activation of widget_text hook.
*
* @author Stefan Herndler
* @since 1.5.5
* @var string
*/
const C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT = "footnote_inputfield_expert_lookup_widget_text";
/**
* Settings Container Key the activation of the_post hook.
*
* @author Stefan Herndler
* @since 1.5.5
* @var string
*/
const C_BOOL_EXPERT_LOOKUP_THE_POST = "footnote_inputfield_expert_lookup_the_post";
/** /**
* Stores a singleton reference of this class. * Stores a singleton reference of this class.
* *
@ -205,7 +268,7 @@ class MCI_Footnotes_Settings {
* @since 1.5.0 * @since 1.5.0
* @var array * @var array
*/ */
private $a_arr_Container = array("footnotes_storage", "footnotes_storage_custom"); private $a_arr_Container = array("footnotes_storage", "footnotes_storage_custom", "footnotes_storage_expert");
/** /**
* Contains all Default Settings for each Settings Container. * Contains all Default Settings for each Settings Container.
@ -226,7 +289,8 @@ class MCI_Footnotes_Settings {
self::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED => '', self::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED => '',
self::C_STR_FOOTNOTES_COUNTER_STYLE => 'arabic_plain', self::C_STR_FOOTNOTES_COUNTER_STYLE => 'arabic_plain',
self::C_STR_FOOTNOTES_LOVE => 'no', self::C_STR_FOOTNOTES_LOVE => 'no',
self::C_BOOL_FOOTNOTES_IN_EXCERPT => 'yes' self::C_BOOL_FOOTNOTES_IN_EXCERPT => 'yes',
self::C_BOOL_FOOTNOTES_EXPERT_MODE => 'no'
), ),
"footnotes_storage_custom" => array( "footnotes_storage_custom" => array(
self::C_STR_FOOTNOTES_STYLING_BEFORE => '', self::C_STR_FOOTNOTES_STYLING_BEFORE => '',
@ -237,7 +301,15 @@ class MCI_Footnotes_Settings {
self::C_STR_HYPERLINK_ARROW => '↑', self::C_STR_HYPERLINK_ARROW => '↑',
self::C_STR_HYPERLINK_ARROW_USER_DEFINED => '', self::C_STR_HYPERLINK_ARROW_USER_DEFINED => '',
self::C_STR_CUSTOM_CSS => '' self::C_STR_CUSTOM_CSS => ''
) ),
"footnotes_storage_expert" => array(
self::C_BOOL_EXPERT_LOOKUP_THE_TITLE => '',
self::C_BOOL_EXPERT_LOOKUP_THE_CONTENT => 'yes',
self::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT => 'yes',
self::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE => '',
self::C_BOOL_EXPERT_LOOKUP_WIDGET_TEXT => 'yes',
self::C_BOOL_EXPERT_LOOKUP_THE_POST => ''
)
); );
/** /**

View file

@ -42,26 +42,32 @@ class MCI_Footnotes_Task {
*/ */
public function registerHooks() { public function registerHooks() {
// append custom css to the header // append custom css to the header
add_filter('wp_head', array($this, "Header")); add_filter('wp_head', array($this, "wp_head"), PHP_INT_MAX);
// append the reference container to the footer
add_filter('get_footer', array($this, "Footer"));
// append the love and share me slug to the footer // append the love and share me slug to the footer
add_filter('wp_footer', array($this, "Love")); add_filter('wp_footer', array($this, "wp_footer"), PHP_INT_MAX);
// replace footnotes in the content of the page/post if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_TITLE))) {
add_filter('the_content', array($this, "Content"), PHP_INT_MAX); add_filter('the_title', array($this, "the_title"), PHP_INT_MAX);
}
// search for footnotes in the excerpt if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_CONTENT))) {
add_filter('the_excerpt', array($this, "Excerpt"), PHP_INT_MAX); add_filter('the_content', array($this, "the_content"), PHP_INT_MAX);
add_filter('get_the_excerpt', array($this, "Excerpt"), PHP_INT_MAX); }
if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_EXCERPT))) {
// replace footnotes in the content of a widget add_filter('the_excerpt', array($this, "the_excerpt"), PHP_INT_MAX);
add_filter('widget_text', array($this, "WidgetText"), PHP_INT_MAX); }
if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_WIDGET_TITLE))) {
// replace footnotes in the Post object after receiving it from the database add_filter('widget_title', array($this, "widget_title"), PHP_INT_MAX);
add_action('the_post', array($this, "manipulatePostObject")); }
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;
} }
/** /**
@ -70,25 +76,10 @@ class MCI_Footnotes_Task {
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
*/ */
public function Header() { public function wp_head() {
?> ?>
<style type="text/css" media="screen"><?php echo MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_CUSTOM_CSS) ?></style> <style type="text/css" media="screen"><?php echo MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_CUSTOM_CSS) ?></style>
<?php <?php
// reset stored footnotes when displaying the header
self::$a_arr_Footnotes = array();
//ob_start();
}
/**
* Displays the Reference Container if set to the footer.
*
* @author Stefan Herndler
* @since 1.5.0
*/
public function Footer() {
if (MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "footer") {
echo $this->ReferenceContainer();
}
} }
/** /**
@ -97,11 +88,10 @@ class MCI_Footnotes_Task {
* @author Stefan Herndler * @author Stefan Herndler
* @since 1.5.0 * @since 1.5.0
*/ */
public function Love() { public function wp_footer() {
/*$l_str_Content = ob_get_contents(); if (MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "footer") {
$l_str_Content = $this->exec($l_str_Content, false); echo $this->ReferenceContainer();
ob_end_clean(); }
echo $l_str_Content;*/
// get setting for love and share this plugin // get setting for love and share this plugin
$l_str_LoveMeIndex = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE); $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 // check if the admin allows to add a link to the footer
@ -129,6 +119,19 @@ class MCI_Footnotes_Task {
echo sprintf('<div style="text-align:center; color:#acacac;">%s</div>', $l_str_LoveMeText); echo sprintf('<div style="text-align:center; color:#acacac;">%s</div>', $l_str_LoveMeText);
} }
/**
* 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. * Replaces footnotes in the content of the current page/post.
* *
@ -137,7 +140,7 @@ class MCI_Footnotes_Task {
* @param string $p_str_Content Page/Post content. * @param string $p_str_Content Page/Post content.
* @return string Content with replaced footnotes. * @return string Content with replaced footnotes.
*/ */
public function Content($p_str_Content) { public function the_content($p_str_Content) {
// appends the reference container if set to "post_end" // 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); return $this->exec($p_str_Content, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "post_end" ? true : false);
} }
@ -150,10 +153,23 @@ class MCI_Footnotes_Task {
* @param string $p_str_Content Page/Post content. * @param string $p_str_Content Page/Post content.
* @return string Content with replaced footnotes. * @return string Content with replaced footnotes.
*/ */
public function Excerpt($p_str_Content) { 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))); 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. * Replaces footnotes in the content of the current widget.
* *
@ -162,7 +178,7 @@ class MCI_Footnotes_Task {
* @param string $p_str_Content Widget content. * @param string $p_str_Content Widget content.
* @return string Content with replaced footnotes. * @return string Content with replaced footnotes.
*/ */
public function WidgetText($p_str_Content) { public function widget_text($p_str_Content) {
// appends the reference container if set to "post_end" // 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); return $this->exec($p_str_Content, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "post_end" ? true : false);
} }
@ -174,7 +190,7 @@ class MCI_Footnotes_Task {
* @since 1.5.4 * @since 1.5.4
* @param WP_Post $p_obj_Post * @param WP_Post $p_obj_Post
*/ */
public function manipulatePostObject(&$p_obj_Post) { public function the_post(&$p_obj_Post) {
$p_obj_Post->post_content = $this->exec($p_obj_Post->post_content); $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_content_filtered = $this->exec($p_obj_Post->post_content_filtered);
$p_obj_Post->post_excerpt = $this->exec($p_obj_Post->post_excerpt); $p_obj_Post->post_excerpt = $this->exec($p_obj_Post->post_excerpt);

View file

@ -4,7 +4,7 @@
Plugin URI: http://wordpress.org/plugins/footnotes/ Plugin URI: http://wordpress.org/plugins/footnotes/
Description: time to bring footnotes to your website! footnotes are known from offline publishing and everybody takes them for granted when reading a magazine. Description: time to bring footnotes to your website! footnotes are known from offline publishing and everybody takes them for granted when reading a magazine.
Author: ManFisher Medien ManuFaktur Author: ManFisher Medien ManuFaktur
Version: 1.5.4 Version: 1.5.5
Author URI: http://manfisher.net/plugins/footnotes/ Author URI: http://manfisher.net/plugins/footnotes/
Text Domain: footnotes Text Domain: footnotes
Domain Path: /languages Domain Path: /languages

View file

@ -6,7 +6,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
Tested up to: 4.0 Tested up to: 4.0
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.5.4 Stable Tag: 1.5.5
== Description == == Description ==
@ -84,6 +84,15 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest**
== Changelog == == Changelog ==
= 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 = = 1.5.4 =
- Add: Setting to enable an excerpt of the Footnotes mouse-over box text (default: disabled) - 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) - Add: Setting to define the maximum length of the excerpt displayed in the mouse-over box (default: 150 characters)

View file

@ -0,0 +1,41 @@
<table class="widefat fixed">
<thead>
<tr>
<th style="width: 260px !important;">[[head-hook]]</th>
<th style="width: 65px !important;">[[head-checkbox]]</th>
<th style="white-space: nowrap;">[[head-url]]</th>
</tr>
</thead>
<tbody>
<tr>
<td style="width: 260px !important;">[[label-the-title]]</td>
<td style="width: 65px !important;">[[the-title]]</td>
<td style="white-space: nowrap;"><a href="[[url-the-title]]" target="_blank">[[url-the-title]]</a></td>
</tr>
<tr>
<td style="width: 260px !important;">[[label-the-content]]</td>
<td style="width: 65px !important;">[[the-content]]</td>
<td style="white-space: nowrap;"><a href="[[url-the-content]]" target="_blank">[[url-the-content]]</a></td>
</tr>
<tr>
<td style="width: 260px !important;">[[label-the-excerpt]]</td>
<td style="width: 65px !important;">[[the-excerpt]]</td>
<td style="white-space: nowrap;"><a href="[[url-the-excerpt]]" target="_blank">[[url-the-excerpt]]</a></td>
</tr>
<tr>
<td style="width: 260px !important;">[[label-widget-title]]</td>
<td style="width: 65px !important;">[[widget-title]]</td>
<td style="white-space: nowrap;"><a href="[[url-widget-title]]" target="_blank">[[url-widget-title]]</a></td>
</tr>
<tr>
<td style="width: 260px !important;">[[label-widget-text]]</td>
<td style="width: 65px !important;">[[widget-text]]</td>
<td style="white-space: nowrap;"><a href="[[url-widget-text]]" target="_blank">[[url-widget-text]]</a></td>
</tr>
<tr>
<td style="width: 260px !important;">[[label-post-object]]</td>
<td style="width: 65px !important;">[[post-object]]</td>
<td style="white-space: nowrap;"><a href="[[url-post-object]]" target="_blank">[[url-post-object]]</a></td>
</tr>
</tbody>
</table>

View file

@ -4,5 +4,9 @@
<td>[[label-excerpt]]</td> <td>[[label-excerpt]]</td>
<td>[[excerpt]]</td> <td>[[excerpt]]</td>
</tr> </tr>
<tr>
<td>[[label-expert-mode]]</td>
<td>[[expert-mode]]</td>
</tr>
</tbody> </tbody>
</table> </table>