-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcaseupdates-dev.php
119 lines (98 loc) · 3.18 KB
/
caseupdates-dev.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
/*
Plugin Name: Case Updates - Development Plugin
Plugin URI: https://www.scotxblog.com
Description: Integration between wordpress site and my data backend
Version: 1.1
Author: Don Cruse
Author URI: https://texasappellate.com
License: Copyright 2019
*/
/* Shows HTML for a standard case information
block with opinion information
*/
function standard_version($atts) {
extract(shortcode_atts(array(
"docket_no" => 'empty',
"post_date" => get_the_time("Y-m-d")
), $atts));
if ( $docket_no == 'empty' ) {
return '';
}
$site = "https://data.scotxblog.com/api/standard/scotx/no/".$docket_no."?post_date=".$post_date;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $site);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
$replacement = 'src="https://static.scotxblog.com/assets/justices';
$result = preg_replace("/src=\"\/assets\/justices/", $replacement, $result);
return $result;
/* set_transient($transient, $results, 10);*/
}
add_shortcode("texapp", "standard_version");
/* Shows a version that includes the latest case summary,
if a case summary has been written
*/
function summary_version($atts) {
extract(shortcode_atts(array(
"docket_no" => 'empty',
"post_date" => get_the_time("Y-m-d")
), $atts));
if ( $docket_no == 'empty' ) {
return '';
}
$site = "https://data.scotxblog.com/api/summary/scotx/no/".$docket_no."?post_date=".$post_date;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $site);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
$replacement = 'src="https://static.scotxblog.com/assets/justices';
$result = preg_replace("/src=\"\/assets\/justices/", $replacement, $result);
return $result;
/* set_transient($transient, $results, 10);*/
}
add_shortcode("summary", "summary_version");
/* Shows just the name of the case in inline text,
along with a docket number and link to the main
data website.
*/
function texapp_text_version($atts) {
extract(shortcode_atts(array(
"docket_no" => 'empty',
"post_date" => get_the_time("Y-m-d")
), $atts));
if ( $docket_no == 'empty' ) {
return '';
}
$site = "https://data.scotxblog.com/api/text/scotx/no/".$docket_no."?post_date=".$post_date;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $site);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
return $result;
/* set_transient($transient, $results, 10);*/
}
add_shortcode("texapptext", "texapp_text_version");
/* Shows a full page of the OA sitting week.
Note: current implementation does not have images,
so that $replacement for image paths is unnecessary.
*/
function oa_sitting_week_insert($atts) {
extract(shortcode_atts(array(
"date" => 'empty'
), $atts));
if ( date == 'empty' ) {
return '';
}
$site = "https://data.scotxblog.com/api/oa_sitting/week/".$date;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $site);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
add_shortcode("oa_sitting", "oa_sitting_week_insert");