本文整理汇总了PHP中format类的典型用法代码示例。如果您正苦于以下问题:PHP format类的具体用法?PHP format怎么用?PHP format使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了format类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __call
public function __call($m, $a)
{
$ignore_ofs_methods = array('__destruct');
if (in_array($m, $ignore_ofs_methods)) {
return 'IGNORE_OFS_COMMAND_COMPLETE';
}
// if the command is in the list of commands to run on all ofs objects, do so
$all_ofs_methods = array('append_header', 'append_footer');
if (in_array($m, $all_ofs_methods)) {
foreach ($this->ofs as $set_id => $ofs) {
call_user_func_array(array(&$ofs, $m), $a);
}
return 'ALL_OFS_COMMAND_COMPLETE';
}
$use_replica_set_id = format::get_context_replica_set_id();
if ($use_replica_set_id == -10) {
// context_replica_set_id -10 means object does not have slonySetId defined
// use the natural first replica set as the replica context
$first_replica_set = pgsql8::get_slony_replica_set_natural_first(dbsteward::$new_database);
$use_replica_set_id = (int) $first_replica_set['id'];
}
// make sure replica set id to use is known
if (!isset($this->ofs[$use_replica_set_id])) {
if ($this->skip_unknown_set_ids) {
dbsteward::notice("[OFS RSR] context replica set ID is " . $use_replica_set_id . ", but no replica set by that ID, skipping output");
return FALSE;
}
throw new exception("context replica set ID " . $use_replica_set_id . " not defined");
}
$active_set_ofs = $this->ofs[$use_replica_set_id];
dbsteward::debug("[OFS RSR] __call calling " . $use_replica_set_id . " ofs::" . $m);
return call_user_func_array(array(&$active_set_ofs, $m), $a);
}
开发者ID:williammoran,项目名称:DBSteward,代码行数:33,代码来源:ofs_replica_set_router.php
示例2: action_index
public function action_index()
{
// clear buffer
helper_ob::clean_all();
// validating
do {
$options = application::get('flag.numbers.backend.cron.base');
// token
if (!empty($options['token']) && request::input('token') != $options['token']) {
break;
}
// ip
if (!empty($options['ip']) && !in_array(request::ip(), $options['ip'])) {
break;
}
// get date parts
$date_parts = format::now('parts');
print_r($date_parts);
echo "GOOD\n";
} while (0);
// we need to validate token
//$token = request::input('token');
echo "OK\n";
// exit
exit;
}
开发者ID:volodymyr-volynets,项目名称:backend,代码行数:26,代码来源:execute.php
示例3: __set
/**
* Whenever setting the slug, make sure that it conforms to requirements
* @developer Brandon Hansen
* @date Oct 26, 2010
*/
public function __set($key, $value)
{
if ($key == 'slug') {
$value = format::pretty_url($value);
}
parent::__set($key, $value);
}
开发者ID:ready4god2513,项目名称:scs,代码行数:12,代码来源:category.php
示例4: get_title
/**
* Get the page title
* @Developer brandon
* @Date May 7, 2010
*/
public static function get_title()
{
if (!isset(self::$meta['title'])) {
return format::friendly_model_name(Router::$controller) . ' :: ' . format::friendly_model_name(Router::$method);
} else {
return strip_tags(self::$meta['title']);
}
}
开发者ID:ready4god2513,项目名称:Journal,代码行数:13,代码来源:meta.php
示例5: variant_dropdown
/**
* Provide a dropdown for variants
* @developer Brandon Hansen
* @date Nov 2, 2010
*/
public static function variant_dropdown(Product_Model $product)
{
$options = array();
foreach ($product->variants as $variant) {
$options[(string) $variant] = $variant->name . ' - ' . format::dollar_format($variant->price);
}
return self::dropdown(array('name' => 'variant_id', 'id' => 'select-variant'), $options);
}
开发者ID:ready4god2513,项目名称:scs,代码行数:13,代码来源:MY_form.php
示例6: size
public static function size($file, $format = false)
{
$file = path::decode($file);
$size = @filesize($file);
if ($format) {
$size = format::byte($size, $format);
}
return $size;
}
开发者ID:dalinhuang,项目名称:zotop,代码行数:9,代码来源:file.php
示例7: show_path
/**
* Show path route
* @Developer brandon
* @Date Oct 11, 2010
*/
public function show_path($abs = true)
{
$path = $this->object_name . '/' . format::pretty_url($this->slug);
if ($abs) {
return url::site($path);
} else {
return $path;
}
}
开发者ID:ready4god2513,项目名称:scs,代码行数:14,代码来源:product.php
示例8: show
/**
* Clean up the show page URL
* @Developer brandon
* @Date Oct 11, 2010
*/
public function show($name = NULL)
{
$blog = ORM::factory('blog')->where('name', format::dash_to_space($name))->find();
// Set the title
meta::set_title(ucwords($blog->name));
// Set the description
meta::set_description($blog->synopsis);
// Show the page
parent::show($blog);
}
开发者ID:ready4god2513,项目名称:scs,代码行数:15,代码来源:blogs.php
示例9: onDefault
public function onDefault()
{
$tables = $this->db->table()->get(true);
$header['title'] = '数据库管理';
page::header($header);
page::add('<div id="page" class="clearfix">');
page::add('<div id="side">');
block::header('数据库基本信息');
table::header();
table::row(array('w60' => '数据库名称', '2' => '' . $this->db->config['database'] . ''));
table::row(array('w60' => '数据库版本', '2' => '' . $this->db->version(true) . ''));
table::row(array('w60' => '数据库大小', '2' => '<b>' . $this->db->size() . '</b> '));
table::row(array('w60' => '数据表个数', '2' => '<b>' . count($tables) . '</b> 个'));
table::footer();
block::footer();
page::add('</div>');
page::add('<div id="main">');
page::top();
page::navbar($this->navbar(), 'table');
//zotop::dump($tables);
form::header(array('class' => 'ajax'));
$column['select'] = '<input name="id" class="selectAll" type="checkbox"/>';
$column['name'] = '数据表名称';
$column['size w60'] = '大小';
$column['Rows w60'] = '记录数';
$column['Engine w60'] = '类型';
$column['Collation w100'] = '整理';
$column['manage view w60'] = '浏览';
$column['manage delete'] = '删除';
table::header('list', $column);
foreach ($tables as $table) {
$size = $table['Data_length'] + $table['Index_length'];
$column = array();
$column['select'] = '<input name="id[]" class="select" type="checkbox"/>';
$column['name'] = '<b>' . $table['Name'] . '</b><h5>' . $table['Comment'] . '</h5>';
$column['size w60'] = (string) format::size($size);
$column['Rows w60'] = $table['Rows'];
$column['Engine w60'] = $table['Engine'];
$column['collation w100'] = $table['Collation'];
$column['manage view w60'] = '<a href="' . url::build('system/database/table/record') . '">浏览</a>';
$column['manage delete'] = '<a href="' . url::build('system/database/table/delete') . '" class="confirm">删除</a>';
table::row($column);
}
table::footer();
page::add('<div style="height:200px;"></div>');
form::buttons(array('type' => 'select', 'style' => 'width:180px', 'options' => array('check' => '优化', 'delete' => '删除')), array('type' => 'submit', 'value' => '执行操作'));
form::footer();
page::bottom();
page::add('</div>');
page::add('</div>');
page::footer();
}
开发者ID:dalinhuang,项目名称:zotop,代码行数:52,代码来源:database.php
示例10: init
public function init() {
$total = $this->db->count();
$page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1;
$pagesize = 20;
$offset = ($page - 1) * $pagesize;
$list = $this->db->select('', '*', $offset.','.$pagesize);
pc_base::load_sys_class('format', '', 0);
foreach ($list as $key=> $v) {
$list[$key]['lastlogin'] = format::date($v['lastlogin'], 1);
}
$pages = pages($total, $page, $pagesize);
include $this->admin_tpl('administrator_list');
}
开发者ID:panhongsheng,项目名称:zl_cms,代码行数:13,代码来源:administrator.php
示例11: calendar
/**
* see html::calendar()
*/
public static function calendar($options = [])
{
// include js & css files
if (empty($options['readonly'])) {
layout::add_js('/numbers/media_submodules/numbers_frontend_components_calendar_numbers_media_js_base.js');
layout::add_css('/numbers/media_submodules/numbers_frontend_components_calendar_numbers_media_css_base.css');
}
// font awesome icons
library::add('fontawesome');
// widget parameters
$type = $options['calendar_type'] ?? $options['type'] ?? 'date';
$widget_options = ['id' => $options['id'], 'type' => $type, 'format' => $options['calendar_format'] ?? format::get_date_format($type), 'date_week_start_day' => $options['calendar_date_week_start_day'] ?? 1, 'date_disable_week_days' => $options['calendar_date_disable_week_days'] ?? null, 'master_id' => $options['calendar_master_id'] ?? null, 'slave_id' => $options['calendar_slave_id'] ?? null];
$options['type'] = 'text';
// determine input size
$placeholder = format::get_date_placeholder($widget_options['format']);
$options['size'] = strlen($placeholder);
// set placeholder
if (!empty($options['placeholder']) && $options['placeholder'] == 'format::get_date_placeholder') {
$options['placeholder'] = $placeholder;
$options['title'] = ($options['title'] ?? '') . ' (' . $placeholder . ')';
}
if (isset($options['calendar_icon']) && ($options['calendar_icon'] == 'left' || $options['calendar_icon'] == 'right')) {
$position = $options['calendar_icon'];
if (i18n::rtl()) {
if ($position == 'left') {
$position = 'right';
} else {
$position = 'left';
}
}
$icon_type = $type == 'time' ? 'clock-o' : 'calendar';
unset($options['calendar_icon']);
if (empty($options['readonly'])) {
$icon_onclick = 'numbers_calendar_var_' . $options['id'] . '.show();';
} else {
$icon_onclick = null;
}
$icon_value = html::span(['onclick' => $icon_onclick, 'class' => 'numbers_calendar_icon numbers_prevent_selection', 'value' => html::icon(['type' => $icon_type])]);
$result = html::input_group(['value' => html::input($options), $position => $icon_value, 'dir' => 'ltr']);
$div_id = $options['id'] . '_div_holder';
$result .= html::div(['id' => $div_id, 'class' => 'numbers_calendar_div_holder']);
$widget_options['holder_div_id'] = $div_id;
} else {
$result = html::input($options);
}
// we do not render a widget if readonly
if (empty($options['readonly'])) {
layout::onload('numbers_calendar(' . json_encode($widget_options) . ');');
}
return $result;
}
开发者ID:volodymyr-volynets,项目名称:frontend,代码行数:54,代码来源:base.php
示例12: set
/**
* see tinyurl::set();
*/
public static function set($url, $options = [])
{
// insert new row into the table
$object = new numbers_backend_misc_tinyurl_db_model_tinyurls();
$result = $object->insert(['sm_tinyurl_inserted' => format::now('datetime'), 'sm_tinyurl_url' => $url . '', 'sm_tinyurl_expires' => $options['expires'] ?? null]);
if ($result['success']) {
$result['data']['id'] = $result['last_insert_id'];
$result['data']['hash'] = base_convert($result['last_insert_id'] . '', 10, 36);
} else {
$result['data'] = [];
}
array_key_unset($result, ['success', 'error', 'data'], ['preserve' => true]);
return $result;
}
开发者ID:volodymyr-volynets,项目名称:backend,代码行数:17,代码来源:base.php
示例13: save
public function save(&$form)
{
$model = factory::model($form->options['other']['model']);
$save = [$model->column_prefix . 'important' => !empty($form->values['important']) ? 1 : 0, $model->column_prefix . 'comment_value' => $form->values['comment'] . '', $model->column_prefix . 'who_entity_id' => session::get('numbers.entity.em_entity_id'), $model->column_prefix . 'inserted' => format::now('timestamp')];
foreach ($form->options['other']['map'] as $k => $v) {
$save[$v] = $form->options['other']['pk'][$k];
}
$save_result = $model->save($save, ['ignore_not_set_fields' => true]);
if ($save_result['success']) {
$form->error('success', 'Comment has been added successfully!');
} else {
$form->error('danger', 'Could not add comment!');
}
}
开发者ID:volodymyr-volynets,项目名称:frontend,代码行数:14,代码来源:comment.php
示例14: process
/**
* Process the lock
* @param string $id
* @return boolean
*/
public static function process($id)
{
$lock_data = lock::exists($id);
if ($lock_data !== false) {
$minutes = round(abs(strtotime(format::now()) - strtotime($lock_data)) / 60, 2);
if ($minutes > 30) {
lock::release($id);
$lock_data = false;
}
}
// we are ok to proceed
if ($lock_data === false) {
lock::create($id);
return true;
} else {
return false;
}
}
开发者ID:volodymyr-volynets,项目名称:framework,代码行数:23,代码来源:lock.php
示例15: public_get_one
public function public_get_one() {
$total = $this->comment_check_db->count(array('siteid'=>$this->get_siteid()));
$comment_check_data = $this->comment_check_db->select(array('siteid'=>$this->get_siteid()), '*', '19,1', 'id desc');
$comment_check_data = $comment_check_data[0];
$r = array();
if (is_array($comment_check_data) && !empty($comment_check_data)) {
$this->comment_data_db->table_name($comment_check_data['tableid']);
$r = $this->comment_data_db->get_one(array('id'=>$comment_check_data['comment_data_id'], 'siteid'=>$this->get_siteid()));
pc_base::load_sys_class('format','', 0);
$r['creat_at'] = format::date($r['creat_at'], 1);
if (pc_base::load_config('system','charset')=='gbk') {
foreach ($r as $k=>$v) {
$r[$k] = iconv('gbk', 'utf-8', $v);
}
}
}
echo json_encode(array('total'=>$total, 'data'=>$r));
}
开发者ID:hxzyzz,项目名称:ddc,代码行数:18,代码来源:check.php
示例16: get
/**
* Get information
*
* @param string $ip
* @return array
*/
public function get($ip)
{
$ip = $ip . '';
// try to get IP information from cache
$cache = new cache('db');
$cache_id = 'misc_ip_ipinfo_' . $ip;
$data = $cache->get($cache_id);
if ($data !== false) {
return ['success' => true, 'error' => [], 'data' => $data];
}
// if we need to query ipinfo.io
$json = file_get_contents("http://ipinfo.io/{$ip}/json");
$data = json_decode($json, true);
if (isset($data['country'])) {
$temp = explode(',', $data['loc']);
$save = ['ip' => $ip, 'date' => format::now('date'), 'country' => $data['country'], 'region' => $data['region'], 'city' => $data['city'], 'postal' => $data['postal'], 'lat' => format::read_floatval($temp[0]), 'lon' => format::read_floatval($temp[1])];
$cache->set($cache_id, $save, ['misc_ip_ipinfo'], 604800);
return ['success' => true, 'error' => [], 'data' => $save];
} else {
return ['success' => false, 'error' => ['Could not decode IP address!'], 'data' => ['ip' => $ip]];
}
}
开发者ID:volodymyr-volynets,项目名称:backend,代码行数:28,代码来源:base.php
示例17: render
/**
* Render
*
* @param object $object
* @return string
*/
public static function render($object)
{
$input = $object->options['input'];
if (empty($input['sort'])) {
$i = 0;
foreach ($object->orderby as $k => $v) {
$input['sort'][$i]['column'] = $k;
$input['sort'][$i]['order'] = $v;
$i++;
}
}
// generating form
$table = ['header' => ['row_number' => ' ', 'column' => i18n(null, 'Column'), 'order' => i18n(null, 'Order')], 'options' => []];
$order_model = new object_data_model_order();
$columns = [];
// we need to skip certain columns
foreach ($object->columns as $k => $v) {
if (!in_array($k, ['row_number', 'offset_number', 'action'])) {
$v['name'] = i18n(null, $v['name']);
$columns[$k] = $v;
}
}
// full text search goes last
if (!empty($object->filter['full_text_search'])) {
$columns['full_text_search'] = ['name' => i18n(null, 'Text Search')];
}
// render 5 rows
for ($i = 0; $i < 5; $i++) {
if (empty($input['sort'][$i]['column'])) {
$input['sort'][$i]['order'] = SORT_ASC;
}
$column = html::select(['id' => 'sort_' . $i . '_column', 'name' => 'sort[' . $i . '][column]', 'options' => $columns, 'value' => $input['sort'][$i]['column'] ?? null]);
$order = html::select(['id' => 'sort_' . $i . '_order', 'name' => 'sort[' . $i . '][order]', 'no_choose' => true, 'options' => $order_model->options(['i18n' => true]), 'value' => $input['sort'][$i]['order'] ?? null]);
$table['options'][$i] = ['row_number' => ['value' => format::id($i + 1) . '.', 'width' => '1%', 'align' => 'right'], 'column' => ['value' => $column, 'width' => '25%', 'class' => 'list_sort_name'], 'order' => ['value' => $order, 'width' => '30%']];
}
$body = html::table($table);
$footer = html::button2(['name' => 'submit_sort', 'value' => i18n(null, 'Submit'), 'type' => 'primary', 'onclick' => "numbers.modal.hide('list_{$object->list_link}_sort'); \$('#list_{$object->list_link}_form').attr('target', '_self'); \$('#list_{$object->list_link}_form').attr('no_ajax', ''); return true;"]);
return html::modal(['id' => "list_{$object->list_link}_sort", 'class' => 'large', 'title' => i18n(null, 'Sort'), 'body' => $body, 'footer' => $footer]);
}
开发者ID:volodymyr-volynets,项目名称:frontend,代码行数:45,代码来源:sort.php
示例18: action_index
public function action_index()
{
$input = request::input(null, true, true);
$result = ['success' => false, 'error' => [], 'loggedin' => false, 'expired' => false, 'expires_in' => 0];
if (!empty($input['token']) && !empty($input[session_name()])) {
$crypt = new crypt();
$token_data = $crypt->token_validate($input['token'], ['skip_time_validation' => true]);
if (!($token_data === false || $token_data['id'] !== 'general')) {
// quering database
$model = new numbers_backend_session_db_model_sessions();
$db = $model->db_object();
$session_id = $db->escape($input[session_name()]);
$expire = format::now('timestamp');
$sql = <<<TTT
\t\t\t\t\tSELECT
\t\t\t\t\t\tsm_session_expires,
\t\t\t\t\t\tsm_session_user_id
\t\t\t\t\tFROM {$model->name}
\t\t\t\t\tWHERE 1=1
\t\t\t\t\t\tAND sm_session_id = '{$session_id}'
\t\t\t\t\t\tAND sm_session_expires >= '{$expire}'
TTT;
$temp = $db->query($sql);
// put values into result
$result['expired'] = empty($temp['rows']);
$result['loggedin'] = !empty($temp['rows'][0]['sm_session_user_id']);
// calculate when session is about to expire
if (!empty($temp['rows'])) {
$now = format::now('unix');
$expires = strtotime($temp['rows'][0]['sm_session_expires']);
$result['expires_in'] = $expires - $now;
}
$result['success'] = true;
}
}
// rendering
layout::render_as($result, 'application/json');
}
开发者ID:volodymyr-volynets,项目名称:backend,代码行数:38,代码来源:check.php
示例19: init
/**
* Initialize
*
* @param array $options
*/
public static function init($options = [])
{
// default options
self::$defaut_options = ['language_code' => 'sys', 'locale' => 'en_CA.UTF-8', 'timezone' => 'America/Toronto', 'server_timezone' => application::get('php.date.timezone'), 'date' => 'Y-m-d', 'time' => 'H:i:s', 'datetime' => 'Y-m-d H:i:s', 'timestamp' => 'Y-m-d H:i:s.u', 'amount_frm' => 20, 'amount_fs' => 40, 'settings' => ['currency_codes' => []], 'locale_locales' => [], 'locale_locale_js' => null, 'locale_set_name' => null, 'locale_options' => [], 'locale_override_class' => null];
// settings from config files
$config = application::get('flag.global.format');
// settings from user account
$entity = entity::groupped('format');
// merge all of them together
self::$options = array_merge_hard(self::$defaut_options, $config, i18n::$options, $entity, $options);
// fix utf8
self::$options['locale'] = str_replace(['utf8', 'utf-8'], 'UTF-8', self::$options['locale']);
// generate a list of available locales
$locale_settings = self::set_locale(self::$options['locale'], self::$defaut_options['locale']);
self::$options = array_merge_hard(self::$options, $locale_settings);
// fix values
self::$options['amount_frm'] = (int) self::$options['amount_frm'];
self::$options['amount_fs'] = (int) self::$options['amount_fs'];
self::$options['locale_options']['mon_thousands_sep'] = self::$options['locale_options']['mon_thousands_sep'] ?? ',';
self::$options['locale_options']['mon_decimal_point'] = self::$options['locale_options']['mon_decimal_point'] ?? '.';
if (empty(self::$options['locale_options']['mon_grouping'])) {
self::$options['locale_options']['mon_grouping'] = [3, 3];
}
// load data from models
if (!empty(self::$options['model'])) {
foreach (self::$options['model'] as $k => $v) {
$method = factory::method($v, null);
self::$options['settings'][$k] = factory::model($method[0], true)->{$method[1]}();
}
unset(self::$options['model']);
}
// push js format version to frontend
if (!empty(self::$options['locale_override_class'])) {
$locale_override_class = self::$options['locale_override_class'];
$locale_override_class::js();
}
}
开发者ID:volodymyr-volynets,项目名称:framework,代码行数:42,代码来源:format.php
示例20: L
?>
> <input name="info[islink]" type="checkbox" id="islink" value="1"<?php
if ($info['islink']) {
?>
checked<?php
}
?>
onclick="ruselinkurl();" > <font color="red"><?php
echo L('islink');
?>
</font>
<h6> <?php
echo L('inputtime');
?>
</h6> <?php
echo form::date('info[inputtime]', format::date($info['inputtime'], 1), 1);
?>
<h6> <?php
echo L('template_style');
?>
</h6> <?php
echo form::select($template_list, $data['style'], 'name="data[style]" id="style" onchange="load_file_list(this.value)"', L('please_select'));
?>
<h6> <?php
echo L('show_template');
?>
</h6> <span id="show_template"><?php
echo '<script type="text/javascript">$.getJSON(\'?m=admin&c=category&a=public_tpl_file_list&style=' . $style . '&id=' . $data['show_template'] . '&module=special&templates=show&name=data\', function(data){$(\'#show_template\').html(data.show_template);});</script>';
?>
</span>
</div>
开发者ID:baowzh,项目名称:renfang,代码行数:31,代码来源:content_edit.tpl.php
注:本文中的format类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论