00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 class eZXMLInputType
00042 {
00043
00044
00045
00046 function eZXMLInputType()
00047 {
00048 }
00049
00050 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 ?>