Skip to content

Instantly share code, notes, and snippets.

View borislav-angelov's full-sized avatar

Borislav Angelov borislav-angelov

View GitHub Profile
@borislav-angelov
borislav-angelov / ai1wm-database-7.110.patch
Created August 20, 2026 11:56
ai1wm-database-7.110.patch
diff --git a/lib/vendor/servmask/database/class-ai1wm-database.php b/lib/vendor/servmask/database/class-ai1wm-database.php
index 41925eff..40675891 100644
--- a/lib/vendor/servmask/database/class-ai1wm-database.php
+++ b/lib/vendor/servmask/database/class-ai1wm-database.php
@@ -1634,7 +1634,7 @@ abstract class Ai1wm_Database {
// Replace serialized values
foreach ( $this->get_old_replace_values() as $old_value ) {
if ( strpos( $input, $this->escape( $old_value ) ) !== false ) {
- $input = preg_replace_callback( "/'(.*?)(?<!\\\\)'/S", array( $this, 'replace_table_values_callback' ), $input );
+ $input = preg_replace_callback( "/'((?:[^'\\\\]++|\\\\.)*+)'/sS", array( $this, 'replace_table_values_callback' ), $input );
<?php
class AWSV4 {
private $accessKeyID = null;
private $secretAccessKey = null;
private $regionName = null;
private $serviceName = null;
private $httpMethodName = null;
private $canonicalURI = "/";
@borislav-angelov
borislav-angelov / wp_http_debug.php
Last active August 29, 2015 14:18
WP HTTP Debug
<?php
add_action( 'http_api_debug', 'viper_http_api_debug', 10, 5 );
public function viper_http_api_debug( $response, $type, $class, $args, $url ) {
$output = 'Request URL: ' . var_export( $url, true );
$output .= 'Request Args: ' . var_export( $args, true );
$output .= 'Request Response : ' . var_export( $response, true );
echo $output;
<?php
$dir = "C:\\";
$start = microtime(true);
function recursive_readdir($dir) {
$dh = opendir($dir);
while (false !== ($filename = readdir($dh))) {
if ($filename != '.' && $filename != '..') {
if (is_dir($dir . $filename)) {
<?php
$dir = "C:\\temp\\";
$start = microtime(true);
function recursive_readdir($dir) {
$dh = opendir($dir);
while (false !== ($filename = readdir($dh))) {
if ($filename != '.' && $filename != '..') {
<?php
$i = 0;
while (true) {
echo $i . " abc \n";
time_sleep_until( time() + 10);
$i++;
}
<?php
<?php
abstract class Ai1ec_Event_Callback_Abstract {
protected $_registry = null;
protected $_registry_name = null;
protected $_method = null;
public function __construct(
<?php
class Ai1ec_Event_Dispatcher {
public function register(
$hook,
Ai1ec_Event_Callback_Abstract $entity,
$priority = 10,
$accepted_args = 1
) {
class Ai1ec_Event_Dispatcher {
public function register(
$hook,
Ai1ec_Event_Callback_Abstract $entity,
$priority = 10,
$accepted_args = 1
) {
if ($entity instanceof Ai1ec_Event_Callback_Filter) {
<?php
$dispatcher = new Ai1ec_Event_Dispatcher();
$callback_filter = new Ai1ec_Event_Callback_Filter( $this->_registry, 'model.settings', 'modify2' );
$dispatcher->register( 'title', $callback_filter, 19, 2 );
$callback_filter2 = new Ai1ec_Event_Callback_Filter( $this->_registry, 'model.settings', 'modify' );
$dispatcher->register( 'title', $callback_filter2, 17, 2 );