]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/template/connect/class_XmlSelfConnectTemplateEngine.php
Added filter for self-connect attempts
[hub.git] / application / hub / main / template / connect / class_XmlSelfConnectTemplateEngine.php
index 84341daadb58622fa5a92ea62776660cbb8ec502..20d69b3fbadcf8147bf53cee9bb170ddf4493bb1 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 class XmlSelfConnectTemplateEngine extends BaseTemplateEngine implements CompileableTemplate, Registerable {
+       /**
+        * Data nodes
+        */
+       const SELF_CONNECT_DATA_NODE_ID    = 'node-id';
+       const SELF_CONNECT_DATA_SESSION_ID = 'session-id';
+
        /**
         * Main nodes in the XML tree
         */
@@ -33,11 +39,7 @@ class XmlSelfConnectTemplateEngine extends BaseTemplateEngine implements Compile
        /**
         * Sub nodes in the XML tree
         */
-       private $subNodes = array(
-               'self-connect-data',
-               'node-id',
-               'session-id'
-       );
+       private $subNodes = array();
 
        /**
         * Current main node
@@ -57,6 +59,13 @@ class XmlSelfConnectTemplateEngine extends BaseTemplateEngine implements Compile
        protected function __construct () {
                // Call parent constructor
                parent::__construct(__CLASS__);
+
+               // Init array
+               $this->subNodes = array(
+                       'self-connect-data',
+                       self::SELF_CONNECT_DATA_NODE_ID,
+                       self::SELF_CONNECT_DATA_SESSION_ID
+               );
        }
 
        /**
@@ -314,7 +323,7 @@ class XmlSelfConnectTemplateEngine extends BaseTemplateEngine implements Compile
         */
        private function startNodeId () {
                // Push the node name on the stacker
-               $this->getStackerInstance()->pushNamed('self_connect', 'node-id');
+               $this->getStackerInstance()->pushNamed('self_connect', self::SELF_CONNECT_DATA_NODE_ID);
        }
 
        /**
@@ -324,7 +333,7 @@ class XmlSelfConnectTemplateEngine extends BaseTemplateEngine implements Compile
         */
        private function startSessionId () {
                // Push the node name on the stacker
-               $this->getStackerInstance()->pushNamed('self_connect', 'session-id');
+               $this->getStackerInstance()->pushNamed('self_connect', self::SELF_CONNECT_DATA_SESSION_ID);
        }
 
        /**