SHARE
TWEET

Подсветка php-синтаксиса в стандартном редакторе bitrix

a guest Feb 14th, 2012 169 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Подстветка синтаксиса для админки
  2. if ($_SERVER['SCRIPT_NAME']=="/bitrix/admin/fileman_file_edit.php")
  3. {
  4.    AddEventHandler("main", "OnEpilog", "InitPHPHighlight");
  5.    function InitPHPHighlight()
  6.    {
  7.       global $APPLICATION;
  8.       $path = '/js/codemirror';
  9.       $string='
  10.      <link rel="stylesheet" href="'.$path.'/lib/codemirror.css">
  11.      <link rel="stylesheet" href="'.$path.'/lib/util/dialog.css">
  12.      <script src="'.$path.'/lib/codemirror.js"></script>
  13.      <script src="'.$path.'/mode/htmlmixed/htmlmixed.js"></script>
  14.      <script src="'.$path.'/mode/xml/xml.js"></script>
  15.      <script src="'.$path.'/mode/javascript/javascript.js"></script>
  16.      <script src="'.$path.'/mode/css/css.js"></script>
  17.      <script src="'.$path.'/mode/clike/clike.js"></script>
  18.      <script src="'.$path.'/mode/php/php.js"></script>
  19.      <script src="'.$path.'/lib/util/dialog.js"></script>
  20.      <script src="'.$path.'/lib/util/searchcursor.js"></script>
  21.      <script src="'.$path.'/lib/util/search.js"></script>
  22.      <style>
  23.      .CodeMirror-scroll, .CodeMirror-dialog { font: 12px "Monaco", "Lucida Console", "Courier" !important; }
  24.      .CodeMirror-dialog > div { top:auto; bottom:9px; left:-8px; right:-8px;}
  25.      .CodeMirror-scroll { height: 500px; }
  26.      .CodeMirror-selected { background: #c7ddfe !important; }
  27.      .activeline { background: #ffffff !important;}
  28.      </style>
  29.      <script>
  30.      BX.ready(function(){
  31.        //setTimeout( Codemirror_Init, 300);
  32.        Codemirror_Init();
  33.      });
  34.      function Codemirror_Init() {
  35.        var nl=document.getElementsByTagName("textarea");
  36.        var editor = CodeMirror.fromTextArea(nl[0], {
  37.          lineNumbers: true,
  38.          matchBrackets: true,
  39.          mode: "application/x-httpd-php",
  40.          indentUnit: 2,
  41.          indentWithTabs: false,
  42.          tabMode: "indent",
  43.          enterMode: "indent",
  44.          lineWrapping: true,
  45.          onChange: function(){editor.save();},
  46.          onCursorActivity: function() {
  47.            editor.setLineClass(hlLine, null);
  48.            hlLine = editor.setLineClass(editor.getCursor().line, "activeline");
  49.          },
  50.        });
  51.        
  52.        var hlLine = editor.setLineClass(0, "activeline");
  53.      }
  54.      </script>';
  55.      
  56.       $APPLICATION->AddHeadString($string);
  57.    }
  58. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top