本文整理汇总了PHP中Field::checkFields方法的典型用法代码示例。如果您正苦于以下问题:PHP Field::checkFields方法的具体用法?PHP Field::checkFields怎么用?PHP Field::checkFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Field
的用法示例。
在下文中一共展示了Field::checkFields方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkFields
public function checkFields(&$errors, $checkForDuplicates = true)
{
if (!is_writable(DOCROOT . $this->get('destination') . '/')) {
$errors['destination'] = 'Folder is not writable. Please check permissions.';
}
parent::checkFields($errors, $checkForDuplicates);
}
示例2: checkFields
public function checkFields(&$errors, $checkForDuplicates = TRUE)
{
parent::checkFields($errors, $checkForDuplicates);
$related_fields = $this->get('related_sbl_id');
if (empty($related_fields)) {
$errors['related_sbl_id'] = __('This is a required field.');
}
return is_array($errors) && !empty($errors) ? self::__ERROR__ : self::__OK__;
}
示例3: checkFields
public function checkFields(&$errors, $checkForDuplicates = true)
{
parent::checkFields($errors, $checkForDuplicates);
$this->rememberSalt();
if (trim($this->get('salt')) == '') {
$errors['salt'] = 'This is a required field.';
}
}
示例4: checkFields
/**
* Checks fields for errors in section editor.
*
* @param array $errors
* @param boolean $checkForDuplicates
*/
public function checkFields(&$errors, $checkForDuplicates = true)
{
if (!is_array($errors)) {
$errors = array();
}
$templates = $this->get('templates');
if (empty($templates)) {
$errors['templates'] = __('This is a required field.');
}
$senders = $this->get('senders');
if (empty($senders)) {
$errors['senders'] = __('This is a required field.');
}
$recipient_groups = $this->get('recipient_groups');
if (empty($recipient_groups)) {
$errors['recipient_groups'] = __('This is a required field.');
}
parent::checkFields($errors, $checkForDuplicates);
}
示例5: checkFields
/**
* Checks fields for errors in section editor.
*
* @param array $errors
* @param boolean $checkForDuplicates
*/
function checkFields(&$errors, $checkForDuplicates = true)
{
if (!is_array($errors)) {
$errors = array();
}
// check if a related section has been selected
if ($this->get('related_section_id') == '') {
$errors['related_section_id'] = __('This is a required field.');
}
// check if caption content is well formed
if ($this->get('caption')) {
$validate = simplexml_load_string('<li>' . $this->get('caption') . '</li>');
if (!$validate) {
$errors['caption'] = __('Caption has to be well-formed. Please check opening and closing tags.');
}
}
parent::checkFields($errors, $checkForDuplicates);
}
示例6: checkFields
public function checkFields(&$errors, $checkForDuplicates = true)
{
if (!is_dir(DOCROOT . $this->get('destination') . '/')) {
$errors['destination'] = __('Directory <code>%s</code> does not exist.', array($this->get('destination')));
} elseif (!is_writable(DOCROOT . $this->get('destination') . '/')) {
$errors['destination'] = __('Destination folder, <code>%s</code>, is not writable. Please check permissions.', array($this->get('destination')));
}
if ($this->get('maximum_filesize') != NULL && !is_numeric($this->get('maximum_filesize'))) {
$errors['maximum_filesize'] = __('Invalid value specified. Must be a number.');
}
if ($this->get('maximum_dimension_width') != NULL && !is_numeric($this->get('maximum_dimension_width'))) {
$errors['maximum_dimension_width'] = __('Invalid value specified. Must be a number.');
}
if ($this->get('maximum_dimension_height') != NULL && !is_numeric($this->get('maximum_dimension_height'))) {
$errors['maximum_dimension_height'] = __('Invalid value specified. Must be a number.');
}
if ($this->get('resize_long_edge_dimension') != NULL && !is_numeric($this->get('resize_long_edge_dimension'))) {
$errors['resize_long_edge_dimension'] = __('Invalid value specified. Must be a number.');
}
parent::checkFields($errors, $checkForDuplicates);
}
示例7: checkFields
public function checkFields(array &$errors, $checkForDuplicates = true)
{
$expression = trim($this->get('expression'));
if (!empty($expression)) {
$r = Conditionalizer::parse($expression);
if (empty($r)) {
$errors['expression'] = __('Invalid syntax');
}
}
return parent::checkFields($errors, $checkForDuplicates);
}
示例8: checkFields
public function checkFields(&$errors, $checkForDuplicates = true)
{
if (!is_array($errors)) {
$errors = array();
}
if ($this->get('cname') != '' && !preg_match('/([.]+)/i', $this->get('cname'))) {
$errors['cname'] = __('This is an invalid CNAME. Don\'t include the protocol (http/s).');
}
// Check if a related section has been selected
if ($this->get('bucket') == '') {
$errors['bucket'] = __('You have not setup your S3 Access keys yet. Please do so <a href="' . SYMPHONY_URL . '/system/preferences/">here</a>.');
}
return Field::checkFields($errors, $checkForDuplicates);
}
示例9: checkFields
/**
*
* Validates the field settings before saving it into the field's table
*/
public function checkFields(array &$errors, $checkForDuplicates)
{
parent::checkFields($errors, $checkForDuplicates);
$field_handles = $this->get('field-handles');
if (empty($field_handles)) {
$errors['field-handles'] = __('You must set at least one field handle or * to enable those settings for all fields in this section');
}
foreach ($this->prefixes as $key => $prefix) {
$width = $this->get($prefix . 'width');
$height = $this->get($prefix . 'height');
$resize = $this->get($prefix . 'resize');
$position = $this->get($prefix . 'position');
if (!empty($width) && (!is_numeric($width) || intval($width) < 0)) {
$errors[$prefix . 'width'] = __('Width must be a positive integer');
}
if (!empty($height) && (!is_numeric($height) || intval($height) < 0)) {
$errors[$prefix . 'height'] = __('Height must be a positive integer');
}
if (!empty($resize) && (!is_numeric($resize) || intval($resize) < 1 || intval($resize) > 3)) {
$errors[$prefix . 'resize'] = __('Resize must be a positive integer between 1 and 3');
}
if (!empty($position) && (!is_numeric($position) || intval($position) < 1 || intval($position) > 9)) {
$errors[$prefix . 'position'] = __('Position must be a positive integer between 1 and 9');
}
}
return !empty($errors) ? self::__ERROR__ : self::__OK__;
}
示例10: checkFields
/**
* @see http://symphony-cms.com/learn/api/2.3/toolkit/field/#checkFields
*/
function checkFields(&$errors, $checkForDuplicates = true)
{
if (!is_array($errors)) {
$errors = array();
}
// Check if a related section has been selected
if ($this->get('subsection_id') == '') {
$errors['subsection_id'] = __('This is a required field.');
}
// Check if caption content is well formed
if ($this->get('caption')) {
try {
simplexml_load_string('<li>' . $this->get('caption') . '</li>');
} catch (Exception $e) {
$errors['caption'] = __('%s has to be well-formed. Please check opening and closing tags.', array(__('Caption')));
}
}
// Check if droptext content is well formed
if ($this->get('droptext')) {
try {
simplexml_load_string('<li>' . $this->get('droptext') . '</li>');
} catch (Exception $e) {
$errors['droptext'] = __('%s has to be well-formed. Please check opening and closing tags.', array(__('Drop text')));
}
}
parent::checkFields($errors, $checkForDuplicates);
}
示例11: checkFields
function checkFields(array &$errors, $checkForDuplicates = true)
{
parent::checkFields($errors, $checkForDuplicates);
if (trim($this->get('xml_location')) === '') {
$errors['xml_location'] = __('This is a required field.');
}
if (trim($this->get('item_xpath')) === '') {
$errors['item_xpath'] = __('This is a required field.');
}
if (trim($this->get('text_xpath')) === '') {
$errors['text_xpath'] = __('This is a required field.');
}
return !empty($errors) ? self::__ERROR__ : self::__OK__;
}
示例12: checkFields
function checkFields(&$errors, $checkForDuplicates = true)
{
if (!is_array($errors)) {
$errors = array();
}
if ($this->get('related_field_id') == '' || $this->get('related_field_id') == 'none') {
$errors['related_field_id'] = __('A file upload field must be selected.');
}
parent::checkFields($errors, $checkForDuplicates);
}
示例13: checkFields
function checkFields(&$errors, $checkForDuplicates = true)
{
// check for presence of upload fields
$section_id = Administration::instance()->Page->_context[1];
$fields = FieldManager::fetch(NULL, $section_id, 'ASC', 'sortorder', NULL, NULL, sprintf("AND (type IN ('%s'))", implode("', '", $this->supported_upload_fields)));
if (empty($fields)) {
$errors['related_field_id'] = __('There is no upload field in this section. You have to save the section with an upload field before you can add an image cropper field.');
} else {
// check if a related field has been selected
if ($this->get('related_field_id') == '') {
$errors['related_field_id'] = __('This is a required field.');
}
}
// check if ratios content is well formed
if ($this->get('ratios')) {
$ratios = explode(',', $this->get('ratios'));
$ratios = array_map('trim', $ratios);
foreach ($ratios as $ratio) {
if (!preg_match('/^(\\d+\\/\\d+|0)$/', $ratio)) {
$errors['ratios'] = __('Ratios have to be well formed.');
}
}
}
// check if min fields are integers
$min_fields = array('min_width', 'min_height');
foreach ($min_fields as $field) {
$i = $this->get($field);
if ($i != '' && !preg_match('/^\\d+$/', $i)) {
$errors[$field] = __('This has to be an integer.');
}
}
return parent::checkFields($errors, $checkForDuplicates);
}
示例14: checkFields
public function checkFields(&$errors, $checkForDuplicates = true)
{
$expression = trim($this->get('filter_publish'));
if ($expression) {
$r = $this->parseExpression($expression);
if (empty($r)) {
$errors['filter_publish'] = __('Invalid expression.');
}
}
return parent::checkFields($errors, $checkForDuplicates);
}
示例15: checkFields
public function checkFields(array &$errors, $checkForDuplicates = true)
{
if (!is_array($errors)) {
$errors = array();
}
if ($this->get('static_options') == '' && ($this->get('dynamic_options') == '' || $this->get('dynamic_options') == 'none')) {
$errors['dynamic_options'] = __('At least one source must be specified, dynamic or static.');
}
parent::checkFields($errors, $checkForDuplicates);
}