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


PHP Converter::isEmptyString方法代码示例

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


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

示例1: validate

 /**
  * Validate
  *
  * @param mixed $data Data
  *
  * @return void
  */
 public function validate($data)
 {
     parent::validate($data);
     if (!\XLite\Core\Converter::isEmptyString($data)) {
         $entity = \XLite\Core\Database::getRepo('XLite\\Module\\XC\\ProductVariants\\Model\\ProductVariant')->findOneBySku($this->sanitize($data));
         if ($entity) {
             $this->throwVariantSKUError();
         }
     }
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:17,代码来源:SKU.php

示例2: validate

 /**
  * Validate
  *
  * @param mixed $data Data
  *
  * @return void
  */
 public function validate($data)
 {
     if (!\XLite\Core\Converter::isEmptyString($data)) {
         $entity = \XLite\Core\Database::getRepo('XLite\\Model\\Product')->findOneBySku($this->sanitize($data));
         // DO NOT use "!==" here
         if ($entity && (empty($this->productId) || $entity->getProductId() != $this->productId)) {
             $this->throwSKUError();
         }
     }
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:17,代码来源:SKUAbstract.php

示例3: validate

 /**
  * Validate
  *
  * @param mixed $data Data
  *
  * @return void
  */
 public function validate($data)
 {
     if (!\XLite\Core\Converter::isEmptyString($data)) {
         $entity = \XLite\Core\Database::getRepo($this->fieldClass)->findOneBy(array($this->fieldName => $this->sanitize($data)));
         // DO NOT use "!==" here
         if ($entity && (empty($this->fieldValue) || $entity->{'get' . \XLite\Core\Converter::convertToCamelCase($this->fieldName)}() != $this->fieldValue)) {
             $this->throwSKUError();
         }
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:17,代码来源:UniqueField.php

示例4: validate

 /**
  * Validate
  *
  * @param mixed $data Data
  *
  * @return void
  * @throws \XLite\Core\Validator\Exception
  */
 public function validate($data)
 {
     if (!\XLite\Core\Converter::isEmptyString($data)) {
         parent::validate($data);
         $entity = \XLite\Core\Database::getRepo($this->class)->findOneByCleanURL($this->sanitize($data));
         // DO NOT use "!==" here
         if ($entity && (empty($this->id) || $entity->getUniqueIdentifier() != $this->id)) {
             $this->throwCleanURLError();
         }
     }
 }
开发者ID:kingsj,项目名称:core,代码行数:19,代码来源:CleanURL.php

示例5: validate

 /**
  * Validate
  *
  * @param mixed $data Data
  *
  * @return void
  * @throws \XLite\Core\Validator\Exception
  */
 public function validate($data)
 {
     $data = $this->sanitize($data);
     if (!\XLite\Core\Converter::isEmptyString($data)) {
         parent::validate($data);
         /** @var \XLite\Model\Repo\CleanURL $repo */
         $repo = \XLite\Core\Database::getRepo('XLite\\Model\\CleanURL');
         $postedData = \XLite\Core\Request::getInstance()->postedData;
         if (!isset($postedData['forceCleanURL']) && !$repo->isURLUnique($data, $this->class, $this->id)) {
             $this->throwCleanURLError($data);
         }
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:21,代码来源:CleanURL.php

示例6: prepareBeforeSave

 /**
  * Lifecycle callback
  *
  * @return void
  * @see    ____func_see____
  * @since  1.0.24
  *
  * @PrePersist
  * @PreUpdate
  */
 public function prepareBeforeSave()
 {
     if (\XLite\Core\Converter::isEmptyString($this->getCleanURL())) {
         $this->setCleanURL(null);
     }
 }
开发者ID:kingsj,项目名称:core,代码行数:16,代码来源:Page.php

示例7: updateCleanURL

 /**
  * Update cleanURL
  *
  * @param \XLite\Model\AEntity $model Model
  * @param  string              $value Value
  *
  * @return void
  */
 protected function updateCleanURL(\XLite\Model\AEntity $model, $value)
 {
     if (!\XLite\Core\Converter::isEmptyString($value)) {
         $validator = new \XLite\Core\Validator\String\CleanURL(false, null, get_class($model), $model->getId());
         try {
             $validator->validate($value);
             $model->setCleanURL($value);
         } catch (\XLite\Core\Validator\Exception $exception) {
         }
     } else {
         $model->setCleanURL(null);
     }
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:21,代码来源:AProcessor.php

示例8: getPostedData

 /**
  * Get posted data
  *
  * @param string $field Name of the field to retrieve OPTIONAL
  *
  * @return mixed
  */
 protected function getPostedData($field = null)
 {
     $value = parent::getPostedData($field);
     $time = \XLite\Core\Converter::time();
     if (!isset($field)) {
         if (isset($value['arrivalDate'])) {
             $value['arrivalDate'] = intval(strtotime($value['arrivalDate'])) ?: mktime(0, 0, 0, date('m', $time), date('j', $time), date('Y', $time));
         }
         if (isset($value['sku']) && \XLite\Core\Converter::isEmptyString($value['sku'])) {
             $value['sku'] = null;
         }
         if (isset($value['productClass'])) {
             $value['productClass'] = \XLite\Core\Database::getRepo('\\XLite\\Model\\ProductClass')->find($value['productClass']);
         }
         if (isset($value['taxClass'])) {
             $value['taxClass'] = \XLite\Core\Database::getRepo('\\XLite\\Model\\TaxClass')->find($value['taxClass']);
         }
     } elseif ('arrivalDate' === $field) {
         $value = intval(strtotime($value)) ?: mktime(0, 0, 0, date('m', $time), date('j', $time), date('Y', $time));
     } elseif ('sku' === $field) {
         $value = null;
     } elseif ('productClass' === $field) {
         $value = \XLite\Core\Database::getRepo('\\XLite\\Model\\ProductClass')->find($value);
     } elseif ('taxClass' === $field) {
         $value = \XLite\Core\Database::getRepo('\\XLite\\Model\\TaxClass')->find($value);
     }
     return $value;
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:35,代码来源:ProductAbstract.php

示例9: prepareBeforeUpdate

 /**
  * Prepare update date
  *
  * @return void
  *
  * @PreUpdate
  */
 public function prepareBeforeUpdate()
 {
     $this->setUpdateDate(\XLite\Core\Converter::time());
     if (\XLite\Core\Converter::isEmptyString($this->getSku())) {
         $this->setSKU(null);
     }
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:14,代码来源:Product.php

示例10: generateCleanURL

 /**
  * Generate clean URL
  *
  * @param \XLite\Model\Product $model  Product
  * @param string               $value  Value OPTIONAL
  *
  * @return void
  */
 protected function generateCleanURL(\XLite\Model\Product $model, $value = '')
 {
     if (\XLite\Core\Converter::isEmptyString($value)) {
         if (!\XLite\Core\Converter::isEmptyString($this->currentRowData['name'])) {
             // Input cleanURL value is empty, trying to get product name from current row data
             $lngCodes = array_unique(array('en', $this->importer->getLanguageCode()));
             foreach ($lngCodes as $code) {
                 if (!empty($this->currentRowData['name'][$code])) {
                     $value = $this->currentRowData['name'][$code];
                     break;
                 }
             }
         }
         if (\XLite\Core\Converter::isEmptyString($value)) {
             // Try to get value from current product name
             $value = $model->getName();
         }
     } else {
         $value = preg_replace('/\\.html$/', '', $value);
     }
     /** @var \XLite\Model\Repo\CleanURL $repo */
     $repo = \XLite\Core\Database::getRepo('XLite\\Model\\CleanURL');
     $value = $repo->generateCleanURL($model, $value);
     if (!\XLite\Core\Converter::isEmptyString($value)) {
         $this->updateCleanURL($model, $value);
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:35,代码来源:Products.php

示例11: normalizeGroupValue

 /**
  * Normalize 'group' value
  *
  * @param mixed @value Value
  *
  * @return \XLite\Model\AttributeGroup
  */
 protected function normalizeGroupValue($value)
 {
     if (!\XLite\Core\Converter::isEmptyString($this->currentRowData['class'])) {
         $className = $this->getDefLangValue($this->currentRowData['class']);
         $productClass = \XLite\Core\Database::getRepo('XLite\\Model\\ProductClass')->findOneByName($className);
     } else {
         $productClass = null;
     }
     return $this->normalizeValueAsAttributeGroup($value, $productClass);
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:17,代码来源:Attributes.php

示例12: getPostedData

 /**
  * Get posted data
  *
  * @param string $field Name of the field to retrieve OPTIONAL
  *
  * @return mixed
  */
 protected function getPostedData($field = null)
 {
     $value = parent::getPostedData($field);
     if (!isset($field)) {
         if (isset($value['arrivalDate'])) {
             $value['arrivalDate'] = intval(strtotime($value['arrivalDate'])) ?: time();
         }
         if (isset($value['sku']) && \XLite\Core\Converter::isEmptyString($value['sku'])) {
             $value['sku'] = null;
         }
     } elseif ('arrivalDate' === $field) {
         $value = intval(strtotime($value)) ?: time();
     } elseif ('sku' === $field) {
         $value = null;
     }
     return $value;
 }
开发者ID:kingsj,项目名称:core,代码行数:24,代码来源:Product.php


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