本文整理汇总了PHP中df函数的典型用法代码示例。如果您正苦于以下问题:PHP df函数的具体用法?PHP df怎么用?PHP df使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了df函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNameInMagentoFormat
/**
* Например, для класса Df_SalesRule_Model_Event_Validator_Process
* метод должен вернуть: «df_sales_rule/event_validator_process»
*
* @static
* @return string
*/
public static function getNameInMagentoFormat()
{
/** @var string $result */
static $result;
if (!isset($result)) {
$result = df()->reflection()->getModelNameInMagentoFormat(self::getClass());
}
return $result;
}
示例2: Search
function Search($firstcount, $displaypg)
{
global $cache_types;
$result = $this->findAll("*,description AS digest", null, null, "id DESC", $firstcount, $displaypg);
while (list($keys, $values) = each($result)) {
$result[$keys]['pubdate'] = df($values['created']);
$result[$keys]['url'] = $this->getPermaLink($values['id'], "product/price");
}
return $result;
}
示例3: Search
function Search($firstcount, $displaypg)
{
global $cache_types;
$result = $this->findAll("Help.*,Help.content as digest", null, null, $this->orderby, $firstcount, $displaypg);
while (list($keys, $values) = each($result)) {
$result[$keys]['pubdate'] = df($values['created']);
$result[$keys]['typename'] = $cache_types['helptype'][$values['helptype_id']];
$result[$keys]['url'] = $this->getPermaLink($values['id']);
}
return $result;
}
示例4: Search
function Search($firstcount, $displaypg)
{
global $cache_types;
$result = $this->findAll("Dict.*,Dict.word as title", null, null, $this->orderby, $firstcount, $displaypg);
while (list($keys, $values) = each($result)) {
$result[$keys]['pubdate'] = df($values['created']);
$result[$keys]['typename'] = $cache_types['dicttype'][$values['dicttype_id']];
$result[$keys]['url'] = $this->url(array("do" => "dict", "id" => $values['id']));
}
return $result;
}
示例5: Search
function Search($firstcount, $displaypg)
{
global $cache_types;
$result = $this->findAll("*,content AS digest", null, null, "id DESC", $firstcount, $displaypg);
while (list($keys, $values) = each($result)) {
$result[$keys]['pubdate'] = df($values['created']);
$result[$keys]['force_date'] = df($values['force_time']);
$result[$keys]['typename'] = $cache_types['standardtype'][$values['type_id']];
$result[$keys]['url'] = $this->getPermaLink($values['id'], 'standard');
}
return $result;
}
示例6: formatResult
function formatResult($result)
{
if (!empty($result)) {
$count = count($result);
for ($i = 0; $i < $count; $i++) {
$result[$i]['pubdate'] = df($result[$i]['submit_time']);
$result[$i]['image'] = pb_get_attachmenturl($result[$i]['picture'], '', 'small');
}
return $result;
} else {
return null;
}
}
示例7: Search
function Search($firstcount, $displaypg)
{
global $cache_types;
$result = $this->findAll("*,Market.name AS title", null, null, $this->orderby, $firstcount, $displaypg);
while (list($keys, $values) = each($result)) {
$result[$keys]['digest'] = $values['content'];
$result[$keys]['pubdate'] = df($values['created']);
$result[$keys]['typename'] = $cache_types['markettype'][$values['markettype_id']];
$result[$keys]['url'] = $this->getPermaLink($values['id']);
$result[$keys]['thumb'] = pb_get_attachmenturl($values['picture']);
}
return $result;
}
示例8: Search
function Search($firstcount, $displaypg)
{
global $cache_types;
$result = $this->findAll("*", null, null, "display_order ASC,id DESC", $firstcount, $displaypg);
while (list($keys, $values) = each($result)) {
$result[$keys]['title'] = $values['subject'];
$result[$keys]['digest'] = $values['message'];
$result[$keys]['pubdate'] = df($values['created']);
$result[$keys]['typename'] = $cache_types['announcementtype'][$values['announcetype_id']];
$result[$keys]['url'] = $this->url(array("do" => "announce", "id" => $values['id']));
unset($result[$keys]['subject'], $result[$keys]['message']);
}
return $result;
}
示例9: checkExist
function checkExist($id, $extra = false)
{
$id = intval($id);
$info = $this->dbstuff->GetRow("SELECT * FROM {$this->table_prefix}expos WHERE id={$id}");
if (empty($info) or !$info) {
return false;
} else {
if ($extra) {
$info['begin_date'] = !$info['begin_time'] ? df($this->timestamp) : df($info['begin_time']);
$info['end_date'] = !$info['end_time'] ? df($this->timestamp) : df($info['end_time']);
$this->info = $info;
}
return true;
}
}
示例10: mkCacheData
function mkCacheData($date_from, $date_to, $product_id)
{
$conditions = array();
$info = $this->dbstuff->GetRow("SELECT * FROM " . $this->table_prefix . "products WHERE id='" . $product_id . "'");
if (!empty($info)) {
$_GET['pn'] = $info['name'];
}
$mdt = date("Ymd") . "_" . substr(md5($_GET['pn'] . $_GET['ds'] . $_GET['de']), 0, 6);
$file_item = $mdt;
$file_path = DATA_PATH . "tmp/" . $file_item . $this->cache_ext;
if (!file_exists($file_path)) {
// use the chart class to build the chart:
include_once LIB_PATH . 'ofc/chart.php';
$g = new graph();
$result = $this->dbstuff->GetArray("SELECT DATE_FORMAT(FROM_UNIXTIME(created),'%m') as mn,avg(max_price) AS avmax,avg(min_price) AS avmin FROM " . $this->table_prefix . "quotes WHERE product_id=" . $product_id . " AND created BETWEEN {$date_from} AND {$date_to} group by mn ORDER BY created ASC");
if (!empty($result)) {
foreach ($result as $val) {
$data[] = floor(($val['avmax'] + $val['avmin']) / 2);
}
$title = L("stat_charts", "tpl") . $_GET['ds'] . L("arrive_to", "tpl") . $_GET['de'];
} elseif ($info['name']) {
$title = $info['name'];
} else {
$title = L("data_not_exists") . df();
}
$g->title($title, '{font-size: 24px;color: #0000FF}');
$g->set_data($data);
$g->line_hollow(2, 4, '0x80a033', $_GET['pn'], 10);
// label each point with its value
//$g->set_x_labels( explode(",", L("months", "tpl")) );
$x_result = $this->dbstuff->GetArray("select CONCAT(FROM_UNIXTIME(created, '%Y'),'/',FROM_UNIXTIME(created, '%m')) as m from " . $this->table_prefix . "quotes WHERE created BETWEEN {$date_from} AND {$date_to} group by DATE_FORMAT(FROM_UNIXTIME(created),'%m') ORDER BY created ASC");
foreach ($x_result as $val) {
$x_tmp[] = $val['m'];
}
$g->set_x_labels($x_tmp);
$label_y = $this->dbstuff->GetRow("select max(max_price) as price_max,min(min_price) as price_min from " . $this->table_prefix . "quotes WHERE product_id=" . $product_id . " AND created BETWEEN {$date_from} AND {$date_to}");
$y_max = !empty($label_y['price_max']) ? $label_y['price_max'] : 100;
// set the Y max
$this->max_price = $label_y['price_max'];
$this->min_price = $label_y['price_min'];
$g->set_y_max($label_y['price_max']);
// label every 20 (0,20,40,60)
$g->y_label_steps(6);
// display the data
file_put_contents($file_path, $g->render());
}
$this->cache_datafile = $file_item . $this->cache_ext;
}
示例11: detail
function detail()
{
global $viewhelper;
$viewhelper->setTitle(L("announce", "tpl"));
$types = cache_read("type");
$viewhelper->setPosition('test', "index.php?do=announce");
if (isset($_GET['title'])) {
$title = trim($_GET['title']);
$res = $this->announcement->findBySubject($title);
$id = $res['id'];
}
if (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
if (!empty($id)) {
$result = $this->announcement->findById($id);
if (!empty($result)) {
$result['message'] = nl2br($result['message']);
$viewhelper->setPosition($types['announcementtype'][$result['announcetype_id']], "index.php?do=announce&typeid=" . $result['announcetype_id']);
$viewhelper->setTitle($result['subject']);
$viewhelper->setPosition($result['subject']);
$viewhelper->setMetaDescription($result['message']);
$result['title'] = pb_lang_split($result['subject']);
$result['content'] = pb_lang_split($result['message']);
$result['typename'] = pb_lang_split($types['announcementtype'][$result['announcetype_id']]);
$result['pubdate'] = df($result['created']);
$neighbour_info = $this->announcement->getNeighbour($id, "id,subject AS title,subject");
if (!empty($neighbour_info['prev'])) {
$title = pb_lang_split($neighbour_info['prev']['title']);
$result['prev_link'] = "<a href='" . $this->url(array("id" => $neighbour_info['prev']['id'], "module" => 'announce')) . "'>" . $title . "</a>";
$result['prev_title'] = $title;
} else {
$result['prev_link'] = L("nothing", "tpl");
}
if (!empty($neighbour_info['next'])) {
$title = pb_lang_split($neighbour_info['next']['title']);
$result['next_link'] = "<a href='" . $this->url(array("id" => $neighbour_info['next']['id'], "module" => 'announce')) . "'>" . $title . "</a>";
$result['next_title'] = $title;
} else {
$result['next_link'] = L("nothing", "tpl");
}
setvar("item", $result);
setvar("PageTitle", strip_tags($result['subject']));
render("detail.default", true);
}
}
}
示例12: prepareFields
/**
* Prepare fields for table
*
* @param type $user
* @return type
*/
public function prepareFields($user, $key)
{
switch ($key) {
case 'login':
return $user->render('list', 'avatar.small');
break;
case 'reg_date':
return df($user->reg_date, 'd M Y');
break;
case 'posts':
return '<a href="' . $user->getLink() . '/posts/" class="badge' . ($user->posts > 0 ? ' badge-info' : '') . '">' . $user->posts . '</a>';
break;
case 'comments':
return '<a href="' . $user->getLink() . '/comments/" class="badge' . ($user->comments > 0 ? ' badge-warning' : '') . '">' . $user->comments . '</a>';
break;
}
}
示例13: Search
function Search($firstcount, $displaypg)
{
global $cache_types;
if (empty($_GET['page'])) {
//array_unshift($this->condition,"id between 1000 and 2000");
}
$orderby = "id DESC";
if (isset($_GET['type'])) {
$type = trim($_GET['type']);
if ($type == "hot") {
$orderby = "News.clicked DESC";
}
}
$result = $this->findAll("*,content AS digest", null, null, $orderby, $firstcount, $displaypg);
while (list($keys, $values) = each($result)) {
$result[$keys]['pubdate'] = df($values['created']);
$result[$keys]['typename'] = $cache_types['newstype'][$values['type_id']];
$result[$keys]['thumb'] = pb_get_attachmenturl($values['picture'], '', 'small');
$result[$keys]['url'] = $this->url(array("do" => "news", "id" => $values['id']));
}
return $result;
}
示例14: detail
function detail()
{
global $viewhelper;
using("tag", "meta");
$tag = new Tags();
$meta = new Metas();
$conditions = array();
$viewhelper->setTitle(L("info", "tpl"));
$viewhelper->setPosition(L("info", "tpl"), "index.php?do=news");
if (isset($_GET['title'])) {
$title = trim($_GET['title']);
$res = $this->news->findByTitle($title);
$id = $res['id'];
}
if (isset($_GET['id'])) {
$id = intval($_GET['id']);
}
if (!empty($id)) {
$_PB_CACHE['newstype'] = cache_read("type", "newstype");
$this->news->clicked($id);
$info = $this->news->read("*", $id);
if (empty($info) or !$info) {
flash("data_not_exists", '', 0);
}
if (!empty($info['tag_ids'])) {
$the_tags = $tag->getTagsByIds($info['tag_ids'], true);
$tmp = null;
$info['tag'] = $tag->tag;
foreach ($the_tags as $key => $val) {
$tmp .= "<a href='" . $this->url(array("module" => "search", "do" => "news", "q" => urlencode($val))) . "'>" . $val . "</a> ";
}
$info['tag_link'] = $tmp;
}
if (!empty($info['picture'])) {
$info['image'] = pb_get_attachmenturl($info['picture'], '', 'small');
}
$info['pubdate'] = df($info['created']);
$info['typename'] = $_PB_CACHE['newstype'][$info['type_id']];
$viewhelper->setTitle($info['typename']);
$viewhelper->setPosition($info['typename'], $this->url(array("module" => "search", "do" => "news", "typeid" => $info['type_id'])));
//seo info
$meta_info = $meta->getSEOById($id, 'news', false);
empty($meta_info['title']) ? $viewhelper->setTitle($info['title']) : $viewhelper->setTitle($meta_info['title']);
empty($meta_info['description']) ? $viewhelper->setMetaDescription($info['content']) : $viewhelper->setMetaDescription($meta_info['description']);
if (isset($meta_info['keyword'])) {
$viewhelper->setMetaKeyword($meta_info['keyword']);
}
$viewhelper->setPosition($info['title']);
if (!empty($info['require_membertype'])) {
$require_ids = explode(",", $info['require_membertype']);
if (!empty($pb_userinfo['pb_userid'])) {
$membertype_id = $this->news->dbstuff->GetOne("SELECT membertype_id FROM {$tb_prefix}members WHERE id='" . $pb_user['pb_userid'] . "'");
if (!in_array($membertype_id, $require_ids)) {
$info['content'] = L("news_membertype_not_allowed", "tpl");
}
} else {
$info['content'] = L("news_membertype_not_allowed", "tpl");
}
}
if ($info['type'] == 1) {
$info['source'] = L("company_news", "tpl");
$info['content'] = "<a href='" . $info['content'] . "'>" . $info['content'] . "</a>";
}
if (!empty($info['picture'])) {
$info['image_url'] = pb_get_attachmenturl($info['picture']);
}
$neighbour_info = $this->news->getNeighbour($id, "id,title");
if (!empty($neighbour_info['prev'])) {
$title = pb_lang_split($neighbour_info['prev']['title']);
$info['prev_link'] = "<a href='" . $this->url(array("module" => "news", "id" => $neighbour_info['prev']['id'])) . "'>" . $title . "</a>";
$info['prev_title'] = $title;
} else {
$info['prev_link'] = L("nothing", "tpl");
}
if (!empty($neighbour_info['next'])) {
$title = pb_lang_split($neighbour_info['next']['title']);
$info['next_link'] = "<a href='" . $this->url(array("module" => "news", "id" => $neighbour_info['next']['id'])) . "'>" . $title . "</a>";
$info['next_title'] = $title;
} else {
$info['next_link'] = L("nothing", "tpl");
}
setvar("item", pb_lang_split_recursive($info));
} else {
flash();
}
setvar("Newstypes", $_PB_CACHE['newstype']);
render("detail.default");
}
示例15: smarty_block_offer
//.........这里部分代码省略.........
}
if (isset($params['country_id'])) {
$conditions[] = "t.country_id='" . $params['country_id'] . "'";
}
if (isset($params['expday'])) {
$conditions[] = "t.expire_time<'" . ($params['expday'] * 86400 + $trade->timestamp) . "'";
}
if (isset($params['subday'])) {
$conditions[] = "t.submit_time>'" . ($trade->timestamp - $params['expireday'] * 86400) . "'";
}
if (isset($params['typeid'])) {
if (!empty($params['typeid'])) {
if (strpos($params['typeid'], ",") > 0) {
$tmp_ids = explode(",", $params['typeid']);
$conditions[] = "t.type_id in ('" . implode("','", $tmp_ids) . "')";
} else {
$conditions[] = "t.type_id='" . $params['typeid'] . "'";
}
}
}
if (isset($params['urgent'])) {
$conditions[] = "t.if_urgent='1'";
}
if (!empty($params['memberid'])) {
$conditions[] = "t.member_id='" . $params['memberid'] . "'";
}
if (!empty($params['companyid'])) {
$conditions[] = "t.company_id='" . $params['companyid'] . "'";
}
if (isset($params['cash'])) {
$conditions[] = "t.require_point>0";
}
$trade->setCondition($conditions);
$orderby = null;
$orderby = isset($params['orderby']) ? " ORDER BY " . trim($params['orderby']) . " " : " ORDER BY modified DESC";
$limit = $offset = 0;
if (isset($params['row'])) {
$limit = $params['row'];
}
if (isset($params['start'])) {
$offset = $params['start'];
}
if (isset($_GET['pos'])) {
$offset = intval($_GET['pos']);
}
$trade->setLimitOffset($offset, $limit);
$mysql_limit = $trade->getLimitOffset();
if (isset($params['limit'])) {
$mysql_limit = " " . trim($params['limit']);
}
if (!$params['recursive']) {
$sql = "SELECT *,title as name,title as fulltitle,content as fullcontent FROM {$trade->table_prefix}trades t " . $trade->getCondition() . "{$orderby}" . $mysql_limit;
} else {
$sql = "SELECT *,content as fullcontent FROM {$trade->table_prefix}trades t " . $trade->getCondition() . " ORDER BY t.display_order ASC,t.id DESC" . $mysql_limit;
}
$offer_typenames = $trade_controller->getTradeTypes();
if (empty($smarty->blockvars[$param_count])) {
$smarty->blockvars[$param_count] = $trade->GetArray($sql);
if (!$smarty->blockvars[$param_count]) {
return $repeat = false;
}
}
if (!function_exists("smarty_function_the_url")) {
require "function.the_url.php";
}
if (list($key, $item) = each($smarty->blockvars[$param_count])) {
$repeat = true;
$item['rownum'] = $key;
$item['iteration'] = ++$key;
$url = smarty_function_the_url(array("id" => $item['id'], "typeid" => $item['type_id'], "module" => "offer"));
$item['url'] = $url;
$item['title'] = strip_tags($item['title']);
$item['content'] = strip_tags($item['content']);
if (isset($params['titlelen'])) {
$item['title'] = mb_substr($item['title'], 0, $params['titlelen']);
}
if (isset($params['infolen'])) {
$item['content'] = mb_substr($item['content'], 0, $params['infolen']);
}
if (isset($params['titlestart'])) {
$item['title'] = $params['titlestart'] . $item['title'];
}
$item['pubdate'] = df($item['submit_time']);
$item['typeid'] = $item['type_id'];
$item['typename'] = $offer_typenames[$item['type_id']];
$item['src'] = $item['thumb'] = URL . "attachment/" . $item['picture'] . ".small.jpg";
$item['link'] = '<a title="' . $item['fulltitle'] . '" href="' . $url . '">' . $item['title'] . '</a>';
$item['style'] = parse_highlight($item['highlight']);
$smarty->assign($params['name'], $item);
} else {
$repeat = false;
reset($smarty->blockvars[$param_count]);
}
if (!is_null($content)) {
print $content;
}
if (!$repeat) {
$smarty->blockvars[$param_count] = array();
}
}