TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Script Giveaway (http://www.talkphp.com/script-giveaway/)
-   -   Simple Wordpress plugin for developers (http://www.talkphp.com/script-giveaway/3540-simple-wordpress-plugin-developers.html)

Enfernikus 10-27-2008 09:24 PM

Simple Wordpress plugin for developers
 
Well I run a blog to talk about things php and my life and views and such things and I sometimes can't be arsed to write a hyperlink to a function on php, so I wrote a quick plugin to do it for me. Thought someone might find it useful.

PHP Code:

<?php

/*

**************************************************************************

Plugin Name:  PHPFunctionsToLinks
Version:      1.0
Description:  For developer's blogs, it turns [function]strstr()[/function] into a hyper link onto php.net's site

**************************************************************************

*/
class BBToPHPLinks
{
    
        function 
BBToPHPLinks()
        {
            
add_action'the_content', array(&$this'ParseBB') );
        }
        
        function 
ParseBB$content )
        {
            
//First check to see if there IS BBCode to parse
            
if( !(stristr($content'[function]') && stristr($content'[/function]')) )
            {
                return 
$content;
            }
            
            
//There is BBCode, parse it all out and return
            
return preg_replace('/\[function\](.*?)\[\\/function\]/si''<a href="http://php.net/$1">$1</a>'$content);
            
        }
}

$BBToPHPLinks = new BBToPHPLinks();

?>


codefreek 10-30-2008 08:51 PM

simple but yeah thank you ;)


All times are GMT. The time now is 01:37 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0