• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP property_exists函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中property_exists函数的典型用法代码示例。如果您正苦于以下问题:PHP property_exists函数的具体用法?PHP property_exists怎么用?PHP property_exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: __construct

 public function __construct(Database &$db, $model_name)
 {
     $this->db =& $db;
     $this->model_name = $model_name;
     $this->field_prefix = strtolower($model_name);
     $this->table_name = property_exists($model_name, 'table_name') ? $model_name::$table_name : $this->tableNameFromEntity($model_name);
 }
开发者ID:wst,项目名称:spindash,代码行数:7,代码来源:model-manager.inc.php


示例2: __set

 public function __set($property, $value)
 {
     if (property_exists($this, $property)) {
         $this->{$property} = $value;
     }
     return $this;
 }
开发者ID:omusico,项目名称:RentSquare,代码行数:7,代码来源:BankCard.php


示例3: getItem

 /**
  * Method to get a single record.
  *
  * @param   integer  $pk  The id of the primary key.
  *
  * @return  mixed  Object on success, false on failure.
  *
  * @since   1.6
  */
 public function getItem($pk = null)
 {
     $pk = !empty($pk) ? $pk : (int) $this->getState($this->getName() . '.id');
     $table = $this->getTable();
     if ($pk > 0) {
         // Attempt to load the row.
         $return = $table->load($pk);
         // Check for a table object error.
         if ($return === false && $table->getError()) {
             $this->setError($table->getError());
             return false;
         }
     }
     // Convert to the JObject before adding other data.
     $properties = $table->getProperties(1);
     $item = JArrayHelper::toObject($properties, 'JObject');
     if (property_exists($item, 'params')) {
         $registry = new JRegistry();
         $registry->loadString($item->params);
         $item->params = $registry->toArray();
     }
     if (property_exists($item, 'order_params')) {
         $registry = new JRegistry();
         $registry->loadString($item->order_params);
         $item->order_params = $registry->toArray();
     }
     return $item;
 }
开发者ID:sankam-nikolya,项目名称:lptt,代码行数:37,代码来源:edit.php


示例4: getLogout

 /**
  * Log the user out of the application.
  *
  * @return \Illuminate\Http\Response
  */
 public function getLogout()
 {
     $user = \Auth::user()->name;
     \Auth::logout();
     \Session::flash('flash_message', $user . ': You have been logged out.');
     return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/');
 }
开发者ID:dmorgorg,项目名称:photos,代码行数:12,代码来源:AuthController.php


示例5: fromObject

 /**
  * @param object $object
  * @return $this
  * @throws UnexpectedValueException
  */
 public function fromObject($object)
 {
     parent::fromObject($object);
     if (property_exists($object, 'isRecurring')) {
         $this->isRecurring = $object->isRecurring;
     }
     if (property_exists($object, 'locale')) {
         $this->locale = $object->locale;
     }
     if (property_exists($object, 'paymentProductFilters')) {
         if (!is_object($object->paymentProductFilters)) {
             throw new UnexpectedValueException('value \'' . print_r($object->paymentProductFilters, true) . '\' is not an object');
         }
         $value = new PaymentProductFiltersHostedCheckout();
         $this->paymentProductFilters = $value->fromObject($object->paymentProductFilters);
     }
     if (property_exists($object, 'returnUrl')) {
         $this->returnUrl = $object->returnUrl;
     }
     if (property_exists($object, 'showResultPage')) {
         $this->showResultPage = $object->showResultPage;
     }
     if (property_exists($object, 'tokens')) {
         $this->tokens = $object->tokens;
     }
     if (property_exists($object, 'variant')) {
         $this->variant = $object->variant;
     }
     return $this;
 }
开发者ID:Ingenico-ePayments,项目名称:connect-sdk-php,代码行数:35,代码来源:HostedCheckoutSpecificInput.php


