本文整理汇总了PHP中modObjectCreateProcessor::beforeSet方法的典型用法代码示例。如果您正苦于以下问题:PHP modObjectCreateProcessor::beforeSet方法的具体用法?PHP modObjectCreateProcessor::beforeSet怎么用?PHP modObjectCreateProcessor::beforeSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类modObjectCreateProcessor
的用法示例。
在下文中一共展示了modObjectCreateProcessor::beforeSet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeSet
public function beforeSet()
{
$this->setCheckbox('uri', false);
$this->setCheckbox('override', false);
$this->setCheckbox('active', false);
return parent::beforeSet();
}
示例2: 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();
}
示例3: 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();
}
示例4: 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();
}
示例5: beforeSet
public function beforeSet()
{
if (!$this->getProperty('raw')) {
return $this->failure($this->modx->lexicon('uf_err_content'));
}
return parent::beforeSet();
}
示例6: beforeSet
public function beforeSet()
{
$group = $this->getProperty('group');
$items = $this->modx->getCollection($this->classKey, array('group' => $group));
$this->setProperty('position', count($items));
return parent::beforeSet();
}
示例7: beforeSet
/**
* @return bool
*/
public function beforeSet()
{
$rid = $this->getProperty('rid');
list($type, $principal) = explode('-', $this->getProperty('principal'));
if ($this->modx->getCount($this->classKey, array('rid' => $rid, 'principal_type' => $type, 'principal' => $principal))) {
$this->modx->error->addField('principal', $this->modx->lexicon('admintools_permissions_err_ae'));
return parent::beforeSet();
}
switch ($type) {
case 'all':
$weight = 0;
break;
case 'gst':
$weight = 1;
break;
case 'grp':
$weight = 10;
break;
case 'usr':
$weight = 100;
break;
}
if ($type != 'grp') {
$this->setProperty('priority', 0);
}
$this->setProperty('weight', $weight);
$this->setProperty('principal_type', $type);
$this->setProperty('principal', $principal);
return parent::beforeSet();
}
示例8: beforeSet
public function beforeSet()
{
$clientId = $this->getProperty('client_id');
if (empty($clientId)) {
$this->addFieldError('client_id', $this->modx->lexicon('oauth2server.err.clients.client_id_empty'));
}
$exists = $this->modx->getCount('OAuth2ServerClients', array('client_id' => $clientId));
if ($exists > 0) {
$this->addFieldError('client_id', $this->modx->lexicon('oauth2server.err.clients.client_id_exists'));
}
$clientSecret = $this->getProperty('client_secret');
if (empty($clientSecret)) {
$bytes = openssl_random_pseudo_bytes(20);
$hex = bin2hex($bytes);
$this->setProperty('client_secret', $hex);
}
$redirectUri = $this->getProperty('redirect_uri');
if (empty($redirectUri)) {
$this->addFieldError('redirect_uri', $this->modx->lexicon('oauth2server.err.clients.redirect_uri_empty'));
}
$grantTypes = $this->getProperty('grant_types');
if (empty($grantTypes)) {
$this->setProperty('grant_types', NULL);
}
$scope = $this->getProperty('scope');
if (empty($scope)) {
$this->setProperty('scope', NULL);
}
$userId = $this->getProperty('user_id');
$modxUser = $this->modx->user->get('id');
if (empty($userId)) {
$this->setProperty('user_id', $modxUser);
}
return parent::beforeSet();
}
示例9: beforeSet
public function beforeSet()
{
// link
$action = $this->getProperty('action_id');
if (empty($action)) {
$this->setProperty('action_id', null);
} else {
$this->setProperty('action', $action);
}
$handler = $this->getProperty('handler');
if (empty($handler)) {
$this->setProperty('handler', null);
}
$link = $this->getProperty('link');
if (empty($link)) {
$this->setProperty('link', null);
}
// icon
$icon = $this->getProperty('icon');
if (empty($icon)) {
$this->setProperty('icon', null);
}
$iconms = $this->getProperty('icon_ms');
if (empty($iconms)) {
$this->setProperty('icon_ms', null);
}
$iconfile = $this->getProperty('icon_file');
if (empty($iconfile)) {
$this->setProperty('icon_file', null);
}
return parent::beforeSet();
}
示例10: 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();
}
示例11: beforeSet
public function beforeSet()
{
$name = $this->getProperty('name');
if ($this->doesAlreadyExist(array('name' => $name))) {
$this->addFieldError('name', $this->modx->lexicon('propertyset_err_ns_name'));
}
return parent::beforeSet();
}
示例12: beforeSet
public function beforeSet()
{
$this->setDefaultProperties(array('target' => 0, 'principal_class' => 'modUserGroup', 'principal' => 0, 'authority' => 9999, 'policy' => 0));
if (!$this->getProperty('target') || !$this->getProperty('principal_class')) {
return $this->modx->lexicon($this->objectType . '_err_create_md');
}
return parent::beforeSet();
}
示例13: beforeSet
public function beforeSet()
{
$subscribe = $this->modx->getObject('modUser', array('username' => $this->getProperty('username')))->get('id');
$this->setProperty('subscriberid', $subscribe);
$this->unsetProperty('username');
$this->unsetProperty('ctx');
$this->unsetProperty('society_action');
return parent::beforeSet();
}
示例14: beforeSet
/** {@inheritDoc} */
public function beforeSet()
{
foreach (array('domain', 'resource') as $key) {
${$key} = trim($this->getProperty($key));
if (empty(${$key})) {
$this->modx->error->addField($key, $this->modx->lexicon('subdomainsfolder_err_ae'));
}
}
return parent::beforeSet();
}
示例15: beforeSet
public function beforeSet()
{
$headers = $this->modx->fromJSON($this->getProperty('headers', '[]'));
$this->object->set('headers', $headers);
$binary = $this->getProperty('binary', null);
if ($binary !== null) {
$this->object->set('binary', $binary == 'true');
}
return parent::beforeSet();
}