Ejemplo n.º 1
0
 /**
  * Validate some form fields input via Hooks
  * 
  * @since 1.0.0
  * @access public
  * @param array $fields 
  * @return json
  */
 public function validate_fields($fields)
 {
     $validator = new TF_Validator($fields, apply_filters('tf_form_validate_theme_field_rules', array('tf_theme_name' => array('rule' => 'notEmpty', 'error_msg' => __('You must enter the theme name', 'themify-flow')), 'tf_theme_description' => array('rule' => 'notEmpty', 'error_msg' => __('You must enter the theme description', 'themify-flow')), 'tf_theme_author' => array('rule' => 'notEmpty', 'error_msg' => __('You must enter the author name', 'themify-flow')))));
     if ($validator->fails()) {
         wp_send_json_error($validator->get_error_messages());
     }
 }
 /**
  * Validate some form fields input
  * 
  * @since 1.0.0
  * @access public
  * @param array $fields 
  * @return json
  */
 public function validate_fields($fields)
 {
     $validator = new TF_Validator($fields, apply_filters('tf_form_validate_template_field_rules', array('tf_template_name' => array('rule' => 'notEmpty', 'error_msg' => __('You should enter the template name', 'themify-flow')))));
     if ($validator->fails()) {
         wp_send_json_error($validator->get_error_messages());
     }
 }
 /**
  * Validate Template Part form.
  * 
  * @since 1.0.0
  * @access public
  * @param array $fields 
  * @return json
  */
 public function validate_region_fields($fields)
 {
     $validator = new TF_Validator($fields, apply_filters('tf_builder_form_validate_region_template_part_field_rules', array('tf_template_part_shortcode' => array('rule' => 'notEmpty', 'error_msg' => __('You should select template part', 'themify-flow')))));
     if ($validator->fails()) {
         wp_send_json_error($validator->get_error_messages());
     }
 }