The Modified Version of phoogle WordPress plugin - Eliminating the needs of Exec-PHP
Posted by Daniel - 1,226 Views
This is the modified version of phoogle plugin for WordPress. phoogle is a WordPress plugin to display Google Map within your post. The Original version requires the installation of Exec-PHP, another wordpress plugin to allow the execution of php script on your post.
I don’t have Exec-PHP installed and I have no intention to install it, so here it is the result of my modification on the original phoogle. Now it doesn’t require Exec-PHP and I am glad I had it done. Usage Example can be found here.
If you are wondering what kind of modifications I did so phoogle can display the Google Map without the Exec-PHP, here is the explanation:
Lets talk about the spec first. I want to insert a tag inside the post that will look like this:
or
and then I want the phoogle parses that tag to get the latitude and the longitude then it will render the Map inside the post right on the position of the tag.
To do that I had modified the addGeoPoint() function and addAddress() function then created another function that will parse the tag and then returns the post content with the map rendering code inserted.
This is the modified addGeoPoint() function:
The addAddress() function is too long to be placed here (I don’t like long post). If you’re interested you can just check the sourcecode, it’s all there.
This is the function to parse the tag and the one that will trigger the appropriate function:
$content = preg_replace(‘#\[gm point="(.*?):(.*?):(.*?)"\]#sie’, ‘addGeoPoint(\’\\1\’, \’\\2\’, \’\\3\’);’, $content);
$content = preg_replace(‘#\[gm address="(.*?):(.*?)"\]#sie’, ‘addAddress(\’\\1\’, \’\\2\’);’, $content);
return $content;
}
Last step, I put the GetPointThenParseIt($content) function as a filter on the_content section. Don’t forget to check my other post explaining the usage example of phoogle plugin.
Get modifed phoogle plugin (8 KB)
The following posts are programmatically considered as related to the current post by YARPP Plugin:
- The Code Snippet Plugin, my favourite syntax highlighter plugin for WordPress
- SmartImageResizer Plugin, WordPress plugin based on Joe Lencioni’s Smart Image Resizer
- Installing Apache, PHP, MySQL and Wordpress on Windows Platform - Part 1
- Installing Apache, PHP, MySQL and Wordpress on Windows Platform - Part 2
- ContuttoPDF (Wordpress Plugin to convert your Content to PDF)
2 Responses to “The Modified Version of phoogle WordPress plugin - Eliminating the needs of Exec-PHP”
Leave a Reply
Hi, my name is Daniel Nugraha, a single male live on an island called Java, Indonesia. This is the place for me to share my interest in computer programming.
-
Get my Full Feed Here
Comments - Thanks Guys :)
Rangga Kusuma: Gan, Tengkiu buat postingan yang sangat berguna. Kebetulan ada project utk bikin sms gateway, dan converter Agan sangat berguna utk...
Chuck Norton: I actually went ahead & bolted over to Justin’s Get The Image plugin here: http://justintadlock.com/ar...
Chuck Norton: Question: is it possible to insert something like [custfieldimg=”joice1.jpg,15 0,1:1″] into the actual templates instead of...
Therese Lachance: Hi, Any idea how to have ContuttoPDF fetch the correct page language?
tresloukadu: yo how did u fixed when the tags shows <? and it shows < “& l t ; ” ?? please send me an email.














December 23rd, 2008 at 5:19 am
Will your modifications allow me to create maps with multiple points on them?
Dennis Wurster’s last blog post: PayPal vs. Dymo LabelWriter Twin Turbo on the Macintosh
December 23rd, 2008 at 6:07 am
Hi Dennis, No at this time :)