本文整理汇总了PHP中validation::getMessageErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP validation::getMessageErrors方法的具体用法?PHP validation::getMessageErrors怎么用?PHP validation::getMessageErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类validation
的用法示例。
在下文中一共展示了validation::getMessageErrors方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validation
}
}
if (isset($_POST['remove'])) {
if (isset($_POST['id']) && !empty($_POST['id'])) {
$v1 = new validation();
$rules = array();
$v1->addSource($_POST['id']);
for ($i = 0; $i < count($_POST['id']); ++$i) {
$rules[] = array('type' => 'numeric', "required" => true, 'min' => '0', 'max' => '10000', 'trim' => true);
}
$v1->AddRules($rules);
$v1->run();
foreach ($v1->sanitized as $id) {
if ($managerCourse->hasActivities($id)) {
$v1->errors['HasLesson'] = $tr->__('The course you want to remove is attached to one or more lessons. Please, first delete these lessons');
break;
}
}
if (sizeof($v1->errors) > 0) {
$error_course_remove = $v1->getMessageErrors();
} else {
foreach ($v1->sanitized as $id) {
$managerCourse->delete($id);
}
}
} else {
$error_course_remove = $tr->__("Please select the fields to delete");
}
}
}
require_once __ROOT_PLUGIN__ . "Views/admin/course.view.php";
示例2: StudyPressUserWP
$v->addRule('courseId', 'numeric', true, 1, 99999, true);
} else {
$v->errors['courseId'] = $tr->__("You must create a course");
}
$v->run();
if (sizeof($v->errors) > 0) {
$error_quiz_add = $v->getMessageErrors();
} else {
$currentUser = new StudyPressUserWP();
$id_quiz = $managerQuiz->add(new Quiz(array('pictureUrl' => isset($v->sanitized['pictureurl']) ? $v->sanitized['pictureurl'] : '', 'name' => $v->sanitized['name'], 'author' => $currentUser->displayName(), 'authorId' => $currentUser->id(), 'courseId' => $v->sanitized['courseId'])));
}
}
}
if (isset($_POST['remove'])) {
if (isset($_POST['id']) && !empty($_POST['id'])) {
$v = new validation();
$v->addSource($_POST['id']);
foreach ($_POST['id'] as $key => $value) {
$v->addRule($key, 'numeric', true, 1, 9999999, true);
}
$v->run();
if (sizeof($v->errors) > 0) {
$error_quiz_remove = $v->getMessageErrors();
} else {
foreach ($v->sanitized as $value) {
$managerQuiz->delete($value);
}
}
}
}
require_once __ROOT_PLUGIN__ . "Views/admin/quiz.view.php";
示例3: DomainManager
if (!defined('ABSPATH')) {
exit;
}
global $tr;
$managerDomain = new DomainManager();
$error_domain_add = "";
$error_domain_remove = "";
if (isset($_POST)) {
$validation = new validation();
}
if (isset($_POST['add'])) {
$validation->addSource($_POST);
$validation->AddRules(array('name' => array('type' => 'string', "required" => true, 'min' => '1', 'max' => '200', 'trim' => true), 'desc' => array('type' => 'string', "required" => true, 'min' => '0', 'max' => '999999', 'trim' => true)));
$validation->run();
if (sizeof($validation->errors) > 0) {
$error_domain_add = $validation->getMessageErrors();
} else {
$managerDomain->add(new Domain(array('name' => $validation->sanitized['name'], 'description' => $validation->sanitized['desc'])));
if ($managerDomain->isError()) {
$error_domain_add = $tr->__("This name already exist");
}
}
}
if (isset($_POST['remove'])) {
if (isset($_POST['id']) && !empty($_POST['id'])) {
$rules = array();
$validation->addSource($_POST['id']);
for ($i = 0; $i < count($_POST['id']); ++$i) {
$rules[] = array('type' => 'numeric', "required" => true, 'min' => '0', 'max' => '10000', 'trim' => true);
}
$validation->AddRules($rules);
示例4: validation
}
}
} else {
$error_course_update = $tr->__("Please select at least one author") . "<br/>" . $tr->__("Please select at least one category") . "<br/>" . $tr->__("Please enter a valid name");
}
} else {
// if is an author
$v = new validation();
$v->addSource($_POST['course']);
$v->AddRules(array('id' => array('type' => 'numeric', "required" => true, 'min' => '1', 'max' => '999999', 'trim' => true), 'description' => array('type' => 'string', "required" => true, 'min' => '0', 'max' => '999999', 'trim' => true)));
if (isset($_POST['course']['pictureId']) && !empty($_POST['course']['pictureId'])) {
$v->addRule('pictureId', 'numeric', true, 1, 999999, true);
}
$v->run();
if (sizeof($v->errors)) {
$error_course_update = $v->getMessageErrors();
} else {
if ($course = $managerCourse->getById($v->sanitized['id'])) {
$course->setDescription($v->sanitized['description']);
if (isset($v->sanitized['pictureId'])) {
$course->setPictureId($v->sanitized['pictureId']);
}
$managerCourse->update($course->getId(), $course);
}
}
}
}
} else {
wp_die("Access denied !");
}
if ($user->isAdministrator() || in_array($user->id(), $course->getAuthors())) {
示例5: Configuration
}
}
if (isset($_POST['type']) && $_POST['type'] === "share-groups") {
if (isset($_POST['quizId']) && !empty($_POST['quizId']) && isset($_POST['groups'])) {
require_once "_AutoLoadClassAjax.php";
global $tr;
$c = new Configuration();
$c = $c->getConfig();
if ($c['bp_shareResult'] = 'true') {
$v = new validation();
$v->addSource($_POST);
$v->addRule('quizId', 'numeric', true, 1, 9999999, true);
$v->run();
if (sizeof($v->errors) > 0) {
header("HTTP/1.0 400 Bad Request");
echo $v->getMessageErrors();
} else {
$manager = new QuizManager();
$type = "quiz";
$activity = $manager->getById($v->sanitized['quizId']);
if (!$activity) {
$manager = new LessonManager();
$type = "lesson";
$activity = $manager->getById($v->sanitized['quizId']);
}
if ($activity) {
if (StudyPressUserWP::isLoggedIn()) {
$user = new StudyPressUserWP();
if ($manager->isDone($v->sanitized['quizId'], $user->id())) {
if (function_exists('bp_is_active') && bp_is_active('groups')) {
$permalink = get_permalink($activity->getPostId());
示例6: validation
}
}
}
}
/*
|---------------------------------------------------------------------
| Supression de plusieurs Leçon
|---------------------------------------------------------------------
|
|
*/
if (isset($_POST['remove'])) {
if (isset($_POST['id']) && !empty($_POST['id'])) {
$v = new validation();
$v->addSource($_POST['id']);
foreach ($_POST['id'] as $key => $value) {
$v->addRule($key, 'numeric', true, 1, 9999999, true);
}
$v->run();
if (sizeof($v->errors) > 0) {
$error_lesson_remove = $v->getMessageErrors();
} else {
foreach ($v->sanitized as $value) {
$managerLesson->delete($value);
}
}
} else {
$error_lesson_remove = $tr->__("Please select the fields to delete");
}
}
require_once __ROOT_PLUGIN__ . "Views/admin/lesson.view.php";
示例7: validation
$v->addSource($_GET);
$v->addRule('id', 'numeric', true, 1, 9999999, true);
$v->run();
if (!sizeof($v->errors) > 0) {
$quiz = $managerQuiz->getById($v->sanitized['id']);
if ($quiz) {
if (isset($_POST['update'])) {
//var_dump($_POST);
$v = new validation();
$v->addSource($_POST['quiz']);
$v->AddRules(array('id' => array('type' => 'numeric', "required" => true, 'min' => '1', 'max' => '999999', 'trim' => true), 'name' => array('type' => 'string', "required" => true, 'min' => '1', 'max' => '400', 'trim' => true), 'description' => array('type' => 'string', "required" => true, 'min' => '0', 'max' => '999999', 'trim' => true), 'duree' => array('type' => 'numeric', "required" => true, 'min' => '0', 'max' => '999999', 'trim' => true), 'pictureurl' => array('type' => 'numeric', "required" => false, 'min' => '0', 'max' => '999999', 'trim' => true), 'courseId' => array('type' => 'numeric', "required" => false, 'min' => '0', 'max' => '999999', 'trim' => true)));
$v->run();
$notes = isset($_POST['quiz']['note']) ? json_encode($_POST['quiz']['note']) : "";
$glossaires = isset($_POST['quiz']['glossary']) ? json_encode($_POST['quiz']['glossary']) : "";
if (sizeof($v->errors) > 0) {
$error_quiz_update = $v->getMessageErrors();
} else {
$currentUser = new StudyPressUserWP();
if ($managerCourse->getCoursesByAuthor($currentUser->id())) {
$quiz = $managerQuiz->getById($v->sanitized['id']);
$quiz->setName($v->sanitized['name']);
$quiz->setCourseId($v->sanitized['courseId']);
$quiz->setDescription($v->sanitized['description']);
$quiz->setDuration($v->sanitized['duree']);
$quiz->setPictureUrl($v->sanitized['pictureurl']);
$quiz->setTags($notes);
$quiz->setGlossary($glossaires);
$managerQuiz->update($v->sanitized['id'], $quiz);
$quiz = $managerQuiz->getById($v->sanitized['id']);
}
}
示例8: validation
$v = new validation();
$v->addSource($_GET);
$v->addRule('id', 'numeric', true, 1, 9999999, true);
$v->run();
if (!sizeof($v->errors) > 0) {
$lesson = $managerLesson->getById($v->sanitized['id']);
if ($lesson) {
if (isset($_POST['update'])) {
$v = new validation();
$v->addSource($_POST['lesson']);
$v->AddRules(array('id' => array('type' => 'numeric', "required" => true, 'min' => '1', 'max' => '999999', 'trim' => true), 'name' => array('type' => 'string', "required" => true, 'min' => '1', 'max' => '400', 'trim' => true), 'description' => array('type' => 'string', "required" => true, 'min' => '0', 'max' => '999999', 'trim' => true), 'duree' => array('type' => 'numeric', "required" => true, 'min' => '0', 'max' => '999999', 'trim' => true), 'pictureurl' => array('type' => 'numeric', "required" => false, 'min' => '0', 'max' => '999999', 'trim' => true), 'courseId' => array('type' => 'numeric', "required" => false, 'min' => '0', 'max' => '999999', 'trim' => true)));
$v->run();
$notes = isset($_POST['lesson']['note']) ? json_encode($_POST['lesson']['note']) : "";
$glossaires = isset($_POST['lesson']['glossary']) ? json_encode($_POST['lesson']['glossary']) : "";
if (sizeof($v->errors) > 0) {
$error_lesson_update = $v->getMessageErrors();
} else {
$currentUser = new StudyPressUserWP();
if ($managerCourse->getCoursesByAuthor($currentUser->id())) {
$lesson = $managerLesson->getById($v->sanitized['id']);
$lesson->setName($v->sanitized['name']);
$lesson->setCourseId($v->sanitized['courseId']);
$lesson->setDescription($v->sanitized['description']);
$lesson->setDuration($v->sanitized['duree']);
$lesson->setPictureUrl($v->sanitized['pictureurl']);
$lesson->setTags($notes);
$lesson->setGlossary($glossaires);
$managerLesson->update($v->sanitized['id'], $lesson);
$lesson = $managerLesson->getById($v->sanitized['id']);
}
}