当前位置: 首页>>代码示例>>PHP>>正文


PHP replace函数代码示例

本文整理汇总了PHP中replace函数的典型用法代码示例。如果您正苦于以下问题:PHP replace函数的具体用法?PHP replace怎么用?PHP replace使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了replace函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: CAMOS_report

function CAMOS_report($pid, $encounter, $cols, $id)
{
    $data = formFetch("form_CAMOS", $id);
    if ($data) {
        //echo "(category) ".stripslashes($data['category'])." | ";
        //echo "(subcategory) ".stripslashes($data['subcategory'])." | ";
        //echo "(item) ".stripslashes($data['item']);
        echo "<div class='navigateLink'><a href='" . $GLOBALS['webroot'] . "/interface/forms/CAMOS/rx_print.php?sigline=embossed' target=_new>" . xl('Rx') . "</a>\n";
        echo " | ";
        echo "<a href='" . $GLOBALS['webroot'] . "/interface/forms/CAMOS/rx_print.php?sigline=signed' target=_new>" . xl('Signed Rx') . "</a>\n";
        echo "<br>";
        echo "<a href='" . $GLOBALS['webroot'] . "/interface/forms/CAMOS/rx_print.php?letterhead=true&signer=patient' target=_new>" . xl('Letterhead that patient signs') . "</a>\n";
        echo " | ";
        echo "<a href='" . $GLOBALS['webroot'] . "/interface/forms/CAMOS/rx_print.php?letterhead=true&signer=doctor' target=_new>" . xl('Letterhead that doctor signs') . "</a>\n";
        echo "<br>";
        echo "<a href='" . $GLOBALS['webroot'] . "/interface/forms/CAMOS/notegen.php?pid=" . $pid . "&encounter=" . $encounter . "' target=_new>" . xl('Print This Encounter') . "</a>\n";
        echo " | ";
        echo "<a href='" . $GLOBALS['webroot'] . "/interface/forms/CAMOS/notegen.php' target=_new>" . xl('Print Any Encounter') . "</a></div>\n";
        //    echo "<pre>".wordwrap(stripslashes(content_parser($data['content'])))."</pre><hr>\n";
        echo "<pre>" . wordwrap(stripslashes(replace($pid, $encounter, $data['content']))) . "</pre><hr>\n";
    }
}
开发者ID:katopenzz,项目名称:openemr,代码行数:22,代码来源:report.php

示例2: get_product_list

function get_product_list($select = 0, $ignore = 0)
{
    global $apx, $db, $set;
    $select = (int) $select;
    //Leeres Feld
    $list = '<option value=""></option>';
    //Sprachplatzhalter dropen
    $apx->lang->drop('type', 'products');
    //Auslesen
    $lasttype = '';
    $data = $db->fetch("SELECT id,type,title FROM " . PRE . "_products WHERE active='1' ORDER BY type ASC,title ASC");
    if (count($data)) {
        foreach ($data as $res) {
            ++$i;
            if ($ignore == $res['id']) {
                continue;
            }
            //Gruppieren
            if ($res['type'] != $lasttype) {
                if ($lasttype) {
                    $list .= '</optgroup>';
                }
                $list .= '<optgroup label="' . $apx->lang->get('PRODTYPE_' . strtoupper($res['type'])) . '">';
            }
            $list .= '<option value="' . $res['id'] . '"' . iif($res['id'] == $select, ' selected="selected"') . '>' . replace($res['title']) . '</option>';
            $lasttype = $res['type'];
        }
        if ($lasttype) {
            $list .= '</optgroup>';
        }
    }
    return $list;
}
开发者ID:bigfraggle,项目名称:open-apexx,代码行数:33,代码来源:admin_system.php

