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


PHP rewritedata函数代码示例

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


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

示例1: build_cache_setting


//.........这里部分代码省略.........
    $data['ucapp'] = $data['ucappopen'] = array();
    $data['uchomeurl'] = '';
    $data['discuzurl'] = $_G['siteurl'];
    $appsynlogins = 0;
    foreach ($ucapparray as $apparray) {
        if ($apparray['appid'] != UC_APPID) {
            if (!empty($apparray['synlogin'])) {
                $appsynlogins = 1;
            }
            if ($data['uc']['navlist'][$apparray['appid']] && $data['uc']['navopen']) {
                $data['ucapp'][$apparray['appid']]['name'] = $apparray['name'];
                $data['ucapp'][$apparray['appid']]['url'] = $apparray['url'];
            }
        } else {
            $data['discuzurl'] = $apparray['url'];
        }
        if (!empty($apparray['viewprourl'])) {
            $data['ucapp'][$apparray['appid']]['viewprourl'] = $apparray['url'] . $apparray['viewprourl'];
        }
        foreach ($appnamearray as $name) {
            if ($apparray['type'] == $name && $apparray['appid'] != UC_APPID) {
                $data['ucappopen'][$name] = 1;
                if ($name == 'UCHOME') {
                    $data['uchomeurl'] = $apparray['url'];
                } elseif ($name == 'XSPACE') {
                    $data['xspaceurl'] = $apparray['url'];
                }
            }
        }
    }
    $data['allowsynlogin'] = $data['allowsynlogin'] && $appsynlogins ? 1 : 0;
    $data['homeshow'] = $data['uchomeurl'] && $data['uchome']['homeshow'] ? $data['uchome']['homeshow'] : '0';
    unset($data['allowthreadplugin']);
    if ($data['jspath'] == 'data/cache/') {
        writetojscache();
    } elseif (!$data['jspath']) {
        $data['jspath'] = 'static/js/';
    }
    if ($data['cacheindexlife']) {
        $cachedir = DISCUZ_ROOT . './' . $data['cachethreaddir'];
        $tidmd5 = substr(md5(0), 3);
        @unlink($cachedir . '/' . $tidmd5[0] . '/' . $tidmd5[1] . '/' . $tidmd5[2] . '/0.htm');
    }
    $reginputbwords = array('username', 'password', 'password2', 'email');
    if (in_array($data['reginput']['username'], $reginputbwords) || !preg_match('/^[A-z]\\w+?$/', $data['reginput']['username'])) {
        $data['reginput']['username'] = random(6);
    }
    if (in_array($data['reginput']['password'], $reginputbwords) || !preg_match('/^[A-z]\\w+?$/', $data['reginput']['password'])) {
        $data['reginput']['password'] = random(6);
    }
    if (in_array($data['reginput']['password2'], $reginputbwords) || !preg_match('/^[A-z]\\w+?$/', $data['reginput']['password2'])) {
        $data['reginput']['password2'] = random(6);
    }
    if (in_array($data['reginput']['email'], $reginputbwords) || !preg_match('/^[A-z]\\w+?$/', $data['reginput']['email'])) {
        $data['reginput']['email'] = random(6);
    }
    $defaultcurhost = empty($_G['setting']['domain']['app']['default']) ? '{CURHOST}' : $_G['setting']['domain']['app']['default'];
    $output = array('str' => array(), 'preg' => array());
    //str為二級域名的查找和替換,preg為rewrite和默認域名的查找和替換
    $_G['domain'] = array();
    if (is_array($_G['setting']['domain']['app'])) {
        $apps = $_G['setting']['domain']['app'];
        $repflag = $apps['portal'] || $apps['forum'] || $apps['group'] || $apps['home'] || $apps['default'];
        foreach ($apps as $app => $domain) {
            if (in_array($app, array('default', 'mobile'))) {
                continue;
            }
            $appphp = "{$app}.php";
            if (!$domain) {
                $domain = $defaultcurhost;
            }
            if ($domain != '{CURHOST}') {
                $domain = 'http://' . $domain . $_G['siteport'] . '/';
            }
            if ($repflag) {
                $output['str']['search'][$app] = "<a href=\"{$app}.php";
                $output['str']['replace'][$app] = '<a href="' . $domain . $appphp;
                $_G['domain']['pregxprw'][$app] = '<a href\\="(' . preg_quote($domain, '/') . ')' . $appphp;
            } else {
                $_G['domain']['pregxprw'][$app] = '<a href\\="()' . $appphp;
            }
        }
    }
    if ($_G['setting']['rewritestatus'] || $output['str']['search']) {
        if ($_G['setting']['rewritestatus']) {
            require_once libfile('function/admincp');
            $output['preg'] = rewritedata(0);
        }
        if ($repflag) {
            if ($defaultcurhost != '{CURHOST}') {
                $defaultcurhost = 'http://' . $defaultcurhost . $_G['siteport'] . '/';
            }
            $output['preg']['search'][] = "/<a href=\"(\\w+\\.php)/";
            $output['preg']['replace'][] = '<a href="' . $defaultcurhost . "\$1";
        }
    }
    $data['output'] = $output;
    save_syscache('setting', $data);
    $_G['setting'] = $data;
}
开发者ID:pan289091315,项目名称:Discuz,代码行数:101,代码来源:cache_setting.php

