- Starting to convert from the fields system to a get-set system
authorRobert Sesek <rsesek@bluestatic.org>
Thu, 12 Oct 2006 04:35:24 +0000 (04:35 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Thu, 12 Oct 2006 04:35:24 +0000 (04:35 +0000)
- Removed the localize API
- Use gettext for internationalized strings

api.php
date.php
db_postgresql.php
dev/changes.txt
functions.php
kernel.php
localize.php [deleted file]
printer.php
printer_css.php
xml.php

diff --git a/api.php b/api.php
index 7388537b0f8375bd39cf326f081c5dadb3bdedb1..786a6f9b21ff29912c95a40ebe8ab327e1765f53 100644 (file)
--- a/api.php
+++ b/api.php
@@ -279,7 +279,7 @@ class API
                        {
                                if ($verify === false)
                                {
-                                       $this->error(sprintf($this->registry->modules['localize']->string('Validation of %1$s failed'), $field));
+                                       $this->error(sprintf(_('Validation of %1$s failed'), $field));
                                }
                                else
                                {
@@ -390,7 +390,7 @@ class API
                $result = $this->registry->modules[ISSO_DB_LAYER]->query_first("SELECT * FROM {$this->prefix}{$this->table} WHERE {$this->condition}");
                if (!$result)
                {
-                       $this->error($this->registry->modules['localize']->string('No records were returned'));
+                       $this->error(_('No records were returned'));
                        return;
                }
                
@@ -520,7 +520,7 @@ class API
                        {
                                if (!isset($this->values["$name"]))
                                {
-                                       $this->error(sprintf($this->registry->modules['localize']->string('Required field %1$s was not set'), $name));
+                                       $this->error(sprintf(_('Required field %1$s was not set'), $name));
                                }
                        }
                        else if ($options[F_REQ] == REQ_SET)
@@ -629,7 +629,7 @@ class API
        {
                if ($this->values["$field"] == 0)
                {
-                       return sprintf($this->registry->modules['localize']->string('The field "%1$s" cannot be zero'), $field);
+                       return sprintf(_('The field "%1$s" cannot be zero'), $field);
                }
                
                return true;
@@ -645,7 +645,7 @@ class API
        {
                if (empty($this->values["$field"]))
                {
-                       return sprintf($this->registry->modules['localize']->string('The field "%1$s" cannot be empty'), $field);
+                       return sprintf(_('The field "%1$s" cannot be empty'), $field);
                }
                
                return true;
index d663412ee514da8c4115f05887d276540f836321..c5b024300e71326570292a60ca2b2af8c8538869 100644 (file)
--- a/date.php
+++ b/date.php
@@ -81,15 +81,6 @@ class Date
        */
        var $offset = 0;
        
-       /**
-       * Fields array that is used in this module
-       * @var  array
-       * @access       private
-       */
-       var $fields = array(
-               'usertz'        => array(REQ_NO,        null,   false)
-       );
-       
        // ###################################################################
        /**
        * Constructor: sets the server's timezone
@@ -112,31 +103,28 @@ class Date
        
        // ###################################################################
        /**
-       * Sets an ISSO field
+       * Sets the user timezone variable
        *
        * @access       public
        *
-       * @param        string  Field name
-       * @param        mixed   Value of the field
+       * @param        integer User time zone
        */
-       function set($name, $value)
+       function setUserTimezone($tz)
        {
-               $this->registry->do_set($name, $value, 'date');
+               $this->usertz = $tz;
        }
        
        // ###################################################################
        /**
-       * Gets an ISSO field
+       * Gets the user timezone variable
        *
        * @access       public
        *
-       * @param        string  Field name
-       *
-       * @return       mixed   Value of the field
+       * @return       integer The user timezone
        */
-       function get($fieldname)
+       function getUserTimezone()
        {
-               return $this->registry->do_get($fieldname, 'date');
+               return $this->usertz;
        }
                
        // ###################################################################
@@ -187,36 +175,36 @@ class Date
        {
                $opt = array();
                
-               $opt['-12']             = $this->registry->modules['localize']->string('(GMT - 12:00) Enitwetok, Kwajalien');
-               $opt['-11']             = $this->registry->modules['localize']->string('(GMT - 11:00) Midway Island, Samoa');
-               $opt['-10']             = $this->registry->modules['localize']->string('(GMT - 10:00) Hawaii');
-               $opt['-9']              = $this->registry->modules['localize']->string('(GMT - 9:00) Alaska');
-               $opt['-8']              = $this->registry->modules['localize']->string('(GMT - 8:00) Pacific Time (US &amp; Canada)');
-               $opt['-7']              = $this->registry->modules['localize']->string('(GMT - 7:00) Mountain Time (US &amp; Canada)');
-               $opt['-6']              = $this->registry->modules['localize']->string('(GMT - 6:00) Central Time (US &amp; Canada)');
-               $opt['-5']              = $this->registry->modules['localize']->string('(GMT - 5:00) Eastern Time (US &amp; Canada)');
-               $opt['-4']              = $this->registry->modules['localize']->string('(GMT - 4:00) Atlantic Time (Canada)');
-               $opt['-3.5']    = $this->registry->modules['localize']->string('(GMT - 3:30) Newfoundland');
-               $opt['-3']              = $this->registry->modules['localize']->string('(GMT - 3:00)  Brazil, Buenos Aires, Georgetown');
-               $opt['-2']              = $this->registry->modules['localize']->string('(GMT - 2:00) Mid-Atlantic, St. Helena');
-               $opt['-1']              = $this->registry->modules['localize']->string('(GMT - 1:00) Azores, Cape Verde Islands');
-               $opt['0']               = $this->registry->modules['localize']->string('(GMT) London, Dublin, Casablanca');
-               $opt['1']               = $this->registry->modules['localize']->string('(GMT + 1:00) Berlin, Madrid, Paris');
-               $opt['2']               = $this->registry->modules['localize']->string('(GMT + 2:00) Kaliningrad, South Africa, Warsaws');
-               $opt['3']               = $this->registry->modules['localize']->string('(GMT + 3:00) Baghdad, Moscow, Nairobi');
-               $opt['3.5']             = $this->registry->modules['localize']->string('(GMT + 3:30) Tehran');
-               $opt['4']               = $this->registry->modules['localize']->string('(GMT + 4:00) Abu Dhabi, Tbilisi, Muscat');
-               $opt['4.5']             = $this->registry->modules['localize']->string('(GMT + 4:30) Kabul');
-               $opt['5']               = $this->registry->modules['localize']->string('(GMT + 5:00) Ekaterinburg, Islamabad, Tashkent');
-               $opt['5.5']             = $this->registry->modules['localize']->string('(GMT + 5:30) Calcutta, Madras, New Delhi');
-               $opt['6']               = $this->registry->modules['localize']->string('(GMT + 6:00) Almaty, Colomba, Dhakra');
-               $opt['7']               = $this->registry->modules['localize']->string('(GMT + 7:00) Bangkok, Hanoi, Jakarta');
-               $opt['8']               = $this->registry->modules['localize']->string('(GMT + 8:00) Beijing, Hong Kong, Singapore');
-               $opt['9']               = $this->registry->modules['localize']->string('(GMT + 9:00) Seoul, Tokyo, Yakutsk');
-               $opt['9.5']             = $this->registry->modules['localize']->string('(GMT + 9:30) Adelaide, Darwin');
-               $opt['10']              = $this->registry->modules['localize']->string('(GMT + 10:00) Guam, Papua New Guinea, Sydney');
-               $opt['11']              = $this->registry->modules['localize']->string('(GMT + 11:00) Magadan, New Caledonia, Solomon Islands');
-               $opt['12']              = $this->registry->modules['localize']->string('(GMT + 12:00) Auckland, Wellington, Fiji');
+               $opt['-12']             = _('(GMT - 12:00) Enitwetok, Kwajalien');
+               $opt['-11']             = _('(GMT - 11:00) Midway Island, Samoa');
+               $opt['-10']             = _('(GMT - 10:00) Hawaii');
+               $opt['-9']              = _('(GMT - 9:00) Alaska');
+               $opt['-8']              = _('(GMT - 8:00) Pacific Time (US &amp; Canada)');
+               $opt['-7']              = _('(GMT - 7:00) Mountain Time (US &amp; Canada)');
+               $opt['-6']              = _('(GMT - 6:00) Central Time (US &amp; Canada)');
+               $opt['-5']              = _('(GMT - 5:00) Eastern Time (US &amp; Canada)');
+               $opt['-4']              = _('(GMT - 4:00) Atlantic Time (Canada)');
+               $opt['-3.5']    = _('(GMT - 3:30) Newfoundland');
+               $opt['-3']              = _('(GMT - 3:00)  Brazil, Buenos Aires, Georgetown');
+               $opt['-2']              = _('(GMT - 2:00) Mid-Atlantic, St. Helena');
+               $opt['-1']              = _('(GMT - 1:00) Azores, Cape Verde Islands');
+               $opt['0']               = _('(GMT) London, Dublin, Casablanca');
+               $opt['1']               = _('(GMT + 1:00) Berlin, Madrid, Paris');
+               $opt['2']               = _('(GMT + 2:00) Kaliningrad, South Africa, Warsaws');
+               $opt['3']               = _('(GMT + 3:00) Baghdad, Moscow, Nairobi');
+               $opt['3.5']             = _('(GMT + 3:30) Tehran');
+               $opt['4']               = _('(GMT + 4:00) Abu Dhabi, Tbilisi, Muscat');
+               $opt['4.5']             = _('(GMT + 4:30) Kabul');
+               $opt['5']               = _('(GMT + 5:00) Ekaterinburg, Islamabad, Tashkent');
+               $opt['5.5']             = _('(GMT + 5:30) Calcutta, Madras, New Delhi');
+               $opt['6']               = _('(GMT + 6:00) Almaty, Colomba, Dhakra');
+               $opt['7']               = _('(GMT + 7:00) Bangkok, Hanoi, Jakarta');
+               $opt['8']               = _('(GMT + 8:00) Beijing, Hong Kong, Singapore');
+               $opt['9']               = _('(GMT + 9:00) Seoul, Tokyo, Yakutsk');
+               $opt['9.5']             = _('(GMT + 9:30) Adelaide, Darwin');
+               $opt['10']              = _('(GMT + 10:00) Guam, Papua New Guinea, Sydney');
+               $opt['11']              = _('(GMT + 11:00) Magadan, New Caledonia, Solomon Islands');
+               $opt['12']              = _('(GMT + 12:00) Auckland, Wellington, Fiji');
                
                return $opt;
        }
index 86a18a4fcb812c11eaeab4eec8c8b60d4b1cf481..afac834d72a75f5e46148e18181020c706e52e1b 100644 (file)
@@ -72,15 +72,6 @@ class DB_PostgreSQL extends DB_Abstract
        */
        var $port = 5432;
        
-       /**
-       * Fields array that is used in this module
-       * @var  array
-       * @access       private
-       */
-       var $fields = array(
-               'port'          => array(REQ_NO,        null,   true)
-       );
-       
        // ###################################################################
        /**
        * Constructor
@@ -101,33 +92,29 @@ class DB_PostgreSQL extends DB_Abstract
        
        // ###################################################################
        /**
-       * Sets an ISSO field
+       * Sets the PGSQL port number
        *
        * @access       public
        *
-       * @param        string  Field name
-       * @param        mixed   Value of the field
+       * @param        integer The port number
        */
-       function set($name, $value)
+       function setPort($port)
        {
-               $this->registry->do_set($name, $value, 'db_postgresql');
+               $this->port = $port;
        }
        
        // ###################################################################
        /**
-       * Gets an ISSO field
+       * Gets the currently-set port number
        *
        * @access       public
        *
-       * @param        string  Field name
-       *
-       * @return       mixed   Value of the field
+       * @return       integer The port number
        */
-       function get($fieldname)
+       function getPort()
        {
-               return $this->registry->do_get($fieldname, 'db_postgresql');
+               return $this->port;
        }
-
        
        // ###################################################################
        /**
index 79ef1158e82001efce4dcaf75c850c759323e3cc..c5ee9a30f4bd1a13a9fba003e35d457638b11a4b 100644 (file)
@@ -1,3 +1,10 @@
+2.1.0
+===============
+- Removed the unspecifc set() functions in place of hard-coded ones
+- ** API BRAEK ** removed the tag handler feature of the XML processor
+- ** API BREAK ** removed the localization module
+- Use gettext internally for strings
+
 2.0.2
 ===============
 - ** API BREAK ** changed Printer->page_start() to be more internationalization-friendly and to use more CSS rather than nested <div>s [printer.php]
index a1f2492fd987f8e94d2b83a470963430488eef22..0aefea5b45a759bf825f96f881a25b01cd0fe589 100644 (file)
@@ -75,17 +75,6 @@ class Functions
        */
        var $bgcolour = '';
        
-       /**
-       * Fields array that is used in this module
-       * @var  array
-       * @access       private
-       */
-       var $fields = array(
-               'cookiepath'    => array(REQ_YES,       null,   true),
-               'cookiedom'             => array(REQ_YES,       null,   true),
-               'cookieexp'             => array(REQ_YES,       null,   true)
-       );
-       
        // ###################################################################
        /**
        * Constructor
@@ -106,31 +95,80 @@ class Functions
        
        // ###################################################################
        /**
-       * Sets an ISSO field
+       * Sets the cookie path
+       *
+       * @access       public
+       *
+       * @param        string  Cookie path
+       */
+       function setCookiePath($path)
+       {
+               $this->cookiepath = $path;
+       }
+       
+       // ###################################################################
+       /**
+       * Gets the cookie path
+       *
+       * @access       public
+       *
+       * @return       string  The cookie path
+       */
+       function getCookiePath()
+       {
+               return $this->cookiepath;
+       }
+       
+       // ###################################################################
+       /**
+       * Sets the cookie domain
+       *
+       * @access       public
+       *
+       * @param        string  Cookie domain
+       */
+       function setCookieDomain($domain)
+       {
+               $this->cookiedom = $domain;
+       }
+       
+       // ###################################################################
+       /**
+       * Gets the cookie domain
        *
        * @access       public
        *
-       * @param        string  Field name
-       * @param        mixed   Value of the field
+       * @return       string  The cookie domain
        */
-       function set($name, $value)
+       function getCookieDomain()
        {
-               $this->registry->do_set($name, $value, 'functions');
+               return $this->cookiedom;
        }
        
        // ###################################################################
        /**
-       * Gets an ISSO field
+       * Sets the cookie expiration time
        *
        * @access       public
        *
-       * @param        string  Field name
+       * @param        integer Cookie expiration time
+       */
+       function setCookiePath($exp)
+       {
+               $this->cookieexp = $exp;
+       }
+       
+       // ###################################################################
+       /**
+       * Gets the cookie expiration time
+       *
+       * @access       public
        *
-       * @return       mixed   Value of the field
+       * @return       integer The cookie expiration time
        */
-       function get($fieldname)
+       function getCookiePath()
        {
-               return $this->registry->do_get($fieldname, 'functions');
+               return $this->cookieexp;
        }
        
        // ###################################################################
@@ -145,8 +183,6 @@ class Functions
        */
        function cookie($name, $value = '', $sticky = true)
        {
-               $this->registry->check_isso_fields(get_class($this));
-               
                // expire the cookie
                if (!$value)
                {
index cab6c2e16283b48f2741ce5d3754badf7a4fc8d1..5a70fca2d3b63d662bbe09f0e80edbfd2be04de4 100644 (file)
@@ -252,8 +252,6 @@ class ISSO
        * @access       private
        */
        var $fields = array(
-               'sourcepath'    => array(REQ_YES,       'fetch_sourcepath', false),
-               'apppath'               => array(REQ_YES,       'fetch_sourcepath',     false),
                'webpath'               => array(REQ_NO,        'fetch_sourcepath',     false),
                'application'   => array(REQ_YES,       null,                           false),
                'appversion'    => array(REQ_NO,        null,                           false),
@@ -281,7 +279,7 @@ class ISSO
                
                // attempt to set the sourcepath
                $path = call_user_func('debug_backtrace');
-               $this->set('sourcepath', str_replace('kernel.php', '', $path[0]['file']));
+               $this->setSourcePath(str_replace('kernel.php', '', $path[0]['file']));
                
                // start input sanitize using variable_order GPC
                if (!defined('ISSO_NO_INPUT_SANITIZE'))
@@ -306,206 +304,54 @@ class ISSO
        
        // ###################################################################
        /**
-       * Sets a specified field in the ISSO. This is used to set all the
-       * required fields that ISSO uses for linking. It replaces the old
-       * method of setting the instance variables directly.
+       * Sets the sourcepath
        *
        * @access       public
        *
-       * @param        string  Field name
-       * @param        mixed   Value of the field
+       * @param        string  Source path
        */
-       function set($fieldname, $value)
+       function setSourcePath($path)
        {
-               $this->do_set($fieldname, $value, null);
+               $this->sourcepath = $this->fetch_sourcepath($path);
        }
        
        // ###################################################################
        /**
-       * Does the actual setting of the field. set() is defined in each
-       * module, but this controls the actual data. This is done so that
-       * there isn't an extra parameter in set() that controls module spaces
+       * Gets the sourcepath
        *
-       * @access       protected
-       *
-       * @param        string  Field name
-       * @param        mixed   Value
-       * @param        string  Module name (as referred to in ISSO->modules[]) to place in
-       */
-       function do_set($fieldname, $value, $module)
-       {
-               if ($module == null)
-               {
-                       $field =& $this->fields["$fieldname"];
-               }
-               else
-               {
-                       $field =& $this->modules["$module"]->fields["$fieldname"];
-               }
-               
-               if (is_array($field))
-               {
-                       if ($field[1] != null)
-                       {
-                               if (preg_match('#^\$(.*)#', $field[1]))
-                               {
-                                       $caller = preg_replace('#^\$(.*)->([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)$#', 'array(&$\1, "\2")', $field[1]);
-                                       eval('$caller = ' . $caller . ';');
-                               }
-                               else
-                               {
-                                       $caller = array(&$this, $field[1]);
-                               }
-                               
-                               $value = call_user_func($caller, $value);
-                       }
-                       
-                       if ($module == null)
-                       {
-                               $this->$fieldname = $value;
-                       }
-                       else
-                       {
-                               $this->modules["$module"]->$fieldname = $value;
-                       }
-                       
-                       $field[2] = true;
-               }
-               else
-               {
-                       trigger_error('Invalid field `' . $module . '.' . $fieldname . '` specified in ISSO->do_set()', E_USER_ERROR);
-               }
-       }
-       
-       // ###################################################################
-       /**
-       * Fetches the value of a field. This is protected because get() should
-       * be defined in each module to make a call to this function.
-       *
-       * @access       protected
+       * @access       public
        *
-       * @param        string  Field name
-       * @param        string  Module name (as referred to in ISSO->modules[]) to fetch from
+       * @return       string  Source path
        */
-       function do_get($fieldname, $module)
+       function getSourcePath()
        {
-               if ($module == null)
-               {
-                       $field =& $this->fields["$fieldname"];
-               }
-               else
-               {
-                       $field =& $this->modules["$module"]->fields["$fieldname"];
-               }
-               
-               if (is_array($field))
-               {
-                       if ($field[2] == false)
-                       {
-                               trigger_error('Field ' . $module . ':: ' . $filedname . ' is not set and therefore cannot be get()', E_USER_ERROR);
-                       }
-                       
-                       if ($module == null)
-                       {
-                               return $this->$fieldname;
-                       }
-                       else
-                       {
-                               return $this->modules["$module"]->$fieldname;
-                       }
-                       
-                       $field[2] = true;
-               }
-               else
-               {
-                       trigger_error('Invalid field `' . $module . '.' . $fieldname . '` specified in ISSO->do_get()', E_USER_ERROR);
-               }
+               return $this->sourcepath;
        }
        
        // ###################################################################
        /**
-       * Returns the value of an ISSO field. You should not access any instance
-       * variables directly, use this instead.
+       * Sets the apppath
        *
        * @access       public
        *
-       * @param        string  Field name
-       *
-       * @return       mixed   Value of the field
+       * @param        string  Application path
        */
-       function get($fieldname)
+       function setAppPath($path)
        {
-               return $this->do_get($fieldname, null);
+               $this->apppath = $this->fetch_sourcepath($path);
        }
        
        // ###################################################################
        /**
-       * Makes sure that all of the required fields in ISSO are set before
-       * any action is done. This will throw an error block describing
-       * the fields that need to be set if any are missing.
+       * Gets the apppath
        *
        * @access       public
        *
-       * @param        string  Module to check for; null is kernel, string is a module name, false is all
-       * @param        bool    Is this a non-error environment that should display all fields?
+       * @return       string  Source path
        */
-       function check_isso_fields($module = null, $called = false)
+       function getAppPath()
        {
-               $missing = array();
-               
-               if ($module === false)
-               {
-                       $modules = $this->show_modules(true);
-               }
-               else if ($module === null)
-               {
-                       $modules = array(get_class($this));
-               }
-               else
-               {
-                       $modules = array($module);
-               }
-               
-               foreach ($modules AS $module)
-               {
-                       if (empty($this->modules["$module"]->fields))
-                       {
-                               continue;
-                       }
-                       
-                       foreach ($this->modules["$module"]->fields AS $name => $field)
-                       {
-                               if ($field[0] == REQ_YES AND $field[2] == false AND $called == false)
-                               {
-                                       $missing[] = $module . ':: ' . $name;
-                               }
-                               else if ($called == true AND $field[2] == false)
-                               {
-                                       $missing[] = $module . ':: ' . $name . ($field[0] == REQ_YES ? ' <strong>(REQUIRED)</strong>' : '');
-                               }
-                       }
-               }
-               
-               if (sizeof($missing) > 0)
-               {
-                       $error = ($called ? 'The following fields are not set:' : 'You are missing required ISSO fields. Please make sure you have set:');
-                       $error .= "\n";
-                       $error .= '<ul>';
-                       
-                       foreach ($missing AS $field)
-                       {
-                               $error .= "\n\t" . '<li>' . $field . '</li>';
-                       }
-                       
-                       $error .= "\n" . '</ul>';
-                       
-                       $this->message(($called ? '' : 'Missing ') . 'Fields', $error, ($called ? 1 : 3));
-                       
-                       if ($called == false)
-                       {
-                               exit;
-                       }
-               }
+               return $this->apppath;
        }
        
        // ###################################################################
diff --git a/localize.php b/localize.php
deleted file mode 100644 (file)
index b0480e2..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-<?php
-/*=====================================================================*\
-|| ###################################################################
-|| # Blue Static ISSO Framework [#]issoversion[#]
-|| # Copyright Â©2002-[#]year[#] Blue Static
-|| #
-|| # 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; version [#]gpl[#] of the License.
-|| #
-|| # 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, write to the Free Software Foundation, Inc.,
-|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-|| ###################################################################
-\*=====================================================================*/
-
-/**
-* Localization system
-* localize.php
-*
-* @package     ISSO
-*/
-
-/**
-* Localization System
-*
-* This framework handles localization. Localization in new ISSO
-* applications is done through this framework. Nearly all strings
-* are passed to the string function, which looks up the string in
-* a .strings.xml file during runtime. Before release, mkstrings
-* creates the .strings.xml file for translators. Common strings
-* can be accessed through the get lex function which calls a string
-* based on unique identifier; this is useful for commonly used strings.
-*
-* Constants:
-*              ISSO_LOCALIZE_DEBUG - Wrap all strings in markup to show that it
-*                                                              has been localized
-*
-* @author              Blue Static
-* @copyright   Copyright Â©2002 - [#]year[#], Blue Static
-* @version             $Revision$
-* @package             ISSO
-* 
-*/
-class Localize
-{
-       /**
-       * Framework registry object
-       * @var  object
-       * @access       private
-       */
-       var $registry = null;
-       
-       /**
-       * Localization table
-       * @var  array
-       * @access       private
-       */
-       var $localtable = array();
-       
-       /**
-       * The lex lookup table
-       * @var  array
-       * @access       private
-       */
-       var $lextable = array();
-       
-       // ###################################################################
-       /**
-       * Constructor
-       */
-       function __construct(&$registry)
-       {
-               $this->registry =& $registry;
-       }
-       
-       // ###################################################################
-       /**
-       * (PHP 4) Constructor
-       */
-       function Localize(&$registry)
-       {
-               $this->__construct($registry);
-       }
-       
-       // ###################################################################
-       /**
-       * Initializes the localization system with a table
-       *
-       * @access       public
-       *
-       * @param        array   Localization table
-       */
-       function init_with_table($table)
-       {
-               $this->localtable = $table;
-       }
-       
-       // ###################################################################
-       /**
-       * Returns a localized string from the table
-       *
-       * @access       public
-       *
-       * @param        string  Text to localize
-       *
-       * @return       string  Localized string
-       */
-       function string($key)
-       {
-               if (defined('ISSO_LOCALIZE_DEBUG'))
-               {
-                       return '[@&quot;' . $key . '&quot;]';
-               }
-               
-               if (isset($this->localtable["$key"]))
-               {
-                       return $this->localtable["$key"];
-               }
-               
-               return $key;
-       }
-       
-       // ###################################################################
-       /**
-       * Returns a value from the lex table for a specific code
-       *
-       * @access       public
-       *
-       * @param        string  Lex code
-       *
-       * @return       string  Localized string
-       */
-       function getlex($code)
-       {
-               if (defined('ISSO_LOCALIZE_DEBUG'))
-               {
-                       return '&[@&quot;' . $code . '&quot;]';
-               }
-               
-               if (isset($this->lextable["$code"]))
-               {
-                       return $this->lextable["$code"];
-               }
-               
-               trigger_error('Lex code `' . $code . '` did not appear in the lex table', E_USER_ERROR);
-       }
-       
-       // ###################################################################
-       /**
-       * Sets a value in the lex table for easy access of strings
-       * that are commonly used
-       *
-       * @access       public
-       *
-       * @param        string  Lex code
-       * @param        string  Text equiv
-       */
-       function setlex($code, $value)
-       {
-               if (isset($this->lextable["$code"]))
-               {
-                       trigger_error('Cannot set lex `' . $code . '` : value already exists', E_USER_ERROR);
-               }
-               
-               $this->lextable["$code"] = $value;
-       }
-}
-
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
-?>
\ No newline at end of file
index b738a1981afd21187147185630009847ee232887..a3c7a470fe5f0a86f2dd991f6826f7161bedc39b 100644 (file)
@@ -89,15 +89,6 @@ class Printer
        */
        var $language = array('langcode' => 'en_US', 'direction' => 'ltr', 'charset' => 'utf-8');
        
-       /**
-       * Fields array that is used in this module
-       * @var  array
-       * @access       private
-       */
-       var $fields = array(
-               'realm'                         => array(REQ_YES,       null,   false)
-       );
-       
        // ###################################################################
        /**
        * Constructor
@@ -118,16 +109,28 @@ class Printer
        
        // ###################################################################
        /**
-       * Sets an ISSO field
+       * Sets the realm
+       *
+       * @access       public
+       *
+       * @param        string  Realm
+       */
+       function setRealm($realm)
+       {
+               $this->realm = $realm;
+       }
+       
+       // ###################################################################
+       /**
+       * Gets the realm
        *
        * @access       public
        *
-       * @param        string  Field name
-       * @param        mixed   Value of the field
+       * @return       string  Realm
        */
-       function set($name, $value)
+       function getRealm()
        {
-               $this->registry->do_set($name, $value, 'printer');
+               return $this->realm;
        }
        
        // ###################################################################
@@ -156,21 +159,6 @@ class Printer
                $this->language = $lang;
        }
        
-       // ###################################################################
-       /**
-       * Gets an ISSO field
-       *
-       * @access       public
-       *
-       * @param        string  Field name
-       *
-       * @return       mixed   Value of the field
-       */
-       function get($fieldname)
-       {
-               return $this->registry->do_get($fieldname, 'printer');
-       }
-       
        // ###################################################################
        /**
        * Creates a redirect to another page; constructs the header and footer
@@ -241,7 +229,7 @@ JS;
                        define('ISSO_PRINTER_NO_NAVIGATION', 1);
                }
                
-               $this->page_start($this->registry->modules['localize']->string('Redirect'));
+               $this->page_start(_('Redirect'));
                
                if ($postvars)
                {
@@ -255,7 +243,7 @@ JS;
                        $this->form_end();
                }
                
-               $redir = sprintf($this->registry->modules['localize']->string('Please wait to be redirected. If you are not redirected in a few seconds, click <a href="%1$s">here</a>.'), $location);
+               $redir = sprintf(_('Please wait to be redirected. If you are not redirected in a few seconds, click <a href="%1$s">here</a>.'), $location);
                $override = false;
                if ($message == null)
                {
@@ -268,7 +256,7 @@ JS;
                        $override = true;
                }
                
-               $this->page_message($this->registry->modules['localize']->string('Redirect'), $showmessage, $override);
+               $this->page_message(_('Redirect'), $showmessage, $override);
                
                $this->page_code($js);
                
@@ -290,8 +278,8 @@ JS;
                        define('ISSO_PRINTER_NO_NAVIGATION', 1);
                }
                
-               $this->page_start($this->registry->modules['localize']->string('Error'));
-               $this->page_message($this->registry->modules['localize']->string('Error'), $message);
+               $this->page_start(_('Error'));
+               $this->page_message(_('Error'), $message);
                $this->page_end();
                
                exit;
@@ -323,7 +311,7 @@ JS;
                        return;
                }
                
-               $title = sprintf($this->registry->modules['localize']->string('%1$s - %2$s - %3$s'), $this->registry->application, $this->realm, $actiontitle);
+               $title = sprintf(_('%1$s - %2$s - %3$s'), $this->registry->application, $this->realm, $actiontitle);
                
                echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
                echo "<html xml:lang=\"" . $this->language['langcode'] . "\" lang=\"" . $this->language['langcode'] . "\" dir=\"" . $this->language['direction'] . "\">\n<head>";
@@ -434,7 +422,7 @@ JS;
                        define('ISSO_PRINTER_NO_NAVIGATION', 1);
                }
                
-               $this->page_start($this->registry->modules['localize']->string('Confirm'));
+               $this->page_start(_('Confirm'));
                
                $this->form_start($location, $action);
                foreach ($params AS $key => $value)
@@ -443,9 +431,9 @@ JS;
                }
                
                $this->table_start(true, '75%');
-               $this->table_head($this->registry->modules['localize']->string('Confirm'), 1);
+               $this->table_head(_('Confirm'), 1);
                $this->row_span("<blockquote>$message</blockquote>", ':swap:', 'left', 1);
-               $this->row_submit('<input type="button" class="button" name="no" value="  ' . $this->registry->modules['localize']->string('No') . '  " onclick="history.back(1); return false;" />', $this->registry->modules['localize']->string('Yes'), '');
+               $this->row_submit('<input type="button" class="button" name="no" value="  ' . _('No') . '  " onclick="history.back(1); return false;" />', _('Yes'), '');
                $this->table_end();
                
                $this->form_end();
@@ -813,7 +801,7 @@ JS;
        {
                if ($submit === ':save:')
                {
-                       $submit = "  " . $this->registry->modules['localize']->string('Submit') . "  ";
+                       $submit = "  " . _('Submit') . "  ";
                }
                else
                {
@@ -822,7 +810,7 @@ JS;
                
                if ($reset === ':reset:')
                {
-                       $reset = "  " . $this->registry->modules['localize']->string('Reset') . "  ";
+                       $reset = "  " . _('Reset') . "  ";
                }
                else
                {
@@ -892,7 +880,7 @@ JS;
                
                $listitem = array();
                
-               $this->row_text($label, "\n<select class=\"button\" name=\"$name\"" . (($is_jump) ? " onchange=\"this.form.submit();\"" : '') . ">$optionlist\n</select>" . (($is_jump) ? "\n<input type=\"submit\" class=\"button\" value=\"  " . $this->registry->modules['localize']->string('Go') . "  \" accesskey=\"g\" />" : '') . "\n", $colspan);
+               $this->row_text($label, "\n<select class=\"button\" name=\"$name\"" . (($is_jump) ? " onchange=\"this.form.submit();\"" : '') . ">$optionlist\n</select>" . (($is_jump) ? "\n<input type=\"submit\" class=\"button\" value=\"  " . _('Go') . "  \" accesskey=\"g\" />" : '') . "\n", $colspan);
        }
        
        // ###################################################################
@@ -932,7 +920,7 @@ JS;
        */
        function row_yesno($label, $name, $value, $colspan = 2)
        {
-               $this->row_text($label, "<input type=\"radio\" name=\"$name\" value=\"1\"" . (($value) ? ' checked="checked"' : '') . " /> " . $this->registry->modules['localize']->string('Yes') . " <input type=\"radio\" name=\"$name\" value=\"0\"" . ((!$value) ? ' checked="checked"' : '') . "  /> " . $this->registry->modules['localize']->string('No'), $colspan);
+               $this->row_text($label, "<input type=\"radio\" name=\"$name\" value=\"1\"" . (($value) ? ' checked="checked"' : '') . " /> " . _('Yes') . " <input type=\"radio\" name=\"$name\" value=\"0\"" . ((!$value) ? ' checked="checked"' : '') . "  /> " . _('No'), $colspan);
        }
 }
 
index 4c2278065670c6d9f962dd76a15357c520f07a32..83759ac059fcd2fc6c70351a3b6cf62f214a31b5 100644 (file)
@@ -216,23 +216,23 @@ class Printer_CSS
                $print =& $this->registry->modules['printer'];
                
                $lang = array(
-                       'standard_css_attributes'       => $this->registry->modules['localize']->string('Standard CSS Attributes'),
-                       'extra_css_attributes'          => $this->registry->modules['localize']->string('Extra CSS Attributes'),
+                       'standard_css_attributes'       => _('Standard CSS Attributes'),
+                       'extra_css_attributes'          => _('Extra CSS Attributes'),
                        
-                       'links_normal'                          => $this->registry->modules['localize']->string('Normal CSS Links'),
-                       'links_visited'                         => $this->registry->modules['localize']->string('Visited CSS Links'),
-                       'links_hover'                           => $this->registry->modules['localize']->string('Hover CSS Links'),
+                       'links_normal'                          => _('Normal CSS Links'),
+                       'links_visited'                         => _('Visited CSS Links'),
+                       'links_hover'                           => _('Hover CSS Links'),
                        
-                       'background'                            => $this->registry->modules['localize']->string('Background'),
-                       'font_color'                            => $this->registry->modules['localize']->string('Font Color'),
-                       'font_style'                            => $this->registry->modules['localize']->string('Font Style'),
-                       'font_size'                                     => $this->registry->modules['localize']->string('Font Size'),
-                       'font_family'                           => $this->registry->modules['localize']->string('Font Family'),
+                       'background'                            => _('Background'),
+                       'font_color'                            => _('Font Color'),
+                       'font_style'                            => _('Font Style'),
+                       'font_size'                                     => _('Font Size'),
+                       'font_family'                           => _('Font Family'),
                        
-                       'text_decoration'                       => $this->registry->modules['localize']->string('Text Decoration'),
+                       'text_decoration'                       => _('Text Decoration'),
                        
-                       'css_selector'                          => $this->registry->modules['localize']->string('CSS Selector'),
-                       'save_css'                                      => $this->registry->modules['localize']->string('Save CSS')
+                       'css_selector'                          => _('CSS Selector'),
+                       'save_css'                                      => _('Save CSS')
                );
                
                foreach ($this->descriptors AS $descriptor)
diff --git a/xml.php b/xml.php
index 478e7cb2ed2276df6531c547675b5a19bb7b1505..ebe613743b6e94b8a77afe3478122fa55d285ee2 100644 (file)
--- a/xml.php
+++ b/xml.php
@@ -88,15 +88,6 @@ class XML
        */
        var $result = array();
        
-       /**
-       * Fields array that is used in this module
-       * @var  array
-       * @access       private
-       */
-       var $fields = array(
-               'taghandler'    => array(REQ_NO,        null,   false)
-       );
-       
        // ###################################################################
        /**
        * Constructor
@@ -115,35 +106,6 @@ class XML
                $this->__construct($registry);
        }
        
-       // ###################################################################
-       /**
-       * Sets an ISSO field
-       *
-       * @access       public
-       *
-       * @param        string  Field name
-       * @param        mixed   Value of the field
-       */
-       function set($name, $value)
-       {
-               $this->registry->do_set($name, $value, 'xml');
-       }
-       
-       // ###################################################################
-       /**
-       * Gets an ISSO field
-       *
-       * @access       public
-       *
-       * @param        string  Field name
-       *
-       * @return       mixed   Value of the field
-       */
-       function get($fieldname)
-       {
-               return $this->registry->do_get($fieldname, 'xml');
-       }
-       
        // ###################################################################
        /**
        * Parse an XML file
@@ -271,20 +233,6 @@ class XML
                // attach data to the node
                if (($this->cdata = trim($this->cdata)) != '')
                {
-                       // if we have a data handler, operate it now
-                       if (isset($this->taghandler["$name"]))
-                       {
-                               $this->registry->debug("handler: " . $this->taghandler["$name"]);
-                               if (function_exists($this->taghandler["$name"]))
-                               {
-                                       $this->cdata = $this->taghandler["$name"]($this->cdata, $this);
-                               }
-                               else
-                               {
-                                       trigger_error('Could not find the function [' . $this->taghandler["$name"] . '()] for the XML tag "' . $name . '"', E_USER_ERROR);
-                               }
-                       }
-                       
                        $this->attribs['value'] = $this->cdata;
                }