示例6: createEvent

 public function createEvent(Request $request, $payload)
 {
     $newEvent = json_decode(urldecode($payload));
     if (!property_exists($newEvent, 'alert')) {
         return false;
     }
     $alert = $newEvent->alert;
     $event = new RawEvent();
     $event->setType('monitis');
     $system = str_replace('http://', '', $alert->url);
     $system = str_replace(' ', '', $system);
     $event->setSystem($system);
     if ($alert->alertType === self::STATUS_PROBLEM) {
         $event->setStatus(Event::STATUS_FAILURE);
         if (property_exists($alert, "errorString")) {
             $event->setMessage($alert->errorString);
         } else {
             $event->setMessage('Monitis found an error for ' . $alert->name . '.');
         }
     } else {
         $event->setStatus(Event::STATUS_SUCCESS);
         $event->setMessage("");
     }
     $event->setIdentifier("monitis_" . $system . "_" . $alert->type);
     $event->setUnique(false);
     $event->setUrl('http://dashboard.monitis.com/');
     if (property_exists($alert, 'stepDuration')) {
         $event->setValue($alert->stepDuration);
     }
     return $event;
 }
开发者ID:phmLabs,项目名称:Koalamon,代码行数:31,代码来源:MonitisFormat.php


示例7: fromObject

 /**
  * @param object $object
  * @return $this
  * @throws UnexpectedValueException
  */
 public function fromObject($object)
 {
     parent::fromObject($object);
     if (property_exists($object, 'isRecurring')) {
         $this->isRecurring = $object->isRecurring;
     }
     if (property_exists($object, 'paymentProduct809SpecificInput')) {
         if (!is_object($object->paymentProduct809SpecificInput)) {
             throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct809SpecificInput, true) . '\' is not an object');
         }
         $value = new RedirectPaymentProduct809SpecificInput();
         $this->paymentProduct809SpecificInput = $value->fromObject($object->paymentProduct809SpecificInput);
     }
     if (property_exists($object, 'paymentProduct816SpecificInput')) {
         if (!is_object($object->paymentProduct816SpecificInput)) {
             throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct816SpecificInput, true) . '\' is not an object');
         }
         $value = new RedirectPaymentProduct816SpecificInput();
         $this->paymentProduct816SpecificInput = $value->fromObject($object->paymentProduct816SpecificInput);
     }
     if (property_exists($object, 'paymentProduct882SpecificInput')) {
         if (!is_object($object->paymentProduct882SpecificInput)) {
             throw new UnexpectedValueException('value \'' . print_r($object->paymentProduct882SpecificInput, true) . '\' is not an object');
         }
         $value = new RedirectPaymentProduct882SpecificInput();
         $this->paymentProduct882SpecificInput = $value->fromObject($object->paymentProduct882SpecificInput);
     }
     if (property_exists($object, 'returnUrl')) {
         $this->returnUrl = $object->returnUrl;
     }
     return $this;
 }
开发者ID:Ingenico-ePayments,项目名称:connect-sdk-php,代码行数:37,代码来源:RedirectPaymentMethodSpecificInput.php


示例8: GetValue

 /**
  * Gets the value of an OGNL expression in the given context.
  *
  * @param $expression the OGNL expression to evaluate
  * @param $context the context in which to evaluate the expression
  *
  * @return the value of the expression or null if the expression is invalid
  */
 public static function GetValue($expression, $context)
 {
     if (!isset($expression) || !isset($context)) {
         return null;
     }
     while (strlen($expression) > 0) {
         $matches = array();
         if (preg_match(self::$OGNL_TOKEN_REGEX, $expression, $matches)) {
             $token = array_shift($matches);
             $expression = substr($expression, strlen($token));
             // Remove empty matches.
             $matches = array_filter($matches, 'strlen');
             foreach ($matches as $field) {
                 if (is_object($context) && property_exists($context, $field)) {
                     $context = $context->{$field};
                 } else {
                     if (is_array($context) && array_key_exists($field, $context)) {
                         $context = $context[$field];
                     } else {
                         // Field doesn't evaluate in the context.
                         return null;
                     }
                 }
             }
         } else {
             // Invalid expression.
             return null;
         }
     }
     return $context;
 }
开发者ID:antonsmolin,项目名称:google-ads-api-namespaced,代码行数:39,代码来源:OgnlUtils.php


示例9: __set

 /**
  * @param string $property
  * @param mixed  $value
  */
 public function __set($property, $value)
 {
     if (!property_exists($this, $property)) {
         //$this->unknownProperties[$property] = $value;
         $this->{$property} = $value;
     }
 }
