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


PHP modObjectCreateProcessor类代码示例

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


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

示例1: beforeSet

 /** {inheritDoc} */
 public function beforeSet()
 {
     /** @var msDiscount $msDiscount */
     $msDiscount = $this->modx->getService('msDiscount');
     $properties = $this->getProperties();
     foreach ($properties as $k => $v) {
         $properties[$k] = $msDiscount->sanitize($k, $v);
     }
     $this->setProperties($properties);
     $required = array('name');
     foreach ($required as $v) {
         if ($this->getProperty($v) == '') {
             $this->modx->error->addField($v, $this->modx->lexicon('msd_err_ns'));
         }
     }
     $unique = array('name');
     foreach ($unique as $v) {
         if ($this->modx->getCount($this->classKey, array($v => $this->getProperty($v)))) {
             $this->modx->error->addField($v, $this->modx->lexicon('msd_err_ae'));
         }
     }
     $active = $this->getProperty('active');
     $this->setProperty('active', !empty($active) && $active != 'false');
     return parent::beforeSet();
 }
开发者ID:bendasvadim,项目名称:msDiscount,代码行数:26,代码来源:create.class.php

示例2: beforeSet

 /** {inheritDoc} */
 public function beforeSet()
 {
     /** @var msDiscount $msDiscount */
     $msDiscount = $this->modx->getService('msDiscount');
     $properties = $this->getProperties();
     foreach ($properties as $k => $v) {
         $properties[$k] = $msDiscount->sanitize($k, $v);
     }
     $this->setProperties($properties);
     $required = array('name', 'discount', 'coupons');
     foreach ($required as $v) {
         $value = trim($this->getProperty($v));
         if (empty($value) || $value == '0%') {
             $this->modx->error->addField($v, $this->modx->lexicon('msd_err_ns'));
         }
     }
     $unique = array('name');
     foreach ($unique as $v) {
         if ($this->modx->getCount($this->classKey, array($v => $this->getProperty($v)))) {
             $this->modx->error->addField($v, $this->modx->lexicon('msd_err_ae'));
         }
     }
     $prefix = $this->getProperty('prefix');
     if (!empty($prefix) && !preg_match('#[A-Z0-9]{5}#i', $prefix)) {
         $this->modx->error->addField('prefix', $this->modx->lexicon('msd_err_prefix'));
     } else {
         $this->setProperty('prefix', strtoupper($prefix));
     }
     return parent::beforeSet();
 }
开发者ID:bendasvadim,项目名称:msDiscount,代码行数:31,代码来源:create.class.php

示例3: beforeSave

 public function beforeSave()
 {
     if (!$this->object->get('name')) {
         return 'Please, type project name';
     }
     return parent::beforeSave();
 }
开发者ID:Tramp1357,项目名称:atlasorg,代码行数:7,代码来源:create.class.php

示例4: beforeSet

 public function beforeSet()
 {
     $optionId = $this->getProperty('option_id');
     if (empty($optionId)) {
         return $this->modx->lexicon($this->objectType . '_err_ns');
     }
     $categoryId = $this->getProperty('category_id');
     if (empty($categoryId)) {
         return $this->modx->lexicon('ms2_category_err_ns');
     }
     $unique = array('option_id' => $optionId, 'category_id' => $categoryId);
     if ($this->doesAlreadyExist($unique)) {
         return $this->modx->lexicon($this->objectType . '_err_ae', $unique);
     }
     $this->option = $this->modx->getObject('msOption', $optionId);
     if (!$this->option) {
         return $this->modx->lexicon($this->objectType . '_err_nf');
     }
     $category = $this->modx->getObject('msCategory', $categoryId);
     if (!$category) {
         return $this->modx->lexicon('ms2_category_err_nf');
     }
     $this->object->set('option_id', $optionId);
     $this->object->set('category_id', $categoryId);
     $rank = $this->modx->getCount($this->classKey, array('category_id' => $categoryId));
     $this->object->set('rank', $rank);
     return parent::beforeSet();
 }
开发者ID:rafull6,项目名称:texno-service,代码行数:28,代码来源:add.class.php

示例5: beforeSave

 /** {@inheritDoc} */
 public function beforeSave()
 {
     $q = $this->modx->newQuery($this->classKey);
     $q->where(array('tab:=' => $this->getProperty('tab')));
     $this->object->fromArray(array('rank' => $this->modx->getCount('up2Fields', $q)));
     return parent::beforeSave();
 }
开发者ID:arimanr,项目名称:userprofile2,代码行数:8,代码来源:create.class.php

示例6: initialize

 /** {@inheritDoc} */
 public function initialize()
 {
     if (!$this->modx->hasPermission($this->permission)) {
         return $this->modx->lexicon('access_denied');
     }
     return parent::initialize();
 }
开发者ID:volkovnd,项目名称:miniShop2,代码行数:8,代码来源:create.class.php

示例7: beforeSave

 public function beforeSave()
 {
     // Setting creator and time created
     $this->object->set('createdby', $this->modx->user->get('id'));
     $this->object->set('createdon', date('Y-m-d H:i:s', time()));
     return parent::beforeSave();
 }
开发者ID:doksec,项目名称:formz,代码行数:7,代码来源:create.class.php

示例8: beforeSet

 public function beforeSet()
 {
     $this->setCheckbox('uri', false);
     $this->setCheckbox('override', false);
     $this->setCheckbox('active', false);
     return parent::beforeSet();
 }
开发者ID:svyatoslavteterin,项目名称:belton.by,代码行数:7,代码来源:create.class.php

示例9: afterSave

 public function afterSave()
 {
     $contexts = $this->getProperty('access_contexts', '');
     $contexts = is_array($contexts) ? $contexts : explode(',', $contexts);
     $contexts = array_unique($contexts);
     if (!empty($contexts)) {
         $flush = false;
         if ($this->getProperty('access_admin')) {
             if ($this->addAdminAccess($contexts)) {
                 $flush = true;
             }
         }
         if ($this->getProperty('access_anon')) {
             if ($this->addAnonymousAccess($contexts)) {
                 $flush = true;
             }
         }
         if ($this->getProperty('access_parallel')) {
             if ($this->addParallelUserGroup($contexts)) {
                 $flush = true;
             }
         }
         $userGroups = $this->getProperty('access_usergroups');
         if (!empty($userGroups)) {
             $userGroups = is_array($userGroups) ? $userGroups : explode(',', $userGroups);
             if ($this->addOtherUserGroups($userGroups, $contexts)) {
                 $flush = true;
             }
         }
         if ($flush) {
             $this->flushPermissions();
         }
     }
     return parent::afterSave();
 }
开发者ID:ChrstnMgcn,项目名称:revolution,代码行数:35,代码来源:create.class.php

示例10: afterSave

 public function afterSave()
 {
     $categories = $this->getCategories();
     $categories = $this->object->setCategories($categories);
     $this->object->set('categories', $categories);
     return parent::afterSave();
 }
开发者ID:Vitaliz,项目名称:miniShop2,代码行数:7,代码来源:create.class.php

示例11: beforeSave

 public function beforeSave()
 {
     $name = $this->getProperty('tag');
     $group = $this->getProperty('group');
     $alias = $this->getProperty('alias');
     if (empty($name) || empty($group)) {
         if (empty($group)) {
             $this->addFieldError('group', $this->modx->lexicon('tagger.err.group_name_ns'));
         }
         if (empty($name)) {
             $this->addFieldError('tag', $this->modx->lexicon('tagger.err.tag_name_ns'));
         }
     } else {
         if ($this->doesAlreadyExist(array('tag' => $name, 'group' => $group))) {
             $this->addFieldError('tag', $this->modx->lexicon('tagger.err.tag_name_ae'));
         }
     }
     if (!empty($alias)) {
         $alias = $this->object->cleanAlias($alias);
         if ($this->doesAlreadyExist(array('alias' => $alias, 'group' => $group))) {
             $this->addFieldError('alias', $this->modx->lexicon('tagger.err.tag_alias_ae'));
         }
     }
     return parent::beforeSave();
 }
开发者ID:hansek,项目名称:Tagger,代码行数:25,代码来源:create.class.php

示例12: initialize

 public function initialize()
 {
     if (!($this->historyFile = $this->modx->msrevaluation->process())) {
         $this->failure($this->modx->msrevaluation->error);
     }
     return parent::initialize();
 }
开发者ID:svyatoslavteterin,项目名称:belton.by,代码行数:7,代码来源:process.class.php

示例13: afterSave

 public function afterSave()
 {
     /** @var xPDOFileCache $provider */
     $provider = $this->modx->cacheManager->getCacheProvider('oauth2server');
     $provider->flush();
     return parent::afterSave();
 }
开发者ID:lokamaya,项目名称:oauth2-server,代码行数:7,代码来源:create.class.php

示例14: beforeSet

 public function beforeSet()
 {
     $content = '';
     $classKey = $this->getProperty('class_key');
     switch ($classKey) {
         case 'sSnippetTask':
             $content = $this->getProperty('snippet-content');
             if (empty($content)) {
                 $this->addFieldError('snippet-content', $this->modx->lexicon('scheduler.error.no-snippet-content'));
                 return false;
             }
             break;
         case 'sProcessorTask':
             $content = $this->getProperty('processor-content');
             if (empty($content)) {
                 $this->addFieldError('processor-content', $this->modx->lexicon('scheduler.error.no-processor-content'));
                 return false;
             }
             break;
         case 'sFileTask':
         default:
             $content = $this->getProperty('file-content');
             if (empty($content)) {
                 $this->addFieldError('file-content', $this->modx->lexicon('scheduler.error.no-file-content'));
                 return false;
             }
             break;
     }
     $this->setProperty('content', $content);
     return parent::beforeSet();
 }
开发者ID:sebastian-marinescu,项目名称:Scheduler,代码行数:31,代码来源:create.class.php

示例15: beforeSave

 /** {@inheritDoc} */
 public function beforeSave()
 {
     $data = $this->modx->currencyrate->calcData($this->object->toArray());
     $data['rank'] = $this->modx->getCount($this->classKey);
     $this->object->fromArray($data);
     return parent::beforeSave();
 }
开发者ID:xom9k,项目名称:currencyrate,代码行数:8,代码来源:create.class.php


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