本文整理汇总了PHP中dater函数的典型用法代码示例。如果您正苦于以下问题:PHP dater函数的具体用法?PHP dater怎么用?PHP dater使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dater函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ordersPerMonth
function ordersPerMonth()
{
$db = Database::getDatabase();
$orders = $db->getRows("SELECT DATE_FORMAT(dt, '%Y-%m') as dtstr, COUNT(*) FROM orders WHERE type = 'PayPal' AND app_id = '{$this->id}' GROUP BY CONCAT(YEAR(dt), '-', MONTH(dt)) ORDER BY YEAR(dt) ASC, MONTH(dt) ASC");
$keys = gimme($orders, 'dtstr');
$values = gimme($orders, 'COUNT(*)');
$orders = array();
for ($i = 0; $i < count($keys); $i++) {
$orders[$keys[$i]] = $values[$i];
}
$first_order_date = $db->getValue("SELECT dt FROM orders ORDER BY dt ASC LIMIT 1");
list($year, $month) = explode('-', dater($first_order_date, 'Y-n'));
do {
$month = str_pad($month, 2, '0', STR_PAD_LEFT);
if (!isset($orders["{$year}-{$month}"])) {
$orders["{$year}-{$month}"] = 0;
}
$month = intval($month) + 1;
if ($month == 13) {
$month = 1;
$year++;
}
} while ($year != date('Y') && $month != date('m'));
ksort($orders);
return $orders;
}
示例2: testDater
function testDater()
{
$ts = time();
$date = date('Y-m-d H:i:s', $ts);
$this->assertEquals($date, dater($ts, 'Y-m-d H:i:s'));
$this->assertEquals($date, dater($date, 'Y-m-d H:i:s'));
$this->assertEquals($date, dater(strtotime($date), 'Y-m-d H:i:s'));
}
示例3: testDater
function testDater()
{
$ts = time();
$date = date('Y-m-d H:i:s', $ts);
$this->equals(dater($ts, 'Y-m-d H:i:s'), $date);
$this->equals(dater($date, 'Y-m-d H:i:s'), $date);
$this->equals(dater(strtotime($date), 'Y-m-d H:i:s'), $date);
}
示例4: refreshContent
public static function refreshContent($url, $expires_in = 300)
{
$str = self::getURL($url);
$data = self::decodeStrData($str);
if ($data === false) {
return false;
}
$db = Database::getDatabase();
$db->query("REPLACE INTO url_cache (url, dt_refreshed, dt_expires, data) VALUES (:url, :dt_refreshed, :dt_expires, :data)", array('url' => $url, 'dt_refreshed' => dater(), 'dt_expires' => dater(time() + $expires_in), 'data' => $str));
return $str;
}
示例5: upgradeLicense
public function upgradeLicense()
{
$upgrade_app = new Application($this->application->upgrade_app_id);
if ($upgrade_app->ok()) {
$o = new Order();
$o->app_id = $upgrade_app->id;
$o->dt = dater();
$o->first_name = $this->order->first_name;
$o->last_name = $this->order->last_name;
$o->payer_email = $this->order->payer_email;
$o->notes = "Upgrade via Shine";
$o->type = 'Upgrade';
$o->insert();
$o->generateLicense();
return $o;
}
return null;
}
示例6: track
public static function track($page_title = '')
{
$db = Database::getDatabase();
$dt = dater();
$referer = getenv('HTTP_REFERER');
$referer_is_local = self::refererIsLocal($referer);
$url = full_url();
$search_terms = self::searchTerms();
$img_search = '';
$ip = self::getIP();
$info = self::browserInfo();
$browser_family = $info['browser'];
$browser_version = $info['version'];
$os = $info['platform'];
$os_version = '';
$user_agent = $info['useragent'];
$exec_time = defined('START_TIME') ? microtime(true) - START_TIME : 0;
$num_queries = $db->numQueries();
$sql = "INSERT INTO stats (dt, referer, referer_is_local, url, page_title, search_terms, img_search, browser_family, browser_version, os, os_version, ip, user_agent, exec_time, num_queries)\n VALUES (:dt, :referer, :referer_is_local, :url, :page_title, :search_terms, :img_search, :browser_family, :browser_version, :os, :os_version, :ip, :user_agent, :exec_time, :num_queries)";
$vals = array('dt' => $dt, 'referer_is_local' => $referer_is_local, 'referer' => $referer, 'url' => $url, 'page_title' => $page_title, 'search_terms' => $search_terms, 'img_search' => $img_search, 'ip' => $ip, 'browser_family' => $browser_family, 'browser_version' => $browser_version, 'os_version' => $os_version, 'os' => $os, 'user_agent' => $user_agent, 'exec_time' => $exec_time, 'num_queries' => $num_queries);
$db->query($sql, $vals);
}
示例7: dater
if ($f->type == "bug") {
?>
<tr>
<th class="r">Critical</th>
<td><?php
echo $f->critical == 0 ? "No" : "Yes!";
?>
</td>
</tr>
<?php
}
?>
<tr>
<th class="r">Date Submitted</th>
<td><?php
echo dater('n/j/Y g:ia', $f->dt);
?>
</td>
</tr>
<tr>
<th class="r">IP</th>
<td><?php
echo $f->ip;
?>
</td>
</tr>
<tr>
<th class="r">Registration</th>
<td><?php
echo $f->reguser;
?>
示例8: utf8_encode
echo utf8_encode($o->last_name);
?>
</td>
<td><a href="mailto:<?php
echo utf8_encode($o->payer_email);
?>
"><?php
echo utf8_encode($o->payer_email);
?>
</a></td>
<td><?php
echo $o->type;
?>
</td>
<td><?php
echo dater($o->dt, 'm/d/Y g:ia');
?>
</td>
<td><?php
echo $o->intlAmount();
?>
</td>
<td><a href="order.php?id=<?php
echo $o->id;
?>
">View</a></td>
</tr>
<?php
}
?>
</tbody>
示例9: foreach
</tr>
</thead>
<tbody>
<?php
foreach ($milestones as $m) {
?>
<tr>
<td><a href="tickets-milestone.php?id=<?php
echo $m->id;
?>
"><?php
echo $m->title;
?>
</a></td>
<td><?php
echo dater($m->dt_due, 'F j');
?>
</td>
<td><span class="pbar"><span class="inner" style="width:<?php
echo $m->percent();
?>
%;"></span><span class="percent"><?php
echo $m->percent();
?>
%</span></span></td>
</tr>
<?php
}
?>
</tbody>
</table>
示例10: foreach
foreach ($versions as $v) {
?>
<tr>
<td><a href="version-edit.php?id=<?php
echo $v->id;
?>
"><?php
echo $v->human_version;
?>
</a></td>
<td><?php
echo $v->version_number;
?>
</td>
<td><?php
echo dater($v->dt, 'n/d/Y g:ia');
?>
</td>
<td><?php
echo number_format($v->downloads);
?>
</td>
<td><?php
echo number_format($v->updates);
?>
</td>
</tr>
<?php
}
?>
</tbody>
示例11: UCWords
?>
</td>
</tr>
<?php
if ($Auth->level != 'free user') {
?>
<tr>
<td class="first">
<?php
echo UCWords(t('reverts_to_free_account', 'reverts to free account'));
?>
:
</td>
<td>
<?php
echo $Auth->level == 'paid user' ? dater($Auth->paidExpiryDate) : UCWords(t('never', 'never'));
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<div class="clear"><!-- --></div>
<div id="pageHeader" style="padding-top: 18px;">
<h2><?php
echo strtolower(PAGE_NAME);
?>
示例12: header
if (empty($_POST['last_name']) || empty($_POST['first_name']) || empty($_POST['payment_gross']) || empty($_POST['transaction_id'])) {
header("HTTP/1.1 400 Missing parameter");
error_log("Incomplete POST variables – exiting.");
exit;
}
//
$app = new Application();
$app->select(7);
if (!$app->ok()) {
header("HTTP/1.1 400 Missing parameter");
error_log("Application not found!");
exit;
}
//
$o = new Order();
$o->app_id = $app->id;
$o->item_name = $app->name;
$o->dt = dater();
$o->type = 'MUPromo';
$o->first_name = $_POST['first_name'];
$o->last_name = $_POST['last_name'];
$o->payer_email = $_POST['email'];
$o->txn_id = $_POST['transaction_id'];
$o->payment_gross = preg_replace('/[^0-9.]/', '', $_POST['payment_gross']);
// custom
$o->insert();
$o->generateLicense();
//$o->emailLicense();
// return the URL
header('Content-type: text/plain', TRUE);
echo "http://updates.basil-salad.com/shine/order-retrieve.php?order_id=" . urlencode($o->id) . "&email=" . urlencode($o->payer_email) . "\n";
示例13: dater
<description>Most recent changes with links to updates.</description>
<language>en</language>
<item>
<title><?php
echo $app->name;
?>
<?php
echo $v->human_version;
?>
</title>
<description><![CDATA[ <?php
echo $combined_description;
?>
]]></description>
<pubDate><?php
echo dater('D, d M Y H:i:s O', $v->dt);
?>
</pubDate>
<enclosure url="<?php
echo $v->url;
?>
" sparkle:shortVersionString="<?php
echo $v->human_version;
?>
" sparkle:version="<?php
echo $v->version_number;
?>
" length="<?php
echo $v->filesize;
?>
" type="application/octet-stream" sparkle:dsaSignature="<?php
示例14: Application
$app = new Application($_GET['app_id']);
if (!$app->ok()) {
redirect('/tickets/');
}
if (isset($_POST['btnNew'])) {
if ($Error->ok()) {
$t = new Ticket();
$t->app_id = $app->id;
$t->title = trim($_POST['title']);
$t->description = $_POST['description'];
$t->created_by = $Auth->id;
$t->assigned_to = $_POST['assigned_to'];
$t->milestone_id = $_POST['milestone_id'];
$t->status = $_POST['status'];
$t->dt_created = dater();
$t->dt_last_state = dater();
if (strlen($t->title) == 0) {
$t->title = 'Untitled Ticket';
}
$t->insert();
redirect('/tickets/app/' . $app->id . '/list/');
} else {
}
} else {
$title = '';
$description = '';
$assigned_to = '';
$milestone_id = '';
$tags = '';
}
$fakeTicket = new Ticket();
示例15: Application
<?php
require 'includes/master.inc.php';
$Auth->requireAdmin('login.php');
$nav = 'applications';
$app = new Application($_GET['id']);
if (!$app->ok()) {
redirect('index.php');
}
if (isset($_POST['btnSerial'])) {
if (strlen($_POST['serial']) > 0) {
$s = new Serial();
$s->app_id = $app->id;
$s->dt = dater();
$s->guid = $_POST['guid'];
$s->serial = $_POST['serial'];
$s->insert();
redirect('pirates.php?id=' . $app->id);
}
}
$db = Database::getDatabase();
$pirates = $db->getRows("SELECT * FROM pirates WHERE app_id = '{$app->id}' ORDER BY dt DESC");
$serial_count = $db->getValue("SELECT COUNT(*) from pirated_serials WHERE app_id = '{$app->id}'");
$serial_date = $db->getValue("SELECT dt FROM pirated_serials WHERE app_id = '{$app->id}' ORDER BY dt DESC LIMIT 1");
$serial_date = $serial_date ? time2str($serial_date) : 'never';
if (isset($_GET['feed']) && $_GET['feed'] == 'json') {
$serials = DBObject::glob('Serial', "SELECT * from pirated_serials WHERE app_id = '{$app->id}'");
$arr = array();
foreach ($serials as $s) {
$arr[] = array('dt' => $s->dt, 'guid' => $s->guid, 'serial' => $s->serial);
}