示例3: BuildDeleteMissilesForm

 private function BuildDeleteMissilesForm(&$CurrentPlanet)
 {
     global $resource, $lang;
     if ($_POST['form'] == 'missiles') {
         $_POST['502'] = replace('+', '', $_POST['502']);
         $_POST['502'] = replace('-', '', $_POST['502']);
         $_POST['503'] = replace('+', '', $_POST['503']);
         $_POST['503'] = replace('-', '', $_POST['503']);
         $_POST['502'] = intval($_POST['502']);
         $_POST['503'] = intval($_POST['503']);
         if ($_POST['502'] > $CurrentPlanet[$resource[502]]) {
             $_POST['502'] = $CurrentPlanet[$resource[502]];
         }
         if ($_POST['503'] > $CurrentPlanet[$resource[503]]) {
             $_POST['503'] = $CurrentPlanet[$resource[503]];
         }
         doquery("UPDATE {{table}} SET `" . $resource[502] . "` = `" . $resource[502] . "` - " . $_POST['502'] . " , `" . $resource[503] . "` = `" . $resource[503] . "` - " . $_POST['503'] . " WHERE `id` = " . $CurrentPlanet['id'] . ";", 'planets');
         $CurrentPlanet[$resource[502]] -= $_POST['502'];
         $CurrentPlanet[$resource[503]] -= $_POST['503'];
     }
     $RowsTPL = gettemplate('infos/delete_missile_rows');
     $parse['max_mis'] = pretty_number($CurrentPlanet[$resource[44]] * MAX_MIS_PER_LEVEL);
     $parse['int_miss'] = $lang['tech'][502] . ': ' . $CurrentPlanet[$resource[502]];
     $parse['plant_miss'] = $lang['tech'][503] . ': ' . $CurrentPlanet[$resource[503]];
     $Result = parsetemplate($RowsTPL, $parse);
     return $Result;
 }
开发者ID:sonicmaster,项目名称:RPG,代码行数:27,代码来源:class.ShowInfosPage.php

示例4: show

 function show()
 {
     global $set, $db, $apx, $html;
     quicklink('contact.add');
     $orderdef[0] = 'title';
     $orderdef['title'] = array('title', 'ASC', 'COL_TITLE');
     $orderdef['email'] = array('email', 'ASC', 'COL_EMAIL');
     $col[] = array('ID', 3, 'align="center"');
     $col[] = array('COL_TITLE', 50, 'class="title"');
     $col[] = array('COL_EMAIL', 47, '');
     list($count) = $db->first("SELECT count(id) FROM " . PRE . "_contact");
     pages('action.php?action=contact.show&amp;sortby=' . $_REQUEST['sortby'], $count);
     $data = $db->fetch("SELECT id,title,email FROM " . PRE . "_contact " . getorder($orderdef) . getlimit());
     if (count($data)) {
         foreach ($data as $res) {
             ++$i;
             $tabledata[$i]['COL1'] = $res['id'];
             $tabledata[$i]['COL2'] = replace($res['title']);
             $tabledata[$i]['COL3'] = replace($res['email']);
             //Optionen
             if ($apx->user->has_right('contact.edit')) {
                 $tabledata[$i]['OPTIONS'] .= optionHTML('edit.gif', 'contact.edit', 'id=' . $res['id'], $apx->lang->get('CORE_EDIT'));
             }
             if ($apx->user->has_right('contact.del')) {
                 $tabledata[$i]['OPTIONS'] .= optionHTMLOverlay('del.gif', 'contact.del', 'id=' . $res['id'], $apx->lang->get('CORE_DEL'));
             }
         }
     }
     $apx->tmpl->assign('TABLE', $tabledata);
     $html->table($col);
     orderstr($orderdef, 'action.php?action=contact.show');
     save_index($_SERVER['REQUEST_URI']);
 }
开发者ID:bigfraggle,项目名称:open-apexx,代码行数:33,代码来源:admin.php

示例5: get_catlist

 function get_catlist($selected = null)
 {
     global $set, $db, $apx;
     if (is_null($selected)) {
         $selected = $_POST['catid'];
     }
     $catlist = '<option></option>';
     if ($set['news']['subcats']) {
         $data = $this->cat->getTree(array('title', 'open', 'forgroup'));
     } else {
         $data = $db->fetch("SELECT id,title,open,forgroup FROM " . PRE . "_news_cat ORDER BY title ASC");
     }
     if (!count($data)) {
         return '';
     }
     foreach ($data as $res) {
         $allowed = unserialize($res['forgroup']);
         if ($res['level']) {
             $space = str_repeat('&nbsp;&nbsp;', $res['level'] - 1);
         }
         if ($res['open'] && ($res['forgroup'] == 'all' || is_array($allowed) && in_array($apx->user->info['groupid'], $allowed))) {
             $catlist .= '<option value="' . $res['id'] . '" ' . iif($selected == $res['id'], ' selected="selected"') . ' style="color:green;">' . $space . replace($res['title']) . '</option>';
         } else {
             $catlist .= '<option value="" disabled="disabled">' . $space . replace($res['title']) . '</option>';
         }
     }
     return $catlist;
 }
