Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2004-10-10 20:58:07
- spchampion
- Archived Plugin Author
- Registered: 2004-06-10
- Posts: 62
Plugin decoder
A while back, I wrote a little tool to decode a Textpattern plugin and spit it back out in its original form. I never did publicize it very well in this forum (I mentioned it in a post on the bugs forum), but tmacwrig’s loss of the code for his plugin reminded that I should.
The tool is a command line only tool, and it requires that you have PHP configured to work in a command line environment. Otherwise, it’s pretty simple. Just run it like this:
php plugin_decode.php plugin_file.txt
Easy as pie. Download here.
Offline
#2 2007-08-24 21:36:20
- marios
- Archived Plugin Author
- Registered: 2005-03-12
- Posts: 1,253
Re: Plugin decoder
Is this commandline tool still available ?
I would like to have it, but the link is expired
regards, marios
⌃ ⇧ < ⎋ ⌃ ⇧ >
Offline
Re: Plugin decoder
If not, it should be easy enough to re-create it, assuming the decoding is supposed to produce something compatible with zem_tpl.
Offline
Re: Plugin decoder
As I do not need this very often, I just use this procedure:
- Cut the comments off the plugin code’s head (remove all lines starting with a hash)
- Decode the rest through base64 (available on *nix, downloadable for Widows from various locations, e.g. at John Walker’s site)
base64 -d somefile.txt
This leaves you with a legible representation of the plugins code, help text, and a little PHP-internal glibberish. One could package this in a script suitable for one’s O/S, too, but I just didn’t care enough.
Last edited by wet (2007-08-25 11:12:35)
Offline
Re: Plugin decoder
Or just go halfway the plugin installation in TXP, that shows you the plugin code and help before actually installing it.
Offline
#6 2007-08-25 14:01:04
- marios
- Archived Plugin Author
- Registered: 2005-03-12
- Posts: 1,253
Re: Plugin decoder
Thanks for the infor ruud, wet.
I’ll look into it soon. I want to make it a command for TM, so I can encode and decode both ways, that’s why.
regards.
⌃ ⇧ < ⎋ ⌃ ⇧ >
Offline
Re: Plugin decoder
Ied_plugincomposer will decode plugins. Does it need to be command line tool?
Shoving is the answer – pusher robot
Offline
#8 2007-08-31 10:21:04
- marios
- Archived Plugin Author
- Registered: 2005-03-12
- Posts: 1,253
Re: Plugin decoder
hakjoon wrote:
Ied_plugincomposer will decode plugins. Does it need to be command line tool?
The problem, is it uses another template, not zem_template, which is odd, because the plugin is quite usefull.
I’ve poked around in the source, but in the end I couldn’t figure it out.
regards, marios
⌃ ⇧ < ⎋ ⌃ ⇧ >
Offline
Re: Plugin decoder
That’s true. I actually kind of like the template it generates, but it’s not official.
I wonder how hard it would be to generate the official one as I really like the plugin. I do all my plugin generation through it.
Shoving is the answer – pusher robot
Offline
#10 2007-09-01 23:04:51
- marios
- Archived Plugin Author
- Registered: 2005-03-12
- Posts: 1,253
Re: Plugin decoder
hakjoon wrote:
That’s true. I actually kind of like the template it generates, but it’s not official.
I wonder how hard it would be to generate the official one as I really like the plugin. I do all my plugin generation through it.
Looked at it twice, but couldn’t make any sense out of it. In the meanwhile, I just made a Textmate command. if you have set up your development environment as a TextMate Project ( With both the development Site Root and the dev folder at the root ) you can see both the output and the source Files in your Project Drawer and doing ctrl shift H will copy the file to the outputfolder and the compile it with zem_template ( if zem_tpl is present )
Set Save to nothing
Input to none
and Output to: Show as Tooltip
(Give it a scope of text.html.txp source.php.embedded.block.html , if you are using the txp bundle)
Name it. eg.: Compile plugin.
Here is the code:
# so we can work with relative paths
cd "$TM_DIRECTORY"
FILE="${TM_FILENAME/%.*/}"
cp "$TM_FILEPATH" "$COMPILE_DIR"\/"$FILE".php
php "$COMPILE_DIR$FILE".php > "$COMPILE_DIR$FILE".txt
# force TM to refresh project drawer and open duplicate
{ osascript -e 'tell application "SystemEvents" to activate' \
-e 'tell application "TextMate" to activate'
open -a TextMate "$COMPILE_DIR$FILE".txt; } &>/dev/null &
NOTE: You need to setup the Projectvarible $COMPILE_DIR, for this to work ( with trailing slash )
Now you can just press ctrl shift H , in the plugin that you are coding and it will open the encoded txt file right away.
I also like the the 80char linewrapping much more, that zem_template has.
Submitted my original request here as well.
May be Walker can shed some light on it.
regards, marios
Last edited by marios (2007-09-01 23:31:45)
⌃ ⇧ < ⎋ ⌃ ⇧ >
Offline
#11 2007-09-05 14:23:37
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Plugin decoder
Just run PHP from the commandline.
php upm_textile_toggle.php > upm_textile_toggle.txt
works fine for me
Offline
Re: Plugin decoder
Just run PHP from the commandline.
php upm_textile_toggle.php > upm_textile_toggle.txt
Wasn’t it supposed to be the other way around? From paste version back to PHP? Meaning, a tool that decodes md5 base64 since that is what the template is using.
Last edited by obeewan (2007-10-05 23:23:27)
Plugins:
ob1_advanced_search 1.032b, ob1_search_score 1.0, ob1_pagination 2.5, ob1_title 4.1, ob1_modified 2.1
“Let your plans be dark and as impenetratable as night, and when you move, fall like a thunderbolt.”
— Sun Tzu
Offline