Jump to content

(Wolf) Export Hook With Version Numbers


Wolfie

Recommended Posts

%7Boption%7D



File Name: (Wolf) Export Hook With Version Numbers

File Submitter: Wolfie

File Submitted: 28 Aug 2012

File Category: Utilities



Recommended for anyone who develops or exports hooks on a regular basis!

Very very simple. When exporting a hook, it will change the default name (which is just the hook's key with '.xml' added to it) to a name that includes the version number(s) in it.

Using this hook as an example, it changes this:

wolf_exportHookWithVersionNumbers.xml

to this:

wolf_exportHookWithVersionNumbers 33000 (v3.3 Alpha).xml

Tested on IPB 3.3.4. May work for 3.0.x to 3.2.x but is untested. (If you use a version prior to 3.3.0, please leave feedback with your version of IPB and whether or not this hook worked for you.)

Features:

  • Adds version number to exported filename automatically.
  • Can update hook files with new header information
  • Header information customizable
  • Choose commenting style of header
  • Change start/end tags for replacement
  • Test mode for file modifications (leaves original files alone)
  • Backup mode available
About the customizable header:
This will let you create a generic header (via settings) to place inside the PHP files associated with the hook. When exporting, it will replace the content located between two tags with an updated header. When dealing with multiple files for one hook, it can be cumbersome to update each file with new version information if only one file was changed. Thus, this feature.

The tags are customizable but are defaulted to '#soh' and '#eoh' for start and end, respectively. Here is an example of how it looks in a php file:

#soh // some customized details // to give generic information // about this file #eoh

<?php






The three lines between the two tags would get replaced with the customized header. This makes it easy to include name, email, copyright info, site, version number, dates, etc.

There is also a '#created' tag, where you can put the unix timestamp for when the hook/file was first created. If it's found, it will use this to set <#thisyear#> to the original year of the hook/file. If the '#created' tag is between the two main tags, it will add it after the end tag.

There are four modes for the header features. If you don't want it to be used at all, just set it to be off. Otherwise I recommend 'test' mode, as that will write out to a new file (same file name with '.NEW' added to it), so you can confirm that it won't corrupt your file during the process. I strongly recommend test mode for a few days and also making a backup of all files. I have tested it and even used it when exporting this hook, but it's "better safe than sorry."


(At some point I will provide a list of tags and what information it supplies. For now, the example in the settings should suffice or you can open the 'export' file and take a peek.)

This hook may not be redistributed, shared, copied, or duplicated in any way without my approval.



here to download this file

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...