Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

22
LINES

< > BotCompany Repo | #1009007 // Integrate Bot

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (1548L/10K/36K).

1  
!7
2  
3  
p {
4  
  S encoding = "ISO-8859-1";
5  
  File outDir = new File("/home/stefan/dev/woody/web-out");
6  
  for (File f : listFiles("/home/stefan/dev/woody/web")) pcall {
7  
    if (!f.getName().endsWith(".php")) continue;
8  
    print(f);
9  
    S text = loadTextFileWithEncoding(f, encoding);
10  
    L<S> lines = lines(text);
11  
    lines.add(0, [[<? include("bot.inc.php"); ?>]]);
12  
    int idx = indexOfElementThatContains(lines, " BOTFELD ");
13  
    if (idx < 0) { print("no botfeld"); continue; }
14  
    assertTrue(cic(lines.get(idx+1), "<TD"));
15  
    int j = indexOfElementThatContains(lines, idx+2, "</TD");
16  
    if (j < 0) { print("huh"); continue; }
17  
    lines.set(idx+1, lines.get(idx+1)
18  
      + "\n<? bot(); ?>" + "\n<!--");
19  
    lines.set(j, "-->" + lines.get(j));
20  
    saveTextFileWithEncoding(new File(outDir, f.getName()), lines(lines), encoding);
21  
  }
22  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1009007
Snippet name: Integrate Bot
Eternal ID of this version: #1009007/3
Text MD5: f4b24000c1d345d478a9b007db111ac3
Transpilation MD5: 1a4c7f8d9f39c20f7e74d752302030d5
Author: stefan
Category: javax / a.i.
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-06-26 17:50:51
Source code size: 852 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 492 / 557
Version history: 2 change(s)
Referenced in: [show references]