From f10d17ccc230c3f157612476d26adb47fba6b25c Mon Sep 17 00:00:00 2001 From: David Artiss Date: Wed, 29 Jun 2016 12:54:37 +0000 Subject: [PATCH] Version 1.6.4 git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@1445720 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- class/widgets/base.php | 75 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 class/widgets/base.php diff --git a/class/widgets/base.php b/class/widgets/base.php new file mode 100644 index 0000000..39641a7 --- /dev/null +++ b/class/widgets/base.php @@ -0,0 +1,75 @@ + 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 + parent::__construct( + 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 + ); + } +}