Skip to content

Instantly share code, notes, and snippets.

View Slaver's full-sized avatar

Viacheslav Radionov Slaver

View GitHub Profile
<?php
class OrderProcessor
{
public function processOrder($orderId, $items, $customerEmail)
{
// Check if product exists
foreach ($items as $item) {
$sql = "SELECT quantity FROM products WHERE id = " . $item['id'];
$result = mysqli_query($GLOBALS['db_connection'], $sql);
<?php
class UserManager
{
private $db;
public function __construct($db)
{
$this->db = $db;
}
@Slaver
Slaver / functions.php
Last active November 13, 2019 15:48
How to use WP Super Cache and AdRotate
<?php
/**
* Custom banner handler for cache
*/
add_action('init', 'adrotate_request_handler');
function adrotate_request_handler() {
if ( isset($_GET['adrotate_action']) && $_GET['adrotate_action'] == 'show' ) {
// You can use adrotate_group or adrotate_ad
// First param — ad group ID