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


PHP xPDO::invokeEvent方法代碼示例

本文整理匯總了PHP中xPDO::invokeEvent方法的典型用法代碼示例。如果您正苦於以下問題:PHP xPDO::invokeEvent方法的具體用法?PHP xPDO::invokeEvent怎麽用?PHP xPDO::invokeEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在xPDO的用法示例。


在下文中一共展示了xPDO::invokeEvent方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: changePassword

 /**
  * Change the user password.
  *
  * @access public
  * @param string $newPassword Password to set.
  * @param string $oldPassword Current password for validation.
  * @return boolean Indicates if password was successfully changed.
  * @todo Add support for configurable password encoding.
  */
 public function changePassword($newPassword, $oldPassword)
 {
     $changed = false;
     if ($this->passwordMatches($oldPassword)) {
         if (!empty($newPassword)) {
             $this->set('password', $newPassword);
             $changed = $this->save();
             if ($changed) {
                 $this->xpdo->invokeEvent('OnUserChangePassword', array('user' => &$this, 'newpassword' => $newPassword, 'oldpassword' => $oldPassword, 'userid' => $this->get('id'), 'username' => $this->get('username'), 'userpassword' => $newPassword));
             }
         }
     }
     return $changed;
 }
開發者ID:e-gob,項目名稱:chilesinpapeleo-ayuda,代碼行數:23,代碼來源:moduser.class.php

示例2: getProperties

 /**
  * Get the properties on this source
  * @param boolean $parsed
  * @return array
  */
 public function getProperties($parsed = false)
 {
     $properties = $this->get('properties');
     $defaultProperties = $this->getDefaultProperties();
     if (!empty($properties) && is_array($properties)) {
         foreach ($properties as &$property) {
             $property['overridden'] = 0;
             if (array_key_exists($property['name'], $defaultProperties)) {
                 if ($defaultProperties[$property['name']]['value'] != $property['value']) {
                     $property['overridden'] = 1;
                 }
             } else {
                 $property['overridden'] = 2;
             }
         }
         $properties = array_merge($defaultProperties, $properties);
     } else {
         $properties = $defaultProperties;
     }
     /** @var array $results Allow manipulation of media source properties via event */
     $results = $this->xpdo->invokeEvent('OnMediaSourceGetProperties', array('properties' => $this->xpdo->toJSON($properties)));
     if (!empty($results)) {
         foreach ($results as $result) {
             $result = is_array($result) ? $result : $this->xpdo->fromJSON($result);
             $properties = array_merge($properties, $result);
         }
     }
     if ($parsed) {
         $properties = $this->parseProperties($properties);
     }
     return $this->prepareProperties($properties);
 }
開發者ID:WhisperingTree,項目名稱:blog,代碼行數:37,代碼來源:modmediasource.class.php


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