Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/wp-file-.../lib/codemirr.../mode/asterisk
File: asterisk.js
// CodeMirror, copyright (c) by Marijn Haverbeke and others
[0] Fix | Delete
// Distributed under an MIT license: http://codemirror.net/LICENSE
[1] Fix | Delete
[2] Fix | Delete
/*
[3] Fix | Delete
* =====================================================================================
[4] Fix | Delete
*
[5] Fix | Delete
* Filename: mode/asterisk/asterisk.js
[6] Fix | Delete
*
[7] Fix | Delete
* Description: CodeMirror mode for Asterisk dialplan
[8] Fix | Delete
*
[9] Fix | Delete
* Created: 05/17/2012 09:20:25 PM
[10] Fix | Delete
* Revision: none
[11] Fix | Delete
*
[12] Fix | Delete
* Author: Stas Kobzar (stas@modulis.ca),
[13] Fix | Delete
* Company: Modulis.ca Inc.
[14] Fix | Delete
*
[15] Fix | Delete
* =====================================================================================
[16] Fix | Delete
*/
[17] Fix | Delete
[18] Fix | Delete
(function(mod) {
[19] Fix | Delete
if (typeof exports == "object" && typeof module == "object") // CommonJS
[20] Fix | Delete
mod(require("../../lib/codemirror"));
[21] Fix | Delete
else if (typeof define == "function" && define.amd) // AMD
[22] Fix | Delete
define(["../../lib/codemirror"], mod);
[23] Fix | Delete
else // Plain browser env
[24] Fix | Delete
mod(CodeMirror);
[25] Fix | Delete
})(function(CodeMirror) {
[26] Fix | Delete
"use strict";
[27] Fix | Delete
[28] Fix | Delete
CodeMirror.defineMode("asterisk", function() {
[29] Fix | Delete
var atoms = ["exten", "same", "include","ignorepat","switch"],
[30] Fix | Delete
dpcmd = ["#include","#exec"],
[31] Fix | Delete
apps = [
[32] Fix | Delete
"addqueuemember","adsiprog","aelsub","agentlogin","agentmonitoroutgoing","agi",
[33] Fix | Delete
"alarmreceiver","amd","answer","authenticate","background","backgrounddetect",
[34] Fix | Delete
"bridge","busy","callcompletioncancel","callcompletionrequest","celgenuserevent",
[35] Fix | Delete
"changemonitor","chanisavail","channelredirect","chanspy","clearhash","confbridge",
[36] Fix | Delete
"congestion","continuewhile","controlplayback","dahdiacceptr2call","dahdibarge",
[37] Fix | Delete
"dahdiras","dahdiscan","dahdisendcallreroutingfacility","dahdisendkeypadfacility",
[38] Fix | Delete
"datetime","dbdel","dbdeltree","deadagi","dial","dictate","directory","disa",
[39] Fix | Delete
"dumpchan","eagi","echo","endwhile","exec","execif","execiftime","exitwhile","extenspy",
[40] Fix | Delete
"externalivr","festival","flash","followme","forkcdr","getcpeid","gosub","gosubif",
[41] Fix | Delete
"goto","gotoif","gotoiftime","hangup","iax2provision","ices","importvar","incomplete",
[42] Fix | Delete
"ivrdemo","jabberjoin","jabberleave","jabbersend","jabbersendgroup","jabberstatus",
[43] Fix | Delete
"jack","log","macro","macroexclusive","macroexit","macroif","mailboxexists","meetme",
[44] Fix | Delete
"meetmeadmin","meetmechanneladmin","meetmecount","milliwatt","minivmaccmess","minivmdelete",
[45] Fix | Delete
"minivmgreet","minivmmwi","minivmnotify","minivmrecord","mixmonitor","monitor","morsecode",
[46] Fix | Delete
"mp3player","mset","musiconhold","nbscat","nocdr","noop","odbc","odbc","odbcfinish",
[47] Fix | Delete
"originate","ospauth","ospfinish","osplookup","ospnext","page","park","parkandannounce",
[48] Fix | Delete
"parkedcall","pausemonitor","pausequeuemember","pickup","pickupchan","playback","playtones",
[49] Fix | Delete
"privacymanager","proceeding","progress","queue","queuelog","raiseexception","read","readexten",
[50] Fix | Delete
"readfile","receivefax","receivefax","receivefax","record","removequeuemember",
[51] Fix | Delete
"resetcdr","retrydial","return","ringing","sayalpha","saycountedadj","saycountednoun",
[52] Fix | Delete
"saycountpl","saydigits","saynumber","sayphonetic","sayunixtime","senddtmf","sendfax",
[53] Fix | Delete
"sendfax","sendfax","sendimage","sendtext","sendurl","set","setamaflags",
[54] Fix | Delete
"setcallerpres","setmusiconhold","sipaddheader","sipdtmfmode","sipremoveheader","skel",
[55] Fix | Delete
"slastation","slatrunk","sms","softhangup","speechactivategrammar","speechbackground",
[56] Fix | Delete
"speechcreate","speechdeactivategrammar","speechdestroy","speechloadgrammar","speechprocessingsound",
[57] Fix | Delete
"speechstart","speechunloadgrammar","stackpop","startmusiconhold","stopmixmonitor","stopmonitor",
[58] Fix | Delete
"stopmusiconhold","stopplaytones","system","testclient","testserver","transfer","tryexec",
[59] Fix | Delete
"trysystem","unpausemonitor","unpausequeuemember","userevent","verbose","vmauthenticate",
[60] Fix | Delete
"vmsayname","voicemail","voicemailmain","wait","waitexten","waitfornoise","waitforring",
[61] Fix | Delete
"waitforsilence","waitmusiconhold","waituntil","while","zapateller"
[62] Fix | Delete
];
[63] Fix | Delete
[64] Fix | Delete
function basicToken(stream,state){
[65] Fix | Delete
var cur = '';
[66] Fix | Delete
var ch = stream.next();
[67] Fix | Delete
// comment
[68] Fix | Delete
if(ch == ";") {
[69] Fix | Delete
stream.skipToEnd();
[70] Fix | Delete
return "comment";
[71] Fix | Delete
}
[72] Fix | Delete
// context
[73] Fix | Delete
if(ch == '[') {
[74] Fix | Delete
stream.skipTo(']');
[75] Fix | Delete
stream.eat(']');
[76] Fix | Delete
return "header";
[77] Fix | Delete
}
[78] Fix | Delete
// string
[79] Fix | Delete
if(ch == '"') {
[80] Fix | Delete
stream.skipTo('"');
[81] Fix | Delete
return "string";
[82] Fix | Delete
}
[83] Fix | Delete
if(ch == "'") {
[84] Fix | Delete
stream.skipTo("'");
[85] Fix | Delete
return "string-2";
[86] Fix | Delete
}
[87] Fix | Delete
// dialplan commands
[88] Fix | Delete
if(ch == '#') {
[89] Fix | Delete
stream.eatWhile(/\w/);
[90] Fix | Delete
cur = stream.current();
[91] Fix | Delete
if(dpcmd.indexOf(cur) !== -1) {
[92] Fix | Delete
stream.skipToEnd();
[93] Fix | Delete
return "strong";
[94] Fix | Delete
}
[95] Fix | Delete
}
[96] Fix | Delete
// application args
[97] Fix | Delete
if(ch == '$'){
[98] Fix | Delete
var ch1 = stream.peek();
[99] Fix | Delete
if(ch1 == '{'){
[100] Fix | Delete
stream.skipTo('}');
[101] Fix | Delete
stream.eat('}');
[102] Fix | Delete
return "variable-3";
[103] Fix | Delete
}
[104] Fix | Delete
}
[105] Fix | Delete
// extension
[106] Fix | Delete
stream.eatWhile(/\w/);
[107] Fix | Delete
cur = stream.current();
[108] Fix | Delete
if(atoms.indexOf(cur) !== -1) {
[109] Fix | Delete
state.extenStart = true;
[110] Fix | Delete
switch(cur) {
[111] Fix | Delete
case 'same': state.extenSame = true; break;
[112] Fix | Delete
case 'include':
[113] Fix | Delete
case 'switch':
[114] Fix | Delete
case 'ignorepat':
[115] Fix | Delete
state.extenInclude = true;break;
[116] Fix | Delete
default:break;
[117] Fix | Delete
}
[118] Fix | Delete
return "atom";
[119] Fix | Delete
}
[120] Fix | Delete
}
[121] Fix | Delete
[122] Fix | Delete
return {
[123] Fix | Delete
startState: function() {
[124] Fix | Delete
return {
[125] Fix | Delete
extenStart: false,
[126] Fix | Delete
extenSame: false,
[127] Fix | Delete
extenInclude: false,
[128] Fix | Delete
extenExten: false,
[129] Fix | Delete
extenPriority: false,
[130] Fix | Delete
extenApplication: false
[131] Fix | Delete
};
[132] Fix | Delete
},
[133] Fix | Delete
token: function(stream, state) {
[134] Fix | Delete
[135] Fix | Delete
var cur = '';
[136] Fix | Delete
if(stream.eatSpace()) return null;
[137] Fix | Delete
// extension started
[138] Fix | Delete
if(state.extenStart){
[139] Fix | Delete
stream.eatWhile(/[^\s]/);
[140] Fix | Delete
cur = stream.current();
[141] Fix | Delete
if(/^=>?$/.test(cur)){
[142] Fix | Delete
state.extenExten = true;
[143] Fix | Delete
state.extenStart = false;
[144] Fix | Delete
return "strong";
[145] Fix | Delete
} else {
[146] Fix | Delete
state.extenStart = false;
[147] Fix | Delete
stream.skipToEnd();
[148] Fix | Delete
return "error";
[149] Fix | Delete
}
[150] Fix | Delete
} else if(state.extenExten) {
[151] Fix | Delete
// set exten and priority
[152] Fix | Delete
state.extenExten = false;
[153] Fix | Delete
state.extenPriority = true;
[154] Fix | Delete
stream.eatWhile(/[^,]/);
[155] Fix | Delete
if(state.extenInclude) {
[156] Fix | Delete
stream.skipToEnd();
[157] Fix | Delete
state.extenPriority = false;
[158] Fix | Delete
state.extenInclude = false;
[159] Fix | Delete
}
[160] Fix | Delete
if(state.extenSame) {
[161] Fix | Delete
state.extenPriority = false;
[162] Fix | Delete
state.extenSame = false;
[163] Fix | Delete
state.extenApplication = true;
[164] Fix | Delete
}
[165] Fix | Delete
return "tag";
[166] Fix | Delete
} else if(state.extenPriority) {
[167] Fix | Delete
state.extenPriority = false;
[168] Fix | Delete
state.extenApplication = true;
[169] Fix | Delete
stream.next(); // get comma
[170] Fix | Delete
if(state.extenSame) return null;
[171] Fix | Delete
stream.eatWhile(/[^,]/);
[172] Fix | Delete
return "number";
[173] Fix | Delete
} else if(state.extenApplication) {
[174] Fix | Delete
stream.eatWhile(/,/);
[175] Fix | Delete
cur = stream.current();
[176] Fix | Delete
if(cur === ',') return null;
[177] Fix | Delete
stream.eatWhile(/\w/);
[178] Fix | Delete
cur = stream.current().toLowerCase();
[179] Fix | Delete
state.extenApplication = false;
[180] Fix | Delete
if(apps.indexOf(cur) !== -1){
[181] Fix | Delete
return "def strong";
[182] Fix | Delete
}
[183] Fix | Delete
} else{
[184] Fix | Delete
return basicToken(stream,state);
[185] Fix | Delete
}
[186] Fix | Delete
[187] Fix | Delete
return null;
[188] Fix | Delete
}
[189] Fix | Delete
};
[190] Fix | Delete
});
[191] Fix | Delete
[192] Fix | Delete
CodeMirror.defineMIME("text/x-asterisk", "asterisk");
[193] Fix | Delete
[194] Fix | Delete
});
[195] Fix | Delete
[196] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function