- Add: Plugin Widget to define where the reference container shall appear when set to "widget area"

- Update: Translation for new settings and for the Widget description

git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@920341 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
Aricura 2014-05-24 12:38:22 +00:00
parent b7af8ff042
commit e6a31532e0
10 changed files with 216 additions and 95 deletions

View file

@ -472,9 +472,9 @@ class Class_FootnotesSettings
/* setting for 'footnote tag starts with' */
$l_arr_Options = array(
"((" => __("((", FOOTNOTES_PLUGIN_NAME),
"<fn>" => htmlspecialchars(__("<fn>", FOOTNOTES_PLUGIN_NAME)),
"[ref]" => __("[ref]", FOOTNOTES_PLUGIN_NAME),
"((" => "((",
"<fn>" => htmlspecialchars("<fn>"),
"[ref]" => "[ref]",
"userdefined" => __('user defined', FOOTNOTES_PLUGIN_NAME)
);
$this->AddLabel(FOOTNOTE_INPUTFIELD_PLACEHOLDER_START, __("Footnote tag starts with:", FOOTNOTES_PLUGIN_NAME));
@ -482,9 +482,9 @@ class Class_FootnotesSettings
/* setting for 'footnote tag ends with' */
$l_arr_Options = array(
"))" => __("))", FOOTNOTES_PLUGIN_NAME),
"</fn>" => htmlspecialchars(__("</fn>", FOOTNOTES_PLUGIN_NAME)),
"[/ref]" => __("[/ref]", FOOTNOTES_PLUGIN_NAME),
"))" => "))",
"</fn>" => htmlspecialchars("</fn>"),
"[/ref]" => "[/ref]",
"userdefined" => __('user defined', FOOTNOTES_PLUGIN_NAME)
);
$this->AddLabel(FOOTNOTE_INPUTFIELD_PLACEHOLDER_END, __("and ends with:", FOOTNOTES_PLUGIN_NAME) . '&nbsp;&nbsp;&nbsp;', 'text-align: right;');

View file

@ -0,0 +1,51 @@
<?php
/**
* Created by PhpStorm.
* User: Stefan
* Date: 24.05.14
* Time: 13:57
*/
class Class_FootnotesWidget extends WP_Widget {
/**
* @constructor
*/
function Class_FootnotesWidget() {
$widget_ops = array( 'classname' => 'Class_FootnotesWidget', 'description' => __('The widget defines the position of the reference container if set to "widget area".', FOOTNOTES_PLUGIN_NAME) );
$control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'footnotes_widget' );
$this->WP_Widget( 'footnotes_widget', sprintf(__("%s Widget", FOOTNOTES_PLUGIN_NAME), FOOTNOTES_PLUGIN_PUBLIC_NAME), $widget_ops, $control_ops );
}
/**
* widget form creation
* @param $instance
*/
function form($instance) {
echo __('The widget defines the position of the reference container if set to "widget area".', FOOTNOTES_PLUGIN_NAME);
}
/**
* widget update
* @param $new_instance
* @param $old_instance
*/
function update($new_instance, $old_instance) {
return $new_instance;
}
/**
* widget display
* @param $args
* @param $instance
*/
function widget($args, $instance) {
/* access to the global settings collection */
global $g_arr_FootnotesSettings;
/* get setting for 'display reference container position' */
$l_str_ReferenceContainerPosition = $g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_REFERENCE_CONTAINER_PLACE];
if ($l_str_ReferenceContainerPosition == "widget") {
echo footnotes_OutputReferenceContainer();
}
}
}