We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28788
    • 79 Posts
    Ok here we have it: Totally unsecured and could no doubt be vastly improved... The Ping.fm Snippet!
    It recognizes and creates clickable URLS for links, twitter @usernames and twitter #hashtags.

    <?php
    require_once('assets/libs/docapi/docmanager.class.inc.php');
    $submited=isset($_POST['submit']);
    
    //$body   .= "Method: {$_POST["method"]}\n";
    
    if($_POST["title"] != ""){
      $body .= "Title: {$_POST["title"]}\n";
    }
    
    $body   .= "" .stripslashes($_POST["message"]) ."\n";
    
    if($_POST["location"] != ""){
      $body .= "Location: {$_POST["location"]}\n";
    }
    
    if($_POST["media"] != ""){
        $body .= "\nExtra media variables:\n\n";
        $body .= "Raw Message: {$_POST["raw_message"]}\n";
      $body .= "Media URL: {$_POST["media"]}\n";
    }
     
    if($_POST["trigger"] != ""){
      $body .= "Trigger: {$_POST["trigger"]}\n";
    }
    
    
    if(!$submited) {
    	
    	$body = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)','<a href="\\1">\\1</a>', $body);  
    	$body = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_\+.~#?&//=]+)','\\1<a href="http://\\2">\\2</a>', $body);  
    	$body = eregi_replace('([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})','<a href="mailto:\\1">\\1</a>', $body);
    	$body = eregi_replace('((@)[-a-zA-Z0-9@:%_\+.~#?&//=]+)','<a href="http://twitter.com/\\1">\\1</a>', $body);
    	$body = str_replace('/@','/',$body);
    	$body = eregi_replace('((#)[-a-zA-Z0-9@:%_\+.~#?&//=]+)','<a href="http://search.twitter.com/search?q=%23\\1">\\1</a>', $body);
    	$body = str_replace('%23#','%23',$body);
           
    	$doc = new Document();
    	$doc->Set('pagetitle','*pagetitle');
    	$doc->Set('parent',*parentid);
    	$doc->Set('alias','post-'.date("Y-m-d"));
    	$doc->Set('content',$body);
    	$doc->Set('*tvname','*tvvalue');
    	$doc->Set('template','*templatename');
    	$doc->Set('hidemenu', 0);
    	$doc->Save();
    	
    }
    ?>