当前位置: 首页>>代码示例>>PHP>>正文


PHP Valid::numeric方法代码示例

本文整理汇总了PHP中Valid::numeric方法的典型用法代码示例。如果您正苦于以下问题:PHP Valid::numeric方法的具体用法?PHP Valid::numeric怎么用?PHP Valid::numeric使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Valid的用法示例。


在下文中一共展示了Valid::numeric方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: action_pay

 /**
  * [action_form] generates the form to pay at paypal
  */
 public function action_pay()
 {
     $this->auto_render = FALSE;
     $order_id = $this->request->param('id');
     $order = new Model_Order();
     $order->where('id_order', '=', $order_id)->where('status', '=', Model_Order::STATUS_CREATED)->limit(1)->find();
     if ($order->loaded()) {
         // case when selling advert
         if ($order->id_product == Model_Order::PRODUCT_AD_SELL) {
             $paypal_account = $order->ad->paypal_account();
             $currency = i18n::get_intl_currency_symbol();
             if (isset($order->ad->cf_shipping) and Valid::numeric($order->ad->cf_shipping) and $order->ad->cf_shipping > 0) {
                 $order->amount = $order->amount + $order->ad->cf_shipping;
             }
         } else {
             $paypal_account = core::config('payment.paypal_account');
             $currency = core::config('payment.paypal_currency');
         }
         $paypal_url = Core::config('payment.sandbox') ? Paypal::url_sandbox_gateway : Paypal::url_gateway;
         $paypal_data = array('order_id' => $order_id, 'amount' => number_format($order->amount, 2, '.', ''), 'site_name' => core::config('general.site_name'), 'site_url' => URL::base(TRUE), 'paypal_url' => $paypal_url, 'paypal_account' => $paypal_account, 'paypal_currency' => $currency, 'item_name' => $order->description);
         $this->template = View::factory('paypal', $paypal_data);
         $this->response->body($this->template->render());
     } else {
         Alert::set(Alert::INFO, __('Order could not be loaded'));
         $this->redirect(Route::url('default'));
     }
 }
开发者ID:kotsios5,项目名称:openclassifieds2,代码行数:30,代码来源:paypal.php

示例2: set

 /**
  * Handles setting of columns
  * Overriding this method to handle WKT Geometry value
  *
  * @param  string $column Column name
  * @param  mixed  $value  Column value
  * @throws Kohana_Exception
  * @return ORM
  */
 public function set($column, $value)
 {
     // Convert to WKT Point
     if ($column == 'value' and is_array($value) and array_key_exists('lat', $value) and Valid::numeric($value['lat']) and array_key_exists('lon', $value) and Valid::numeric($value['lon'])) {
         $value = strtr("POINT(lon lat)", $value);
     }
     return parent::set($column, $value);
 }
开发者ID:kwameboame,项目名称:platform,代码行数:17,代码来源:Point.php

示例3: action_browse

 /**
  * Action: browse
  */
 public function action_browse()
 {
     $this->data['events'] = array();
     // Get start stamp
     $from = Arr::get($_REQUEST, 'from', 'today');
     $from = Valid::numeric($from) ? (int) $from : strtotime($from);
     // Get order
     $order = Arr::get($_REQUEST, 'order') == 'desc' ? 'desc' : 'asc';
     // Get limit, time span or 500 events max
     $limit = Arr::get($_REQUEST, 'limit', '1w');
     if (Valid::numeric($limit)) {
         // Limit given as event count
         $to = false;
         $limit = max(min((int) $limit, 500), 1);
     } else {
         if ($span = Date::parse_span($limit)) {
             // Limit given as timespan
             $to = strtotime(($order == 'asc' ? '+' : '-') . $span, $from);
             $limit = 500;
         } else {
             // No limit given
             $to = false;
             $limit = 500;
         }
     }
     // Get fields
     $field = explode(':', Arr::get($_REQUEST, 'field', 'id:name:city'));
     $fields = empty($field) || ($field[0] = 'all') ? self::$_fields : array_intersect($field, self::$_fields);
     $fields = empty($fields) ? array('id', 'name') : $fields;
     // Build query
     $event = new Model_Event();
     $events = DB::select_array($event->fields())->order_by('stamp_begin', $order);
     if ($order == 'asc') {
         // Upcoming events
         if ($to) {
             $events->where('stamp_begin', 'BETWEEN', array($from, $to));
         } else {
             $events->where('stamp_begin', '>=', $from);
         }
     } else {
         // Past events
         if ($to) {
             $events->where('stamp_begin', 'BETWEEN', array($to, $from));
         } else {
             $events->where('stamp_begin', '<=', $from);
         }
     }
     // Build data
     foreach ($event->load($events, $limit) as $event) {
         $this->data['events'][] = $this->_prepare_event($event, $fields);
     }
 }
