Skip to content

Instantly share code, notes, and snippets.

View bonny's full-sized avatar
🇺🇦
StandWithUkraine

Pär Thernström bonny

🇺🇦
StandWithUkraine
View GitHub Profile
@bonny
bonny / wordpress-org-forced-update-response.md
Last active January 17, 2026 13:51
WordPress.org Plugin Update API response with autoupdate=1 (forced security update) - Real example from WooCommerce 10.4.2→10.4.3

WordPress.org Plugin Update API - The autoupdate Field for Forced Security Updates

This research was conducted for Simple History, a WordPress activity log plugin. We wanted to understand exactly how WordPress handles forced security updates so we could display this information clearly to site administrators. This document shares our findings.


API endpoint: POST https://api.wordpress.org/plugins/update-check/1.1/ Date captured: January 14, 2026 Plugin: WooCommerce 10.4.2 → 10.4.3

@bonny
bonny / simple-history-options-logger.php
Last active April 11, 2025 07:54
WordPress plugin that logs when a options are modified. Create folder `/plugins/simple-history-options-logger` and add file inside folder. Then active plugin in WordPress admin.
<?php
/**
* Plugin Name: Simple History Options Logger
* Description: Logs changes to selected WordPress options in Simple History
* Version: 1.0.0
* Author: Simple History
* Text Domain: simple-history-options-logger
* Domain Path: /languages
* Requires at least: 5.0
* Requires PHP: 7.4
<?php
// phpcs:ignoreFile
namespace Simple_History\ExampleCodeSnippets;
/**
* Support thread:
* https://wordpress.org/support/topic/logging-options-table-activity/
*
* Log when any of the options in an array are updated.
@bonny
bonny / 1-simple-fields-register-field-group-small-example.php
Last active July 14, 2022 11:34
Simple Fields simple_fields_register_field_group(), simple_fields_register_post_connector(), simple_fields_register_post_type_default() examplesSee http://simple-fields.com/ for more info.
<?php
// Minimal amount of code
// to create a new field group
// with one field
simple_fields_register_field_group('attachment', array(
'name' => 'Attachment',
'fields' => array(
array(
'name' => 'File',
@bonny
bonny / watson-xbar-plugin.sh
Last active January 20, 2022 16:57
xbar script for watson
#!/usr/bin/env bash
# Watson Brew Status
#
# by Antoine Corcy <contact@sbin.dk>
# updated by Pär Thernstrom <par.thernstrom@gmail.com>
# to support Watson custom location and configuration.
#
# <xbar.title>Watson Brew Status</xbar.title>
# <xbar.version>1.0</xbar.version>
<?php //version my202
//set allowTestMenu to false to disable System/Server test page
$allowTestMenu = true;
header("Content-Type: text/plain; charset=x-user-defined");
error_reporting(0);
set_time_limit(0);
function phpversion_int()
@bonny
bonny / gist:3923633
Created October 20, 2012 15:40
Dropdown Field, Extended Return Values
Array
(
[selected_value] => Dropdown 2
[selected_option] => Array
(
[value] => Dropdown 2
[key] => dropdown_num_3
[is_selected] => 1
)
@bonny
bonny / index.html
Created June 7, 2020 19:57
TextTV.nu iframe
<p>Iframe med "vanliga" texttv.nu</p>
<iframe
src="http://texttv.nu/"
title="TextTV.nu"
width="400"
height="540">
</iframe>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bonny
bonny / simple-note-osx-app-restorer.php
Last active July 24, 2017 12:48
PHP script to list and retrieve notes from the OS X Simple Notes app. Nice to have since import/sync seems buggy in first version of the app (It deleted two months of notes for me anyway, because of a crash during import.) How to: Find the file "Simplenote.storedata.xml" that is located perhaps here or in your time machine or Arq or similar: ~/L…
<meta charset="utf-8">
<title>SimpleNote Restorer</title>
<style>
body {
font-family: sans-serif;
background-color: #f5f5f5;
color: #111;
font-size: 14px;
}
li {