當前位置: 首頁>>代碼示例>>PHP>>正文


PHP format類代碼示例

本文整理匯總了PHP中format的典型用法代碼示例。如果您正苦於以下問題:PHP format類的具體用法?PHP format怎麽用?PHP format使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了format類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的format類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。