本文整理汇总了PHP中eregi_replace函数的典型用法代码示例。如果您正苦于以下问题:PHP eregi_replace函数的具体用法?PHP eregi_replace怎么用?PHP eregi_replace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eregi_replace函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: kdmail
function kdmail($f)
{
$this->load('lib/phpmailer/class.phpmailer');
$mail = new PHPMailer();
//$body = $mail->getFile(ROOT.'index.php');
//$body = eregi_replace("[\]",'',$body);
$mail->IsSendmail();
// telling the class to use SendMail transport
$mail->From = $f["from"];
$mail->FromName = either($f["fromname"], "noticer");
$mail->Subject = either($f["subject"], "hello");
//$mail->AltBody = either($f["altbody"], "To view the message, please use an HTML compatible email viewer!"); // optional, comment out and test
$mail->AltBody = either($f["msg"], "To view the message, please use an HTML compatible email viewer!");
// optional, comment out and test
if ($f["embedimg"]) {
foreach ($f["embedimg"] as $i) {
//$mail->AddEmbeddedImage(ROOT."public/images/logo7.png","logo","logo7.png");
$mail->AddEmbeddedImage($i[0], $i[1], $i[2]);
}
}
if ($f["msgfile"]) {
$body = $mail->getFile($f["msgfile"]);
$body = eregi_replace("[\\]", '', $body);
if ($f["type"] == "text") {
$mail->IsHTML(false);
$mail->Body = $body;
} else {
$mail->MsgHTML($body);
//."<br><img src= \"cid:logo\">");
}
} else {
if ($f["type"] == "text") {
$mail->IsHTML(false);
$mail->Body = $f["msg"];
} else {
$mail->MsgHTML($f["msg"]);
//."<br><img src= \"cid:logo\">");
}
}
if (preg_match('/\\,/', $f["to"])) {
$emails = explode(",", $f["to"]);
foreach ($emails as $i) {
$mail->AddAddress($i, $f["toname"]);
}
} else {
$mail->AddAddress($f["to"], $f["toname"]);
}
$mail->AddBCC($this->config["site"]["mail"], "bcc");
if ($f["files"]) {
foreach ($f["files"] as $i) {
$mail->AddAttachment($i);
// attachment
}
}
if (!$mail->Send()) {
return "Mailer Error: " . $mail->ErrorInfo;
} else {
return "Message sent!";
}
}
示例2: makeURL
function makeURL($URL)
{
$URL = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:\\+.~#?&//=]+)', '<a href=\\1>\\1</a>', $URL);
$URL = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:\\+.~#?&//=]+)', '<a href=\\1>\\1</a>', $URL);
$URL = eregi_replace('([_\\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\\.)+[a-z]{2,3})', '<a href=\\1>\\1</a>', $URL);
return $URL;
}
示例3: CLT
function CLT($text)
{
//convertir url en titre le plus proche
$text = trim(Str_ireplace(array('c.html', '/Q.', 'p.html', '.sh', "frontalier74", "frontaliers", "creditimmo", "a74", "s74", "xzxzx", "index", "2007", "_vd", "z/", "y/", "http://", ".fr/"), '', $text), '&? ');
$text = Preg_replace("~\\.(shtml|html|php|php5)\$~is", '', $text);
$text = Preg_replace("~^/?s\\.~is", '', $text);
$text = trim(Preg_Replace("~\\.((ch|co|com|fr|org|biz|info)/?|(shtml|html|htm|php|fla|jpg|bg|K)\$)~", ' ', $text));
$text = Str_ireplace(array('%E0', "%e0", 'à'), 'a', $text);
#,"f.","a."
$text = Str_ireplace(array("1rachat-credit", "portail-patrimoine"), 'rachat de credit', $text);
$text = eregi_replace("(c|p)?.html", '', $text);
$text = ereg_replace("_([0-9]+)|^([0-9]+)-|-([0-9]+)|\\.([0-9]+)|\\/([0-9]+)|htm.\$", "", $text);
//Les nombes en trop en paramètres ..
$text = ucfirst(trim(str_replace(array("%20", "-", "_", "/", ".", ",", '|'), " ", $text)));
#ore processing factory
$pos = strpos($text, '?', 0);
if ($pos > 0) {
Preg_match_all("~=([^&]+)~is", $text, $t);
$text = substr($text, 0, $pos);
if ($t) {
$t = $t[1];
$text .= implode(' ', $t);
}
}
return $text;
//Supprimer le Get de merde, non, en aucun cas, on le conserve
}
示例4: OpenTag
/** returnes true if $p_tag is a "<open tag>"
@param $p_tag - tag string
$p_array - tag array;
@return true/false
*/
function OpenTag($p_tag, $p_array)
{
$aTAGS =& $this->aTAGS;
$aHREF =& $this->aHREF;
$maxElem =& $this->iTagMaxElem;
if (!eregi("^<([a-zA-Z1-9]{1,{$maxElem}}) *(.*)>\$", $p_tag, $reg)) {
return false;
}
$p_tag = $reg[1];
$sHREF = array();
if (isset($reg[2])) {
preg_match_all("|([^ ]*)=[\"'](.*)[\"']|U", $reg[2], $out, PREG_PATTERN_ORDER);
for ($i = 0; $i < count($out[0]); $i++) {
$out[2][$i] = eregi_replace("(\"|')", "", $out[2][$i]);
array_push($sHREF, array($out[1][$i], $out[2][$i]));
}
}
if (in_array($p_tag, $aTAGS)) {
return false;
}
//tag already opened
if (in_array("</{$p_tag}>", $p_array)) {
array_push($aTAGS, $p_tag);
array_push($aHREF, $sHREF);
return true;
}
return false;
}
示例5: encode_blast_email
function encode_blast_email($htmlmessage = NULL, $textmessage = NULL, $message_ID, $fields = NULL)
{
if ($this->type != 'Email-Admin') {
if ($htmlmessage) {
$htmlmessage = eregi_replace("\\[USERID\\]", $message_ID, $htmlmessage);
if ($fields) {
$htmlmessage = merge_fields_email($htmlmessage, $message_ID, $fields);
}
$htmlmessage .= '<img src="' . $Web_Site . 'http://localhost/amp/ut.php?m=' . $message_ID . '" width="1" height="1" border="0">';
$htmlmessage .= '<br><p align="center"> To unsubscribe please click <a href="' . $Web_Site . 'http://localhost/amp/unsubscribe.php?m=' . $message_ID . '">here</a></p>';
$htmlmessage = ereg_replace("\\[[A-Z\\. ]+\\]", "", $htmlmessage);
}
if ($textmessage) {
//$textmessage = eregi_replace("\[USERID\]",$message_ID,$textmessage,$fields=NULL);
if ($fields) {
$textmessage = $this->merge_fields_email($textmessage, $message_ID, $fields);
}
$textmessage .= '\\n_____________________________________________________\\n To unsubscribe go to:\\n ' . $Web_Site . '/unsubscribe.php?m=' . $message_ID;
$textmessage = ereg_replace("\\[[A-Z\\. ]+\\]", "", $textmessage);
}
} else {
if ($htmlmessage) {
if ($fields) {
$htmlmessage = merge_fields_email($htmlmessage, $message_ID, $fields);
}
$htmlmessage .= '<img src="' . AMP_SITE_URL . '/ut.php?m=' . $message_ID . '" width="1" height="1" border="0">';
$htmlmessage = ereg_replace("\\[[A-Z\\. ]+\\]", "", $htmlmessage);
}
}
$message = array('html' => $htmlmessage, 'text' => $textmessage);
return $message;
}
示例6: postProcessForm
public function postProcessForm(&$v, &$fb, &$obj)
{
$defs = $obj->_getPluginsDef();
$field = $obj->fb_elementNamePrefix . 'filename' . $obj->fb_elementNamePostfix;
if (!$_FILES[$field]['tmp_name']) {
return;
}
$filename = $obj->getImageName();
if (!$filename) {
$filename = $obj->getOwner()->tableName() . '_' . substr(md5(time() + rand(0, 100)), 0, 10);
}
$obj->filename = $this->_upFile($obj, $obj->fb_elementNamePrefix . 'filename' . $obj->fb_elementNamePostfix, $defs['otfimage']['path'], $filename);
$obj->update();
/**
* Clearing cache for this image
**/
$filename = eregi_replace('(\\.[^\\.]+)$', '', basename($obj->filename));
$cachefolder = APP_ROOT . 'public/' . $defs['otfimage']['cache'] . '/' . $filename . '/';
foreach (FileUtils::getAllFiles($cachefolder) as $file) {
@unlink($file);
}
/**
* Setting as main if none exist
*/
$main = $obj->getOwner();
$mainImg = $main->getMainImage();
if (!$obj->ismain && !$mainImg->pk()) {
$obj->setAsMain();
}
}
示例7: get_news
function get_news()
{
global $DISABLE_NEWS_GETTER;
if ($DISABLE_NEWS_GETTER == 1) {
return "nonews";
}
$news = @file("http://x7chat.com/rss/x7cu.rss");
$news = @implode("", $news);
$news = preg_split("/<news>/", $news);
@array_shift($news);
$newsnum = 0;
$return = array();
foreach ($news as $Key => $val) {
$i++;
$val = eregi_replace("_;", ";", $val);
$val = explode(";", $val);
$return[$newsnum]['title'] = $val[0];
$return[$newsnum]['author'] = $val[1];
$return[$newsnum]['date'] = $val[2];
$return[$newsnum]['icon'] = $val[3];
$return[$newsnum]['body'] = $val[4];
if ($i > 2) {
break;
}
$newsnum++;
}
if (count($return) == 0) {
$return = "nonews";
}
return $return;
}
示例8: formatUrlsInText
function formatUrlsInText($text)
{
//$reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";
$reg_exUrl = "(((f|ht){1}tp://)[-a-zA-Z0-9@:%_\\+.~#?&//=]+)";
if (preg_match_all($reg_exUrl, $text, $matches)) {
preg_match_all($reg_exUrl, $text, $matches);
$usedPatterns = array();
foreach ($matches[0] as $pattern) {
if (!array_key_exists($pattern, $usedPatterns)) {
$usedPatterns[$pattern] = true;
//$text = str_replace($pattern, "<a class=userContent href='".$pattern."' target='_blank'>".$pattern."</a>", $text);
$text = eregi_replace($pattern, "<a class=userContent href='" . $pattern . "' target='_blank'>" . $pattern . "</a>", $text);
}
}
echo nl2br($text);
//return $text;
} else {
$reg_exUrl = "/(^|[^\\/])([a-zA-Z0-9\\-\\_]+\\.[\\S]+(\\b|\$))/";
preg_match_all($reg_exUrl, $text, $matches);
$usedPatterns = array();
foreach ($matches[0] as $pattern) {
if (!array_key_exists($pattern, $usedPatterns)) {
$usedPatterns[$pattern] = true;
$text = str_replace($pattern, "<a class=userContent href='http:\\/\\/" . $pattern . "' target=_blank>" . $pattern . "</a>", $text);
}
}
echo nl2br($text);
//return $text;
}
}
示例9: generateKML
function generateKML($kml_id, $resdir, $getmapurl, $wmsversion, $layername, $layertitle, $north, $south, $east, $west)
{
$getmapurl = eregi_replace("&", "&", $getmapurl);
//$kml_id=md5(uniqid(rand(), true));
if ($h = fopen($resdir . "/" . $kml_id . ".kml", "w+")) {
// $content = $text .chr(13).chr(10); //example for linefeeds
$kml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" . chr(13) . chr(10);
$kml .= "<kml xmlns=\"http://earth.google.com/kml/2.2\">" . chr(13) . chr(10);
$kml .= "<GroundOverlay>" . chr(13) . chr(10);
$kml .= "<name>" . $layertitle . " - www.geoportal.rlp.de</name>" . chr(13) . chr(10);
$kml .= "<Icon>" . chr(13) . chr(10);
$kml .= "<href>" . $getmapurl . "VERSION=" . $wmsversion . "&REQUEST=GetMap&SRS=EPSG:4326&WIDTH=512&HEIGHT=512&LAYERS=" . $layername . "&STYLES=&TRANSPARENT=TRUE&BGCOLOR=0xffffff&FORMAT=image/png&</href>" . chr(13) . chr(10);
//http://www.geoportal.rlp.de/owsproxy/3acc4cc90d02c754c531a9d5fa1b1545/5d38dd28a830f2c4ab97a506225d0a9b?VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG:4326&WIDTH=512&HEIGHT=512&LAYERS=boriweCD01&TRANSPARENT=TRUE&FORMAT=image/jpeg&</href>
$kml .= "<RefreshMode>onExpire</RefreshMode>" . chr(13) . chr(10);
$kml .= "<viewRefreshMode>onStop</viewRefreshMode>" . chr(13) . chr(10);
$kml .= "<viewRefreshTime>1</viewRefreshTime>" . chr(13) . chr(10);
$kml .= "<viewBoundScale>0.87</viewBoundScale>" . chr(13) . chr(10);
$kml .= "</Icon>" . chr(13) . chr(10);
$kml .= "<LatLonBox>" . chr(13) . chr(10);
$kml .= "<north>" . $north . "</north>" . chr(13) . chr(10);
$kml .= "<south>" . $south . "</south>" . chr(13) . chr(10);
$kml .= "<east>" . $east . "</east>" . chr(13) . chr(10);
$kml .= "<west>" . $west . "</west>" . chr(13) . chr(10);
$kml .= "</LatLonBox>" . chr(13) . chr(10);
$kml .= "</GroundOverlay>" . chr(13) . chr(10);
$kml .= "</kml>" . chr(13) . chr(10);
if (!fwrite($h, $kml)) {
#exit;
}
fclose($h);
}
}
示例10: FormatPropertiesForDatabaseInput
function FormatPropertiesForDatabaseInput()
{
$this->Label = FormatStringForDatabaseInput($this->Label);
$this->Contents = FormatStringForDatabaseInput($this->Contents);
$this->Contents = eregi_replace("<textarea>", "<textarea>", $this->Contents);
$this->Contents = eregi_replace("<//textarea>", "</textarea>", $this->Contents);
}
示例11: CCIJavaBabble
function CCIJavaBabble($myoutput)
{
global $mycrypto, $myalpha2, $javaencrypt, $preservehead;
$s = $myoutput;
$s = ereg_replace("\n", "", $s);
if ($preservehead) {
eregi("(^.+<body[^>]*>)", $s, $chunks);
$outputstring = $chunks[1];
eregi_replace($headpart, "", $s);
eregi("(</body[^>]*>.*)", $s, $chunks);
$outputend = $chunks[1];
eregi_replace($footpart, "", $s);
} else {
$outputstring = "";
$outputend = "";
}
if ($javaencrypt) {
$s = strtr($s, $myalpha2, $mycrypto);
$s = rawurlencode($s);
$outputstring .= "<script>var cc=unescape('{$s}'); ";
$outputstring .= "var index = document.cookie.indexOf('" . md5($_SERVER["REMOTE_ADDR"] . $_SERVER["SERVER_ADDR"]) . "='); " . "var aa = '{$myalpha2}'; " . "if (index > -1) { " . " index = document.cookie.indexOf('=', index) + 1; " . " var endstr = document.cookie.indexOf(';', index); " . " if (endstr == -1) endstr = document.cookie.length; " . " var bb = unescape(document.cookie.substring(index, endstr)); " . "} " . "cc = cc.replace(/[{$myalpha2}]/g,function(str) { return aa.substr(bb.indexOf(str),1) }); document.write(cc);";
} else {
$outputstring .= "<script>document.write(unescape('" . rawurlencode($s) . "'));";
}
$outputstring .= "</script><noscript>You must enable Javascript in order to view this webpage.</noscript>" . $outputend;
return $outputstring;
}
示例12: PreLoad
function PreLoad()
{
global $totalresult, $pageno;
if (empty($pageno) || ereg("[^0-9]", $pageno)) {
$pageno = 1;
}
if (empty($totalresult) || ereg("[^0-9]", $totalresult)) {
$totalresult = 0;
}
$this->pageNO = $pageno;
$this->totalResult = $totalresult;
if (isset($this->tpl->tpCfgs['pagesize'])) {
$this->pageSize = $this->tpl->tpCfgs['pagesize'];
}
$this->totalPage = ceil($this->totalResult / $this->pageSize);
if ($this->totalResult == 0) {
//$this->isQuery = true;
//$this->dsql->Execute('mbdl',$this->sourceSql);
//$this->totalResult = $this->dsql->GetTotalRow('mbdl');
$countQuery = eregi_replace("select[ \r\n\t](.*)[ \r\n\t]from", "Select count(*) as dd From", $this->sourceSql);
$row = $this->dsql->GetOne($countQuery);
$this->totalResult = $row['dd'];
$this->sourceSql .= " limit 0," . $this->pageSize;
} else {
$this->sourceSql .= " limit " . ($this->pageNO - 1) * $this->pageSize . "," . $this->pageSize;
}
}
示例13: trim
function SQL语句解析函数_应用于消息中心($sql, $操作记录编号)
{
global $db, $MetaTables;
//判断自定义表是否存在,如果不存在直接返回
//判断是否是联合全操作,是否有子查询,是否用left
//如果有,则表示为手写SQL代码,不是系统生成,则直接返回,不进行过滤
$sql = trim($sql);
//转成小写
$sqllower = strtolower($sqllower);
//缩进空格
$sql = eregi_replace(" ", " ", $sql);
$sql = eregi_replace(" ", " ", $sql);
if (substr($sqllower, 0, strlen("insert into")) == "insert into") {
$sqlArray = explode('insert into', $sql);
$sqlArray = explode('values', $sqlArray[1]);
$sqlArray = explode('(', $sqlArray[0]);
$Tablename = $sqlArray[0];
开始处理消息中心('INSERT', $Tablename, $数据字段, $操作记录编号);
}
if (substr($sqllower, 0, strlen("update")) == "update") {
$sqlArray = explode('update', $sql);
$sqlArray = explode('set', $sqlArray[1]);
$Tablename = TRIM($sqlArray[0]);
}
if (substr($sqllower, 0, strlen("delete from")) == "delete from") {
$sqlArray = explode('delete from', $sql);
$sqlArray = explode(' ', $sqlArray[1]);
$Tablename = TRIM($sqlArray[0]);
开始处理消息中心('DELETE', $Tablename, $数据字段, $操作记录编号);
}
}
示例14: ss_clean
function ss_clean($usertext)
{
// if ( eregi ("\"", $tabletext) ) { echo "<p>Yesss!</p>"; }
// print "<p>Test: ".eregi ( "<script", $tabletext )." (should give ereg output)</p>";
//What about cases where multiple classes?
$pattern = 'spreadsheetCellActive';
$replacement = '';
$usertext = eregi_replace($pattern, $replacement, $usertext);
//remove any auto_locked rows or columns
$pattern = 'auto_locked';
$replacement = '';
$usertext = eregi_replace($pattern, $replacement, $usertext);
//remove any empty class statements
$pattern = 'class="([[:space:]]*)"';
$replacement = '';
$usertext = eregi_replace($pattern, $replacement, $usertext);
//debug regex -- leave here
//echo "pattern: $pattern ".htmlspecialchars(($usertext), ENT_QUOTES);
//die;
// Disable any attempt inject a script into the database
$usertext = eregi_replace("<script", "<DISABLEDscript", $usertext);
// Disable any attempt inject php into the database (ajaxed, but be sure)
$usertext = eregi_replace("<[\\?]", "<DISABLED?", $usertext);
return $usertext;
}
示例15: makeClickableLinks
function makeClickableLinks($text)
{
$text = eregi_replace('(((f|ht){1}tp://)[-a-zA-Z0-9@:%_+.~#?&//=]+)', '<a href="\\1">\\1</a>', $text);
$text = eregi_replace('([[:space:]()[{}])(www.[-a-zA-Z0-9@:%_+.~#?&//=]+)', '\\1<a href="http://\\2">\\2</a>', $text);
$text = eregi_replace('([_.0-9a-z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,3})', '<a href="mailto:\\1">\\1</a>', $text);
return $text;
}