forked from root/threadr.lostcave.ddnss.de
rewrote some variable names and code style to make more sense to me
parent
523bcf1830
commit
daff15e873
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python2
|
#!/usr/bin/python2
|
||||||
|
|
||||||
print """
|
print """
|
||||||
Variable Grabbler - version 1.0
|
Variable Grabbler - version 1.1
|
||||||
-------------------------------"""
|
-------------------------------"""
|
||||||
|
|
||||||
# definitions
|
# definitions
|
||||||
|
@ -11,17 +11,21 @@ dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
fext = "*.php"
|
fext = "*.php"
|
||||||
|
|
||||||
print "Opening config file..."
|
print "Opening config file..."
|
||||||
config = open(os.path.join(dir, "variable_grabbler.cfg"),"r")
|
config = open("variable_grabbler.cfg","r")
|
||||||
parsed = json.load(config)
|
parsed = json.load(config)
|
||||||
|
|
||||||
for x in parsed:
|
for x in parsed:
|
||||||
for path, dirs, files in os.walk(dir):
|
for path, dirs, files in os.walk(dir):
|
||||||
for fname in fnmatch.filter(files, fext):
|
for fname in fnmatch.filter(files, fext):
|
||||||
fpath = os.path.join(path, fname)
|
fpath = os.path.join(path, fname)
|
||||||
with open(fpath) as f:
|
file_in = open(fpath, "r")
|
||||||
s = f.read()
|
file_content = file_in.read()
|
||||||
s = s.replace("%" + x + "%", parsed[x])
|
file_in.close()
|
||||||
with open(fpath, "w") as f:
|
|
||||||
f.write(s)
|
file_content = file_content.replace("%" + x + "%", parsed[x])
|
||||||
|
|
||||||
|
file_out = open(fpath, "w")
|
||||||
|
file_out.write(file_content)
|
||||||
|
file_out.close()
|
||||||
|
|
||||||
config.close()
|
config.close()
|
||||||
|
|
Loading…
Reference in New Issue