本文整理汇总了PHP中quotemeta函数的典型用法代码示例。如果您正苦于以下问题:PHP quotemeta函数的具体用法?PHP quotemeta怎么用?PHP quotemeta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了quotemeta函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: explodeinfo
function explodeinfo($info, $item)
{
if (!is_array($item)) {
$item = explodeopts($item);
}
$ln = explode("\n", preg_replace('/\\r/', '', $info));
$n = 0;
$result = array();
while ($a = array_shift($ln)) {
$lab = $item[$n];
if (preg_match("/^" . str_replace("/", '\\/', quotemeta($lab)) . ": (.*)\$/", $a, $m)) {
$v = isset($m[1]) ? $m[1] : "";
if ($m[1] == "\\") {
$v = "";
$x = "/^" . (isset($item[$n + 1]) ? quotemeta($item[$n + 1]) : "\n") . ": /";
while (count($ln) && !preg_match($x, $ln[0])) {
$a = array_shift($ln);
$v .= $v ? "\n{$a}" : $a;
}
}
$result[$lab] = "{$v}";
} else {
global $xoopsConfig;
if (isset($xoopsConfig['debug']) && $xoopsConfig['debug']) {
echo "<span class='error'>" . $item[$n] . ",{$a}</span>";
}
break;
}
$n++;
}
return $result;
}
示例2: search_font
function search_font($str, $stx, $tag_open = '<code>', $tag_close = '</code>')
{
if ($str == '') {
return FALSE;
}
if ($stx != '') {
// 문자앞에 \ 를 붙인다.
$src = array('/', '|');
$dst = array('\\/', '\\|');
if (!trim($stx)) {
return $str;
}
// 검색어 전체를 공란으로 나눈다
$s = explode(' ', $stx);
// '/(검색1|검색2)/i' 와 같은 패턴을 만듬
$pattern = '';
$bar = '';
foreach ($s as $row) {
if (trim($row) == '') {
continue;
}
$tmp_str = str_replace($src, $dst, quotemeta($row));
$pattern .= $bar . $tmp_str . '(?![^<]*>)';
$bar = '|';
}
return preg_replace('/(' . $pattern . ')/i', $tag_open . '\\1' . $tag_close, $str);
// 기존
// return preg_replace('/('.preg_quote($stx, '/').')/i', $tag_open."\\1".$tag_close, $str);
}
return $str;
}
示例3: index
function index()
{
$this->mongo_db->select_db("Users");
$this->mongo_db->select_collection("Account");
$sSearch = (string) trim("@");
$sSearch = quotemeta($sSearch);
$regex = "/{$sSearch}/i";
$filter = $this->mongo_db->regex($regex);
$pencarian = array('email' => $filter);
$datapage['datalist'] = $this->mongo_db->find($pencarian, 0, 0, array('email' => 1));
$datapage['tagcontent'] = $this->tambahan_fungsi->global_get_random(15);
$css = array(base_url() . "resources/css/jqueryui.css", base_url() . "resources/plugin/codeprettifier/prettify.css", base_url() . "resources/plugin/form-toggle/toggles.css", base_url() . "resources/plugin/pines-notify/jquery.pnotify.default.css", base_url() . "resources/plugin/bootstrap3-dialog-master/bootstrap-dialog.css", base_url() . "resources/plugin/form-select2/select2.css", base_url() . "resources/plugin/form-multiselect/css/multi-select.css");
$js = array(base_url() . "resources/plugin/jquery-validation-1.10.0/lib/jquery.metadata.js", base_url() . "resources/plugin/jquery-validation-1.10.0/dist/jquery.validate.js", base_url() . "resources/plugin/bootstrap3-dialog-master/bootstrap-dialog.js", base_url() . "resources/plugin/pines-notify/jquery.pnotify.min.js", base_url() . "resources/plugin/form-multiselect/js/jquery.multi-select.min.js", base_url() . "resources/plugin/quicksearch/jquery.quicksearch.min.js", base_url() . "resources/plugin/form-typeahead/typeahead.min.js", base_url() . "resources/plugin/form-select2/select2.min.js", base_url() . "resources/plugin/form-autosize/jquery.autosize-min.js");
$this->template_admin->header_web(TRUE, "Broadcast Email", $css, $js, TRUE, "");
$this->template_admin->headerbar();
$this->template_admin->top_menu(TRUE);
$this->load->view("panel/panel_utama");
$this->template_admin->panel_menu();
$this->load->view("panel/panel_content");
$this->load->view("panel/panel_wrap");
$this->load->view("sendemail_view", $datapage);
$this->load->view("panel/close_div");
$this->load->view("panel/close_div");
$this->template_admin->addresbar();
$this->load->view("panel/close_div");
$this->template_admin->footer();
}
示例4: export
public function export(TableInterface $table, $toDirectory, $baseFileName = null)
{
if ($baseFileName === null) {
$baseFileName = $table->getName() . '-structure.sql';
}
exec($this->mysqlDumpPath . 'mysqldump -u' . $this->username . ' -p' . quotemeta($this->password) . ' ' . $this->database . ' ' . $table . ' --no-data --create-options --disable-keys --lock-tables --skip-add-drop-table --skip-comments > "' . $toDirectory . '/' . $baseFileName . '"');
}
示例5: people
function people($start = 0)
{
$keysearch = isset($_GET['keysearch']) ? $_GET['keysearch'] : "";
$output['success'] = FALSE;
$ceklogin = $this->cek_session->islogin();
$output['logged_in'] = $ceklogin;
$output['follow'] = FALSE;
$output['message'] = "No user found";
if ($ceklogin) {
$this->mongo_db->select_db("Users");
$this->mongo_db->select_collection("Properties");
$pencarian = array();
if ($keysearch != "") {
$sSearch = (string) trim($keysearch);
$sSearch = quotemeta($sSearch);
$regex = "/{$sSearch}/i";
$filter = $this->mongo_db->regex($regex);
$pencarian = array('fullname' => $filter);
}
$tempdata = $this->mongo_db->find($pencarian, (int) $start, 100, array('join_date' => 1));
$output['count'] = (int) $this->mongo_db->count2($pencarian);
if ($tempdata) {
$output['success'] = TRUE;
$listdata = array();
foreach ($tempdata as $dt) {
$tempdtuser = $this->m_userdata->user_account_byid($dt["lilo_id"]);
$listdata[] = array("_id" => $dt['lilo_id'], "avatarname" => $dt['avatarname'], "fullname" => $dt['fullname'], "picture" => $dt['picture'], "email" => $tempdtuser['email'], "username" => $tempdtuser['username'], "fb_id" => $tempdtuser['username'], "twitter_id" => $tempdtuser['username']);
}
$output['data'] = $listdata;
}
}
echo json_encode($output);
}
示例6: generateApacheRewrite
/**
* @param string $from
* @param string $to
* @param bool $show_comments
* @return string
*/
function generateApacheRewrite($from, $to, $show_comments)
{
$parsedFrom = parse_url(trim($from));
$parsedTo = parse_url(trim($to));
$line_output = "";
if ($show_comments) {
$line_output .= PHP_EOL . '# ' . $_POST['type'] . ' --- ' . $from . ' => ' . $to . PHP_EOL;
}
if ($parsedFrom['host'] != $parsedTo['host']) {
$line_output .= 'RewriteCond %{HTTP_HOST} ^' . quotemeta($parsedFrom['host']) . '$';
$line_output .= PHP_EOL;
$prefix = $parsedTo['scheme'] . '://' . $parsedTo['host'] . '/';
} else {
$prefix = '/';
}
$explodedQuery = explode('&', $parsedFrom['query']);
foreach ($explodedQuery as $qs) {
if (strlen($qs) > 0) {
$line_output .= 'RewriteCond %{QUERY_STRING} (^|&)' . quotemeta($qs) . '($|&)';
$line_output .= PHP_EOL;
}
}
$line_output .= 'RewriteRule ^' . quotemeta(ltrim($parsedFrom['path'], '/')) . '$ ' . $prefix . ltrim($parsedTo['path'], '/') . '?' . $parsedTo['query'] . ($_POST['type'] == 'Rewrite' ? '&%{QUERY_STRING}' : ' [L,R=301]');
$line_output .= PHP_EOL;
return $line_output;
}
示例7: pattern_output
function pattern_output()
{
$subpattern_array = array('/%title%/', '/%date%/', '/%link%/', '/%excerpt(\\d*)%/');
$var_array = array(quotemeta($this->ptitle), $this->datum, $this->plink, $this->excerpt);
$r = preg_replace($subpattern_array, $var_array, $this->pattern);
return stripslashes($r);
}
示例8: replace_smileys
function replace_smileys($text, $calledfrom = 'root')
{
if ($calledfrom == 'admin') {
$prefix = '.';
$prefix2 = '../';
} else {
$prefix = '';
$prefix2 = '';
}
$filepath = $prefix . "./images/smileys/";
unset($files);
if ($dh = opendir($filepath)) {
while ($file = readdir($dh)) {
if (preg_match("/\\.gif/si", $file)) {
$files[] = $file;
}
}
}
$replacements_1 = array();
$replacements_2 = array();
foreach ($files as $file) {
$smiley = explode(".", $file);
$replacements_1[] = ':' . quotemeta($smiley[0]) . ':';
$replacements_2[] = '[SMILE=smile]' . $prefix2 . 'images/smileys/' . $file . '[/SMILE]';
}
$ergebnis = safe_query("SELECT * FROM `" . PREFIX . "smileys`");
while ($ds = mysql_fetch_array($ergebnis)) {
$replacements_1[] = $ds['pattern'];
$replacements_2[] = '[SMILE=' . $ds['alt'] . ']' . $prefix2 . 'images/smileys/' . $ds['name'] . '[/SMILE]';
}
$text = strtr($text, array_combine($replacements_1, $replacements_2));
return $text;
}
示例9: fromFileScan
/**
* @ignore
*/
public static function fromFileScan($uPattern)
{
$tSep = quotemeta(DIRECTORY_SEPARATOR);
$tPos = strrpos($uPattern, $tSep);
if ($tSep !== '/' && $tPos === false) {
$tSep = '/';
$tPos = strrpos($uPattern, $tSep);
}
if ($tPos !== false) {
$tPattern = substr($uPattern, $tPos + strlen($tSep));
$tPath = substr($uPattern, 0, $tPos + strlen($tSep));
} else {
$tPath = $uPattern;
$tPattern = "";
}
$tTemp = new static();
$tHandle = new \DirectoryIterator($tPath);
$tPatExists = strlen($uPattern) > 0;
for (; $tHandle->valid(); $tHandle->next()) {
if (!$tHandle->isFile()) {
continue;
}
$tFile = $tHandle->current();
if ($tPatExists && !fnmatch($tPattern, $tFile)) {
continue;
}
$tTemp->add(simplexml_load_file($tPath . $tFile));
}
return $tTemp;
}
示例10: list_data
function list_data()
{
$this->mongo_db->select_db("Users");
$this->mongo_db->select_collection("Account");
$awal = isset($_GET['iDisplayStart']) ? (int) $_GET['iDisplayStart'] : 0;
$limit = isset($_GET['iDisplayLength']) ? (int) $_GET['iDisplayLength'] : 10;
$sEcho = isset($_GET['sEcho']) ? (int) $_GET['sEcho'] : 1;
$sSearch = isset($_GET['sSearch']) ? $_GET['sSearch'] : "";
$sSortDir_0 = isset($_GET['sSortDir_0']) ? $_GET['sSortDir_0'] : "asc";
$pencarian = array();
if ($sSearch != "") {
$sSearch = (string) trim($sSearch);
$sSearch = quotemeta($sSearch);
$regex = "/{$sSearch}/i";
$filter = $this->mongo_db->regex($regex);
$pencarian = array('username' => $filter);
}
$data = $this->mongo_db->find($pencarian, $awal, $limit, array('username' => 1));
$output = array("sEcho" => intval($sEcho), "iTotalRecords" => $this->mongo_db->count($pencarian), "iTotalDisplayRecords" => $this->mongo_db->count($pencarian), "aaData" => array());
$i = $awal + 1;
foreach ($data as $dt) {
$actionmenu = $this->template_icon->detail_onclick("getdatauserval('" . $dt['_id'] . "')", "", 'Set Value', "bullet_go.png", "", "linkdetail");
$output['aaData'][] = array($i, $dt['username'], $dt['email'], $actionmenu);
$i++;
}
if (IS_AJAX) {
echo json_encode($output);
} else {
redirect($this->session->userdata('urlsebelumnya'));
}
}
示例11: list_data
function list_data()
{
$this->mongo_db->select_db("Game");
$this->mongo_db->select_collection("DialogStory");
$awal = isset($_GET['iDisplayStart']) ? (int) $_GET['iDisplayStart'] : 0;
$limit = isset($_GET['iDisplayLength']) ? (int) $_GET['iDisplayLength'] : 10;
$sEcho = isset($_GET['sEcho']) ? (int) $_GET['sEcho'] : 1;
$sSortDir_0 = isset($_GET['sSortDir_0']) ? $_GET['sSortDir_0'] : "desc";
$iSortCol_0 = isset($_GET['iSortCol_0']) ? (int) $_GET['iSortCol_0'] : 0;
$jns_sorting = -1;
if ($sSortDir_0 == "asc") {
$jns_sorting = 1;
}
$keysearchdt = "name";
if ($iSortCol_0 == 1) {
$keysearchdt = "name";
} else {
if ($iSortCol_0 == 2) {
$keysearchdt = "description";
}
}
$sSearch = isset($_GET['sSearch']) ? $_GET['sSearch'] : "";
$pencarian = array();
if ($sSearch != "") {
$sSearch = (string) trim($sSearch);
$sSearch = quotemeta($sSearch);
$regex = "/{$sSearch}/i";
$filter = $this->mongo_db->regex($regex);
$pencarian = array($keysearchdt => $filter);
}
$data = $this->mongo_db->find($pencarian, $awal, $limit, array($keysearchdt => $jns_sorting));
$output = array("sEcho" => intval($sEcho), "iTotalRecords" => $this->mongo_db->count($pencarian), "iTotalDisplayRecords" => $this->mongo_db->count($pencarian), "aaData" => array());
$i = $awal + 1;
foreach ($data as $dt) {
$import = "";
$copy = "";
$detail = "";
$delete = "";
if ($this->m_checking->actions("Dialogs", "module5", "Export", TRUE, FALSE, "home")) {
$import = $this->template_icon->link_icon3("quest/dialog/export/" . $dt['_id'], "Import", "database_go.png", "target=\"_blank\" class=\"linkdetail\" ");
}
if ($this->m_checking->actions("Dialogs", "module5", "Duplicate", TRUE, FALSE, "home")) {
$copy = $this->template_icon->detail_onclick("duplikat('" . $dt['_id'] . "')", "", 'Create Duplicat', "application_side_contract.png", "", "linkdetail");
}
if ($this->m_checking->actions("Dialogs", "module5", "Edit", TRUE, FALSE, "home")) {
$detail = $this->template_icon->detail_onclick("ubahdata('" . $dt['_id'] . "')", "#editdata", 'Edit', "pencil.png", "", "", "data-toggle='modal'");
}
if ($this->m_checking->actions("Dialogs", "module5", "Delete", TRUE, FALSE, "home")) {
$delete = $this->template_icon->detail_onclick("hapusdata('" . $dt['_id'] . "','Are you sure want to delete Dialog with name " . $dt['name'] . "')", "", 'Delete', "delete.png", "", "linkdelete");
}
$output['aaData'][] = array($i, "<label><input type='checkbox' name='id_export[]' value='" . (string) $dt['_id'] . "'/></label>", $dt['name'], $dt['description'], $import . $copy . $detail . $delete);
$i++;
}
if (IS_AJAX) {
echo json_encode($output);
} else {
redirect('quest/dialog/index');
}
}
示例12: list_data
function list_data()
{
$this->mongo_db->select_db("Logs");
$this->mongo_db->select_collection("logActivities");
$awal = isset($_GET['iDisplayStart']) ? (int) $_GET['iDisplayStart'] : 0;
$limit = isset($_GET['iDisplayLength']) ? (int) $_GET['iDisplayLength'] : 10;
$sEcho = isset($_GET['sEcho']) ? (int) $_GET['sEcho'] : 1;
$sSortDir_0 = isset($_GET['sSortDir_0']) ? $_GET['sSortDir_0'] : "desc";
$iSortCol_0 = isset($_GET['iSortCol_0']) ? (int) $_GET['iSortCol_0'] : 0;
$jns_sorting = -1;
if ($sSortDir_0 == "asc") {
$jns_sorting = 1;
}
$keysearchdt = "datetime";
if ($iSortCol_0 == 1) {
$keysearchdt = "user";
} else {
if ($iSortCol_0 == 2) {
$keysearchdt = "url";
} else {
if ($iSortCol_0 == 3) {
$keysearchdt = "datetime";
} else {
if ($iSortCol_0 == 4) {
$keysearchdt = "action";
}
}
}
}
$sSearch = isset($_GET['sSearch']) ? $_GET['sSearch'] : "";
$pencarian = array();
if ($sSearch != "") {
$sSearch = (string) trim($sSearch);
$sSearch = quotemeta($sSearch);
$regex = "/{$sSearch}/i";
$filter = $this->mongo_db->regex($regex);
$pencarian = array($keysearchdt => $filter);
}
$data = $this->mongo_db->find($pencarian, $awal, $limit, array($keysearchdt => $jns_sorting));
$output = array("sEcho" => intval($sEcho), "iTotalRecords" => $this->mongo_db->count($pencarian), "iTotalDisplayRecords" => $this->mongo_db->count($pencarian), "aaData" => array());
$i = $awal + 1;
foreach ($data as $dt) {
$tgl = "";
if ($dt['datetime'] != "") {
$tgl = date('Y-m-d H:i:s', $dt['datetime']->sec);
}
$delete = "";
if ($this->m_checking->actions("User Logs", "module11", "Delete", TRUE, FALSE, "home")) {
$delete = $this->template_icon->detail_onclick("hapusdata('" . $dt['_id'] . "','Are you sure want to delete Log " . $dt['user'] . "')", "", 'Delete', "delete.png", "", "linkdelete");
}
$output['aaData'][] = array($i, $dt['user'], $dt['url'], $tgl, $dt['action'], $delete);
$i++;
}
if (IS_AJAX) {
echo json_encode($output);
} else {
redirect('weblog/index');
}
}
示例13: list_data
function list_data()
{
$this->mongo_db->select_db("Assets");
$this->mongo_db->select_collection("Redeem");
$awal = isset($_GET['iDisplayStart']) ? (int) $_GET['iDisplayStart'] : 0;
$limit = isset($_GET['iDisplayLength']) ? (int) $_GET['iDisplayLength'] : 10;
$sEcho = isset($_GET['sEcho']) ? (int) $_GET['sEcho'] : 1;
$sSortDir_0 = isset($_GET['sSortDir_0']) ? $_GET['sSortDir_0'] : "desc";
$iSortCol_0 = isset($_GET['iSortCol_0']) ? (int) $_GET['iSortCol_0'] : 0;
$jns_sorting = -1;
if ($sSortDir_0 == "asc") {
$jns_sorting = 1;
}
$keysearchdt = "create";
if ($iSortCol_0 == 1) {
$keysearchdt = "code";
} else {
if ($iSortCol_0 == 2) {
$keysearchdt = "name";
} else {
if ($iSortCol_0 == 3) {
$keysearchdt = "count";
}
}
}
$sSearch = isset($_GET['sSearch']) ? $_GET['sSearch'] : "";
$pencarian = array();
if ($sSearch != "") {
$sSearch = (string) trim($sSearch);
$sSearch = quotemeta($sSearch);
$regex = "/{$sSearch}/i";
$filter = $this->mongo_db->regex($regex);
$pencarian = array($keysearchdt => $filter);
}
$data = $this->mongo_db->find($pencarian, $awal, $limit, array('create' => $jns_sorting));
$output = array("sEcho" => intval($sEcho), "iTotalRecords" => $this->mongo_db->count($pencarian), "iTotalDisplayRecords" => $this->mongo_db->count($pencarian), "aaData" => array());
$i = $awal + 1;
foreach ($data as $dt) {
$tglexpire = "";
if ($dt['expire'] != "") {
$tglexpire = date('Y-m-d', $dt['expire']->sec);
}
$detail = "";
$delete = "";
if ($this->m_checking->actions("Redeem Code", "module5", "Delete", TRUE, FALSE, "home")) {
$delete = $this->template_icon->detail_onclick("hapusdata('" . $dt['_id'] . "','Are you sure want to delete Redeem code " . $dt['code'] . "')", "", 'Delete', "delete.png", "", "linkdelete");
}
if ($this->m_checking->actions("Redeem Code", "module5", "Edit", TRUE, FALSE, "home")) {
$detail = $this->template_icon->detail_onclick("ubahdata('" . $dt['_id'] . "','" . $dt['code'] . "','" . $dt['name'] . "','" . $dt['count'] . "','" . $tglexpire . "')", "#editdata", 'Edit', "pencil.png", "", "", "data-toggle='modal'");
}
$output['aaData'][] = array($i, $dt['code'], $dt['name'], $dt['count'], $tglexpire, date('Y-m-d', $dt['create']->sec), $detail . $delete);
$i++;
}
if (IS_AJAX) {
echo json_encode($output);
} else {
redirect('redimcode/index');
}
}
示例14: list_data
function list_data()
{
$this->mongo_db->select_db("Users");
$this->mongo_db->select_collection("Account");
$awal = isset($_GET['iDisplayStart']) ? (int) $_GET['iDisplayStart'] : 0;
$limit = isset($_GET['iDisplayLength']) ? (int) $_GET['iDisplayLength'] : 10;
$sEcho = isset($_GET['sEcho']) ? (int) $_GET['sEcho'] : 1;
$sSearch = isset($_GET['sSearch']) ? $_GET['sSearch'] : "";
$sSortDir_0 = isset($_GET['sSortDir_0']) ? $_GET['sSortDir_0'] : "asc";
$pencarian = array();
if ($sSearch != "") {
$sSearch = (string) trim($sSearch);
$sSearch = quotemeta($sSearch);
$regex = "/{$sSearch}/i";
$filter = $this->mongo_db->regex($regex);
$pencarian = array('username' => $filter);
}
$data = $this->mongo_db->find($pencarian, $awal, $limit, array('username' => 1));
$output = array("sEcho" => intval($sEcho), "iTotalRecords" => $this->mongo_db->count($pencarian), "iTotalDisplayRecords" => $this->mongo_db->count($pencarian), "aaData" => array());
$i = $awal + 1;
foreach ($data as $dt) {
$delete = "";
$priview = "";
if ($this->m_checking->actions("User Akses", "module2", "Delete", TRUE, FALSE, "home")) {
$delete = $this->template_icon->detail_onclick("hapusdata('" . $dt['_id'] . "','Are you sure want to delete User Access " . $dt['username'] . "')", "", 'Revoke User Access', "group_delete.png", "", "linkdelete");
}
if ($this->m_checking->actions("User Akses", "module2", "Edit", TRUE, FALSE, "home")) {
$priview = $this->template_icon->detail_onclick("lihatdetail('" . $dt['_id'] . "','" . (isset($dt['access']) ? $dt['access'] : '') . "','" . (isset($dt['brand_id']) ? $dt['brand_id'] : '') . "')", "#editdata", 'Edit', "group_edit.png", "", "", "data-toggle='modal'");
}
$group = "";
$brand = "";
if (isset($dt['access'])) {
$this->mongo_db->select_db("Game");
$this->mongo_db->select_collection("Group");
$checkdata = $this->mongo_db->findOne(array('Code' => $dt['access']));
if ($checkdata) {
$group = $checkdata['Name'];
}
}
if (isset($dt['brand_id'])) {
$this->mongo_db->select_db("Assets");
$this->mongo_db->select_collection("Brand");
$checkdata = $this->mongo_db->findOne(array('brand_id' => $dt['brand_id']));
if ($checkdata) {
$brand = $checkdata['name'];
} else {
$brand = $dt['brand_id'];
}
}
$tempdtuser = $this->m_userdata->user_properties((string) $dt["_id"]);
$output['aaData'][] = array($i, $tempdtuser["fullname"], $tempdtuser["handphone"], $dt['username'], $dt['email'], $group, $brand, $priview . $delete);
$i++;
}
if (IS_AJAX) {
echo json_encode($output);
} else {
redirect('management/user/index');
}
}
示例15: insertRules
/**
* @param string $fileName
* @param array $rules
*
* @return bool
*/
function insertRules($fileName, array $rules = [])
{
$startTag = '/*INSERT_START*/';
$endTag = '/*INSERT_END*/';
$content = file_get_contents($fileName);
$content = preg_replace($regexp = sprintf('#%s(.*)%s#s', quotemeta($startTag), quotemeta($endTag)), $startTag . var_export($rules, true) . $endTag, $content);
return false !== file_put_contents($fileName, $content);
}