$message, 'type' => $type ], 30); } wp_safe_redirect($url); exit; } /** * Get sanitized POST data */ protected function getPostData($key, $default = '') { return isset($_POST[$key]) ? sanitize_text_field($_POST[$key]) : $default; } /** * Get sanitized GET data */ protected function getQueryData($key, $default = '') { return isset($_GET[$key]) ? sanitize_text_field($_GET[$key]) : $default; } /** * Validate data */ protected function validate(array $data) { return Validator::make($data); } /** * Render view */ protected function render($view, $data = []) { extract($data); $view_file = SODINO_PLUGIN_DIR . 'admin/views/' . $view . '.php'; if (file_exists($view_file)) { include $view_file; } else { wp_die(sprintf(__('View file not found: %s', 'sodino'), $view)); } } /** * Check user capability */ protected function checkCapability($capability = 'manage_options') { if (!current_user_can($capability)) { wp_die(__('شما دسترسی لازم برای این عملیات را ندارید.', 'sodino')); } } /** * Show admin notice */ public function showAdminNotice() { $notice = get_transient('sodino_admin_notice'); if ($notice) { $class = $notice['type'] === 'error' ? 'notice-error' : 'notice-success'; printf( '
%s