示例2: foreach

     foreach ($settingnew['reginput'] as $key => $val) {
         foreach ($settingnew['reginput'] as $k => $v) {
             if ($key == $k) {
                 continue;
             }
             if ($val == $v) {
                 cpmsg('forum_name_duplicate', '', 'error');
             }
         }
     }
     $settingnew['reginput'] = addslashes(serialize($settingnew['reginput']));
 }
 if ($operation == 'seo') {
     $settingnew['rewritestatus'] = addslashes(serialize($settingnew['rewritestatus']));
     $settingnew['baidusitemap_life'] = max(1, min(24, intval($settingnew['baidusitemap_life'])));
     $rewritedata = rewritedata();
     foreach ($settingnew['rewriterule'] as $k => $v) {
         if (!$v) {
             $settingnew['rewriterule'][$k] = $rewritedata['rulesearch'][$k];
         }
     }
     $settingnew['rewriterule'] = addslashes(serialize($settingnew['rewriterule']));
     $settingnew['seotitle'] = addslashes(serialize($settingnew['seotitle']));
     $settingnew['seodescription'] = addslashes(serialize($settingnew['seodescription']));
     $settingnew['seokeywords'] = addslashes(serialize($settingnew['seokeywords']));
     if (!empty($_G['gp_seothreadlist']) && is_array($_G['gp_seothreadlist'])) {
         foreach ($_G['gp_seothreadlist'] as $seofid => $val) {
             $seofid = intval($seofid);
             DB::update('forum_forumfield', array('seotitle' => $val['seotitle'], 'keywords' => $val['keywords'], 'seodescription' => $val['description']), "fid='{$seofid}'");
         }
     }
开发者ID:pan289091315,项目名称:Discuz,代码行数:31,代码来源:admincp_setting.php

示例3: build_cache_setting


//.........这里部分代码省略.........
		}
		if(!empty($apparray['viewprourl'])) {
			$data['ucapp'][$apparray['appid']]['viewprourl'] = $apparray['url'].$apparray['viewprourl'];
		}
		foreach($appnamearray as $name) {
			if($apparray['type'] == $name && $apparray['appid'] != UC_APPID) {
				$data['ucappopen'][$name] = 1;
				if($name == 'UCHOME') {
					$data['uchomeurl'] = $apparray['url'];
				} elseif($name == 'XSPACE') {
					$data['xspaceurl'] = $apparray['url'];
				}
			}
		}
	}
	$data['allowsynlogin'] = $data['allowsynlogin'] && $appsynlogins ? 1 : 0;
	$data['homeshow'] = $data['uchomeurl'] && $data['uchome']['homeshow'] ? $data['uchome']['homeshow'] : '0';

	unset($data['allowthreadplugin']);
	if($data['jspath'] == 'data/cache/') {
		writetojscache();
	} elseif(!$data['jspath']) {
		$data['jspath'] = 'static/js/';
	}

	if($data['cacheindexlife']) {
		$cachedir = DISCUZ_ROOT.'./'.$data['cachethreaddir'];
		$tidmd5 = substr(md5(0), 3);
		@unlink($cachedir.'/'.$tidmd5[0].'/'.$tidmd5[1].'/'.$tidmd5[2].'/0.htm');
	}

	$reginputbwords = array('username', 'password', 'password2', 'email');
	if(in_array($data['reginput']['username'], $reginputbwords) || !preg_match('/^[A-z]\w+?$/', $data['reginput']['username'])) {
		$data['reginput']['username'] = random(6);
	}
	if(in_array($data['reginput']['password'], $reginputbwords) || !preg_match('/^[A-z]\w+?$/', $data['reginput']['password'])) {
		$data['reginput']['password'] = random(6);
	}
	if(in_array($data['reginput']['password2'], $reginputbwords) || !preg_match('/^[A-z]\w+?$/', $data['reginput']['password2'])) {
		$data['reginput']['password2'] = random(6);
	}
	if(in_array($data['reginput']['email'], $reginputbwords) || !preg_match('/^[A-z]\w+?$/', $data['reginput']['email'])) {
		$data['reginput']['email'] = random(6);
	}

	$defaultcurhost = empty($_G['setting']['domain']['app']['default']) ? '{CURHOST}' : $_G['setting']['domain']['app']['default'];
	$output = array('str'=>array(), 'preg' => array()); //str为二级域名的查找和替换,preg为rewrite和默认域名的查找和替换
	$_G['domain'] = array();
	if(is_array($_G['setting']['domain']['app'])) {
		$apps = $_G['setting']['domain']['app'];
		$repflag = $apps['portal'] || $apps['forum'] || $apps['group'] || $apps['home'] || $apps['default'];
		foreach($apps as $app => $domain) {
			if(in_array($app, array('default', 'mobile'))) {
				continue;
			}
			$appphp = "{$app}.php";
			if(!$domain) {
				$domain = $defaultcurhost;
			}
			if($domain != '{CURHOST}') {
				$domain = 'http://'.$domain.$_G['siteport'].'/';
			}
			if($repflag) {
				$output['str']['search'][$app] = "<a href=\"{$app}.php";
				$output['str']['replace'][$app] = '<a href="'.$domain.$appphp;
				$_G['domain']['pregxprw'][$app] = '<a href\="('.preg_quote($domain, '/').')'.$appphp;
			} else {
				$_G['domain']['pregxprw'][$app] = '<a href\="()'.$appphp;
			}
		}
	}
	if($_G['setting']['rewritestatus'] || $output['str']['search']) {
		if($_G['setting']['rewritestatus']) {
			require_once libfile('function/admincp');
			$output['preg'] = rewritedata(0);
		}
		if($output['preg']) {
			foreach($data['footernavs'] as $id => $nav) {
				$data['footernavs'][$id]['code'] = preg_replace($output['preg']['search'], $output['preg']['replace'], $nav['code']);
			}
			foreach($data['spacenavs'] as $id => $nav) {
				$data['spacenavs'][$id]['code'] = preg_replace($output['preg']['search'], $output['preg']['replace'], $nav['code']);
			}
			foreach($data['mynavs'] as $id => $nav) {
				$data['mynavs'][$id]['code'] = preg_replace($output['preg']['search'], $output['preg']['replace'], $nav['code']);
			}
			foreach($data['topnavs'] as $id => $nav) {
				$data['topnavs'][$id]['code'] = preg_replace($output['preg']['search'], $output['preg']['replace'], $nav['code']);
			}
			foreach($data['plugins']['jsmenu'] as $key => $nav) {
				$data['plugins']['jsmenu'][$key]['url'] = preg_replace($output['preg']['search'], $output['preg']['replace'], $nav['url']);
			}
		}
	}
	$data['output'] = $output;
	$data['connect'] = in_array('qqconnect', $data['plugins']['available']) ? $data['connect'] : array();

	savecache('setting', $data);
	$_G['setting'] = $data;
}
开发者ID:xDiglett,项目名称:discuzx30,代码行数:101,代码来源:cache_setting.php

