Skip to content

Commit 6cd63b7

Browse files
author
James Amner
committed
Updated Licence Attribute in Plugin Comment
Tidied up some of the Output Added ReadMe Adjusted access to some class methods
1 parent a2fff08 commit 6cd63b7

5 files changed

Lines changed: 23 additions & 17 deletions

File tree

admin/class-jerc-admin.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ private function getFilteredQuery()
178178
* @global wpdb $wpdb WPDB
179179
* @return array
180180
*/
181-
public function getData($paging = true)
181+
private function getData($paging = true)
182182
{
183183

184184
$q = $this->getFilteredQuery();
@@ -195,7 +195,7 @@ public function getData($paging = true)
195195
*
196196
* @return int
197197
*/
198-
public function getCount()
198+
private function getCount()
199199
{
200200
$q = $this->getFilteredQuery();
201201

@@ -212,7 +212,7 @@ public function getCount()
212212
*
213213
* @return array
214214
*/
215-
public function getFilterKeys()
215+
private function getFilterKeys()
216216
{
217217
return array(
218218
'time_from',
@@ -233,7 +233,7 @@ public function getFilterKeys()
233233
*
234234
* @return array
235235
*/
236-
public function getFilters()
236+
private function getFilters()
237237
{
238238
$filters = array();
239239
foreach ($this->getFilterKeys() as $key) {
@@ -255,7 +255,7 @@ public function getFilters()
255255
*
256256
* @return string
257257
*/
258-
public function getFilterUrl($key, $value)
258+
private function getFilterUrl($key, $value)
259259
{
260260
$filters = $this->getFilters();
261261
$filters[$key] = $value;
@@ -272,7 +272,7 @@ public function getFilterUrl($key, $value)
272272
*
273273
* @since 1.0.0
274274
*/
275-
public function removeFilterUrl($key)
275+
private function removeFilterUrl($key)
276276
{
277277
$filters = $this->getFilters();
278278
if (isset($filters[$key])) {
@@ -324,7 +324,7 @@ public function exportCSV()
324324
*
325325
* @return void
326326
*/
327-
public function displayPagination()
327+
private function displayPagination()
328328
{
329329
$output = '<span class="displaying-num">' . sprintf(
330330
/* translators: %s: Number of items. */

admin/partials/jerc-admin-display.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@
120120
<?php endforeach; ?>
121121
<button class='button' type='submit' name='action' value='<?php echo $this->action; ?>'>Export CSV</button>
122122
</form>
123-
124123
</div>
125124
<?php $this->displayPagination(); ?>
126125
</div>

jerc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @category WP-Plugin
99
* @package Jerc
1010
* @author James Amner <jdamner@me.com>
11-
* @license GNU GPLv2 https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html
11+
* @license GNU GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
1212
* @link https://amner.me
1313
* @since 1.0.0
1414
*

public/class-jerc-public.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,23 +102,21 @@ public function handleAjax()
102102
// Using XHR for the JS, so json comes in via php://input
103103
$request = json_decode(urldecode(file_get_contents('php://input')), true);
104104
if (JSON_ERROR_NONE !== json_last_error()) {
105-
http_response_code(400);
106-
echo json_encode(
105+
wp_send_json_error(
107106
array(
108107
"error" => "Encoding Error",
109108
"message" => json_last_error_msg(),
110-
)
109+
),
110+
400
111111
);
112-
exit;
113112
}
114113
if (!wp_verify_nonce($request['nonce'], $this->plugin_name)) {
115-
http_response_code(401);
116-
echo json_encode(
114+
wp_send_json_error(
117115
array(
118116
"error" => "CSRF Error",
119-
)
117+
),
118+
401
120119
);
121-
exit;
122120
}
123121

124122
global $wpdb;

readme.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Javascript Error Reporting Client
2+
3+
This is a plugin for [WordPress](https://www.wordpress.org) that collects client-side javascript errors and stores them on the site.
4+
5+
It's useful for debugging issues that are occasional and difficult to detect based on the description of the error.
6+
7+
## Roadmap
8+
- Add something in the JS Script to handle if there's a server-side error processing the request
9+
- Next steps will be to add functionality to only collect data depending on criteria (ie. for logged-in-users only, or for specific js files or error types).

0 commit comments

Comments
 (0)