_format_css(file_get_contents(AGE_GATE_PATH . 'public/css/age-gate-public.css')); wp_die(); } public function get_text_area() { // set_transient(get_current_user_id() . ''); echo '' . wp_nonce_field('age_gate_custom_css', 'safecss', false, false); wp_die(); } public function get_stored_css() { echo stripslashes(get_transient('age_gate_css_backup')); wp_die(); } public function regenerate_serial() { $serial = abs( 2147483648 + mt_rand( -2147482448, 2147483647 ) * mt_rand( -2147482448, 2147483647 ) ); update_option('age_gate_serial', $serial); if($serial){ $message = __('Updated successfully.', 'age-gate'); if ($this->settings['advanced']['use_js']) { $message .= ' '; $message .= __('You are using the JavaScript implementation of Age Gate, if you have caching enabled ensure you purge it to see your changes.', 'age-gate'); } } else { $message = __('Could not update. ', 'age-gate'); } header("Content-type:application/json"); echo json_encode(['serial' => $serial, 'message' => $message]); wp_die(); } private function _format_css($css) { $css = str_replace('{', " {\r\n\t", $css); $css = str_replace('}', "\r\n}\r\n", $css); $css = str_replace(':', ": ", $css); $css = str_replace(';', ";\r\n\t", $css); return $css; } }