Search the Community
Showing results for tags 'php pastebin'.
-
<?php if (!defined("IN_PASTE")) die("Access denied!"); /* Plugin Name: Pastes links Plugin URI: http://php-pastebin.com/ Description: Get link of paste Version: 1.0 Author: Atmoner Author URI: http://php-pastebin.com/ */ //set plugin id as file name of plugin $plugin_id = basename(__FILE__); //some plugin data $data['name'] = "Pastes links"; $data['author'] = "Atmoner"; $data['url'] = "http://php-pastebin.com/"; //register plugin data register_plugin($plugin_id, $data); //Hook , where to execute a function homeblock() add_hook('paste_page','pasteLinks'); // Hook function function pasteLinks() { global $hook,$startUp,$smarty; // Parse code in geshi lib include_once('libs/geshi/geshi.php'); $id = (isset($_GET["id"])?$_GET["id"]:""); $p = $startUp->getPaste($id); if (!empty($p)) { // The Regular Expression filter $reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/"; var_dump($p['paste']); // Check if there is a url in the text if(preg_match($reg_exUrl, $p['paste'], $url)) { $paste = preg_replace( '/(http|ftp)+(s)?\/\/)((\w|\.)+)(\/)?(\S+)?/i', '<br /><a href="\0" target="_BLANK">\0</a>', $p['paste'] ); $smarty->assign("result",$paste); $smarty->assign("getPaste",$p); } else { $geshi = new GeSHi(html_entity_decode(htmlspecialchars_decode($p['paste'])), $p['lang']); $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS); $geshi->set_header_type(GESHI_HEADER_DIV); $geshi->set_case_keywords(GESHI_CAPS_LOWER); $geshi->set_footer_content('Parsed in <TIME> seconds'); $paste = $geshi->parse_code(); $smarty->assign("getPaste",$p); } // Update hits $startUp->updateHits($id); } $hook->remove_addcontentpaste('defaultpaste'); $hook->addcontentPaste('name_content',$paste,2); } Tho' Currently the Code creates spacing with plain text what rolls over the site Any idea on changes to make it compatible with plain text as well ?