1 | <?php |
||
20 | class ConnectionTest{ |
||
21 | |||
22 | /** |
||
23 | * Run all of our connection tests. |
||
24 | * |
||
25 | * @see check_admin_page, check_airplane_mode, check_internet, check_splashbase |
||
26 | * |
||
27 | * @return boolean Status of connection to Internet/Splashbase. |
||
28 | */ |
||
29 | public function test(){ |
||
63 | |||
64 | |||
65 | /** |
||
66 | * Check to make sure that we're only running this check in the correct place. |
||
67 | * |
||
68 | * We only want these (relatively)expensive checks to run on a single admin |
||
69 | * page, so we need to run some checks first and verify that we're on the |
||
70 | * right screen. |
||
71 | * |
||
72 | * @access private |
||
73 | * |
||
74 | * @global object $current_screen Current admin screen info. |
||
75 | * |
||
76 | * @return boolean Whether or not we're in the right place. |
||
77 | */ |
||
78 | private function check_admin_page(){ |
||
100 | |||
101 | |||
102 | /** |
||
103 | * Check if we have Airplane Mode and if it's turned on or not. |
||
104 | * |
||
105 | * @access private |
||
106 | * |
||
107 | * @see get_site_option |
||
108 | * |
||
109 | * @return boolean Connected or not. |
||
110 | */ |
||
111 | private function check_airplane_mode(){ |
||
125 | |||
126 | |||
127 | /** |
||
128 | * Attempt to open a socket to a popular, compact to check overall connectivity. |
||
129 | * |
||
130 | * @access private |
||
131 | * |
||
132 | * @see fsockopen, fsockclose |
||
133 | * |
||
134 | * @return boolean Connected or not. |
||
135 | */ |
||
136 | private function check_internet(){ |
||
151 | |||
152 | |||
153 | /** |
||
154 | * Check an external API to see if it's reachable or not. |
||
155 | * |
||
156 | * @access private |
||
157 | * |
||
158 | * @see wp_remote_get |
||
159 | * |
||
160 | * @param string $url External URL to attempt to reach. |
||
161 | * @return boolean Connected or not. |
||
162 | */ |
||
163 | private function check_external_url( $url ){ |
||
175 | |||
176 | } |
||
177 |