The Modified Version of phoogle WordPress plugin - Eliminating the needs of Exec-PHP
Posted by Daniel - 2,397 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)
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
Popular Entries
- Passing arguments to your VB.NET console application
- Microsoft Excel Import External Data Problem: When Microsoft Query doesn’t recognize some of your parameters
- Resize Image or Crop Image with Joe Lencioni’s Smart Image Resizer, WordPress Setup
- How to Get User Input and allowing more than 256 characters to be entered on .NET Console Application
- ASCII To PDU Converter (Convert ASCII to PDU and vice versa)
- ConsoleProgressBar - Simple Progress Bar Function for your VB.Net Console Application
- An example: Using CPort Delphi Component to read data from your cellphone
- Runtime-Form-Creation. Automatically creating child forms in a Delphi MDI application with a component array
- CPort Component (Serial port interface component for Delphi)
- SmartImageResizer Plugin, WordPress plugin based on Joe Lencioni’s Smart Image Resizer