示例4: output

function output()
{
    global $_G;
    if (defined('DISCUZ_OUTPUTED')) {
        return;
    } else {
        define('DISCUZ_OUTPUTED', 1);
    }
    if (!empty($_G['blockupdate'])) {
        block_updatecache($_G['blockupdate']['bid']);
    }
    $_G['domain'] = array();
    foreach ($_G['config']['app']['domain'] as $app => $domain) {
        if ($domain || $_G['config']['app']['domain']['default']) {
            $domain = empty($domain) ? $_G['config']['app']['domain']['default'] : $domain;
            $_G['domain']['search'][$app] = "<a href=\"{$app}.php";
            $_G['domain']['replace'][$app] = '<a href="http://' . $domain . $_G['siteroot'] . $app . '.php';
            $_G['domain']['pregxp'][$app] = '<a href\\="http\\:\\/\\/(' . preg_quote($domain . $_G['siteroot'], '/') . ')' . preg_quote($app . '.php', '/');
        } else {
            $_G['domain']['pregxp'][$app] = "<a href\\=\"(){$app}.php";
        }
    }
    if ($_G['setting']['rewritestatus'] || $_G['domain']['search']) {
        $content = ob_get_contents();
        $_G['domain']['search'] && ($content = str_replace($_G['domain']['search'], $_G['domain']['replace'], $content));
        $_G['config']['app']['domain']['default'] && ($content = preg_replace("/<a href=\"([^\"]+)\"/e", "rewriteoutput('site_default', 0, '" . $_G['config']['app']['domain']['default'] . $_G['siteroot'] . "', '\\1')", $content));
        if ($_G['setting']['rewritestatus'] && !defined('IN_MODCP') && !defined('IN_ADMINCP')) {
            $searcharray = $replacearray = array();
            $array = rewritedata();
            $content = preg_replace($array['search'], $array['replace'], $content);
        }
        ob_end_clean();
        $_G['gzipcompress'] ? ob_start('ob_gzhandler') : ob_start();
        echo $content;
    }
    if ($_G['setting']['ftp']['connid']) {
        @ftp_close($_G['setting']['ftp']['connid']);
    }
    $_G['setting']['ftp'] = array();
    if (defined('CACHE_FILE') && CACHE_FILE && !defined('CACHE_FORBIDDEN')) {
        global $_G;
        if (diskfreespace(DISCUZ_ROOT . './' . $_G['setting']['cachethreaddir']) > 1000000) {
            if ($fp = @fopen(CACHE_FILE, 'w')) {
                flock($fp, LOCK_EX);
                fwrite($fp, empty($content) ? ob_get_contents() : $content);
            }
            @fclose($fp);
            chmod(CACHE_FILE, 0777);
        }
    }
    if (defined('DISCUZ_DEBUG') && DISCUZ_DEBUG && @(include libfile('function/debug'))) {
        function_exists('debugmessage') && debugmessage();
    }
}
开发者ID:Kingson4Wu,项目名称:php_demo,代码行数:54,代码来源:function_core.php

