Skip to content

Instantly share code, notes, and snippets.

<?php // from https://web.archive.org/web/20161021193734/https://andrewho.nl/encrypt-decrypt-strings-php-easy-way/
function dec_enc($action, $string) {
$output = false;
$encrypt_method = "AES-256-CBC";
$secret_key = 'This is my secret key';
$secret_iv = 'This is my secret iv';
// hash
$key = hash('sha256', $secret_key);
@santiazpi
santiazpi / kinsta-staging-update-routine.php
Last active October 12, 2019 02:10 — forked from devinsays/staging-update-routine.php
staging-update-routine.php
<?php
/**
* Update site to use test mode in local and staging environments
*/
function prefix_env_settings() {
// If settings have already been updated, return early
if ( 1 == get_transient( 'staging-settings-updated' ) ) {
return;
}
@santiazpi
santiazpi / staging-update-routine.php
Created October 4, 2019 20:57 — forked from devinsays/staging-update-routine.php
staging-update-routine.php
<?php
/**
* Update site to use test mode in local and staging environments
*/
function prefix_env_settings() {
// If settings have already been updated, return early
if ( 1 == get_transient( 'staging-settings-updated' ) ) {
return;
}
@santiazpi
santiazpi / woo-email.php
Created April 20, 2019 23:45 — forked from goranefbl/woo-email.php
Use woocommerce email template header/footer with your plugin
public function gens_send_email($user_id,$coupon_code) {
if ( !$user_id || !$coupon_code) {
return false;
}
global $woocommerce;
$mailer = $woocommerce->mailer();
$user_info = get_userdata($user_id);
@santiazpi
santiazpi / eebackup.sh
Last active September 20, 2018 21:52
#!/usr/bin/env bash
# Bash script to back up an easyengine webiste installation
# To debug, use set -xe
# I personally prefer to create an alias, after I placed this file at ~/scripts/
# echo 'alias eebackup=". ~/scripts/eebackup.sh"' >> ~/.bash_aliases
# . ~/.bash_rc to load the new alias
# Note that the script will also create a log at the /var/www/backupdomain.com/logs/ folder
set -e
LOG_FILE="/var/www/$1/logs/eebackup.log"
@santiazpi
santiazpi / filter-wc-orders-by-gateway.php
Created March 6, 2018 00:21 — forked from bekarice/filter-wc-orders-by-gateway.php
Filters WooCommerce Orders by Payment Gateway Used
<?php
/**
* Plugin Name: Filter WooCommerce Orders by Payment Method
* Plugin URI: http://skyverge.com/
* Description: Filters WooCommerce orders by the payment method used :)
* Author: SkyVerge
* Author URI: http://www.skyverge.com/
* Version: 1.0.0
* Text Domain: wc-filter-orders-by-payment
*
#!/bin/bash
# Bash script to clone an easyengine webiste installation onto another (the destination site must exist already)
# To debug, use set -xe
# I personally prefer to create an alias, after I placed this file at ~/scripts/
# echo 'alias eeclone=". ~/scripts/eeclone.sh"' >> ~/.bash_aliases
# . ~/.bash_rc to load the new alias
# Note that the script will also create a log at the /var/www/destinationdomain.com/logs/ folder
log ()
{
@santiazpi
santiazpi / pleskCommands.sh
Created January 9, 2018 03:58 — forked from AlexPashley/pleskCommands.sh
PLESK: Useful PLESK common commands
# USEFUL PLESK COMMANDS
# restart plesk
/etc/init.d/psa restart
# reload plesk configs (useful for vhost.conf)
/usr/local/psa/admin/sbin/websrvmng -a -v
# restart qmail
service qmail restart
@santiazpi
santiazpi / .htaccess
Last active December 16, 2016 16:38 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/