public static function saveDataCommon($user_login = '******') { $response = ['status' => 0, 'message' => '']; if (isset($_POST['message']) && $_POST['message'] && check_ajax_referer('shshoutbox', 'security', false)) { $validate = SHShoutboxMessage::save($_POST['message'], $user_login); if ($validate) { $response = ['status' => 1, 'message' => SHShoutboxMessage::get('ARRAY_A')]; } else { $response['message'] = 'Something went wrong'; } wp_send_json_success($response); } }
public static function create($atts) { $data = SHShoutboxMessage::get(); extract(self::$option); $atts = shortcode_atts(['title' => 'SH shoutbox', 'color' => 'red'], $atts); $title = apply_filters('widget_title', $atts['title']); //css wp_register_style('shshoutbox_css', SH_PLUGIN_URL . 'scripts/style.css'); wp_enqueue_style('shshoutbox_css'); //script wp_register_script('shshoutbox_js', SH_PLUGIN_URL . 'scripts/function.js'); wp_localize_script('shshoutbox_js', 'shshoutbox', ['url' => admin_url('admin-ajax.php'), 'refreshRate' => self::$option['refreshRate']]); wp_enqueue_script('shshoutbox_js'); echo '<style>.shshoutbox .widget-title{color: ' . $atts['color'] . ' ! important}</style>'; require SH_PLUGIN_DIR . 'views/show_shoutbox.php'; }