示例5: rewritedata

 $downgreen = 0;
 $downblue = 2;
 $downsize = 3;
 $downx = 155;
 $downy = 20;
 $srred = 11;
 $srgreen = 111;
 $srblue = 11;
 $srsize = 5;
 $srx = 440;
 $sry = 16;
 if (strlen($username) >= 10) {
     $namesize = 11;
     $namey = 33;
 }
 rewritedata();
 $name_colour = imagecolorallocate($my_img, $namered, $namegreen, $nameblue);
 $up_colour = imagecolorallocate($my_img, $upred, $upgreen, $upblue);
 $down_colour = imagecolorallocate($my_img, $downred, $downgreen, $downblue);
 $sr_colour = imagecolorallocate($my_img, $srred, $srgreen, $srblue);
 //imagestring($my_img, $namesize, $namex, $namey, $username, $name_colour);
 //imagettftext($my_img, $namesize, 0, $namex, $namey, $name_colour, "fonts/simhei.ttf", $username);
 imagestring($my_img, $upsize, $upx, $upy, $uploaded, $up_colour);
 imagestring($my_img, $downsize, $downx, $downy, $downloaded, $down_colour);
 //imagestring($my_img, $srsize, $srx, $sry, $sr, $sr_colour);不显示分享率
 //写用户名
 $pic = imagecreate(500, 222);
 $black = imagecolorallocate($pic, 255, 255, 255);
 $tran = imagecolortransparent($pic, $black);
 $white = imagecolorallocate($pic, $namered, $namegreen, $nameblue);
 $font = "fonts/simhei.ttf";
开发者ID:chenrizhi,项目名称:mtpt,代码行数:31,代码来源:mybar.php


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