开发者ID:anqh,项目名称:anqh,代码行数:55,代码来源:api.php

示例4: get_user

 /**
  * 
  * @return ORM
  */
 public function get_user()
 {
     if ($this->_user instanceof ORM) {
         return $this->_user;
     }
     $profile_id = $this->get_profile_id();
     if (is_string($profile_id) and Valid::numeric($profile_id)) {
         $this->_user = ORM::factory('User', $profile_id);
     } else {
         $this->_user = Auth::get_record(ORM::factory('User'));
         $this->_ctx->set($this->profile_id_ctx, $this->_user->id);
     }
     return $this->_user;
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:18,代码来源:profile.php

示例5: parse

 /**
  *  Finds next execution time(stamp) parsin crontab syntax, 
  *  after given starting timestamp (or current time if ommited)
  * 
  *  @param string $cron_string:
  *
  *      0     1    2    3    4
  *      *     *    *    *    *  
  *      -     -    -    -    -
  *      |     |    |    |    |
  *      |     |    |    |    +----- day of week (0 - 6) (Sunday=0)
  *      |     |    |    +------- month (1 - 12)
  *      |     |    +--------- day of month (1 - 31)
  *      |     +----------- hour (0 - 23)
  *      +------------- min (0 - 59)
  *  @param int $after_timestamp timestamp [default=current timestamp]
  *  @return int unix timestamp - next execution time will be greater 
  *              than given timestamp (defaults to the current timestamp)
  *  @throws Kohana_Exception 
  */
 public static function parse($cron_string, $after_timestamp = NULL)
 {
     if (!Crontab::valid($cron_string)) {
         throw new Kohana_Exception('Invalid cron string: :string', array(':string' => $cron_string));
     }
     if ($after_timestamp !== NULL and !Valid::numeric($after_timestamp)) {
         throw new Kohana_Exception("\$after_timestamp must be a valid unix timestamp (:string given)", array(':string' => $after_timestamp));
     }
     $cron = preg_split("/[\\s]+/i", trim($cron_string));
     $start = empty($after_timestamp) ? time() : $after_timestamp;
     $date = array('minutes' => self::_parse_cron_numbers($cron[0], 0, 59), 'hours' => self::_parse_cron_numbers($cron[1], 0, 23), 'dom' => self::_parse_cron_numbers($cron[2], 1, 31), 'month' => self::_parse_cron_numbers($cron[3], 1, 12), 'dow' => self::_parse_cron_numbers($cron[4], 0, 6));
     // limited to time()+366 - no need to check more than 1year ahead
     for ($i = 0; $i <= 60 * 60 * 24 * 366; $i += 60) {
         if (in_array(intval(date('j', $start + $i)), $date['dom']) and in_array(intval(date('n', $start + $i)), $date['month']) and in_array(intval(date('w', $start + $i)), $date['dow']) and in_array(intval(date('G', $start + $i)), $date['hours']) and in_array(intval(date('i', $start + $i)), $date['minutes'])) {
             return $start + $i;
         }
     }
     return NULL;
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:39,代码来源:crontab.php

示例6: format

 /**
  * 
  * @param integer|string $date
  * @param string $format
  * @return string
  */
 public static function format($date = NULL, $format = NULL)
 {
     if ($format === NULL) {
         $format = Config::get('site', 'date_format', 'Y-m-d H:I:s');
     }
     if (is_array($date)) {
         $string = '';
         if (!empty($date['year']) and !empty($date['month']) and !empty($date['day'])) {
             $string = $date['year'] . '-' . $date['month'] . '-' . $date['day'];
         }
         if ($date['hour'] and !empty($date['minute']) and !empty($date['second'])) {
             $string .= ' ' . $date['hour'] . ':' . $date['minute'] . ':' . $date['second'];
         }
         $date = strtotime($string);
     } else {
         if (!Valid::numeric($date)) {
             $date = strtotime($date);
         }
     }
     if (empty($date)) {
         return __('Never');
     }
     return strtr(date($format, $date), self::_translate_words());
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:30,代码来源:date.php

示例7: __

        ?>
				                        <?php 
    }
    ?>
				                    </td>
				                <?php 
}
?>

								<tr>
									<td class="text-right"><h4><strong><?php 
echo __('Total');
?>
: </strong></h4></td>
									<?php 
if ($order->id_product == Model_Order::PRODUCT_AD_SELL and isset($order->ad->cf_shipping) and Valid::numeric($order->ad->cf_shipping) and $order->ad->cf_shipping > 0) {
    ?>
				                    	<td class="text-center text-danger"><h4><strong><?php 
    echo i18n::money_format($order->amount + $order->ad->cf_shipping, $order->currency);
    ?>
</strong></h4></td>
				                    <?php 
} else {
    ?>
				                    	<td class="text-center text-danger"><h4><strong><?php 
    echo $order->id_product == Model_Order::PRODUCT_AD_SELL ? i18n::money_format($order->amount, $order->currency) : i18n::format_currency($order->amount, $order->currency);
    ?>
</strong></h4></td>
				                    <?php 
}
?>
开发者ID:kotsios5,项目名称:openclassifieds2,代码行数:31,代码来源:order.php

示例8: action_buy

 /**
  * [action_buy] Pay for ad, and set new order 
  *
  */
 public function action_buy()
 {
     //check pay to featured top is enabled
     if (core::config('payment.paypal_seller') == FALSE) {
         throw HTTP_Exception::factory(404, __('Page not found'));
     }
     //getting the user that wants to buy now
     if (!Auth::instance()->logged_in()) {
         Alert::set(Alert::INFO, __('To buy this product you first need to register'));
         $this->redirect(Route::url('oc-panel'));
     }
     $id_product = Model_Order::PRODUCT_AD_SELL;
     //check ad exists
     $id_ad = $this->request->param('id');
     $ad = new Model_Ad($id_ad);
     //loaded published and with stock if we control the stock.
     if ($ad->loaded() and $ad->status == Model_Ad::STATUS_PUBLISHED and (core::config('payment.stock') == 0 or $ad->stock > 0 and core::config('payment.stock') == 1)) {
         $amount = $ad->price;
         $currency = core::config('payment.paypal_currency');
         if (isset($ad->cf_shipping) and Valid::numeric($ad->cf_shipping) and $ad->cf_shipping > 0) {
             $amount = $ad->price + $ad->cf_shipping;
         }
         $order = Model_Order::new_order($ad, $this->user, $id_product, $amount, $currency, __('Purchase') . ': ' . $ad->seotitle);
         $this->redirect(Route::url('default', array('controller' => 'ad', 'action' => 'checkout', 'id' => $order->id_order)));
     } else {
         throw HTTP_Exception::factory(404, __('Page not found'));
     }
 }
开发者ID:nick-catanchin-ie,项目名称:openclassifieds2,代码行数:32,代码来源:ad.php

示例9: get_doc_id

 public function get_doc_id()
 {
     if (Valid::numeric($this->_id)) {
         return $this->_id;
     }
     return $this->_ctx->get($this->doc_id_ctx);
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:7,代码来源:document.php

示例10: set_widget_id

 public function set_widget_id($widget_id)
 {
     return Valid::numeric($widget_id) ? $widget_id : NULL;
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:4,代码来源:timeline.php

示例11: __

        <table class="table table-hover">
            <thead>
                <tr>
                    <th style="text-align: center">#</th>
                    <th><?php 
echo __('Product');
?>
</th>
                    <th class="text-center"><?php 
echo __('Price');
?>
</th>
                </tr>
            </thead>
            <tbody>
                <?if($order->id_product == Model_Order::PRODUCT_AD_SELL AND isset($order->ad->cf_shipping) AND Valid::numeric($order->ad->cf_shipping) AND $order->ad->cf_shipping > 0):?>
                    <tr>
                        <td class="col-md-1" style="text-align: center"><?php 
echo $order->id_product;
?>
</td>
                        <td class="col-md-9"><?php 
echo $order->description;
?>
 <em>(<?php 
echo Model_Order::product_desc($order->id_product);
?>
)</em></td>
                        <td class="col-md-2 text-center"><?php 
echo i18n::format_currency($order->amount - $order->ad->cf_shipping, $order->currency);
?>
开发者ID:bogiesoft,项目名称:openclassifieds2,代码行数:31,代码来源:checkout.php

示例12: validate

 protected function validate($value)
 {
     if (!Valid::numeric($value)) {
         return 'decimal';
     }
 }
开发者ID:tobiasziegler,项目名称:platform,代码行数:6,代码来源:Decimal.php

示例13: parse_meta

 /**
  * 
  * @param string $key
  * @return string
  */
 public function parse_meta($key, $value = NULL)
 {
     if ($value === NULL) {
         $value = strtr($this->{$key}, array('\'' => '\\\'', '\\' => '\\\\'));
     }
     $fields = array();
     $found = preg_match_all('/(?<!\\{)\\{(' . '((\\$|\\:)[A-Za-z0-9_\\-\\.\\/]+(\\|[\\w\\ ]*)?)' . '|[\\.]+' . ')\\}(?!\\})/u', $value, $fields);
     if ($found) {
         $fields = array_unique($fields[1]);
         $parts = array();
         foreach ($fields as $i => $field) {
             $patterns[] = '/(?<!\\{)\\{' . preg_quote($field, '/') . '\\}(?!\\})/u';
             switch ($field) {
                 case '.':
                     // Current page
                     if ($key == 'meta_title') {
                         $parts[] = $this->title();
                     }
                     break;
                 case '..':
                     // Parent page
                     if ($this->parent() instanceof Model_Page_Front) {
                         $parts[] = $this->parent()->{$key}();
                     }
                     break;
                 default:
                     // Level
                     if (Valid::numeric($field) and $this->level() != $field and $this->parent($field) instanceof Model_Page_Front) {
                         $parts[] = $this->parent($field)->{$key}();
                     }
                     break;
             }
             $param = NULL;
             $meta_param = NULL;
             $default = NULL;
             if (strpos($field, '|') !== FALSE) {
                 list($field, $default) = explode('|', $field, 2);
             }
             switch ($field[0]) {
                 case '$':
                     $param = substr($field, 1);
                     break;
                 case ':':
                     $meta_param = substr($field, 1);
                     break;
             }
             if ($param !== NULL) {
                 if (strpos($param, 'site.') !== FALSE) {
                     $parts[] = Config::get('site', substr($param, 5), $default);
                 } else {
                     if (strpos($param, 'ctx.') !== FALSE) {
                         $parts[] = Context::instance()->get(substr($param, 4));
                     } else {
                         if (strpos($param, 'parent.') !== FALSE and $this->parent() instanceof Model_Page_Front and method_exists($this->parent(), substr($param, 7))) {
                             $parts[] = $this->parent()->{substr($param, 7)}();
                         } else {
                             if (method_exists($this, $param)) {
                                 $parts[] = $this->{$param}();
                             }
                         }
                     }
                 }
             }
             if ($meta_param !== NULL) {
                 $parts[] = Arr::get($this->_meta_params, $meta_param, $default);
             }
         }
         $value = preg_replace($patterns, $parts, $value);
     }
     return $value;
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:76,代码来源:front.php

示例14: set_position

 /**
  * Указание позиции поля
  * 
  * @param integer $position
  * @return \DataSource_Hybrid_Field
  */
 public function set_position($position)
 {
     if (!Valid::numeric($position)) {
         $position = DataSource_Hybrid_Field_Factory::get_last_position($this->ds_id) + 10;
     }
     $this->position = (int) $position;
     if ($this->position < 0) {
         $this->position = 0;
     }
     return $this;
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:17,代码来源:field.php

示例15: get_document

 /**
  * 
  * @param integer|string $id
  * @param array $fields
  * @param string $id_field
  * @return null|array
  */
 public function get_document($id, array $fields = NULL, $id_field = NULL)
 {
     $query = $this->get_query_props($fields);
     $hybrid_fields = $this->get_fields();
     if (Valid::numeric($id_field) and isset($hybrid_fields[$id_field])) {
         $id_field = $hybrid_fields[$id_field]->name;
     }
     if ($id_field == 'id' or empty($id_field)) {
         $id_field = 'd.id';
     }
     $query = $query->where($id_field, '=', $id)->where('d.published', '=', 1)->group_by('d.id')->limit(1)->execute()->current();
     if (empty($query)) {
         return NULL;
     }
     return $query;
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:23,代码来源:agent.php


注:本文中的Valid::numeric方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。