function get_reviews() {
$api_key = 'AIzaSyB-Q_Q-Q_Q-Q_Q-Q_Q-Q_Q-Q_Q-Q_Q';
$place_id = 'ChIJQ_Q-Q_Q-Q_Q-Q_Q-Q_Q-Q_Q-Q_Q';
$url = 'https://maps.googleapis.com/maps/api/place/details/json?placeid=' . $place_id . '&key=' . $api_key;
$json = file_get_contents($url);
$obj = json_decode($json);
$reviews = $obj->result->reviews;
$review_count = count($reviews);
$review_html = '';
for ($i = 0; $i < $review_count; $i++) {
$review_html .= '';
$review_html .= '';
$review_html .= '';
$review_html .= '' . $reviews[$i]->author_name . '';
$review_html .= '';
$review_html .= '';
$review_html .= '';
for ($j = 0; $j < $reviews[$i]->rating; $j++) {
$review_html .= '';
}
$review_html .= '';
$review_html .= '' . date('F j, Y', strtotime($reviews[$i]->time)) . '';
$review_html .= '';
$review_html .= '' . $reviews[$i]->text . '';
$review_html .= '';
}
return $review_html;
}
add_shortcode('get_reviews', 'get_reviews');
...well, it's certainly not making the WordPress community codebase worse.We wrote about ~85% of our relatively simple Wordpress plugin[1] using Copilot with no prior WP knowledge, it took maybe 2 hours at most, it's pretty decent and works well, clients are happy. Just had to write a 3-4 line comments of exactly what we wanted, it got it almost right on the first try, it was able to handle writing and reading configuration from the database as well. The only thing it struggled with was posting binary file content which is understandable.
1: https://www.faceshape.com/docs/integrations/wordpress to see the code if interested.
post_with_file() in api.php makes me squinty. There's a lot of dead code in there; unless I'm missing something, that function is only called from infer_faceshape(), and that function is passing a harcoded empty array for the second parameter, which means the foreach(...) loop in it never fires. Ditto for the $filename parameter and the conditional that handles it. I'd also raise some concern about passing $file_path directly to your post data; WP core does some upload filename sanitation, I think, but I don't recall how much or how good it is (or isn't), and anyone that can reach your post_with_file() function might be able to post arbitrary data to your API endpoint (but maybe your API is robust enough that that's not a big deal). WP core has some functions for handling file uploads and filename sanitation that might be helpful here, e.g.: https://developer.wordpress.org/reference/functions/media_ha...
If your plugin is only storing an API key and another setting or two, the best practice is to use WP's options API instead of creating your own table: https://codex.wordpress.org/Options_API
Overall though, Copilot produced some code that's pretty darn standard for the WP community, and knocking it out in 2 hours starting from scratch is way more efficient than I could (or would want to) knucklebust it myself. Cool!
It's outrageously cheap.
Wordpress plugins are insanely expensive, yet businesses will not hesitate to install dozens of them. $8 / month is a rounding error for most web agencies developing WordPress websites.
People would pay $49 a month for that crap.
And for more advanced stuff, you already have co-pilot, if you wanted something similar.
I wonder if that's how this product got started - "most Wordpress plugin code are simple loops that get and do something on data" - and the only missing piece was to build a English language parser that takes that instruction and converts it into Wordpress PHP code that implements that request.
Still an interesting piece of software.
Is't it quite ironic, that somehow this product statement is sneering on the exact kind of people ("expensive developers") that are required to build the product itself?
I'm not very familiar with current AI “copilots” performance, and I'm more thinking in term of the "ideal" code generator (= good output)
It may seem like a stretch, but I’m one of those who dislike coding everything A-Z while still acquiescing to editing (good) code and enjoing integrating it.
Imagine having that as a selling point lol.
So this AI is entirely trained on GPL code?
Wouldn't that make it a derivative work subject to GPL licensing?