]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/template/announcement/class_XmlAnnouncementTemplateEngine.php
Node-id is now deemed 'classified' because it will be used to create signatures,...
[hub.git] / application / hub / main / template / announcement / class_XmlAnnouncementTemplateEngine.php
index d84ba681c82c566252c7033628a3b131be8be6e5..85ed3b4113835d084daf6074343ec654392b8ff4 100644 (file)
@@ -22,7 +22,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-class XmlAnnouncementTemplateEngine extends BaseTemplateEngine implements CompileableTemplate {
+class XmlAnnouncementTemplateEngine extends BaseTemplateEngine implements CompileableTemplate, Registerable {
        /**
         * Main nodes in the XML tree
         */
@@ -38,7 +38,6 @@ class XmlAnnouncementTemplateEngine extends BaseTemplateEngine implements Compil
                'listener',
                'hub-listener',
                'client-listener',
-               'node-id',
                'node-status',
                'tcp-port',
                'udp-port',
@@ -69,7 +68,6 @@ class XmlAnnouncementTemplateEngine extends BaseTemplateEngine implements Compil
        /**
         * Creates an instance of the class TemplateEngine and prepares it for usage
         *
-        * @param       $applicationInstance    A manageable application
         * @return      $templateInstance               An instance of TemplateEngine
         * @throws      BasePathIsEmptyException                If the provided $templateBasePath is empty
         * @throws      InvalidBasePathStringException  If $templateBasePath is no string
@@ -78,10 +76,13 @@ class XmlAnnouncementTemplateEngine extends BaseTemplateEngine implements Compil
         * @throws      BasePathReadProtectedException  If $templateBasePath is
         *                                                                                      read-protected
         */
-       public static final function createXmlAnnouncementTemplateEngine (ManageableApplication $applicationInstance) {
+       public static final function createXmlAnnouncementTemplateEngine () {
                // Get a new instance
                $templateInstance = new XmlAnnouncementTemplateEngine();
 
+               // Get the application instance from registry
+               $applicationInstance = Registry::getRegistry()->getInstance('app');
+
                // Determine base path
                $templateBasePath = $templateInstance->getConfigInstance()->getConfigEntry('application_base_path') . $applicationInstance->getRequestInstance()->getRequestElement('app') . '/';
 
@@ -105,13 +106,13 @@ class XmlAnnouncementTemplateEngine extends BaseTemplateEngine implements Compil
 
                // Set template extensions
                $templateInstance->setRawTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('raw_template_extension'));
-               $templateInstance->setCodeTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('announcement_template_extension'));
+               $templateInstance->setCodeTemplateExtension($templateInstance->getConfigInstance()->getConfigEntry('node_announcement_template_extension'));
 
                // Absolute output path for compiled templates
                $templateInstance->setCompileOutputPath($templateInstance->getConfigInstance()->getConfigEntry('base_path') . $templateInstance->getConfigInstance()->getConfigEntry('compile_output_path'));
 
                // Init a variable stacker
-               $stackerInstance = ObjectFactory::createObjectByConfiguredName('announcement_stacker_class');
+               $stackerInstance = ObjectFactory::createObjectByConfiguredName('node_announcement_stacker_class');
 
                // Set it
                $templateInstance->setStackerInstance($stackerInstance);
@@ -129,7 +130,7 @@ class XmlAnnouncementTemplateEngine extends BaseTemplateEngine implements Compil
         */
        public function loadAnnouncementTemplate ($template = 'self_announcement') {
                // Set template type
-               $this->setTemplateType($this->getConfigInstance()->getConfigEntry('announcement_template_type'));
+               $this->setTemplateType($this->getConfigInstance()->getConfigEntry('node_announcement_template_type'));
 
                // Load the special template
                $this->loadTemplate($template);
@@ -242,7 +243,6 @@ class XmlAnnouncementTemplateEngine extends BaseTemplateEngine implements Compil
         * @param       $resource               XML parser resource (currently ignored)
         * @param       $characters             Characters to handle
         * @return      void
-        * @todo        Find something useful with this!
         */
        public function characterHandler ($resource, $characters) {
                // Trim all spaces away
@@ -270,7 +270,7 @@ class XmlAnnouncementTemplateEngine extends BaseTemplateEngine implements Compil
                // Is the template dependency set?
                if ((!empty($templateDependency)) && (!isset($this->dependencyContent[$node]))) {
                        // Get a temporay template instance
-                       $templateInstance = ObjectFactory::createObjectByConfiguredName('announcement_template_class', array($this->getApplicationInstance()));
+                       $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance('node_announcement_template_class');
 
                        // Then load it
                        $templateInstance->loadAnnouncementTemplate($templateDependency);
@@ -312,16 +312,6 @@ class XmlAnnouncementTemplateEngine extends BaseTemplateEngine implements Compil
                $this->getStackerInstance()->pushNamed('announcement', 'announcement-data');
        }
 
-       /**
-        * Starts the node id
-        *
-        * @return      void
-        */
-       private function startNodeId () {
-               // Push the node name on the stacker
-               $this->getStackerInstance()->pushNamed('announcement', 'node-id');
-       }
-
        /**
         * Starts the node status
         *
@@ -502,16 +492,6 @@ class XmlAnnouncementTemplateEngine extends BaseTemplateEngine implements Compil
                $this->getStackerInstance()->popNamed('announcement');
        }
 
-       /**
-        * Finishes the node id
-        *
-        * @return      void
-        */
-       private function finishNodeId () {
-               // Pop the last entry
-               $this->getStackerInstance()->popNamed('announcement');
-       }
-
        /**
         * Finishes the announcement data
         *