Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux indy02.toastserver.com 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64
User : palandch ( 1163)
PHP Version : 7.1.33
Disable Function : NONE
Directory :  /home/palandch/www/core/model/modx/processors/element/category/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/palandch/www/core/model/modx/processors/element/category/create.class.php
<?php
/**
 * Create a category.
 *
 * @param string $category The new name of the category.
 *
 * @package modx
 * @subpackage processors.element.category
 */
class modElementCategoryCreateProcessor extends modObjectCreateProcessor {
    public $classKey = 'modCategory';
    public $languageTopics = array('category');
    public $permission = 'save_category';
    public $objectType = 'category';

    /**
     * Validate the creation
     * @return boolean
     */
    public function beforeSave() {
        $name = $this->getProperty('category');
        if (empty($name)) {
            $this->addFieldError('category',$this->modx->lexicon('category_err_ns'));
        } else if ($this->alreadyExists($name)) {
            $this->addFieldError('category',$this->modx->lexicon('category_err_ae'));
        }

        return !$this->hasErrors();
    }

    /**
     * Check to see if a Category with that name already exists
     * 
     * @param string $name The name to check against
     * @return boolean
     */
    public function alreadyExists($name) {
        return $this->modx->getCount('modCategory',array('category' => $name)) > 0;
    }
}
return 'modElementCategoryCreateProcessor';

Spamworldpro Mini