本文整理汇总了PHP中ereg函数的典型用法代码示例。如果您正苦于以下问题:PHP ereg函数的具体用法?PHP ereg怎么用?PHP ereg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ereg函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: mysql_import_file
function mysql_import_file($filename, &$errmsg)
{
/* Read the file */
$lines = file($filename);
if (!$lines) {
$errmsg = "cannot open file {$filename}";
return false;
}
$scriptfile = false;
/* Get rid of the comments and form one jumbo line */
foreach ($lines as $line) {
$line = trim($line);
if (!ereg('^--', $line)) {
$scriptfile .= " " . $line;
}
}
if (!$scriptfile) {
$errmsg = "no text found in {$filename}";
return false;
}
/* Split the jumbo line into smaller lines */
$queries = explode(';', $scriptfile);
/* Run each line as a query */
foreach ($queries as $query) {
$query = trim($query);
if ($query == "") {
continue;
}
if (!mysql_query($query . ';')) {
$errmsg = "query " . $query . " failed";
return false;
}
}
return true;
}
开发者ID:Weavebytesipl,项目名称:PhpDAO,代码行数:35,代码来源:class.db.php
示例2: ETCoreStart
/**
* 声明模板用法
*/
function ETCoreStart($set = array('ID' => '1', 'TplType' => 'htm', 'CacheDir' => 'cache', 'TemplateDir' => 'template', 'AutoImage' => 'on', 'LangDir' => 'language', 'Language' => 'default', 'Copyright' => 'off', 'MemCache' => ''))
{
$this->TplID = (defined('TemplateID') ? TemplateID : ((int) @$set['ID'] <= 1 ? 1 : (int) $set['ID'])) . '_';
$this->CacheDir = (defined('NewCache') ? NewCache : (trim($set['CacheDir']) != '' ? $set['CacheDir'] : 'cache')) . '/';
$this->TemplateDir = (defined('NewTemplate') ? NewTemplate : (trim($set['TemplateDir']) != '' ? $set['TemplateDir'] : 'template')) . '/';
$this->Ext = @$set['TplType'] != '' ? $set['TplType'] : 'htm';
$this->AutoImage = @$set['AutoImage'] == 'off' ? 0 : 1;
$this->Copyright = @$set['Copyright'] == 'off' ? 0 : 1;
$this->Server = is_array($GLOBALS['_SERVER']) ? $GLOBALS['_SERVER'] : $_SERVER;
$this->version = trim($_GET['EaseTemplateVer']) ? die('Ease Templae E3!') : '';
//载入语言文件
$this->LangDir = (defined('LangDir') ? LangDir : (@$set['LangDir'] != 'language' && @$set['LangDir'] ? $set['LangDir'] : 'language')) . '/';
if (is_dir($this->LangDir)) {
$this->Language = defined('Language') ? Language : ($set['Language'] != 'default' && $set['Language'] ? $set['Language'] : 'default');
if (@is_file($this->LangDir . $this->Language . '.php')) {
$lang = array();
@(include_once $this->LangDir . $this->Language . '.php');
$this->LangData = $lang;
}
} else {
$this->Language = 'default';
}
//缓存目录检测以及运行模式
if (@ereg(':', $set['MemCache'])) {
$this->RunType = 'MemCache';
$memset = explode(":", $set['MemCache']);
$this->Emc = memcache_connect($memset[0], $memset[1]) or die("Could not connect!");
} else {
$this->RunType = @substr(@sprintf('%o', @fileperms($this->CacheDir)), -3) == 777 && is_dir($this->CacheDir) ? 'Cache' : 'Replace';
}
$CompileBasic = array('/(\\{\\s*|<!--\\s*)inc_php:([a-zA-Z0-9_\\[\\]\\.\\,\\/\\?\\=\\#\\:\\;\\-\\|\\^]{5,200})(\\s*\\}|\\s*-->)/eis', '/<!--\\s*DEL\\s*-->/is', '/<!--\\s*IF(\\[|\\()(.+?)(\\]|\\))\\s*-->/is', '/<!--\\s*ELSEIF(\\[|\\()(.+?)(\\]|\\))\\s*-->/is', '/<!--\\s*ELSE\\s*-->/is', '/<!--\\s*END\\s*-->/is', '/<!--\\s*([a-zA-Z0-9_\\$\\[\\]\'\\"]{2,60})\\s*(AS|as)\\s*(.+?)\\s*-->/', '/<!--\\s*while\\:\\s*(.+?)\\s*-->/is', '/(\\{\\s*|<!--\\s*)lang\\:(.+?)(\\s*\\}|\\s*-->)/eis', '/(\\{\\s*|<!--\\s*)row\\:(.+?)(\\s*\\}|\\s*-->)/eis', '/(\\{\\s*|<!--\\s*)color\\:\\s*([\\#0-9A-Za-z]+\\,[\\#0-9A-Za-z]+)(\\s*\\}|\\s*-->)/eis', '/(\\{\\s*|<!--\\s*)dir\\:([^\\{\\}]{1,100})(\\s*\\}|\\s*-->)/eis', '/(\\{\\s*|<!--\\s*)run\\:(\\}|\\s*-->)\\s*(.+?)\\s*(\\{|<!--\\s*)\\/run(\\s*\\}|\\s*-->)/is', '/(\\{\\s*|<!--\\s*)run\\:(.+?)(\\s*\\}|\\s*-->)/is', '/\\{([a-zA-Z0-9_\'\\"\\[\\]\\$]{1,100})\\}/');
$this->Compile = is_array($this->Compile) ? array_merge($this->Compile, $CompileBasic) : $CompileBasic;
$AnalysisBasic = array('$this->inc_php("\\2")', '";if($ET_Del==true){echo"', '";if(\\2){echo"', '";}elseif(\\2){echo"', '";}else{echo"', '";}echo"', '";\\$_i=0;foreach((array)\\1 AS \\3){\\$_i++;echo"', '";\\$_i=0;while(\\1){\\$_i++;echo"', '$this->lang("\\2")', '$this->Row("\\2")', '$this->Color("\\2")', '$this->Dirs("\\2")', '";\\3;echo"', '";\\2;echo"', '";echo \\$\\1;echo"');
$this->Analysis = is_array($this->Analysis) ? array_merge($this->Analysis, $AnalysisBasic) : $AnalysisBasic;
}
开发者ID:anLl,项目名称:Apply2,代码行数:38,代码来源:template.core.php
示例3: process
function process()
{
if (ereg('.free.fr/', Request::getCurrentCompleteUrl())) {
print "<h2>Attention ! Les utilisateurs de Free.fr doivent faire une opération très particulière pour faire fonctionner phpMyVisites, du fait des limitations techniques imposées par Free.fr.</h2>\n\t\t\t<p> Vous devez donc <u>OBLIGATOIREMENT</u> :</p>\n\t\t\t<ul><li>Créer un répertoire /include/ à la racine de votre site free</li>\n\t\t\t<li>Uploader dans ce nouveau répertoire vide <u>le contenu du répertoire /libs/ de phpmyvisites</u>, une fois phpmyvisites dézippé sur votre ordinateur</li>\n\t\t\t<li>Vous ne devez donc pas changer votre phpmyvisites que vous avez normalement déjà uploadé sur le serveur. Vous devez seulement réuploader les fichiers et répertoires contenus dans le répertoire /libs/ de phpmyvisites. Ces fichiers sont : PEAR.php, Cache/, QuickForm/, HTML/, XML/ (les autres sont facultatifs).</li>\n\t\t\t<li>A la fin de l'opération, vous devez donc avoir à la racine de votre site Free : <br>/include/PEAR.php<br> /include/XML/<br> /include/HTML/<br> etc.\n\t\t\t</ul>\n\t\t\t\n\t\t\t<p> En cas de problèmes consultez les forums de phpMyVisites mais surtout suivez scrupuleusement ces indications et tout se passera très bien !</p>\n\t\t\t\n\t\t\t\n\t\t\t<p><b>If you need these explanations in english, please ask in phpmyvisites forums</b></p>";
}
$this->tpl->assign("show_next_step", true);
}
开发者ID:ber5ien,项目名称:www.jade-palace.co.uk,代码行数:7,代码来源:InstallWelcome.class.php
示例4: WriteHTML
function WriteHTML($html)
{
//HTML parser
$html = str_replace("\n", ' ', $html);
$a = preg_split('/<(.*)>/U', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
foreach ($a as $i => $e) {
if ($i % 2 == 0) {
//Text
if ($this->HREF) {
$this->PutLink($this->HREF, $e);
} else {
$this->Write(5, $e);
}
} else {
//Tag
if ($e[0] == '/') {
$this->CloseTag(strtoupper(substr($e, 1)));
} else {
//Extract properties
$a2 = split(' ', $e);
$tag = strtoupper(array_shift($a2));
$prop = array();
foreach ($a2 as $v) {
if (ereg('^([^=]*)=["\']?([^"\']*)["\']?$', $v, $a3)) {
$prop[strtoupper($a3[1])] = $a3[2];
}
}
$this->OpenTag($tag, $prop);
}
}
}
}
开发者ID:vojtajina,项目名称:sitellite,代码行数:32,代码来源:index.php
示例5: jyxo_bot
function jyxo_bot($q = "", $d = "mm", $ereg = ".", $notereg = "", $cnt = 10000000000000, $page = 1, $pmax = 2, $o = "nocls")
{
$i = 0;
$results = "";
$results[$i] = "";
//$q = str_replace(" ", "+", $q);
$q = urlencode($q);
for (; $page <= $pmax; $page++) {
$request = "http://jyxo.cz/s?q={$q}&d={$d}&o={$o}&cnt={$cnt}&page={$page}";
$fp = fopen($request, "r") or die(" !!! Cannot connect !!!");
while (!feof($fp)) {
$line = fgets($fp);
if (eregi("<div class='r'>", $line) && ereg(" class=ri", $line)) {
$line = explode("<!--m--><div class='r'><A HREF=\"", $line);
$line = $line[1];
$line = explode("\" class=ri", $line);
$line = trim($line[0]);
$line = urldecode($line);
if (@eregi($ereg, $line) && !@eregi($notereg, $line) && !in_array($line, $results)) {
echo "{$line}\n";
//Output
//echo("$i:$line\n"); //Indexed Output
//echo("<a href=\"$line\">$line</a><br />\n"); //XHTML Output
$results[$i] = $line;
$i++;
}
}
}
fclose($fp);
}
echo "\nTotal: {$i}\n";
//Sumary Output
return $results;
}
开发者ID:Harvie,项目名称:Programs,代码行数:34,代码来源:jyxobot.php
示例6: save
function save($db_object,$common,$_POST,$default)
{
$yes= array();
$no = array();
while(list($key,$value)=each($_POST))
{
$$key = $value;
if($value=='YES')
{
if(ereg("^check_",$key))
{
$yes[]=substr($key,6);
}
}
if($value=='NO')
{
if(ereg("^check_",$key))
{
$no[]=substr($key,6);
}
}
}
$yes_id = implode("','",$yes);
$no_id = implode("','",$no);
$fields = $common->prefix_table(name_fields);
$qry1 = "update $fields set status='YES' where name_id in ('$yes_id')";
//echo "$qry1<br>";
$res = $db_object->insert($qry1);
$qry2 = "update $fields set status='NO' where name_id in ('$no_id')";
$res = $db_object->insert($qry2);
//echo "$qry2<br>";
}
开发者ID:nloadholtes,项目名称:people-prodigy,代码行数:35,代码来源:add_lables.php
示例7: scan
function scan($page_content)
{
$i = 0;
if (ereg("<style( *[\n]*.*)>\n*(.\n*)*<\\/style>", $page_content)) {
if (preg_match_all("/(@\\s*import\\s* (url((\"|')?)?((\"|')?)|(\"|'){1}).+(\"|')?\\)?)/", $page_content, $ext_stylesheets)) {
foreach ($ext_stylesheets[0] as $stylesheet) {
$css_content[$i] = preg_replace("/(@\\s*import\\s*)|(url\\(?((\"|')?))|(\"|'){1}|\\)?(\"|')?;|(\\s)/", "", $stylesheet);
$i++;
}
$array = 1;
}
$inline_notused = $this->check_file($page_content, $page_content);
} else {
die("No page styles, sorry!" . $this->helptext);
}
$unused = array('internal' => array(), 'external' => array());
if (isset($array) && $array == 1) {
foreach ($css_content as $css_file) {
$css = file_get_contents($css_file);
if (!empty($css)) {
$not_used = $this->check_file($css, $page_content);
array_push($unused['external'], array('css_file' => $css_file, 'external' => $not_used));
}
}
}
if ($inline_notused != false) {
$unused['internal'] = $inline_notused;
}
return $unused;
}
开发者ID:Ashik72,项目名称:mbIdentifyUnusedCssPlugin,代码行数:30,代码来源:identify_unused_css.php
示例8: Image_Graph_gd_version
/**
* Check which version of GD is installed
* @return int 0 if GD isn't installed, 1 if GD 1.x is installed and 2 if GD 2.x is installed
*/
function Image_Graph_gd_version()
{
if (function_exists("gd_info")) {
$info = gd_info();
$version = $info['GD Version'];
} else {
ob_start();
phpinfo(8);
$php_info = ob_get_contents();
ob_end_clean();
if (ereg("<td[^>]*>GD Version *<\/td><td[^>]*>([^<]*)<\/td>", $php_info, $result)) {
$version = $result[1];
}
}
if ($version) {
//define("GD_VERSION", $version);
}
if (ereg("1\.[0-9]{1,2}", $version)) {
return 1;
}
elseif (ereg("2\.[0-9]{1,2}", $version)) {
return 2;
} else {
return 0;
}
}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:33,代码来源:Common.php
示例9: save_data
function save_data($db_object, $common, $fLang_id, $_POST, $default)
{
$id = array();
while (list($key, $value) = each($_POST)) {
${$key} = $value;
if (ereg("^lang_", $key)) {
$id[] = substr($key, 5);
}
if (ereg("^charset_", $key)) {
$ids = split("_", $key);
$id1 = $ids[1];
$char[$id1] = $value;
}
}
$charset_table = $common->prefix_table("language_charset");
while (list($kk, $vv) = @each($char)) {
$upqry = "update {$charset_table} set charset='{$vv}' where language_id='{$kk}'";
$upqry = "replace into {$charset_table} set language_id='{$kk}',charset='{$vv}'";
$db_object->insert($upqry);
}
$lang_table = $common->prefix_table("language");
$lang = "lang_" . $fLang_id;
for ($i = 0; $i < count($id); $i++) {
$lan = "lang_" . $id[$i];
$lan = ${$lan};
$mysql = "update {$lang_table} set {$lang}='{$lan}' where lang_id='{$id[$i]}'";
$db_object->insert($mysql);
}
}
开发者ID:nloadholtes,项目名称:people-prodigy,代码行数:29,代码来源:edit_lang.php
示例10: Connect
private function Connect($servers)
{
if ($this->IsConnected()) {
throw new Exception('Already connected');
}
if (!is_array($servers) || count($servers) == 0) {
throw new Exception('No servers');
}
foreach ($servers as $s) {
if (!ereg("[^:]+:[0-9]+", $s)) {
throw new Exception($s . ' is not a valid server');
}
}
srand((double) microtime() * 1000000);
shuffle($servers);
foreach ($servers as $s) {
list($server, $port) = explode(":", $s);
$server = gethostbyname($server);
$this->socket = fsockopen($server, $port, $errno, $err);
if ($this->IsConnected()) {
break;
}
}
if ($this->IsConnected()) {
return true;
} else {
throw new Exception($errno . ' - ' . $err);
}
}
开发者ID:mmr,项目名称:b1n,代码行数:29,代码来源:Socket.php
示例11: piclens_gallery
function piclens_gallery()
{
$item_id = EClassApi::getParam('item_id');
$entry = '';
if ($item_id) {
$sql = 'select id, original_image_url, title, position from item_image where item_id = ' . intval($item_id) . ' ORDER BY position ';
DB::query($sql);
if (DB::num_rows()) {
$entry = '';
while ($rows = DB::fetch_row()) {
$rows['title'] = $rows['title'] ? $rows['title'] : "Image {$rows['position']}";
$rows['title'] = trim(XMLLib::_xml_encode_attribute($rows['title']));
if (ereg('/', $rows['original_image_url'])) {
$url = trim(XMLLib::_xml_encode_attribute("http://" . IMAGE_PATH . "{$rows['original_image_url']}"));
} else {
$url = trim(XMLLib::_xml_encode_attribute("http://" . IMAGE_PATH . "uploaded/items/{$rows['original_image_url']}"));
}
$entry .= "\n\t\t \t \t<item>\n\t\t \t \t\t\t<title>" . stripslashes($rows['title']) . "</title>\n\t\t\t\t\t\t<link>{$url}</link>\n\t\t\t\t\t\t<guid>Image {$rows['position']}</guid>\n\t\t\t\t\t\t<media:thumbnail url=\"{$url}\" />\n\t\t\t\t\t\t<media:content url=\"{$url}\" />\n\t\t\t\t</item>\n\t\t \t \t";
}
@header("Content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n\t\t\t <rss version=\"2.0\" xmlns:media=\"http://search.yahoo.com/mrss\">\n\t\t\t <channel>\t\t\t\n\t\t\t <title>Enbac.com</title>\n\t\t\t <link>http://www.chonmon.vn/</link>\n\t\t\t <description>Enbac.com - </description>\n\t\t\t <logo url=\"style/images/logo.piclens.png\" />\n\t\t\t";
echo $entry;
echo "\n\t\t \t </channel>\n\t\t\t </rss>\n\t\t\t";
} else {
die("no_info");
}
} else {
die("no_info");
}
}
开发者ID:hqd276,项目名称:bigs,代码行数:30,代码来源:xml_item.xml.php
示例12: shipping
function shipping($module = '')
{
global $language, $PHP_SELF, $customer_id;
$customer_group = new customer_group($customer_id);
if (ereg('all', $customer_group->getshipment())) {
$this->modules = explode(';', MODULE_SHIPPING_INSTALLED);
} else {
$this->modules = explode(';', $customer_group->getshipment());
}
if (defined('MODULE_SHIPPING_INSTALLED') && tep_not_null(MODULE_SHIPPING_INSTALLED)) {
$include_modules = array();
if (tep_not_null($module) && in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1), $this->modules)) {
$include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, strrpos($PHP_SELF, '.') + 1));
} else {
reset($this->modules);
while (list(, $value) = each($this->modules)) {
$class = substr($value, 0, strrpos($value, '.'));
$include_modules[] = array('class' => $class, 'file' => $value);
}
}
for ($i = 0, $n = sizeof($include_modules); $i < $n; $i++) {
include DIR_WS_LANGUAGES . $language . '/modules/shipping/' . $include_modules[$i]['file'];
include DIR_WS_MODULES . 'shipping/' . $include_modules[$i]['file'];
$GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class']();
}
}
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:27,代码来源:shipping.php
示例13: Net_DNS_RR_A
function Net_DNS_RR_A(&$rro, $data, $offset = '')
{
$this->name = $rro->name;
$this->type = $rro->type;
$this->class = $rro->class;
$this->ttl = $rro->ttl;
$this->rdlength = $rro->rdlength;
$this->rdata = $rro->rdata;
if ($offset) {
if ($this->rdlength > 0) {
/*
* We don't have inet_ntoa in PHP?
*/
$aparts = unpack('C4b', $this->rdata);
$addr = $aparts['b1'] . '.' . $aparts['b2'] . '.' . $aparts['b3'] . '.' . $aparts['b4'];
$this->address = $addr;
}
} else {
if (strlen($data) && ereg("([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.([0-9]+)[ \t]*\$", $data, $regs)) {
if ($regs[1] >= 0 && $regs[1] <= 255 && ($regs[2] >= 0 && $regs[2] <= 255) && ($regs[3] >= 0 && $regs[3] <= 255) && ($regs[4] >= 0 && $regs[4] <= 255)) {
$this->address = $regs[1] . '.' . $regs[2] . '.' . $regs[3] . '.' . $regs[4];
}
}
}
}
开发者ID:railfuture,项目名称:tiki-website,代码行数:25,代码来源:A.php
示例14: validateObjectAttributeHTTPInput
/**
* Validates the input from the object edit form concerning this attribute.
*
* @param mixed $http Class eZHTTPTool.
* @param string $base Seems to be always 'ContentObjectAttribute'.
* @param mixed $contentObjectAttribute Class eZContentObjectAttribute.
*
* @return int eZInputValidator::STATE_INVALID/STATE_ACCEPTED
*/
public function validateObjectAttributeHTTPInput($http, $base, $contentObjectAttribute)
{
if ($http->hasPostVariable($base . "_data_domain_" . $contentObjectAttribute->attribute("id"))) {
$data = $http->postVariable($base . "_data_domain_" . $contentObjectAttribute->attribute("id"));
$data = str_replace(" ", "", $data);
if (!$contentObjectAttribute->validateIsRequired() && $data == "") {
return eZInputValidator::STATE_ACCEPTED;
}
$withSubdomain = $contentObjectAttribute->contentClassAttribute()->attribute(self::SUBDOMAIN_FIELD);
if ($withSubdomain == 1) {
if (!ereg('^' . self::SUBDOMAIN_REGEXP . '$', $data)) {
$contentObjectAttribute->setValidationError(ezi18n('kernel/classes/datatypes', 'No valid domain'));
return eZInputValidator::STATE_INVALID;
}
} else {
if (!ereg('^' . self::DOMAIN_REGEXP . '$', $data)) {
$contentObjectAttribute->setValidationError(ezi18n('kernel/classes/datatypes', 'No valid domain'));
return eZInputValidator::STATE_INVALID;
}
}
return eZInputValidator::STATE_ACCEPTED;
} else {
return eZInputValidator::STATE_ACCEPTED;
}
return eZInputValidator::STATE_INVALID;
}
开发者ID:kmajkowski,项目名称:ymc-ezp-datatypes,代码行数:35,代码来源:ymcdomaintype.php
示例15: get_parser_characters
function get_parser_characters($format)
{
if ($format == 'tab') {
$middle = ' ';
$end_tr = '<BR>';
} elseif ($format == 'html' || $format == '') {
$begin_table = '<TABLE>';
$end_table = '</TABLE>';
$tr = '<TR>';
$end_tr = '</TR>';
$td = '<TD>';
$end_td = '</TD>';
$middle = $end_td . $td;
} elseif (ereg('html:', $format)) {
list($style, $choice) = explode(':', $format);
$begin_table = '<TABLE class = "$choice">';
$end_table = '</TABLE>';
$tr = '<TR>';
$end_tr = '</TR>';
$td = '<TD>';
$end_td = '</TD>';
$middle = $end_td . $td;
}
return $parser_char = array('middle' => $middle, 'begin_table' => $begin_table, 'tr' => $tr, 'end_tr' => $end_tr, 'td' => $td, 'end_td' => $end_td, 'middle' => $middle, 'end_table' => $end_table);
}
开发者ID:helenadeus,项目名称:s3db.map,代码行数:25,代码来源:parser_characters.php
示例16: hookpress_ajax_get_fields
function hookpress_ajax_get_fields()
{
global $wpdb, $hookpress_actions, $hookpress_filters;
if ($_POST['type'] == 'action') {
$args = $hookpress_actions[$_POST['hook']];
}
if ($_POST['type'] == 'filter') {
$args = $hookpress_filters[$_POST['hook']];
}
$fields = array();
foreach ($args as $arg) {
if (ereg('[A-Z]+', $arg)) {
$fields = array_merge($fields, hookpress_get_fields($arg));
} else {
$fields[] = $arg;
}
}
header("Content-Type: text/html; charset=UTF-8");
if ($_POST['type'] == 'filter') {
$first = array_shift($fields);
echo "<option value='{$first}' selected='selected' class='first'>{$first}</option>";
}
sort($fields);
foreach ($fields as $field) {
echo "<option value='{$field}'>{$field}</option>";
}
exit;
}
开发者ID:kennethreitz-archive,项目名称:wordpress-skeleton,代码行数:28,代码来源:services.php
示例17: convertSystemValueToStamp
public function convertSystemValueToStamp($value)
{
if (ereg("P([0-9]{4})-([0-9]{2})", $value, $regs)) {
return mktime(0, 0, 0, 1, ($regs[2] - 1) * 28, $regs[1] + 0);
}
return 0;
}
开发者ID:evilgeny,项目名称:bob,代码行数:7,代码来源:Period.class.php
示例18: check_parameters
function check_parameters()
{
global $checked, $xml, $xsl, $xslSave, $xmlSave, $page, $lang;
if (isset($_GET['xml']) && !ereg("^[a-z][a-z\\/]+.xml\$", $_GET['xml'])) {
die("invalid parameter 1");
} else {
$checked['xml'] = $xml;
}
if (!ereg("^[a-z][a-zA-Z\\/\\_\\-]+.xsl\$", $xsl)) {
die("invalid parameter 2");
} else {
$checked['xsl'] = $xsl;
}
if (isset($xmlSave) && !ereg(".xml\$", $xmlSave)) {
die("invalid parameter 3: {$xmlSave}");
} else {
$checked['xmlSave'] = $xmlSave;
}
if (isset($xslSave) && !ereg(".xsl\$", $xslSave)) {
die("invalid parameter 4");
} else {
$checked['xslSave'] = $xslSave;
}
if (isset($page) && !ereg("^[a-zA-Z\\_\\-]+\$", $page)) {
die("invalid parameter 5");
} else {
$checked['page'] = $page;
}
if (!ereg("^(pt)|(es)|(en)\$", $lang)) {
die("invalid lang parameter 6");
} else {
$checked['lang'] = $lang;
}
}
开发者ID:padlrosa,项目名称:Regional-2,代码行数:34,代码来源:xmlRoot_functions.php
示例19: navigator_url
function navigator_url($field, $title, $color = "white")
{
global $app;
$url = url::complete_me();
if (ereg('webadmin', $url)) {
$path_ext = "webadmin/";
}
if (!ereg('\\?', $url)) {
$url .= "?";
}
$url = preg_replace("|offset=.*?&|", "offset=0&", $url);
$url = str_replace('&sort=asc', '', $url);
$url = str_replace('&sort=desc', '', $url);
$url = str_replace("&order={$field}", '', $url);
$var = $_GET;
if ($var['order'] == $field) {
if ($var['sort'] == 'asc') {
$out = "<a href='{$url}&order={$field}&sort=desc'><font color={$color}>{$title}</font></a> <img src='{$app['www']}/{$path_ext}img/arrow-asc.gif'>";
} else {
$out = "<a href='{$url}&order={$field}&sort=asc'><font color={$color}>{$title}</font></a> <img src='{$app['www']}/{$path_ext}img/arrow-desc.gif'>";
}
} else {
$out = "<a href='{$url}&order={$field}&sort=asc'><font color={$color}>{$title}</font></a>";
}
return $out;
}
开发者ID:salomay,项目名称:refreshin,代码行数:26,代码来源:url.php
示例20: check_email_address
function check_email_address($email) {
// First, we check that there's one @ symbol, and that the lengths are right
if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
// Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
return false;
}
// Split it into sections to make life easier
$email_array = explode("@", $email);
$local_array = explode(".", $email_array[0]);
for ($i = 0; $i < sizeof($local_array); $i++) {
if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
return false;
}
}
if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
$domain_array = explode(".", $email_array[1]);
if (sizeof($domain_array) < 2) {
return false; // Not enough parts to domain
}
for ($i = 0; $i < sizeof($domain_array); $i++) {
if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
return false;
}
}
}
return true;
}
开发者ID:rynoceris,项目名称:angelabeaulieuphoto.dev,代码行数:27,代码来源:index.php
注:本文中的ereg函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论