This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Twitter { | |
private string $bearer; | |
public function __construct( string $bearer ) { | |
$this->bearer = $bearer; | |
} | |
public function get_rate_limits() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Render the login/logout block. | |
* | |
* @param array $attributes Block attributes. | |
* @param string $content Block content. | |
* @param array $block Block instance. | |
*/ | |
$link = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Redirect Logger | |
* Description: Find the source of all redirects. | |
* | |
* Place this in the mu-plugins directory and check the | |
* redirects-1234567.json file in the uploads directory for the logs. | |
*/ | |
namespace WPElevator\Redirect_Logger; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
abstract class WP_Encrypted_Secret_Method { | |
protected WP_Encrypted_Secret_Storage $storage; | |
public function __construct( WP_Encrypted_Secret_Storage $storage ) { | |
$this->storage = $storage; | |
} | |
abstract public function is_supported(): bool; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace YourVendor\Project; | |
class Config { | |
private static array $config = []; | |
private function __construct() { | |
// Private constructor to prevent direct instantiation | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace YourVendor\WooCommerce_CLI; | |
use WP_CLI; | |
use WooCommerce; | |
function anon_orders( $args, $assoc_args ) { | |
$order_ids = wc_get_orders( | |
[ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proxy_cache_path /var/cache/cf-images levels=1:2 keys_zone=CF_IMAGES:10m inactive=7d max_size=10MB; | |
server { | |
# ... here goes the rest of your config. | |
# Proxy example.com/cfimg/original/path/image.jpg?cf=width=100,quality=80 | |
# to example.com/cdn-cgi/image/width=100,quality=80/original/path/image.jpg | |
location ~* ^/cfimg/(.*)$ { | |
resolver 1.1.1.1; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Cloudflare Image API Mock | |
* Description: Replicate Cloudflare Image API functionality locally. | |
* | |
* IMPORTANT: The code below shouldn't be used on production since the | |
* image path resolution is vulnerable to directory traversal attacks. | |
*/ | |
add_action( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// See https://x.com/PoeHaH/status/1875290205894164758 | |
function run_times( callable $callback, int $runs ) { | |
$start = microtime(true); | |
for ($i = 0; $i < $runs; $i++) { | |
$callback(); | |
} | |
return microtime(true) - $start; | |
} |
NewerOlder