开发者ID:uaktags,项目名称:ngcsv1,代码行数:11,代码来源:AbstractEntity.php


示例10: escape

 public static function escape($value)
 {
     if (is_array($value)) {
         foreach ($value as &$ele) {
             self::escape($ele);
         }
         unset($ele);
         return $value;
     }
     if (is_object($value)) {
         $class_vars = get_class_vars(get_class($value));
         foreach ($class_vars as $name => $var) {
             if (!property_exists($value, $name) or !isset($value->{$name})) {
                 continue;
             }
             $value->{$name} = self::escape($value->{$name});
         }
         return $value;
     }
     $value = str_replace(array('javascript:'), '', $value);
     /*
     $value = str_replace(';', "&#59;", $value); 
     $value = str_replace('\\', "\", $value); 
     $value = str_replace('/', "/", $value); 
     $value = str_replace('=', "=", $value);
     */
     $value = htmlentities($value, ENT_QUOTES, 'UTF-8');
     return $value;
 }
开发者ID:joseph-montanez,项目名称:Website-IDE,代码行数:29,代码来源:Template.php


示例11: get

 /**
  * Function to get the value of a given property
  * @param <String> $propertyName
  * @return <Object>
  * @throws Exception
  */
 public function get($propertyName)
 {
     if (property_exists($this, $propertyName)) {
         return $this->{$propertyName};
     }
     return null;
 }
开发者ID:noclav,项目名称:UpdatePackages,代码行数:13,代码来源:Field.php


示例12: extractProperty

 protected static function extractProperty($element, $property)
 {
     if (!is_a($element, get_called_class()) || !property_exists($element, $property)) {
         throw new \InvalidArgumentException('property ' . $property . ' does not exists in class: ' . get_called_class());
     }
     return $element->{$property};
 }
开发者ID:maniaplanet,项目名称:dedicated-server-api,代码行数:7,代码来源:AbstractStructure.php


示例13: getStatusText

 /**
  * Get status text.
  *
  * @return string
  */
 public function getStatusText()
 {
     if (property_exists($this, 'statusText')) {
         return $this->{'statusText'};
     }
     return null;
 }
开发者ID:borobudur-php,项目名称:borobudur-http,代码行数:12,代码来源:HttpStatusTrait.php


示例14: __get

 public function __get($prop)
 {
     if (property_exists($this, $prop)) {
         return $this->{$prop};
     }
     throw new Exception\UpgradeException(sprintf('Property "%s" does not exist for the class "%s".', $prop, get_class($this)));
 }
开发者ID:mheydt,项目名称:scalr,代码行数:7,代码来源:AbstractGetter.php


示例15: updateAttribute

 /**
  * Update object attribute
  *
  * @param  string $attribute
  * @param  string|boolean|integer $value
  *
  * @return object
  */
 private function updateAttribute($attribute, $value)
 {
     if (property_exists($this, $attribute)) {
         $this->{$attribute} = $value;
     }
     return $this;
 }
开发者ID:Gameonn,项目名称:uber-php,代码行数:15,代码来源:GetSetTrait.php


示例16: __get

 public function __get($var)
 {
     if (property_exists(__CLASS__, $var)) {
         return $this->{$var};
     }
     return NULL;
 }
开发者ID:asansola,项目名称:ProyectoFinalProg7,代码行数:7,代码来源:Receta.php


示例17: DiscussionController_Render_Before

 /**
  * Add the insert user's roles to the comment data so we can visually
  * identify different roles in the view.
  */
 public function DiscussionController_Render_Before($Sender)
 {
     $Session = Gdn::Session();
     if ($Session->IsValid()) {
         $JoinUser = array($Session->User);
         RoleModel::SetUserRoles($JoinUser, 'UserID');
     }
     if (property_exists($Sender, 'Discussion')) {
         $JoinDiscussion = array($Sender->Discussion);
         RoleModel::SetUserRoles($JoinDiscussion, 'InsertUserID');
         $Comments = $Sender->Data('Comments');
         RoleModel::SetUserRoles($Comments->Result(), 'InsertUserID');
         $Answers = $Sender->Data('Answers');
         if (is_array($Answers)) {
             RoleModel::SetUserRoles($Answers, 'InsertUserID');
         }
         // And add the css class to the discussion
         if (is_array($Sender->Discussion->Roles)) {
             if (count($Sender->Discussion->Roles)) {
                 $CssRoles = GetValue('Roles', $Sender->Discussion);
                 foreach ($CssRoles as &$RawRole) {
                     $RawRole = $this->_FormatRoleCss($RawRole);
                 }
                 $Sender->Discussion->_CssClass = GetValue('_CssClass', $Sender->Discussion, '') . ' ' . implode(' ', $CssRoles);
             }
         }
     }
 }
