Wordpress Plugin repository HOWTO
June 1, 2008
This is wordpress’s own plugin repository http://wordpress.org/extend/plugins/ .
Once create your id, you can upload your plugin and share with the world. By the way, the plugin must be GPL compliant.
Anyway, I had a hard time uploading my plugin Hana Flv Player because the necessary instructions are there but not in details missing something here and missing something there.
So here is my explanation. I hope that this will help someone too.
First little bit about readme.txt file. You need to create a readme.txt file.
Make sure you define the Stable tag to indicate the current version.
== Hana Flv Player === Contributors: HanaDaddy Donate link: http://www.neox.net/ Tags: FLV, Flash video Requires at least: 2.0 Tested up to: 2.5 Stable tag: 1.5
Below is how to show link (<a href=”">). Link text comes first wrapped with [ ] and link URL goes next with ( ).
[Hana and Sarah's blog](http://www.neox.net/)
In order to use <code></code>, use backtick (`). Therefore `THIS IS CODE` will become <code>THIS IS CODE</code>
If you want to add screeshots, you need to define below section in your readme.txt and place the corresponding image in base trunk folder (refer svn section below for trunk folder . This is basically your plugin local folder to work with svn) The image file name should be in format of screenshot-num.jpg. where num is actual sequentially increasing number. (screenshot-1.jpg, screenshot-2.jpg, screenshot-3.jpg…) Each descriptions go into the readme file with the corresponding number. So the screenshot-1.jpg will be shown with the description “Plugin Settings Page” as it was used with number 1.
== Screenshots == 1. Plugin Settings Page. 2. Adding the hana-flv-player tag in an article. 3. Example video working.
[Perl] Counting referenced array’s length
May 15, 2008
Perl is a powerful script language which is much faster than simple shell script and there are lots of libraries that support virtually every tasks out there. But it is little difficult to learn at first.
One of the weak area of perl is that it doesn’t support multi dimensional array naturally. In order to implement multi dimensional array, you will need to use pointer references. (There may be other ways)
You can referece variable and array by adding "\" backslash in front of the variable.
For example
#create array @a = (1,2,3,4,5,6); #create reference to array a $aref=\@a;
In order to access the variable,you just add the proper symbol in front of the var name.
You will need to use the referenced variable name with the ‘$’ sign intact.
- if you are accessing it as a array , @$ref would refer to the whole array
- if you are accessing the element of the array , $$ref[0] would refer the first element.
#To access the first element of the referenced array print "first element: " . $$arref[1] . "\n"; # this will print '2'
shell script : using sub routine
May 14, 2008
I do lots of unix shell scripting. It’s easy and I can get things done without hassle.
Okay, now this one is maybe easy. But I would like to call a subroutine defined in the library script file, let’s say “lib.inc”.
lib.inc
1 2 3 4 5 6 7 8 9 10 11 12 | #!/bin/sh # This is our real simple sub routine returns 0 value when it is happy is_happy () { #First arg $1, Second arg $2, third $3 ... so on. if [ "$1" = ":)" ] ; then return 0 else return 1 fi } |
You can include the lib.inc by using “.” notation.
When you call the sub routine , call it just like you execute an external command. And the return value can be obtained using $?. Just like getting the return value of external command after execution.
This is main script calling the is_happy().
1 2 3 4 5 6 7 8 9 10 11 12 | #!/bin/sh #including the lib.inc file . lib.inc #calling subroutine is_happy ":)" if [ "$?" -eq 0 ] ; then echo "I am happy!" else echo "No I am not happy!" fi |
That was easy right? There will be more fun on shell scripting at my Coding Haven soon.









