For better or for worse, many WAI-ARIA patterns depend on ID's to connect elements together.
For example (without ARIA):
<label for="first-name">First Name</label>
<input id="first-name"/>
<?php | |
/** | |
* Place this file in the wp-content/mu-plugins directory and run ngrok with | |
* `ngrok http http://<local_url> --host-header=<local_url>` | |
*/ | |
$ngrok_url = '<id>.ngrok.io'; | |
define( 'WP_HOME', 'http://' . $ngrok_url ); | |
define( 'WP_SITEURL', 'http://' . $ngrok_url ); |
We want to upload file to a server with POST HTTP request. We will use curl functions.
// data fields for POST request
$fields = array("f1"=>"value1", "another_field2"=>"anothervalue");
// files to upload
$filenames = array("/tmp/1.jpg", "/tmp/2.png");
<?php | |
$local_file = 'file_path'; //path to a local file on your server | |
$post_fields = array( | |
'name' => 'value', | |
); | |
$boundary = wp_generate_password( 24 ); | |
$headers = array( | |
'content-type' => 'multipart/form-data; boundary=' . $boundary, | |
); |
/** | |
* Build multipart/form-data | |
* | |
* @param array @$data Data | |
* @param array @$files 1-D array of files where key is field name and value if file contents | |
* @param string &$contentType Retun variable for content type | |
* | |
* @return string Encoded data | |
*/ | |
function buildMultipartFormData(array &$data, array &$files, &$contentType) |