예제 #1
0
 if (isset($fieldx[$fieldid])) {
     $newfid = $fieldx[$fieldid];
 }
 if (!$newfid) {
     $newfid = $fieldid;
     print "error: failed to convert field id {$fieldid} at {$sid} | {$datatxt} row \n";
 }
 // Assumption: You may not want this done to your titles.
 // I found numerous people entered leading spaces, all caps, etc.
 //
 // Clean up funny titles:
 $title = strtotitle($title);
 $title = mysql_real_escape_string($title);
 // Get rid of crazy all caps entries...
 $datatxt = strtolower($datatxt);
 $datatxt = strtotitle($datatxt);
 $datatxt = mysql_real_escape_string($datatxt);
 // $sid becomes this item's entry number from the matrix
 $sid = $entryx[$itemid];
 //
 // We're going to encounter a number of enries in this table that now
 // belong in field__option_selected and we can't insert them into this
 // table because of a primary key / unique field, but we want one
 // entry to indicate there is a field there. (I think)
 //
 // this needs to somehow detect dupe / conflicting fields where the
 // multi-optional fields come into play
 // ....and it works well...
 $rowinserted = array();
 if (!isset($rowinserted[$newfid][$sid])) {
     //echo "Go home, you're null!";
예제 #2
0
파일: locales.php 프로젝트: JangPooH/Study
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<title>Locales</title>
</head>
<body style="font-size: 18pt;">
<?php # Script 14.5 - locales.php

// Set the default timezone:
date_default_timezone_set('UTC');

// Need a date object:
$d = new DateTime();

// Create a list of locales:
$locales = array('en_US', 'fr_FR', 'es_BO', 'zh_Hans_CN', 'ru_RU', 'el_GR', 'is_IS');

// Print the date in each locale:
foreach ($locales as $locale) {

	// Set the locale:
	locale_set_default($locale);
	
	// Print the date:
	echo "<p>$locale: " . strtotitle(date_format_locale($d, 'l, j F Y')) . "</p>\n";

}

?>
</body>
</html>