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


PHP EncryptorInterface::encrypt方法代码示例

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


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

示例1: beforeSave

 /**
  * Encrypt value before saving
  *
  * @return void
  */
 public function beforeSave()
 {
     $this->_dataSaveAllowed = false;
     $value = (string) $this->getValue();
     // don't save value, if an obscured value was received. This indicates that data was not changed.
     if (!preg_match('/^\\*+$/', $value) && !empty($value)) {
         $this->_dataSaveAllowed = true;
         $encrypted = $this->_encryptor->encrypt($value);
         $this->setValue($encrypted);
     }
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:16,代码来源:Encrypted.php

示例2: beforeSave

 /**
  * Encrypt value before saving
  *
  * @return void
  */
 public function beforeSave()
 {
     $value = (string) $this->getValue();
     // don't change value, if an obscured value came
     if (preg_match('/^\\*+$/', $this->getValue())) {
         $value = $this->getOldValue();
     }
     if (!empty($value)) {
         $encrypted = $this->_encryptor->encrypt($value);
         if ($encrypted) {
             $this->setValue($encrypted);
         }
     }
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:19,代码来源:Encrypted.php

示例3: _reEncryptCreditCardNumbers

 /**
  * Gather saved credit card numbers from sales order payments and re-encrypt them
  *
  * @return void
  */
 protected function _reEncryptCreditCardNumbers()
 {
     $table = $this->getTable('sales_order_payment');
     $select = $this->getConnection()->select()->from($table, ['entity_id', 'cc_number_enc']);
     $attributeValues = $this->getConnection()->fetchPairs($select);
     // save new values
     foreach ($attributeValues as $valueId => $value) {
         $this->getConnection()->update($table, ['cc_number_enc' => $this->encryptor->encrypt($this->encryptor->decrypt($value))], ['entity_id = ?' => (int) $valueId]);
     }
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:15,代码来源:Change.php

示例4: _beforeSave

 /**
  * Process additional data before save config
  *
  * @return $this
  * @throws \Magento\Framework\Model\Exception
  */
 protected function _beforeSave()
 {
     $value = $this->getValue();
     if (is_array($value) && !empty($value['delete'])) {
         $this->setValue('');
         $this->_certFactory->create()->loadByWebsite($this->getScopeId())->delete();
     }
     if (!isset($_FILES['groups']['tmp_name'][$this->getGroupId()]['fields'][$this->getField()]['value'])) {
         return $this;
     }
     $tmpPath = $this->_tmpDirectory->getRelativePath($_FILES['groups']['tmp_name'][$this->getGroupId()]['fields'][$this->getField()]['value']);
     if ($tmpPath && $this->_tmpDirectory->isExist($tmpPath)) {
         if (!$this->_tmpDirectory->stat($tmpPath)['size']) {
             throw new \Magento\Framework\Model\Exception(__('The PayPal certificate file is empty.'));
         }
         $this->setValue($_FILES['groups']['name'][$this->getGroupId()]['fields'][$this->getField()]['value']);
         $content = $this->_encryptor->encrypt($this->_tmpDirectory->readFile($tmpPath));
         $this->_certFactory->create()->loadByWebsite($this->getScopeId())->setContent($content)->save();
     }
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:27,代码来源:Cert.php

示例5: _saveConfig

 /**
  * Save the configuration value in both core and module db tables.
  *
  * @param $path
  * @param $scopeId
  * @param $value
  * @param string $type
  */
 protected function _saveConfig($path, $scopeId, $value, $type = self::TYPE_NORMAL)
 {
     // do not save config if path validation fails.
     if (!($fullPathParts = $this->_validateFullPath($path))) {
         return;
     }
     if ($type === self::TYPE_ENCRYPTED) {
         $value = $this->_encryptor->encrypt($value);
     }
     // get the path from the parts of path
     $path = implode('/', array_slice($fullPathParts, 1, 3));
     $this->_coreConfigResource->saveConfig($path, $value, $fullPathParts[0], $scopeId);
     $this->_configModel->setData(['scope_type' => $fullPathParts[0], 'scope_id' => $scopeId, 'path' => $path, 'value' => $value]);
     $this->_configModel->save();
     $this->_configModel->clearInstance();
 }
开发者ID:jzahedieh,项目名称:Magento2-FileConfigurator,代码行数:24,代码来源:AbstractLoader.php

示例6: encrypt

 /**
  * Encrypt data
  *
  * @param string $data
  * @return string
  */
 public function encrypt($data)
 {
     return $this->_encryptor->encrypt($data);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:10,代码来源:Info.php

示例7: encryptPassword

 /**
  * Encrypt password
  *
  * @param   string $password
  * @return  string
  */
 public function encryptPassword($password)
 {
     return $this->_encryptor->encrypt($password);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:10,代码来源:Customer.php


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