开发者ID:bigfraggle,项目名称:open-apexx,代码行数:28,代码来源:admin_extend.php

示例6: linker

function linker($content, $regex, $url, $max = -1)
{
    $link_replacements = array();
    $other_replacements = array();
    $title_replacements = array();
    preg_match_all('/<(img|input)(.*?) \\/?>/iu', $content, $others);
    if (!empty($others[0])) {
        $other_replacements = gen_replacements($others[0], 'others');
        $content = replace($other_replacements, $content);
    }
    preg_match_all('/<title>(.+)<\\/title>/', $content, $titles);
    if (!empty($titles[0])) {
        $title_replacements = gen_replacements($titles[0], 'others');
        $content = replace($title_replacements, $content);
    }
    preg_match_all('/<a(.*?)href="(.*?)"(.*?)>(.*?)<\\/a>/iu', $content, $links);
    if (!empty($links[0])) {
        $start = count($link_replacements);
        $tmp = gen_replacements($links[0], 'links', $start);
        $content = replace($tmp, $content);
        $link_replacements = array_merge($link_replacements, $tmp);
    }
    $replace = sprintf('$1<a href="%1$s" title="$2">$2</a>$3', $url);
    $content = preg_replace($regex, $replace, $content, $max);
    $content = replace_bak($link_replacements, $content);
    $content = replace_bak($title_replacements, $content);
    $content = replace_bak($other_replacements, $content);
    return $content;
}
开发者ID:thebravoman,项目名称:software_engineering_2014,代码行数:29,代码来源:linker.php

示例7: user_assign_visitors

function user_assign_visitors($object, $id, &$tmpl)
{
    global $apx, $set, $db, $user;
    $userdata = array();
    $data = $db->fetch("SELECT u.userid,u.username,u.groupid,u.realname,u.gender,u.city,u.plz,u.country,u.city,u.lastactive,u.pub_invisible,u.avatar,u.avatar_title,u.custom1,u.custom2,u.custom3,u.custom4,u.custom5,u.custom6,u.custom7,u.custom8,u.custom9,u.custom10 FROM " . PRE . "_user_visits AS v LEFT JOIN " . PRE . "_user AS u USING(userid) WHERE v.object='" . addslashes($object) . "' AND v.id='" . intval($id) . "' AND v.time>='" . (time() - 24 * 3600) . "' ORDER BY u.username ASC");
    if (count($data)) {
        foreach ($data as $res) {
            ++$i;
            $userdata[$i]['ID'] = $res['userid'];
            $userdata[$i]['USERID'] = $res['userid'];
            $userdata[$i]['USERNAME'] = replace($res['username']);
            $userdata[$i]['GROUPID'] = $res['groupid'];
            $userdata[$i]['ONLINE'] = iif(!$res['pub_invisible'] && $res['lastactive'] + $set['user']['timeout'] * 60 >= time(), 1, 0);
            $userdata[$i]['REALNAME'] = replace($res['realname']);
            $userdata[$i]['GENDER'] = $res['gender'];
            $userdata[$i]['CITY'] = replace($res['city']);
            $userdata[$i]['PLZ'] = replace($res['plz']);
            $userdata[$i]['COUNTRY'] = $res['country'];
            $userdata[$i]['LASTACTIVE'] = $res['lastactive'];
            $userdata[$i]['AVATAR'] = $user->mkavatar($res);
            $userdata[$i]['AVATAR_TITLE'] = $user->mkavtitle($res);
            //Custom-Felder
            for ($ii = 1; $ii <= 10; $ii++) {
                $tabledata[$i]['CUSTOM' . $ii . '_NAME'] = $set['user']['cusfield_names'][$ii - 1];
                $tabledata[$i]['CUSTOM' . $ii] = compatible_hsc($res['custom' . $ii]);
            }
        }
    }
    $tmpl->assign('VISITOR', $userdata);
}
开发者ID:bigfraggle,项目名称:open-apexx,代码行数:30,代码来源:functions.php

示例8: get_gallery_list

