prefix.'abrc_'; return array( 'url_base'=>admin_url('admin.php').'?page=abra-calendary-lesson', 'name'=>$prefix.$table, 'name_settings'=>$prefix.$table_settings, 'prefix'=>$prefix, 'pg_limit'=>60, 'total_schedules'=>$total_schedules, 'charset_collate'=>$wpdb->get_charset_collate(), 'fields'=>[ 'name'=>[ 'label' => 'Nome', 'format' => '%s', 'class' => '', 'required'=> true, 'type' => 'text', 'cleared' => false ], 'worktime'=>[ 'label' => 'Carga horária', 'format' => '%s', 'class' => 'abrac-input-time', 'type' => 'text', 'required'=> true, 'cleared' => false ], 'date_init'=>[ 'label' => 'Data início', 'format' => '%s', 'class' => 'abrac-input-date', 'type' => '', 'required'=> true, 'cleared' => true ], 'date_end'=>[ 'label' => 'Data Final', 'format' => '%s', 'class' => 'abrac-input-date', 'type' => '', 'required'=> true, 'cleared' => true ], 'day_label'=>[ 'label' => 'Dias da semana', 'format' => '%s', 'class' => '', 'required'=> true, 'type' => 'text', 'cleared' => true ], 'period'=>[ 'label' => 'Período', 'format' => '%s', 'class' => 'input-number', 'type' => 'select', 'label_values'=>['matutino','vespertino','noturno'], 'values' =>['matutino','vespertino','noturno'], 'required'=> true, 'cleared' => true ], 'hour_init'=>[ 'label' => 'Horário inicial', 'format' => '%s', 'class' => 'abrac-input-hour', 'type' => 'text', 'required'=> true, 'cleared' => false ], 'hour_end'=>[ 'label' => 'Horário final', 'format' => '%s', 'class' => 'abrac-input-hour', 'type' => 'text', 'required'=> true, 'cleared' => false ], 'amount'=>[ 'label' => 'Valor', 'format' => '%f', 'class' => 'abrac-input-money', 'required'=> true, 'type' => 'text', 'cleared' => true ], 'installments'=>[ 'label' => 'Parcelas', 'format' => '%i', 'class' => '', 'type' =>'select', 'label_values'=>[ '1 parcela', '2 parcelas', '3 parcelas', '4 parcelas', '5 parcelas', '6 parcelas', '7 parcelas', '8 parcelas', '9 parcelas', '10 parcelas', '11 parcelas', '12 parcelas' ], 'label_values_resume'=>[ '', '2x', '3x', '4x', '5x', '6x', '7x', '8x', '9x', '10x', '11x', '12x' ], 'values' =>[1,2,3,4,5,6,7,8,9,10,11,12], 'required'=> true, 'cleared' => true ], 'doc_amount'=>[ 'label' => 'Valor Apostila', 'format' => '%f', 'class' => 'abrac-input-money', 'required'=> true, 'type' => 'text', 'cleared' => true ], 'class'=>[ 'label' => 'Sala', 'format' => '%s', 'class' => '', 'required'=> true, 'type' => 'text', 'cleared' => true ], 'code'=>[ 'label' => 'Código', 'format' => '%s', 'class' => '', 'required'=> true, 'type' => 'text', 'cleared' => true ], 'students'=>[ 'label' => 'Alunos', 'format' => '%i', 'class' => 'input-number', 'type' => 'number', 'required'=> true, 'cleared' => true ], 'teacher'=>[ 'label' => 'Professor', 'format' => '%s', 'class' => '', 'type' => 'text', 'required'=> true, 'cleared' => true ], 'category'=>[ 'label' => 'Categoria', 'format' => '%s', 'class' => '', 'required'=> true, 'type' => 'select', 'label_values' => ['Módulos DI - 1º Ano','Módulos DI - 2º Ano','Cursos Livres'], 'values' => ['Módulos DI - 1º Ano','Módulos DI - 2º Ano','Cursos Livres'], 'cleared' => true ], 'status'=>[ 'label' => 'Status', 'format' => '%s', 'class' => '', 'required'=> true, 'type' => 'select', 'label_values' => ['Confirmado','Pendente','Cancelado','Prorrogado'], 'values' => ['confirmado','pendente','cancelado','prorrogado'], 'cleared' => true ], 'type'=>[ 'label' => 'Tipo do curso', 'format' => '%s', 'class' => '', 'required'=> true, 'type' => 'select', 'type' => 'select', 'label_values' => ['Curso Padrão', 'Curso de Férias'], 'values' => ['Curso padrão', 'Curso de férias'], 'cleared' => false ], 'observation'=>[ 'label' => 'Observação', 'format' => '%s', 'class' => '', 'type' => 'textarea', 'required'=> false, 'cleared' => true ], ], 'settings'=>[ 'label_1'=>[ 'label' => 'Aba Férias de janeiro', 'format' => '%s', 'class' => '', 'type' => '', 'required'=> true, 'cleared' => true ], 'label_2'=>[ 'label' => 'Aba 1º Semestre', 'format' => '%s', 'class' => '', 'type' => '', 'required'=> true, 'cleared' => true ], 'label_3'=>[ 'label' => 'Aba Férias de julho', 'format' => '%s', 'class' => '', 'type' => '', 'required'=> true, 'cleared' => true ], 'label_4'=>[ 'label' => 'Aba 2º Semestre', 'format' => '%s', 'class' => '', 'type' => '', 'required'=> true, 'cleared' => true ], 'day_vacation_1_init'=>[ 'label' => 'Data início das férias do 1 semestre', 'format' => '%s', 'class' => 'abrac-input-month-day', 'type' => '', 'required'=> true, 'cleared' => true ], 'day_vacation_1_end'=>[ 'label' => 'Data final das férias do 1 semestre', 'format' => '%s', 'class' => 'abrac-input-month-day', 'type' => '', 'required'=> true, 'cleared' => true ], 'day_semester_1_init'=>[ 'label' => 'Data início do primeiro semestre', 'format' => '%s', 'class' => 'abrac-input-month-day', 'type' => '', 'required'=> true, 'cleared' => true ], 'day_semester_1_end'=>[ 'label' => 'Data Final do primeiro semestre', 'format' => '%s', 'class' => 'abrac-input-month-day', 'type' => '', 'required'=> true, 'cleared' => true ], 'day_semester_2_init'=>[ 'label' => 'Data início do segundo semestre', 'format' => '%s', 'class' => 'abrac-input-month-day', 'type' => '', 'required'=> true, 'cleared' => true ], 'day_semester_2_end'=>[ 'label' => 'Data Final do segundo semestre', 'format' => '%s', 'class' => 'abrac-input-month-day', 'type' => '', 'required'=> true, 'cleared' => true ], 'day_vacation_2_init'=>[ 'label' => 'Data início das férias do 2 semestre', 'format' => '%s', 'class' => 'abrac-input-month-day', 'type' => '', 'required'=> true, 'cleared' => true ], 'day_vacation_2_end'=>[ 'label' => 'Data final das férias do 2 semestre', 'format' => '%s', 'class' => 'abrac-input-month-day', 'type' => '', 'required'=> true, 'cleared' => true ], ] ); } public function url_create(){ $url_base = self::props()['url_base']; return $url_base; } public function url_edit($id){ $url_edit = self::props()['url_base'].'&action=edit&sch='.$id; return $url_edit; } public function url_del($id){ $url_del = self::props()['url_base'].'&action=del&sch='.$id; return $url_del; } public function table_exist($name){ global $wpdb; $table_name = $wpdb->prefix.'abrc_'.$name; if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name) { return true; } return false; } public function db_create(){ global $wpdb; $props = self::props(); $table = $props['name']; $chrset = $props['charset_collate']; $sql = "CREATE TABLE $table ( id BIGINT(20) NOT NULL AUTO_INCREMENT, name VARCHAR(240), worktime VARCHAR(5) NOT NULL DEFAULT '00:00', date_init TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, date_end TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, day_label VARCHAR(120) NOT NULL DEFAULT 'segunda', period VARCHAR(40) NOT NULL, hour_init VARCHAR(5) NOT NULL DEFAULT '00:00', hour_end VARCHAR(5) NOT NULL DEFAULT '00:00', amount DECIMAL(15, 2) NOT NULL DEFAULT 0, doc_amount DECIMAL(15, 2) NOT NULL DEFAULT 0, installments INT NOT NULL DEFAULT 1, class VARCHAR(240), code VARCHAR(480), type VARCHAR(60) NOT NULL DEFAULT 'Curso padrão', students INT, teacher VARCHAR(480), category VARCHAR(60) NOT NULL DEFAULT 'Todos os Cursos', observation VARCHAR(620), status VARCHAR(30) NOT NULL DEFAULT 'pendente', created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, update_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE now(), UNIQUE KEY id (id) ) $chrset;"; require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); dbDelta( $sql ); } public function db_create_settings(){ global $wpdb; $props = self::props(); $table = $props['name_settings']; $chrset = $props['charset_collate']; $sql = "CREATE TABLE $table ( id BIGINT(20) NOT NULL AUTO_INCREMENT, label_1 VARCHAR(120) NOT NULL DEFAULT '', label_2 VARCHAR(120) NOT NULL DEFAULT '', label_3 VARCHAR(120) NOT NULL DEFAULT '', label_4 VARCHAR(120) NOT NULL DEFAULT '', day_semester_1_init VARCHAR(5) NOT NULL DEFAULT '01-01', day_semester_1_end VARCHAR(5) NOT NULL DEFAULT '06-30', day_semester_2_init VARCHAR(5) NOT NULL DEFAULT '07-01', day_semester_2_end VARCHAR(5) NOT NULL DEFAULT '12-30', day_vacation_1_init VARCHAR(5) NOT NULL DEFAULT '01-01', day_vacation_1_end VARCHAR(5) NOT NULL DEFAULT '01-30', day_vacation_2_init VARCHAR(5) NOT NULL DEFAULT '07-01', day_vacation_2_end VARCHAR(5) NOT NULL DEFAULT '07-30', created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, update_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE now(), UNIQUE KEY id (id) ) $chrset;"; require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); dbDelta( $sql ); ABRACALENDARY::createSettings(); } public function scripts() { wp_enqueue_script('custom_abra_calendary_script',plugins_url('dist/abra-calendary.js?c='.rand(0,999), __FILE__ ), array('jquery')); } public function styles(){ global $post; if(get_page_template_slug($post) == 'abra-calendary-page-template.php'){ wp_register_style( 'custom-styles', plugins_url('/dist/abra-calendary.css?c='.rand(0,99999), __FILE__) ); wp_enqueue_style( 'custom-styles' ); } } public function db_init(){ if(!self::table_exist('calendary_settings')){ self::db_create_settings(); } if(!self::table_exist('calendary')){ self::db_create(); } } function mask($type, $value){ switch ($type) { case 'date': $datetime = explode(' ', $value); $date = explode('-', $datetime[0]); $value = $date[2].'/'.$date[1].'/'.$date[0]; break; case 'date_resume': $datetime = explode(' ', $value); $date = explode('-', $datetime[0]); $value = $date[2].'/'.$date[1].'/'.$date[0]; break; case 'ddmm': $datetime = explode(' ', $value); $date = explode('-', $datetime[0]); $value = $date[1].'/'.$date[0]; break; case 'money': $value = 'R$' . number_format($value, 2, ',', '.'); break; case 'money_resume': $value = number_format($value, 2, ',', '.'); break; case 'time': $value = explode(':', $value)[0]; break; default: $value = $value; break; } return $value; } public function formatMoney($val) { $value = str_replace('R$', '', $val); $value = str_replace('.', '', $value); $value = str_replace(',', '.', $value); if(preg_match('/^[0-9]+(?:\.[0-9]{0,2})?$/', $value)){ return $value; } return false; } public function dateFormat($date){ $date = explode('/', $date); $dd = $date[0]; $mm = $date[1]; $yyyy = $date[2]; if($dd <= 31 && $mm <=12 && $yyyy >=1000 && $yyyy <= 3000){ return $yyyy.'-'.$mm.'-'.$dd.' 00:00:00'; } return false; } public function dayFormat($date){ $date = explode('/', $date); $dd = $date[0]; $mm = $date[1]; $yyyy = $date[2]; if($dd <= 31 && $mm <=12){ return $mm.'-'.$dd; } return false; } public static function format_fields($data){ $fields = [ 'name' => $data['name'], 'worktime' => $data['worktime'], 'date_init' => self::dateFormat($data['date_init']), 'date_end' => self::dateFormat($data['date_end']), 'hour_init' => $data['hour_init'], 'hour_end' => $data['hour_end'], 'day_label' => $data['day_label'], 'period' => $data['period'], 'doc_amount' => self::formatMoney($data['doc_amount']), 'amount' => self::formatMoney($data['amount']), 'installments' => $data['installments'], 'class' => $data['class'], 'code' => $data['code'], 'students' => $data['students'], 'teacher' => $data['teacher'], 'category' => $data['category'], 'observation' => $data['observation'], 'type' => $data['type'], 'status' => $data['status'] ]; return $fields; } public static function format_fields_settings($data){ $fields = [ 'label_1'=>$data['label_1'], 'label_2'=>$data['label_2'], 'label_3'=>$data['label_3'], 'label_4'=>$data['label_4'], 'day_semester_1_init' => self::dayFormat($data['day_semester_1_init']), 'day_semester_1_end' => self::dayFormat($data['day_semester_1_end']), 'day_semester_2_init' => self::dayFormat($data['day_semester_2_init']), 'day_semester_2_end' => self::dayFormat($data['day_semester_2_end']), 'day_vacation_1_init' => self::dayFormat($data['day_vacation_1_init']), 'day_vacation_1_end' => self::dayFormat($data['day_vacation_1_end']), 'day_vacation_2_init' => self::dayFormat($data['day_vacation_2_init']), 'day_vacation_2_end' => self::dayFormat($data['day_vacation_2_end']) ]; return $fields; } public function pagination($current_pg, $total_schedules = false) { $total_schedules = $total_schedules ? $total_schedules : count(ABRACALENDARY::all()); $page_links = paginate_links( array( 'base' => add_query_arg( 'pg', '%#%' ), 'format' => '', 'prev_text' => __( '«', 'text-domain' ), 'next_text' => __( '»', 'text-domain' ), 'total' => $total_schedules/self::props()['pg_limit'], 'current' => $_GET['pg'] )); echo '
' . $page_links . '
'; } public function get_years($year = 2000){ $first_year = $year; $current_year = date('Y'); $qnt_years = $current_year - $first_year; $years = []; for($i = 0; $i <= $qnt_years+1; $i++) { $years[] = $first_year+$i; } return $years; } public function all($request = false){ global $wpdb; $table = self::props()['name']; $pg_limit = self::props()['pg_limit']; if($request){ $query = ''; if($request['where']){ $query .='WHERE '.$request['where'].' '; } if($request['orderBy']){ $query .='ORDER BY '.$request['orderBy'].' '; } if($request['order']){ $query .= $request['order'] ? $request['order'] : 'DESC'; } // query complete if($request['orderBy'] == 'period'){ $query.=', day_init ASC'; } else if($request['orderBy'] == 'amount'){ $query.=', installments ASC'; } if($request['pg']){ $pg = $request['pg']; $pg = $pg * $pg_limit; $pg = $pg - $pg_limit; $query.=' LIMIT '.$pg.','.$pg_limit; } $results = $wpdb->get_results( "SELECT * FROM {$table} ".$query); if($request['filter']){ } } else { $results = $wpdb->get_results( "SELECT * FROM {$table}"); } return $results; } public function periods($years, $request = false){ $settings = ABRACALENDARY::getSettings(); $periods = [ 'periods'=> [ ], 'total'=>[ ], 'batata'=>[] ]; foreach ($years as $key => $year) { // semester date $first_date_S1 = '"'.$year.'-'.$settings->day_semester_1_init.' 00:00:00"'; $last_date_S1 = '"'.$year.'-'.$settings->day_semester_1_end.' 23:59:59"'; $first_date_S1V = '"'.$year.'-'.$settings->day_vacation_1_init.' 00:00:00"'; $last_date_S1V = '"'.$year.'-'.$settings->day_vacation_1_end.' 23:59:59"'; $first_date_S2 = '"'.$year.'-'.$settings->day_semester_2_init.' 00:00:00"'; $last_date_S2 = '"'.$year.'-'.$settings->day_semester_2_end.' 23:59:59"'; $first_date_S2V = '"'.$year.'-'.$settings->day_vacation_2_init.' 00:00:00"'; $last_date_S2V = '"'.$year.'-'.$settings->day_vacation_2_end.' 23:59:59"'; $filter = ''; // searh query if($request['search'] && $request['search'] != ''){ if(current_user_can('edit_post')){ $filter .= 'CONCAT(name,worktime,day_label,date_init,date_end,hour_init,hour_end,amount,doc_amount,period,installments,class,code,students,teacher, status)'; } else { $filter .= 'CONCAT(name,worktime,day_label,date_init,date_end,hour_init,hour_end,amount,doc_amount,period,installments,class,status)'; } $filter.=' LIKE "%'.$request['search'].'%"'; if($request['filter'] != 'all'){ $filter.=' AND '; } } if($request['filter'] != 'all'){ $filter .= $request['filter'] ? 'category="'.$request['filter'].'" AND ' : ''; } $whereS1 = $filter.' type = "Curso padrão" AND date_init >='.$first_date_S1.' AND date_init <='.$last_date_S1; $whereS2 = $filter.' type = "Curso padrão" AND date_end >='.$first_date_S2; $whereS1Vacations = $filter.' type = "Curso de férias" AND date_init >='.$first_date_S1V.' AND date_init <='.$last_date_S1V.' AND date_end <='.$last_date_S1V; $whereS2Vacations = $filter.' type = "Curso de férias" AND date_init >='.$first_date_S2V.' AND date_init <='.$last_date_S2V.' AND date_end <='.$last_date_S2V; $request = $request; $requestS1 = array_merge($request, ['where'=>$whereS1Vacations]); $requestS2 = array_merge($request, ['where'=>$whereS1]); $requestS3 = array_merge($request, ['where'=>$whereS2Vacations]); $requestS4 = array_merge($request, ['where'=>$whereS2]); $schedulesS1 = ABRACALENDARY::all($requestS1); $schedulesS2 = ABRACALENDARY::all($requestS2); $schedulesS3 = ABRACALENDARY::all($requestS3); $schedulesS4 = ABRACALENDARY::all($requestS4); $total_schedules_1 = count(ABRACALENDARY::all(['where'=>$whereS1Vacations])); $total_schedules_2 = count(ABRACALENDARY::all(['where'=>$whereS1])); $total_schedules_3 = count(ABRACALENDARY::all(['where'=>$whereS2Vacations])); $total_schedules_4 = count(ABRACALENDARY::all(['where'=>$whereS2])); $periods['batata'][0] = $whereS1Vacations; // filtra resultados atraves do ano if(!empty($schedulesS4)){ $schedulesS4Filter = []; foreach ($schedulesS4 as $key => $sch) { $year_sch = explode('-',$sch->date_init)[0]; if($year_sch <= $year){ $schedulesS4Filter[] = $sch; } else { $total_schedules_2--; } } $schedulesS4 = $schedulesS4Filter; } $periods['periods'][$year]['semester_1'] = $schedulesS1; $periods['periods'][$year]['semester_2'] = $schedulesS2; $periods['periods'][$year]['semester_3'] = $schedulesS3; $periods['periods'][$year]['semester_4'] = $schedulesS4; $periods['total'][$key][0] = $total_schedules_1; $periods['total'][$key][1] = $total_schedules_2; $periods['total'][$key][2] = $total_schedules_3; $periods['total'][$key][3] = $total_schedules_4; } return $periods; } public static function createSettings(){ global $wpdb; $table = self::props()['name_settings']; $wpdb->insert($table,[ 'id'=>1 ]); // use default values return self::find_settings('id', $wpdb->insert_id); } public static function getSettings(){ global $wpdb; $table = self::props()['name_settings']; $results = $wpdb->get_results( "SELECT * FROM {$table}"); return $results[0]; } public static function updateSettings($data_fields, $id){ global $wpdb; $table = self::props()['name_settings']; $fields = self::props()['settings']; $data = []; $format = []; foreach ($fields as $key => $field) { $data[$key] = $data_fields[$key]; $format[] = $field['format']; } $wpdb->update( $table, $data, array( 'id' => $id)); return self::find_settings('id', $wpdb->insert_id); } public static function create($data){ global $wpdb; $table = self::props()['name']; $wpdb->insert($table, $data); return self::find('id', $wpdb->insert_id); } public static function update($data_fields, $id){ global $wpdb; $table = self::props()['name']; $fields = self::props()['fields']; $data = []; $format = []; foreach ($fields as $key => $field) { $data[$key] = $data_fields[$key]; $format[] = $field['format']; } $wpdb->update( $table, $data, array( 'id' => $id)); return self::find('id', $wpdb->insert_id); } public static function delete($id){ global $wpdb; $table = self::props()['name']; $wpdb->delete($table, ['ID'=>$id]); return self::find('id', $wpdb->insert_id); } public static function updateObservation($id, $observation){ global $wpdb; $table = self::props()['name']; $wpdb->update($table, ['observation'=>$observation], array( 'id' => $id)); return self::find('id', $id); } public static function find($prop, $value){ global $wpdb; $table = self::props()['name']; $results = $wpdb->get_results( "SELECT * FROM {$table} WHERE {$prop} = {$value}"); if($prop == 'id'){ return $results[0]; } return $results; } public static function find_settings($prop, $value){ global $wpdb; $table = self::props()['name_settings']; $results = $wpdb->get_results( "SELECT * FROM {$table} WHERE {$prop} = {$value}"); if($prop == 'id'){ return $results[0]; } return $results; } public function abrac_form_input($event) { $form_required_input = ''; $form_required_input .= ''; echo $form_required_input; } public function admin_page_schedules(){ require_once(ABRACALENDARY__PLUGIN_DIR.'admin/index.php'); } public function admin_page_settings(){ require_once(ABRACALENDARY__PLUGIN_DIR.'admin/settings.php'); } public function setup_menu(){ add_menu_page( 'ABRA Calendário de Turmas', 'ABRA Calendário', 'edit_posts', 'abra-calendary-lesson', array('ABRACALENDARY','admin_page_schedules')); add_submenu_page('abra-calendary-lesson', 'schedules','turmas', 'edit_posts', 'abra-calendary-lesson-schedules', array('ABRACALENDARY','admin_page_schedules')); add_submenu_page('abra-calendary-lesson', 'configuracoes','configurações', 'edit_posts', 'abra-calendary-lesson-settings', array('ABRACALENDARY','admin_page_settings')); } public function shortcode($attrs = []){ if(is_user_logged_in()){ include(ABRACALENDARY__PLUGIN_DIR.'public/calendary.php'); } else { include(ABRACALENDARY__PLUGIN_DIR.'public/login.php'); } } public function request_post(){ $ACTION = isset($_POST['abra-calendary-action']) ? $_POST['abra-calendary-action'] : false; $EVENT = isset($_POST['abra-calendary-event']) && $_POST['abra-calendary-event'] ? $_POST['abra-calendary-event'] : false; if($ACTION && $EVENT){ if($EVENT == 'update-settings'){ $data = self::format_fields_settings($_POST); } else { $data = self::format_fields($_POST); } $result = false; switch ($EVENT) { case 'update-settings': $result = self::updateSettings($data, $_POST['id']); break; case 'add-schedule': $result = self::create($data); break; case 'edit-schedule': $result = self::update($data, $_POST['id']); break; case 'delete-schedule': $result = self::delete($_POST['id']); break; case 'edit-observation': $result = self::updateObservation($_POST['sch_id'], $_POST['observation']); break; default: break; } if($EVENT == 'update-settings'){ wp_redirect(admin_url('admin.php' ).'?page=abra-calendary-lesson-settings'); } else { wp_redirect(admin_url('admin.php' ).'?page=abra-calendary-lesson'); } } } // ajax request public function abrac_action_ajx(){ $user = wp_get_current_user(); $result = false; $ACTION = isset($_POST['abra-calendary-action']) ? $_POST['abra-calendary-action'] : false; $EVENT = isset($_POST['abra-calendary-event']) && $_POST['abra-calendary-event'] ? $_POST['abra-calendary-event'] : false; if($user->allcaps['edit_posts'] == 1 && $EVENT == 'edit-observation'){ $result = self::updateObservation($_POST['sch_id'], $_POST['observation']); } wp_send_json($result); } } Desde 1987 Revelando Talentos - Academia Brasileira de Arte -