Skip to content

Instantly share code, notes, and snippets.

My notes for upgrading laragon to work with latest apache and php8.1
Update to laragon 5:
- Stop all running services in laragon
- Make sure laragon itself is properly closed
- Download the latest laragon.exe and overwrite your original laragon.exe
https://github.com/leokhoa/laragon/releases/download/5.0.0/laragon.exe
Update to latest apache
- Download the latest apache 2.4 VS16 for windows (Apache 2.4.x OpenSSL 1.1.1 VS16):
@acrosman
acrosman / FA_Signing.php
Last active April 3, 2023 06:27
A PHP function to sign dynamic parameters for FormAssembly
<?php
function prepareFormAssemblyQueryString(array $parameters, $salt, $expire_timeout) {
$parts = [];
$signString = '';
foreach($parameters as $key => $value) {
$signString .= $key . $value;
$parts[] = rawurlencode($key) . '=' . rawurlencode($value);
}
$expireTime = time() + $expire_timeout;
$signString .= 'expire' . (string)$expireTime;
@RadGH
RadGH / rs_upload_from_url.php
Last active May 26, 2024 00:08
Upload a file from a URL to the WordPress media gallery. Supports images, PDFs, and other file types.
<?php
/**
* This function uploads a file from a URL to the media library, designed to be placed in your own theme or plugin.
* Metadata will be generated and images will generate thumbnails automatically.
*
* HOW TO USE:
* 1. Add the function below to your theme or plugin
* 2. Call the function and provide the URL to an image or other file.
* 3. If successful, the attachment ID will be returned.
@squarestar
squarestar / install-wp-plugins.php
Last active April 20, 2024 08:02
Programmatically install and activate wordpress plugins
<?php
/**
* Programmatically install and activate wordpress plugins
*
* Usage:
* 1. Edit the $pluginSlugs array at the beginning of this file to include the slugs of all the
* plugins you want to install and activate
* 2. Upload this file to the wordpress root directory (the same directory that contains the
* 'wp-admin' directory).
* 3. Navigate to <your-domain-wordpress-root>/install-wp-plugins.php (If wordpress is installed
@lukaszfiszer
lukaszfiszer / ISO_3166-1_countries_pl.js
Last active May 21, 2024 17:31
List of all countries with their ISO 3166-1 codes, polish and english names, in javascript and json. Sorted by polish name. Source: http://pl.wikipedia.org/wiki/ISO_3166-1 Lista wszystkich państw świata wraz z ich polską i angielską nazwą oraz kodem wg. ISO 3166-1, w formatach javascript i JSON. Posortowana wg. polskiej nazwy: Zródło: http://pl.…
[
{ name_pl: "Afganistan", name_en: "Afghanistan", code: "AF" },
{ name_pl: "Albania", name_en: "Albania", code: "AL" },
{ name_pl: "Algieria", name_en: "Algeria", code: "DZ" },
{ name_pl: "Andora", name_en: "Andorra", code: "AD" },
{ name_pl: "Angola", name_en: "Angola", code: "AO" },
{ name_pl: "Anguilla", name_en: "Anguilla", code: "AI" },
{ name_pl: "Antarktyka", name_en: "Antarctica", code: "AQ" },
{ name_pl: "Antigua i Barbuda", name_en: "Antigua and Barbuda", code: "AG" },
{ name_pl: "Arabia Saudyjska", name_en: "Saudi Arabia", code: "SA" },
@westonruter
westonruter / filter-post-thumbnail-id.php
Last active January 5, 2023 06:42
How to filter the response for get_post_thumbnail_id()
<?php
/**
* How to filter the value that would be returned by get_post_thumbnail_id()
*/
add_filter( 'get_post_metadata', function ( $value, $post_id, $meta_key, $single ) {
// We want to pass the actual _thumbnail_id into the filter, so requires recursion
static $is_recursing = false;
// Only filter if we're not recursing and if it is a post thumbnail ID