function get_gallery_list($selected = 0)
{
    global $set, $db, $apx;
    $list = '<option value=""></option>';
    if ($set['gallery']['subgals']) {
        require_once BASEDIR . 'lib/class.recursivetree.php';
        $tree = new RecursiveTree(PRE . '_gallery', 'id');
        $data = $tree->getTree(array('title'), null, "'" . time() . "' BETWEEN starttime AND endtime " . section_filter(true, 'secid'));
        if (!count($data)) {
            return '';
        }
        foreach ($data as $res) {
            $list .= '<option value="' . $res['id'] . '"' . iif($selected == $res['id'], ' selected="selected"') . '>' . str_repeat('&nbsp;&nbsp;', $res['level'] - 1) . replace(strip_tags($res['title'])) . '</option>';
        }
    } else {
        $data = $db->fetch("SELECT id,title FROM " . PRE . "_gallery WHERE '" . time() . "' BETWEEN starttime AND endtime " . section_filter(true, 'secid') . " ORDER BY title ASC");
        if (!count($data)) {
            return '';
        }
        foreach ($data as $res) {
            $list .= '<option value="' . $res['id'] . '"' . iif($selected == $res['id'], ' selected="selected"') . '>' . replace(strip_tags($res['title'])) . '</option>';
        }
    }
    return $list;
}
开发者ID:bigfraggle,项目名称:open-apexx,代码行数:25,代码来源:admin_system.php

示例9: unSpecialStrReplace

function unSpecialStrReplace($content, $startStr)
{
    $content = replace($content, '[$╠п╩РОоичA]$', $startStr . '|');
    $content = replace($content, '[$╠п╩РОоичB]$', $startStr . '-');
    $content = replace($content, '[$╠п╩РОоичC]$', $startStr . ',');
    $content = replace($content, '[$╠п╩РОоичD]$', $startStr . '\'');
    $content = replace($content, '[$╠п╩РОоичE]$', $startStr . '"');
    $unSpecialStrReplace = $content;
    return @$unSpecialStrReplace;
}
开发者ID:313801120,项目名称:AspPhpCms,代码行数:10,代码来源:2015_NewWebFunction.php

示例10: edit1

function edit1($word)
{
    $list1 = delete($word);
    $list2 = insert($word);
    $list3 = transpose($word);
    $list4 = replace($word);
    $union = array_merge($list1, $list2, $list3, $list4);
    $union = array_unique($union);
    return $union;
}
开发者ID:stevencoding,项目名称:search-engine,代码行数:10,代码来源:didyoumean.php

示例11: apply

 private function apply($query, $args)
 {
     $sql = $this->sql;
     return replace(['/\\[(\\w+)\\]/', '/\\$(\\w+)/'], [function ($matches) use($args) {
         $name = $matches[1];
         return isset($args[$name]) ? $args[$name] : $matches[0];
     }, function ($matches) use($sql, $args) {
         $name = $matches[1];
         return isset($args[$name]) ? $sql->quote($args[$name]) : $matches[0];
     }], $query);
 }
开发者ID:nyan-cat,项目名称:easyweb,代码行数:11,代码来源:sql_procedure.php

示例12: gen_msg

function gen_msg($snt)
{
    $names = array_map(function ($id) {
        return get_member_name($id);
    }, $snt["who"]);
    $talk_time = time_of_when($snt["when"]);
    $abs_time = mktime(23, 59, 0, $snt["when"]["month"], $snt["when"]["day"] - 7, $snt["when"]["year"]);
    $memo_time = mktime(9, 0, 0, $snt["when"]["month"], $snt["when"]["day"] - 2, $snt["when"]["year"]);
    $msg = replace(__ROOT__ . "/template/remind.temp", array("names" => implode(', ', $names), "talk_time" => date('Y-m-d', $talk_time), "abs_time" => date('Y-m-d H:i', $abs_time), "memo_time" => date('Y-m-d H:i', $memo_time)));
    return $msg;
}
开发者ID:skcho,项目名称:seminar,代码行数:11,代码来源:remind.php

示例13: gen_talk_msg

function gen_talk_msg($is_fst, $t, $where, $who)
{
    $talk = get_talk_data($t, $who);
    if ($is_fst) {
        $pdf = "";
    } else {
        $date = date('ymd', $t);
        $pdf = "http://ropas.snu.ac.kr/snt_memo2/{$date}_{$who}.pdf";
    }
    $src = array("TITLE" => $talk["title"], "SPEAKER" => get_member_name($who), "TIME" => date('M j (D)', $t) . " at " . date('H:i', $t), "WHERE" => $where, "ABSTRACT" => $talk["abstract"], "PDF" => $pdf);
    return replace(__ROOT__ . "/template/notice.temp", $src);
}
开发者ID:skcho,项目名称:seminar,代码行数:12,代码来源:notice.php

示例14: createTeamData

function createTeamData($res, $parse)
{
    global $apx, $db, $set, $user;
    $userdata = array();
    if ($res['birthday']) {
        $bd = explode('-', $res['birthday']);
        $birthday = intval($bd[0]) . '. ' . getcalmonth($bd[1]) . iif($bd[2], ' ' . $bd[2]);
        if ($bd[2]) {
            $age = date('Y') - $bd[2];
            if (intval(sprintf('%02d%02d', $bd[1], $bd[0])) > intval(date('md'))) {
                $age -= 1;
            }
        }
    }
    $userdata['ID'] = $res['userid'];
    $userdata['USERID'] = $res['userid'];
    $userdata['NAME'] = replace($res['username']);
    $userdata['USERNAME'] = replace($res['username']);
    $userdata['GROUPID'] = $res['groupid'];
    $userdata['EMAIL'] = replace(iif(!$res['pub_hidemail'], $res['email']));
    $userdata['EMAIL_ENCRYPTED'] = replace(iif(!$res['pub_hidemail'], cryptMail($res['email'])));
    $userdata['ONLINE'] = iif(!$res['pub_invisible'] && $res['lastactive'] + $set['user']['timeout'] * 60 >= time(), 1, 0);
    $userdata['ISONLINE'] = $userdata['ONLINE'];
    $userdata['REALNAME'] = replace($res['realname']);
    $userdata['GENDER'] = $res['gender'];
    $userdata['CITY'] = replace($res['city']);
    $userdata['PLZ'] = replace($res['plz']);
    $userdata['COUNTRY'] = $res['country'];
    $userdata['REGTIME'] = $res['reg_time'];
    $userdata['REGDAYS'] = floor((time() - $res['reg_time']) / (24 * 3600));
    $userdata['LASTACTIVE'] = $res['lastactive'];
    $userdata['AVATAR'] = $user->mkavatar($res);
    $userdata['AVATAR_TITLE'] = $user->mkavtitle($res);
    $userdata['BIRTHDAY'] = $birthday;
    $userdata['AGE'] = $age;
    if (in_array($varname . '.ISBUDDY', $parse)) {
        $userdata['ISBUDDY'] = $user->is_buddy($res['userid']);
    }
    //Custom-Felder
    for ($ii = 1; $ii <= 10; $ii++) {
        $userdata['CUSTOM' . $ii . '_NAME'] = $set['user']['cusfield_names'][$ii - 1];
        $userdata['CUSTOM' . $ii] = compatible_hsc($res['custom' . $ii]);
    }
    //Interaktions-Links
    if ($user->info['userid']) {
        $userdata['LINK_SENDPM'] = mklink('user.php?action=newpm&amp;touser=' . $res['userid'], 'user,newpm,' . $res['userid'] . '.html');
        $userdata['LINK_SENDEMAIL'] = mklink('user.php?action=newmail&amp;touser=' . $res['userid'], 'user,newmail,' . $res['userid'] . '.html');
        if (in_array($varname . '.LINK_BUDDY', $parse) && !$user->is_buddy($res['userid'])) {
            $userdata['LINK_BUDDY'] = mklink('user.php?action=addbuddy&amp;id=' . $res['userid'], 'user,addbuddy,' . $res['userid'] . '.html');
        }
    }
    return $userdata;
}
开发者ID:bigfraggle,项目名称:open-apexx,代码行数:53,代码来源:team.php

示例15: gen_msg

function gen_msg($snt, $commenter_info)
{
    $talk_time = time_of_when($snt["when"]);
    $comment_time = mktime(18, 0, 0, $snt["when"]["month"], $snt["when"]["day"] - 1, $snt["when"]["year"]);
    $commenters_msg = "";
    foreach ($commenter_info as $speaker => $commenters) {
        $speaker_name = get_member_name($speaker);
        $commenters_name = array_map("get_member_name", $commenters);
        $commenters_msg .= $speaker_name . ": " . implode(", ", $commenters_name) . "\n";
    }
    $msg = replace(__ROOT__ . "/template/commenter.temp", array("talk_time" => date("Y-m-d H:i", $talk_time), "comment_time" => date("Y-m-d H:i", $comment_time), "chair_info" => get_member_name($snt["chair"]), "commenter_info" => $commenters_msg));
    return $msg;
}
开发者ID:skcho,项目名称:seminar,代码行数:13,代码来源:commenter.php


注:本文中的replace函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。