eZ Publish  [4.0]
ezxmlinputtype.php
Go to the documentation of this file.
00001 <?php
00002 //
00003 // Definition of eZXMLInputType class
00004 //
00005 // Created on: <06-Nov-2002 14:23:08 wy>
00006 //
00007 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00008 // SOFTWARE NAME: eZ Publish
00009 // SOFTWARE RELEASE: 4.0.x
00010 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS
00011 // SOFTWARE LICENSE: GNU General Public License v2.0
00012 // NOTICE: >
00013 //   This program is free software; you can redistribute it and/or
00014 //   modify it under the terms of version 2.0  of the GNU General
00015 //   Public License as published by the Free Software Foundation.
00016 //
00017 //   This program is distributed in the hope that it will be useful,
00018 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 //   GNU General Public License for more details.
00021 //
00022 //   You should have received a copy of version 2.0 of the GNU General
00023 //   Public License along with this program; if not, write to the Free
00024 //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00025 //   MA 02110-1301, USA.
00026 //
00027 //
00028 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00029 //
00030 
00031 /*! \file ezxmlinputtype.php
00032 */
00033 
00034 /*!
00035   \class eZXMLInputType ezxmlinputtype.php
00036   \ingroup eZDatatype
00037   \brief The class eZXMLInputType does
00038 
00039 */
00040 
00041 class eZXMLInputType
00042 {
00043     /*!
00044      Constructor
00045     */
00046     function eZXMLInputType()
00047     {
00048     }
00049 
00050     static function instance()
00051     {
00052         $ini = eZINI::instance();
00053         $inputHandler = $ini->variable( "ExtensionSettings", "XMLEditor" );
00054 
00055         $isMSIE = false;
00056         $userAgent = eZSys::serverVariable( 'HTTP_USER_AGENT' );
00057         if ( eregi('MSIE[ \/]([0-9\.]+)', $userAgent, $browserInfo ) )
00058         {
00059             $version = $browserInfo[1];
00060             if ( $version >= 5.5 )
00061             {
00062                 $isMSIE = true;
00063             }
00064         }
00065 
00066         $disableExtension = false;
00067         $http = eZHTTPTool::instance();
00068         if ( $http->hasSessionVariable( 'DisableEditorExtension' ) )
00069         {
00070             $disableExtension = true;
00071         }
00072 
00073         $impl = null;
00074         if ( $inputHandler == "standard" )
00075         {
00076             if ( file_exists( "kernel/classes/datatypes/ezxmltext/ezxmlinputhandler.php" ) )
00077             {
00078                 //include_once( "kernel/classes/datatypes/ezxmltext/ezxmlinputhandler.php" );
00079                 $impl = new eZXMLInputHandler();
00080             }
00081         }
00082         elseif ( $inputHandler == "dhtml" )
00083         {
00084             if ( $isMSIE
00085                  and ( file_exists( "extension/xmleditor/" . $inputHandler . "/ezdhtmlinputhandler.php" ) )
00086                  and ( $disableExtension == false ) )
00087             {
00088                 include_once( "extension/xmleditor/" . $inputHandler . "/ezdhtmlinputhandler.php" );
00089                 $impl = new eZDHTMLInputHandler();
00090             }
00091             else
00092             {
00093                 if ( file_exists( "kernel/classes/datatypes/ezxmltext/ezxmlinputhandler.php" ) )
00094                 {
00095                     //include_once( "kernel/classes/datatypes/ezxmltext/ezxmlinputhandler.php" );
00096                     $impl = new eZXMLInputHandler();
00097                 }
00098             }
00099         }
00100         else
00101         {
00102             eZDebug::writeError( "No XML editor available." );
00103         }
00104         return $impl;
00105     }
00106 
00107     function &editorName()
00108     {
00109         $ini = eZINI::instance();
00110         $inputHandler = $ini->variable( "ExtensionSettings", "XMLEditor" );
00111 
00112         $disableExtension = false;
00113 
00114         $isMSIE = false;
00115         $userAgent = eZSys::serverVariable( 'HTTP_USER_AGENT' );
00116         if ( eregi('MSIE[ \/]([0-9\.]+)', $userAgent, $browserInfo ) )
00117         {
00118             $version = $browserInfo[1];
00119             if ( $version >= 5.5 )
00120             {
00121                 $isMSIE = true;
00122             }
00123         }
00124 
00125         $http = eZHTTPTool::instance();
00126         if ( $http->hasSessionVariable( 'DisableEditorExtension' ) )
00127         {
00128             $disableExtension = true;
00129         }
00130 
00131         $editorName = null;
00132         if ( $inputHandler == "standard" )
00133         {
00134             if ( file_exists( "kernel/classes/datatypes/ezxmltext/ezxmlinputhandler.php" ) )
00135             {
00136                 $editorName = "standard";
00137             }
00138         }
00139         elseif ( $inputHandler == "dhtml" )
00140         {
00141             if ( $isMSIE
00142                  and ( file_exists( "extension/xmleditor/" . $inputHandler . "/ezdhtmlinputhandler.php" ) )
00143                  and ( $disableExtension == false ) )
00144             {
00145                 $editorName = "dhtml";
00146             }
00147             else
00148             {
00149                 if ( file_exists( "kernel/classes/datatypes/ezxmltext/ezxmlinputhandler.php" ) )
00150                 {
00151                     $editorName = "standard";
00152                 }
00153             }
00154         }
00155         else
00156         {
00157             eZDebug::writeError( "No XML editor available." );
00158         }
00159         return $editorName;
00160     }
00161 
00162 }
00163 
00164 ?>