2021-04-26 22:57:04 +01:00
< ? php // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
2021-03-02 03:09:34 +00:00
/**
* Includes the Plugin Widget to put the Reference Container to the Widget area .
*
2021-03-03 18:58:03 +00:00
* @ since 1.5 . 0
2021-04-27 08:31:37 +01:00
*
* @ package footnotes
* @ subpackage footnotes / public / widget
2021-03-02 03:09:34 +00:00
*/
2021-04-27 08:31:37 +01:00
require_once plugin_dir_path ( dirname ( __FILE__ ) ) . 'widget/class-footnotes-widget-base.php' ;
2021-04-26 09:39:41 +01:00
2021-03-02 03:09:34 +00:00
/**
* Registers a Widget to put the Reference Container to the widget area .
*
* @ since 1.5 . 0
*/
2021-04-19 12:16:05 +01:00
class Footnotes_Widget_Reference_Container extends Footnotes_Widget_Base {
2021-03-02 03:09:34 +00:00
2021-04-27 09:30:53 +01:00
/**
* The ID of this plugin .
*
* @ since 2.8 . 0
* @ access private
* @ var string $plugin_name The ID of this plugin .
*/
private $plugin_name ;
2021-04-27 09:54:07 +01:00
2021-04-27 09:30:53 +01:00
/**
* Initialize the class and set its properties .
*
* @ since 2.8 . 0
* @ param string $plugin_name The name of this plugin .
*/
public function __construct ( $plugin_name ) {
parent :: __construct ();
$this -> plugin_name = $plugin_name ;
}
2021-03-02 03:09:34 +00:00
/**
* Returns an unique ID as string used for the Widget Base ID .
*
* @ since 1.5 . 0
* @ return string
*/
2021-03-03 18:58:03 +00:00
protected function get_id () {
return 'footnotes_widget' ;
2021-03-02 03:09:34 +00:00
}
/**
* Returns the Public name of the Widget to be displayed in the Configuration page .
*
* @ since 1.5 . 0
* @ return string
*/
2021-03-03 18:58:03 +00:00
protected function get_name () {
2021-04-27 09:30:53 +01:00
return $this -> plugin_name ;
2021-03-02 03:09:34 +00:00
}
/**
* Returns the Description of the child widget .
*
* @ since 1.5 . 0
* @ return string
2021-03-03 18:58:03 +00:00
*
2021-04-15 05:09:23 +01:00
* Edit : curly quotes 2.2 . 0
2021-03-02 03:09:34 +00:00
*/
2021-03-03 18:58:03 +00:00
protected function get_description () {
return __ ( 'The widget defines the position of the reference container if set to “widget area”.' , 'footnotes' );
2021-03-02 03:09:34 +00:00
}
/**
* Outputs the Settings of the Widget .
*
* @ since 1.5 . 0
2021-03-03 18:58:03 +00:00
* @ param mixed $instance The instance of the widget .
2021-03-02 03:09:34 +00:00
* @ return void
2021-03-03 18:58:03 +00:00
*
2021-04-15 05:09:23 +01:00
* Edit : curly quotes 2.2 . 0
2021-03-02 03:09:34 +00:00
*/
2021-03-03 18:58:03 +00:00
public function form ( $instance ) {
echo __ ( 'The widget defines the position of the reference container if set to “widget area”.' , 'footnotes' );
2021-03-02 03:09:34 +00:00
}
/**
* Outputs the Content of the Widget .
*
* @ since 1.5 . 0
2021-03-24 21:19:07 +00:00
* @ param mixed $args The widget ' s arguments .
2021-03-03 18:58:03 +00:00
* @ param mixed $instance The instance of the widget .
2021-03-02 03:09:34 +00:00
*/
2021-03-03 18:58:03 +00:00
public function widget ( $args , $instance ) {
2021-04-26 11:42:17 +01:00
global $footnotes ;
2021-03-03 18:58:03 +00:00
// Reference container positioning is set to "widget area".
2021-04-19 12:16:05 +01:00
if ( 'widget' === Footnotes_Settings :: instance () -> get ( Footnotes_Settings :: C_STR_REFERENCE_CONTAINER_POSITION ) ) {
2021-03-03 18:58:03 +00:00
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
2021-04-26 11:42:17 +01:00
echo $footnotes -> a_obj_task -> reference_container ();
2021-03-03 18:58:03 +00:00
// phpcs:enable
2021-03-02 03:09:34 +00:00
}
}
}