Html::scriptStart PHP Method

scriptStart() static public method

Begin a script block that captures output until HtmlHelper::scriptEnd() is called. This capturing block will capture all output between the methods and create a scriptBlock from it.
static public scriptStart ( )
    static function scriptStart()
    {
        ob_start();
        return null;
    }

Usage Example

示例#1
0
 /**
  * Init the Editor System to a textarea
  *
  * @param $name               name of the html textarea to use
  * @param $rand       rand    of the html textarea to use (if empty no image paste system)(default '')
  * @param $display    boolean display or get js script (true by default)
  *
  * @return nothing
  **/
 static function initEditorSystem($name, $rand = '', $display = true)
 {
     global $CFG_GLPI;
     Html::scriptStart();
     $js = "function waitforpastedata(elem){\n         var _html = elem.innerHTML;\n         if(_html != undefined) {\n            if (_html.match(/<img[^>]+src=\"data:image.*?;base64[^>]*?>/g)){\n               _html = _html.replace(/<img[^>]+src=\"data:image.*?;base64[^>]*?>/g, '');\n               tinyMCE.activeEditor.setContent(_html);\n            } else {\n               that = {\n                  e: elem\n               }\n               that.callself = function () {\n                  waitforpastedata(that.e)\n               }\n               setTimeout(that.callself,20);\n            }\n         }\n      }\n\n      tinyMCE.init({\n         language : '" . $CFG_GLPI["languages"][$_SESSION['glpilanguage']][3] . "',\n         mode : 'exact',\n         browser_spellcheck : true,\n         elements: '{$name}',\n         valid_elements: '*[*]',\n         plugins : 'table,directionality,searchreplace,paste,tabfocus,autoresize',\n         paste_use_dialog : false,\n         paste_auto_cleanup_on_paste : true,\n         paste_convert_headers_to_strong : false,\n         paste_strip_class_attributes : 'all',\n         paste_remove_spans : true,\n         paste_remove_styles : true,\n         paste_retain_style_properties : '',\n         paste_block_drop : true,\n         paste_preprocess : function(pl, o) {\n            _html = o.content;\n            if (_html.match(/<img[^>]+src=\"data:image.*?;base64[^>]*?>/g)){\n               _html = _html.replace(/<img[^>]+src=\"data:image.*?;base64[^>]*?>/g, '');\n               o.content = _html;\n            }\n         },\n         theme : 'advanced',\n         entity_encoding : 'raw', \n         // directionality + search replace plugin\n         theme_advanced_buttons1_add : 'ltr,rtl,search,replace',\n         theme_advanced_toolbar_location : 'top',\n         theme_advanced_toolbar_align : 'left',\n         theme_advanced_statusbar_location : 'none',\n         theme_advanced_resizing : 'true',\n         theme_advanced_buttons1 : 'bold,italic,underline,strikethrough,fontsizeselect,formatselect,separator,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,outdent,indent',\n         theme_advanced_buttons2 : 'forecolor,backcolor,separator,hr,separator,link,unlink,anchor,separator,tablecontrols,undo,redo,cleanup,code,separator',\n         theme_advanced_buttons3 : '',\n         setup : function(ed) {\n         ed.onInit.add(function(ed) {\n            // wake up the autoresize plugin\n            setTimeout(\n               function(){\n                  ed.execCommand('mceAutoResize');\n               }, 1);4204\n               if (tinymce.isIE) {\n                  tinymce.dom.Event.add(ed.getBody(), 'dragenter', function(e) {\n                     return tinymce.dom.Event.cancel(e);\n                  });\n               } else {\n                  tinymce.dom.Event.add(ed.getBody().parentNode, 'drop', function(e) {\n                     tinymce.dom.Event.cancel(e);\n                     tinymce.dom.Event.stop(e);\n                  });\n                  tinymce.dom.Event.add(ed.getBody().parentNode, 'paste', function(e) {\n                     waitforpastedata(ed.getBody());\n                  });\n               }\n            });\n         }\n      });\n   ";
     //         invalid_elements : 'script',
     if ($display) {
         echo Html::scriptBlock($js);
     } else {
         return Html::scriptBlock($js);
     }
 }
All Usage Examples Of Html::scriptStart
Html