This file contains 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 | |
if ( ! class_exists('WP_List_Table')) { | |
require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php'); | |
} | |
class Events_List_Table extends WP_List_Table | |
{ | |
function __construct() | |
{ | |
global $status, $page; |
This file contains 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
// https://www.php.net/manual/en/transliterator.transliterate.php | |
function slugify($string, $separator = '-') | |
{ | |
$slug = trim(strip_tags($string)); | |
$slug = transliterator_transliterate('NFD; [:Nonspacing Mark:] Remove; NFC; Any-Latin; Latin-ASCII; Lower();', $slug); | |
$slug = preg_replace("/[^a-zA-Z0-9\\/_|+ -]/", '', $slug); | |
$slug = preg_replace("/[\\/_|+ -]+/", $separator, $slug); | |
$slug = trim($slug, $separator); | |
return $slug; | |
} |
This file contains 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
# Method 1 | |
certbot certonly --manual --preferred-challenges dns --server https://acme-v02.api.letsencrypt.org/directory --manual-public-ip-logging-ok -d '*.<ypurdomain>' -d '<ypurdomain>' | |
# Method 2 | |
certbot -d example.com --manual --preferred-challenges dns certonly |
This file contains 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
# Keyboard | |
defaults write -g InitialKeyRepeat -int 10 # normal minimum is 15 (225 ms) | |
defaults write -g KeyRepeat -int 1 # normal minimum is 2 (30 ms) |
This file contains 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
@ECHO OFF | |
ECHO Creating SSL Cert... | |
set NGINX_HOME=C:\nginx114 | |
set OPENSSL_HOME="C:\Program Files\OpenSSL-Win64\bin" | |
set PATH=%PHP_HOME%;%PATH% | |
openssl req -x509 -nodes -days 36500 -newkey rsa:4096 -keyout %NGINX_HOME%/ssl/%1.key -out %NGINX_HOME%/ssl/%1.crt | |
ECHO SSL Cert Created... | |
ECHO %NGINX_HOME%/conf/%1.key | |
ECHO %NGINX_HOME%/conf/%1.crt |
This file contains 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
const admin = require("admin"); | |
function getFirebaseUser(req, res, next) { | |
console.log("Check if request is authorized with Firebase ID token"); | |
if ( | |
!req.headers.authorization || | |
!req.headers.authorization.startsWith("Bearer ") | |
) { | |
console.error( | |
"No Firebase ID token was passed as a Bearer token in the Authorization header.", |
This file contains 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
function getRealIPAddr() | |
{ | |
if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet | |
{ | |
$ip=$_SERVER['HTTP_CLIENT_IP']; | |
} | |
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy | |
{ | |
$ip=$_SERVER['HTTP_X_FORWARDED_FOR']; | |
} |
This file contains 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
function force_download_a_file($dl_file) | |
{ | |
if(is_file($dl_file)) | |
{ | |
if(ini_get('zlib.output_compression')) { | |
ini_set('zlib.output_compression', 'Off'); | |
} | |
header('Expires: 0'); | |
header('Pragma: public'); | |
header('Cache-Control: private',false); |
This file contains 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 simpleXml2Array | |
{ | |
public $namespaces, $arr; | |
public function __construct( $xmlstring, $namespaces=null ) | |
{ | |
$xml = new simpleXmlIterator( $xmlstring, null ); | |
$this->namespaces = is_null( $namespaces ) ? null : $xml->getNamespaces( true ); |
NewerOlder