* @copyright 2011 Benjamin Carl * @license http://www.opensource.org/licenses/bsd-license.php The BSD License */ /** * Back Class * * This class is responsible for managing the data in the backend (wordpress admin). * It generates and displays the configuration/options form and the widget * * @category Wordpress * @package Wordpress_Apw * @subpackage Wordpress_Apw_Back * @author Benjamin Carl * @copyright 2011 Benjamin Carl * @license http://www.opensource.org/licenses/bsd-license.php The BSD License */ class Apw_Back { /** * contains an instance of the apw config (defaults ...) * * @var object An instance of the apw config (defaults ...) * @access private */ private $_configuration; /** * contains an instance of the widget-class which contains all * widget-related backend functionallity * * @var object An instance of the widget-class * @access private */ private $_widget; /** * contains an instance of the plugin-class which contains all * plugin-related backend functionallity * * @var object An instance of the plugin-class * @access private */ private $_plugin; /******************************************************************************************************************* * WIDGET ******************************************************************************************************************/ /** * preprocess the data before it gets updated * * This method is intend to preprocess the data before it gets updated. * * @param array $newInstance The updated data * @param array $oldInstance The old data * * @return array The data which should be used for update by the wordpress backend * @access public * @author Benjamin Carl */ public function updateWidget($newInstance, $oldInstance) { return $this->_widget->update($newInstance, $oldInstance); } /** * displays the widget-form in widget menu sidebar-control * * This method is intend to display the widget-form in widget menu sidebar-control. * * @param array $configuration The data for the current widget instance * * @return void * @access public * @author Benjamin Carl */ public function displayWidget($configuration) { $this->_widget->display($configuration); } /******************************************************************************************************************* * PLUGIN ******************************************************************************************************************/ /** * initializes the whole plugin process * * This method is intend to initialize the whole plugin process. * * @param string $pluginName The name of the plugin * * @return void * @access public * @author Benjamin Carl */ public function initPlugin($pluginName) { $this->_plugin->init($pluginName); } /******************************************************************************************************************* * Dependency-Injection (DI) ******************************************************************************************************************/ /** * sets the dependency for configuration * * This method is intend to set the dependency for configuration. * * @param object $configuration An object of the configuration class * * @return void * @access public * @author Benjamin Carl * @PdInject configuration */ public function setConfiguration($configuration) { // store instance of configuration (for reading configuration) // @var $this->_configuration Apw_Configuration $this->_configuration = $configuration; } /** * sets the dependency for widget * * This method is intend to set the dependency for widget. * * @param object $widget An instance of the widget class * * @return void * @access public * @author Benjamin Carl * @PdInject widget */ public function setWidget($widget) { // store instance of widget-class // @var $this->_widget Apw_Widget $this->_widget = $widget; } /** * sets the dependency for plugin * * This method is intend to set the dependency for plugin. * * @param object $plugin An instance of the plugin class * * @return void * @access public * @author Benjamin Carl * @PdInject plugin */ public function setPlugin($plugin) { // store instance of plugin-class // @var $this->_plugin Apw_Plugin $this->_plugin = $plugin; } } ?>