开发者ID:SatiricMan,项目名称:addons,代码行数:32,代码来源:class.roletitle.plugin.php


示例18: run

 public function run($params = array())
 {
     // And array of conditions to pass to the database
     $conditions = array();
     // If the filter has any parameters specified
     if (property_exists($this->info, 'params')) {
         foreach ($this->info->params as $param) {
             $name = dash($param->name);
             // If no value for the parameter was passed in, use the
             // filters's specified default value
             if (array_key_exists($name, $params)) {
                 $conditions[$name] = $params[$name];
             } else {
                 $conditions[$name] = $param->default;
             }
         }
     }
     $result = $this->contentType->find($conditions);
     // See if we were just retrieving a single record
     // TODO: Fix the SQL so we do a LIMIT 1, to hopfully same on memory
     if (property_exists($this->info, 'single') && $this->info->single) {
         if (count($result) > 0) {
             $result = $result[0];
         } else {
             $result = NULL;
         }
     }
     return $result;
 }
开发者ID:jeremyboles,项目名称:update-cms-system,代码行数:29,代码来源:filter.php


示例19: getItem

 public function getItem($pk = null)
 {
     // Initialise variables.
     $pk = !empty($pk) ? $pk : (int) $this->getState($this->getName() . '.id');
     $table = $this->getTable();
     if ($pk > 0) {
         // Attempt to load the row.
         $return = $table->load($pk);
         // Check for a table object error.
         if ($return === false && $table->getError()) {
             $this->setError($table->getError());
             return false;
         }
     }
     // Convert to the JObject before adding other data.
     $properties = $table->getProperties(1);
     $item = JArrayHelper::toObject($properties, 'JObject');
     $item->title = htmlspecialchars(strip_tags($item->title));
     if (property_exists($item, 'params')) {
         $registry = new JRegistry();
         $registry->loadString($item->params);
         $item->params = $registry->toArray();
     }
     if ($item) {
         $arr = str_replace('[', '', $item->value);
         $arr = str_replace(']', '', $arr);
         if (preg_match('/.*\\},{\\.*?/s', $arr, $match)) {
             //var_dump($match);
             $values = str_replace('},', '}///', $arr);
             $values = explode('///', $values);
         } else {
             $values = (array) $arr;
         }
         //            $artOptFields   = $this -> _checkArticleFields($item -> id);
         if (count($values) > 0) {
             $list = array();
             $i = 0;
             foreach ($values as $value) {
                 $list[$i] = new stdClass();
                 $param = new JRegistry($value);
                 $list[$i]->type = $item->type;
                 if (!empty($item->default_value)) {
                     $list[$i]->default_value = explode(',', $item->default_value);
                 } else {
                     $list[$i]->default_value = array();
                 }
                 $list[$i]->name = $param->get('name');
                 $list[$i]->value = $param->get('value');
                 $list[$i]->target = $param->get('target');
                 $list[$i]->editor = $param->get('editor');
                 $list[$i]->image = $param->get('image');
                 $list[$i]->ordering = $param->get('ordering');
                 $i++;
             }
             $item->defvalue = $list;
         }
         $item->groups = $this->getGroups();
     }
     return $item;
 }
开发者ID:Glonum,项目名称:tz_portfolio,代码行数:60,代码来源:field.php


示例20: getProtectedProperty

 function getProtectedProperty($item)
 {
     if (property_exists($this, $item)) {
         return $this->{$item};
     }
     throw new Exception("Property does not exist!");
 }
开发者ID:newairhost,项目名称:HTRouter,代码行数:7,代码来源:RuleTest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP property_option函数代码示例发布时间:2022-05-15
下一篇:
PHP property_check函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap