Last active
December 24, 2015 21:09
-
-
Save sapslaj/6863836 to your computer and use it in GitHub Desktop.
MyBB theme decompiler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unless File.exist?("#{File.absolute_path(ARGV[0])}") | |
print "Theme file \"#{File.absolute_path(ARGV[0])}\" does not exist.\n" | |
exit | |
end | |
begin | |
gem "xml-simple" | |
rescue LoadError | |
system("gem install xml-simple") | |
Gem.clear_paths | |
end | |
require 'xmlsimple' | |
theme = XmlSimple.xml_in(File.absolute_path(ARGV[0]) | |
unless Dir.exists?("#{File.absolute_path(theme['name'])}") | |
print "Creating directory #{File.absolute_path(theme['name'])}" | |
Dir.mkdir("#{File.absolute_path(theme['name'])}") | |
end | |
print "Stylesheets\n" | |
theme['stylesheets'][0]['stylesheet'].each do |stylesheet| | |
File.open("#{theme['name']}/#{stylesheet['name']}", 'w') do |f| | |
f.write(stylesheet['content']) | |
end | |
print "#{stylesheet['name']}\n" | |
end | |
print "Templates\n" | |
theme['templates'][0]['template'].each do |template| | |
File.open("#{theme['name']}/#{template['name']}.html", 'w') do |f| | |
f.write(template['content']) | |
end | |
print "#{template['name']}\n" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment