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


PHP object::data方法代码示例

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


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

示例1: testData

 /**
  * testData
  *
  * @retun void
  * 
  * @access public
  */
 function testData()
 {
     $this->assertEqual($this->Formatacao->data(), date('d/m/Y'));
     $this->assertEqual($this->Formatacao->data(strtotime('2009-04-21')), '21/04/2009');
     $this->assertEqual($this->Formatacao->data('errado', array('invalid' => 'Inválido')), 'Inválido');
     $this->assertEqual($this->Formatacao->data(strtotime('2009-04-21 00:00:00 GMT'), array('userOffset' => '-1')), '20/04/2009');
 }
开发者ID:arendasistemasintegrados,项目名称:mateusleme,代码行数:14,代码来源:formatacao.test.php

示例2: specEnd

 /**
  * Callback called after a spec execution.
  *
  * @param object $log The log object of the whole spec.
  */
 public function specEnd($log = null)
 {
     $isOk = $log->passed() ? "ok" : "not ok";
     switch ($log->type()) {
         case 'skipped':
         case 'pending':
         case 'excluded':
             $prefix = "# {$log->type()} ";
             break;
         default:
             $prefix = '- ';
             break;
     }
     $message = $prefix . trim(implode(" ", $log->messages()));
     $this->_counter++;
     $this->write("{$isOk} {$this->_counter} {$message}\n");
     if ($exception = $log->exception()) {
         $this->write('# Exception: `' . get_class($exception) . '` Code(' . $exception->getCode() . '):' . "\n");
         $this->write('# Message: ' . $exception->getMessage() . "\n");
     } else {
         foreach ($log->children() as $log) {
             if ($log->passed()) {
                 continue;
             }
             $toString = function ($instance) {
                 return 'an instance of `' . get_class($instance) . '`';
             };
             foreach ($log->data() as $key => $value) {
                 $key = ucfirst($key);
                 $value = Text::toString($value, ['object' => ['method' => $toString]]);
                 $this->write("# {$key}: {$value}\n");
             }
         }
     }
 }
开发者ID:crysalead,项目名称:kahlan,代码行数:40,代码来源:Tap.php

示例3: edit

 /**
  * 修改分类
  * @param   array $data 一维数组,$data需要包含要修改的分类cat_id。
  *
  * @return  boolean                 组修改成功,返回相应的分类ID,修改失败,返回FALSE;
  */
 public function edit($data)
 {
     if (empty($data)) {
         return false;
     }
     return $this->model->data($data)->save();
 }
开发者ID:nomagame,项目名称:Charmy,代码行数:13,代码来源:Category.class.php

示例4: data

 /**
  * Set the data to update or insert.
  * 
  * @param  object $data        the data object or array
  * @param  object $skipFields  the fields to skip.
  * @access public
  * @return object the dao object self.
  */
 public function data($data, $skipFields = '')
 {
     if (!is_object($data)) {
         $data = (object) $data;
     }
     $this->sqlobj->data($data, $skipFields);
     return $this;
 }
开发者ID:jsyinwenjun,项目名称:zentao,代码行数:16,代码来源:dao.class.php

示例5: data

 /**
  * Set the data to update or insert.
  * 
  * @param  object $data         the data object or array
  * @access public
  * @return object the dao object self.
  */
 public function data($data)
 {
     if (!is_object($data)) {
         $data = (object) $data;
     }
     $this->sqlobj->data($data);
     return $this;
 }
开发者ID:laiello,项目名称:zentaoms,代码行数:15,代码来源:dao.class.php

示例6: data

 /**
  * Set the data to update or insert.
  * 
  * @param  object $data        the data object or array
  * @param  object $skipFields  the fields to skip.
  * @access public
  * @return object the dao object self.
  */
 public function data($data, $skipFields = '')
 {
     if (!is_object($data)) {
         $data = (object) $data;
     }
     if ($this->autoLang and !isset($data->lang)) {
         $data->lang = $this->app->getClientLang();
     }
     $this->sqlobj->data($data, $skipFields);
     return $this;
 }
开发者ID:peirancao,项目名称:chanzhieps,代码行数:19,代码来源:dao.class.php

示例7: data

 /**
  * Set the data to update or insert.
  * 
  * @param  object $data         the data object or array
  * @param  bool   $autoCompany  auto append company field or not
  * @access public
  * @return object the dao object self.
  */
 public function data($data, $autoCompany = true)
 {
     if (!is_object($data)) {
         $data = (object) $data;
     }
     if ($autoCompany and isset($this->app->company) and $this->table != TABLE_COMPANY and !isset($data->company)) {
         $data->company = $this->app->company->id;
     }
     $this->sqlobj->data($data);
     return $this;
 }
开发者ID:shshenpengfei,项目名称:scrum_project_manage_system,代码行数:19,代码来源:dao.class.php

示例8: _read

 /**
  * The session save handler callback for reading data from the session.
  *
  * @param string $key The key of the data to be returned. If no key is specified,
  *        then all session data is returned in an array of key/value pairs.
  * @return mixed Value corresponding to key if set, null otherwise.
  */
 public function _read($key = null)
 {
     if (!$this->_data || !is_object($this->_data)) {
         return null;
     }
     if ($key === null) {
         return $this->_data->data();
     }
     $data = $this->_data->{$key};
     return $data instanceof Entity ? $data->data() : $data;
 }
开发者ID:tmaiaroto,项目名称:li3b_core,代码行数:18,代码来源:Model.php

示例9: _entityConditions

 /**
  * Will return a find first condition on the associated model if a record is connected.
  * Called by conditions when it is called as a get and no condition is set.
  *
  * @return array ([model's primary key'] => [that key set in the record]).
  */
 protected function _entityConditions()
 {
     if (!$this->_entity || !($model = $this->_config['model'])) {
         return;
     }
     if (is_array($key = $model::key($this->_entity->data()))) {
         return $key;
     }
     $key = $model::meta('key');
     return array($key => $this->_entity->{$key});
 }
开发者ID:EHER,项目名称:chegamos,代码行数:17,代码来源:Query.php

示例10: data

 /**
  * Set the data to update or insert.
  * 
  * @param  object $data        the data object or array
  * @param  object $skipFields  the fields to skip.
  * @access public
  * @return object the dao object self.
  */
 public function data($data, $skipFields = '')
 {
     if (!is_object($data)) {
         $data = (object) $data;
     }
     if ($this->autoLang and !isset($data->lang)) {
         $data->lang = $this->app->getClientLang();
         if (RUN_MODE == 'front' and $this->app->config->cn2tw) {
             $data->lang = str_replace('zh-tw', 'zh-cn', $data->lang);
         }
     }
     $this->sqlobj->data($data, $skipFields);
     return $this;
 }
开发者ID:qiaqiali,项目名称:chanzhieps,代码行数:22,代码来源:dao.class.php

示例11: _entityConditions

 /**
  * Will return a find first condition on the associated model if a record is connected.
  * Called by conditions when it is called as a get and no condition is set.
  *
  * @return array Returns an array in the following format:
  *         `([model's primary key'] => [that key set in the record])`.
  */
 protected function _entityConditions()
 {
     if (!$this->_entity || !($model = $this->_config['model'])) {
         return;
     }
     $key = $model::key($this->_entity->data());
     if (!$key && $this->_type != "create") {
         throw new ConfigException('No matching primary key found.');
     }
     if (is_array($key)) {
         return $key;
     }
     $key = $model::meta('key');
     $val = $this->_entity->{$key};
     return $val ? array($key => $val) : array();
 }
开发者ID:newmight2015,项目名称:Blockchain-2,代码行数:23,代码来源:Query.php

示例12: send

 /**
  * Implements Mail::send() function using SMTP.
  *
  * @param mixed $recipients Either a comma-seperated list of recipients
  *              (RFC822 compliant), or an array of recipients,
  *              each RFC822 valid. This may contain recipients not
  *              specified in the headers, for Bcc:, resending
  *              messages, etc.
  *
  * @param array $headers The array of headers to send with the mail, in an
  *              associative array, where the array key is the
  *              header name (e.g., 'Subject'), and the array value
  *              is the header value (e.g., 'test'). The header
  *              produced from those values would be 'Subject:
  *              test'.
  *
  * @param string $body The full text of the message body, including any
  *               MIME parts, etc.
  *
  * @return mixed Returns true on success
  */
 public function send($recipients, $headers, $body)
 {
     /* If we don't already have an SMTP object, create one. */
     $result = $this->getSMTPObject();
     if (!is_array($headers)) {
         throw new InvalidArgumentException('$headers must be an array');
     }
     $this->_sanitizeHeaders($headers);
     $headerElements = $this->prepareHeaders($headers);
     list($from, $textHeaders) = $headerElements;
     /* Since few MTAs are going to allow this header to be forged
      * unless it's in the MAIL FROM: exchange, we'll use
      * Return-Path instead of From: if it's set. */
     if (!empty($headers['Return-Path'])) {
         $from = $headers['Return-Path'];
     }
     if (!isset($from)) {
         $this->_smtp->rset();
         throw new InvalidArgumentException('No From: address has been provided', self::SMTP_ERROR_FROM);
     }
     $params = null;
     if (!empty($this->_extparams)) {
         foreach ($this->_extparams as $key => $val) {
             $params .= ' ' . $key . (is_null($val) ? '' : '=' . $val);
         }
     }
     $this->_smtp->mailFrom($from, ltrim($params));
     $recipients = $this->parseRecipients($recipients);
     foreach ($recipients as $recipient) {
         $this->_smtp->rcptTo($recipient);
     }
     /* Send the message's headers and the body as SMTP data. */
     $res = $this->_smtp->data($body, $textHeaders);
     list(, $args) = $this->_smtp->getResponse();
     if (preg_match("/Ok: queued as (.*)/", $args, $queued)) {
         $this->queued_as = $queued[1];
     }
     /* we need the greeting; from it we can extract the authorative name of the mail server we've really connected to.
      * ideal if we're connecting to a round-robin of relay servers and need to track which exact one took the email */
     $this->greeting = $this->_smtp->getGreeting();
     /* If persistent connections are disabled, destroy our SMTP object. */
     if ($this->persist === false) {
         $this->disconnect();
     }
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:67,代码来源:smtp.php

示例13: send

 /**
  * Implements Mail::send() function using SMTP.
  *
  * @param mixed $recipients Either a comma-seperated list of recipients
  *              (RFC822 compliant), or an array of recipients,
  *              each RFC822 valid. This may contain recipients not
  *              specified in the headers, for Bcc:, resending
  *              messages, etc.
  *
  * @param array $headers The array of headers to send with the mail, in an
  *              associative array, where the array key is the
  *              header name (e.g., 'Subject'), and the array value
  *              is the header value (e.g., 'test'). The header
  *              produced from those values would be 'Subject:
  *              test'.
  *
  * @param string $body The full text of the message body, including any
  *               MIME parts, etc.
  *
  * @return mixed Returns true on success, or a PEAR_Error
  *               containing a descriptive error message on
  *               failure.
  * @access public
  */
 function send($recipients, $headers, $body)
 {
     /* If we don't already have an SMTP object, create one. */
     $result =& $this->getSMTPObject();
     if (PEAR::isError($result)) {
         return $result;
     }
     if (!is_array($headers)) {
         return PEAR::raiseError('$headers must be an array');
     }
     $this->_sanitizeHeaders($headers);
     $headerElements = $this->prepareHeaders($headers);
     if (is_a($headerElements, 'PEAR_Error')) {
         $this->_smtp->rset();
         return $headerElements;
     }
     list($from, $textHeaders) = $headerElements;
     /* Since few MTAs are going to allow this header to be forged
      * unless it's in the MAIL FROM: exchange, we'll use
      * Return-Path instead of From: if it's set. */
     if (!empty($headers['Return-Path'])) {
         $from = $headers['Return-Path'];
     }
     if (!isset($from)) {
         $this->_smtp->rset();
         return PEAR::raiseError('No From: address has been provided', PEAR_MAIL_SMTP_ERROR_FROM);
     }
     $params = null;
     if (!empty($this->_extparams)) {
         foreach ($this->_extparams as $key => $val) {
             $params .= ' ' . $key . (is_null($val) ? '' : '=' . $val);
         }
     }
     if (PEAR::isError($res = $this->_smtp->mailFrom($from, ltrim($params)))) {
         $error = $this->_error("Failed to set sender: {$from}", $res);
         $this->_smtp->rset();
         return PEAR::raiseError($error, PEAR_MAIL_SMTP_ERROR_SENDER);
     }
     $recipients = $this->parseRecipients($recipients);
     if (is_a($recipients, 'PEAR_Error')) {
         $this->_smtp->rset();
         return $recipients;
     }
     foreach ($recipients as $recipient) {
         $res = $this->_smtp->rcptTo($recipient);
         if (is_a($res, 'PEAR_Error')) {
             $error = $this->_error("Failed to add recipient: {$recipient}", $res);
             $this->_smtp->rset();
             return PEAR::raiseError($error, PEAR_MAIL_SMTP_ERROR_RECIPIENT);
         }
     }
     /* Send the message's headers and the body as SMTP data. */
     $res = $this->_smtp->data($textHeaders . "\r\n\r\n" . $body);
     if (is_a($res, 'PEAR_Error')) {
         $error = $this->_error('Failed to send data', $res);
         $this->_smtp->rset();
         return PEAR::raiseError($error, PEAR_MAIL_SMTP_ERROR_DATA);
     }
     /* If persistent connections are disabled, destroy our SMTP object. */
     if ($this->persist === false) {
         $this->disconnect();
     }
     return true;
 }
开发者ID:kumarsivarajan,项目名称:ctrl-dock,代码行数:88,代码来源:smtp.php

示例14: _validate

 /**
  * After an authentication query against the configured model class has occurred, this method
  * iterates over the configured validators and checks each one by passing the submitted form
  * value as the first parameter, and the corresponding database value as the second. The
  * validator then returns a boolean to indicate success. If the validator fails, it will cause
  * the entire authentication operation to fail. Note that any filters applied to a form field
  * will affect the data passed to the validator.
  *
  * @see lithium\security\auth\adapter\Form::__construct()
  * @see lithium\security\auth\adapter\Form::$_validators
  * @param object $user The user object returned from the database. This object must support a
  *               `data()` method, which returns the object's array representation, and
  *               also returns individual field values by name.
  * @param array $data The form data submitted in the request and passed to `Form::check()`.
  * @return array Returns an array of authenticated user data on success, otherwise `false` if
  *               any of the configured validators fails. See `'validators'` in the `$config`
  *               parameter of `__construct()`.
  */
 protected function _validate($user, array $data)
 {
     foreach ($this->_validators as $field => $validator) {
         if (!isset($this->_fields[$field]) || $field === 0) {
             continue;
         }
         if (!is_callable($validator)) {
             $message = "Authentication validator for `{$field}` is not callable.";
             throw new UnexpectedValueException($message);
         }
         $field = $this->_fields[$field];
         $value = isset($data[$field]) ? $data[$field] : null;
         if (!call_user_func($validator, $value, $user->data($field))) {
             return false;
         }
     }
     $user = $user->data();
     if (!isset($this->_validators[0])) {
         return $user;
     }
     if (!is_callable($this->_validators[0])) {
         throw new UnexpectedValueException("Authentication validator is not callable.");
     }
     return call_user_func($this->_validators[0], $data, $user) ? $user : false;
 }
开发者ID:nashadalam,项目名称:lithium,代码行数:43,代码来源:Form.php

示例15: _cookieValue

 /**
  * Builds a Cookie header value.
  *
  * @param  string $name   The cookie name.
  * @param  object $cookie The cookie instance.
  * @return string
  */
 protected static function _cookieValue($name, $cookie)
 {
     if (!Cookie::isValidName($name)) {
         throw new Exception("Invalid cookie name `'{$name}'`.");
     }
     $result = [];
     foreach ($cookie->data() as $value) {
         $result[] = $name . '=' . urlencode($value);
     }
     return join('; ', $result);
 }
开发者ID:crysalead,项目名称:net,代码行数:18,代码来源:Cookies.php


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