From: Roland Häder Date: Tue, 29 Mar 2011 16:29:03 +0000 (+0000) Subject: Introduced new setter/getter and generic interface: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a34a10c85ac693d6d2c183258eb36deb353d003e;p=core.git Introduced new setter/getter and generic interface: - Added a generic Helper interface - Moved some interfaces to maintain hierarchical directory style - Used that interface in the generic setter which has been moved from the BaseCaptcha class to BaseFrameworkSystem - Added source instance, setter and getter from 'hub' project - TODOs.txt updated --- diff --git a/.gitattributes b/.gitattributes index bc49187f..aaea3ed3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -172,6 +172,11 @@ inc/classes/interfaces/filter/class_Filterable.php -text svneol=unset#text/plain inc/classes/interfaces/helper/.htaccess -text svneol=unset#text/plain inc/classes/interfaces/helper/class_HelpableLogin.php -text svneol=unset#text/plain inc/classes/interfaces/helper/class_HelpableTemplate.php -text svneol=unset#text/plain +inc/classes/interfaces/helper/class_Helper.php svneol=native#text/plain +inc/classes/interfaces/helper/login/.htaccess svneol=native#text/plain +inc/classes/interfaces/helper/login/class_HelpableLogin.php svneol=native#text/plain +inc/classes/interfaces/helper/template/.htaccess svneol=native#text/plain +inc/classes/interfaces/helper/template/class_HelpableTemplate.php svneol=native#text/plain inc/classes/interfaces/io/.htaccess -text svneol=unset#text/plain inc/classes/interfaces/io/class_Streamable.php -text svneol=unset#text/plain inc/classes/interfaces/io/file/.htaccess -text svneol=unset#text/plain diff --git a/docs/TODOs.txt b/docs/TODOs.txt index 07e8e2c3..354a8ce2 100644 --- a/docs/TODOs.txt +++ b/docs/TODOs.txt @@ -3,10 +3,10 @@ ./inc/classes/exceptions/main/class_MissingMethodException.php:13: * @todo Try to rewrite user/guest login classes and mark this exception as deprecated ./inc/classes/exceptions/main/class_NoConfigEntryException.php:10: * @todo Rename this class to NoFoundEntryException ./inc/classes/interfaces/class_FrameworkInterface.php:11: * @todo Find a better name for this interface -./inc/classes/main/class_BaseFrameworkSystem.php:1141: * @todo Write a logging mechanism for productive mode -./inc/classes/main/class_BaseFrameworkSystem.php:1155: // @TODO Finish this part! -./inc/classes/main/class_BaseFrameworkSystem.php:159: // @todo Try to clean these constants up -./inc/classes/main/class_BaseFrameworkSystem.php:318: * @todo SearchableResult and UpdateableResult shall have a super interface to use here +./inc/classes/main/class_BaseFrameworkSystem.php:1178: * @todo Write a logging mechanism for productive mode +./inc/classes/main/class_BaseFrameworkSystem.php:1192: // @TODO Finish this part! +./inc/classes/main/class_BaseFrameworkSystem.php:169: // @todo Try to clean these constants up +./inc/classes/main/class_BaseFrameworkSystem.php:355: * @todo SearchableResult and UpdateableResult shall have a super interface to use here ./inc/classes/main/commands/web/class_WebLoginAreaCommand.php:64: * @todo Add some stuff here: Some personal data, app/game related data ./inc/classes/main/commands/web/class_WebProblemCommand.php:58: * @todo 0% done ./inc/classes/main/commands/web/class_WebStatusCommand.php:58: * @todo 0% done @@ -113,6 +113,8 @@ ./inc/classes/exceptions/language/class_MissingLanguageHandlerException.php:2:// @DEPRECATED ./inc/classes/exceptions/main/class_ClassNotFoundException.php:2:// @DEPRECATED ./inc/classes/exceptions/main/class_ConfigEntryNotFoundException.php:2:// @DEPRECATED +./inc/classes/interfaces/helper/class_HelpableLogin.php:2:// @DEPRECATED +./inc/classes/interfaces/helper/class_HelpableTemplate.php:2:// @DEPRECATED ./inc/classes.php:9: * @deprecated ./inc/database.php:10: * @deprecated ./inc/file_io.php:2:// @DEPRECATED diff --git a/inc/classes/interfaces/helper/class_HelpableLogin.php b/inc/classes/interfaces/helper/class_HelpableLogin.php index cf73944c..f551ef47 100644 --- a/inc/classes/interfaces/helper/class_HelpableLogin.php +++ b/inc/classes/interfaces/helper/class_HelpableLogin.php @@ -1,36 +1,3 @@ - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface HelpableLogin extends FrameworkInterface { - /** - * Execute the login request by given response instance. This instance can - * be used for sending cookies or at least the session id out. - * - * @param $responseInstance An instance of a Responseable class - * @return void - */ - function executeLogin (Responseable $responseInstance); -} - -// [EOF] +// @DEPRECATED ?> diff --git a/inc/classes/interfaces/helper/class_HelpableTemplate.php b/inc/classes/interfaces/helper/class_HelpableTemplate.php index 64551ce0..f551ef47 100644 --- a/inc/classes/interfaces/helper/class_HelpableTemplate.php +++ b/inc/classes/interfaces/helper/class_HelpableTemplate.php @@ -1,34 +1,3 @@ - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -interface HelpableTemplate extends FrameworkInterface { - /** - * Flush the content out,e g. to a template variable - * - * @return void - */ - function flushContent (); -} - -// [EOF] +// @DEPRECATED ?> diff --git a/inc/classes/interfaces/helper/class_Helper.php b/inc/classes/interfaces/helper/class_Helper.php new file mode 100644 index 00000000..9eabb07e --- /dev/null +++ b/inc/classes/interfaces/helper/class_Helper.php @@ -0,0 +1,28 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface Helper extends FrameworkInterface { +} + +// [EOF] +?> diff --git a/inc/classes/interfaces/helper/login/.htaccess b/inc/classes/interfaces/helper/login/.htaccess new file mode 100644 index 00000000..3a428827 --- /dev/null +++ b/inc/classes/interfaces/helper/login/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/helper/login/class_HelpableLogin.php b/inc/classes/interfaces/helper/login/class_HelpableLogin.php new file mode 100644 index 00000000..e4058986 --- /dev/null +++ b/inc/classes/interfaces/helper/login/class_HelpableLogin.php @@ -0,0 +1,36 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface HelpableLogin extends Helper { + /** + * Execute the login request by given response instance. This instance can + * be used for sending cookies or at least the session id out. + * + * @param $responseInstance An instance of a Responseable class + * @return void + */ + function executeLogin (Responseable $responseInstance); +} + +// [EOF] +?> diff --git a/inc/classes/interfaces/helper/template/.htaccess b/inc/classes/interfaces/helper/template/.htaccess new file mode 100644 index 00000000..3a428827 --- /dev/null +++ b/inc/classes/interfaces/helper/template/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/inc/classes/interfaces/helper/template/class_HelpableTemplate.php b/inc/classes/interfaces/helper/template/class_HelpableTemplate.php new file mode 100644 index 00000000..f81669d7 --- /dev/null +++ b/inc/classes/interfaces/helper/template/class_HelpableTemplate.php @@ -0,0 +1,34 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface HelpableTemplate extends Helper { + /** + * Flush the content out,e g. to a template variable + * + * @return void + */ + function flushContent (); +} + +// [EOF] +?> diff --git a/inc/classes/main/class_BaseFrameworkSystem.php b/inc/classes/main/class_BaseFrameworkSystem.php index 7d5ac4a8..0eaddce1 100644 --- a/inc/classes/main/class_BaseFrameworkSystem.php +++ b/inc/classes/main/class_BaseFrameworkSystem.php @@ -128,6 +128,16 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { */ private $databaseInstance = null; + /** + * A helper instance for the form + */ + private $helperInstance = null; + + /** + * An instance of a source + */ + private $sourceInstance = null; + /** * The real class name */ @@ -1466,6 +1476,44 @@ class BaseFrameworkSystem extends stdClass implements FrameworkInterface { return $this->socketResource; } + /** + * Setter for helper instance + * + * @param $helperInstance An instance of a helper class + * @return void + */ + protected final function setHelperInstance (Helper $helperInstance) { + $this->helperInstance = $helperInstance; + } + + /** + * Getter for helper instance + * + * @return $helperInstance An instance of a helper class + */ + public final function getHelperInstance () { + return $this->helperInstance; + } + + /** + * Setter for a Sourceable instance + * + * @param $sourceInstance The Sourceable instance + * @return void + */ + protected final function setSourceInstance (Sourceable $sourceInstance) { + $this->sourceInstance = $sourceInstance; + } + + /** + * Getter for a Sourceable instance + * + * @param $sourceInstance The Sourceable instance + */ + protected final function getSourceInstance () { + return $this->sourceInstance; + } + /** * Setter for raw package Data * diff --git a/inc/classes/main/helper/captcha/class_BaseCaptcha.php b/inc/classes/main/helper/captcha/class_BaseCaptcha.php index 72930291..313ef4c6 100644 --- a/inc/classes/main/helper/captcha/class_BaseCaptcha.php +++ b/inc/classes/main/helper/captcha/class_BaseCaptcha.php @@ -22,11 +22,6 @@ * along with this program. If not, see . */ class BaseCaptcha extends BaseHelper { - /** - * A helper instance for the form - */ - private $helperInstance = null; - /** * Protected constructor * @@ -48,25 +43,6 @@ class BaseCaptcha extends BaseHelper { // Get an RNG from factory $this->setRngInstance(ObjectFactory::createObjectByConfiguredName('rng_class', array($extraInstance))); } - - /** - * Setter for helper instance - * - * @param $helperInstance An instance of a helper class - * @return void - */ - protected final function setHelperInstance (HelpableTemplate $helperInstance) { - $this->helperInstance = $helperInstance; - } - - /** - * Getter for helper instance - * - * @return $helperInstance An instance of a helper class - */ - public final function getHelperInstance () { - return $this->helperInstance; - } } // [EOF]