Skip to content

Instantly share code, notes, and snippets.

View wichaksono's full-sized avatar
🤔
Coding Is Fun.. Right ?

Wakhid Wichaksono wichaksono

🤔
Coding Is Fun.. Right ?
View GitHub Profile
<?php
$folderPath = 'gpuniversity'; // Ganti dengan path folder Anda
$zipFileName = 'gpuniversity.zip'; // Nama file ZIP yang akan dibuat
$zip = new ZipArchive();
// Membuka arsip ZIP untuk menulis
if ($zip->open($zipFileName, ZipArchive::CREATE) === TRUE) {
// Mendapatkan panjang string dari path root
$rootPathLength = strlen(realpath($folderPath)) + 1;
@wichaksono
wichaksono / simple-regex-cedeen.php
Last active September 17, 2022 09:57
CDN statically
<?php
/**
* Taruh di functions.php paling bawah
*/
/**
* Mengubah Semua URL image di konten menjadi berCDN
*/
function cdn_on_the_fly($content) {
$pattern = '#(\-(\d+)x(\d+))?\.((?:jpg|gif|png|webp|jpeg))#';
return preg_replace($pattern, '.$4?format=webp&quality=80&w=$2&h=$3', $content);
<?php
/*
* WordPress Breadcrumbs
* author: Dimox
* version: 2019.03.03
* license: MIT
*/
function dimox_breadcrumbs() {
/* === OPTIONS === */
<script>
document.addEventListener('DOMContentLoaded', init, false);
function init(){
adsBlocked(function(blocked){
if(blocked){
var adblocker = document.getElementById('adblocker-detected');
adblocker.classList.add('show');
}
})
<?php
#.... ubah 4 jadi 04. dan seterusnya selama 1 digit, jika dua digit
# seperti 10, tidak akan berubah jadi 010 tapi tetap 10
function two_digit($string)
{
return sprintf('%02d', $string);
}
<?php
/**
* Sample Countdown Timer JS PHP
*/
$date_start = '10-10-2018 20:40:00';
$date_end = '11-10-2018 20:40:00';
$dateStart = new Datetime($date_start);
$dateEnd = new Datetime($date_end);
$interval = $dateStart->diff($dateEnd);
// var_dump( $intervale );
<?php
/**
* Sample Countdown Timer JS PHP
*/
$date_start = '10-10-2018 20:40:00';
$date_end = '11-10-2018 20:40:00';
$dateStart = new Datetime($date_start);
$dateEnd = new Datetime($date_end);
<?php
session_start();
require 'config.php';
if (
isset($_POST['username']) &&
$_POST['username'] == 'admin' &&
isset($_POST['password']) &&
$_POST['password'] == '12345'
) {
$_SESSION['user_login'] = 'admin';
<?php
/**
*/
require_once get_theme_file_path('class-list-member.php');
function addMenuMembers()
{
add_menu_page('Memberss', 'Memberss', 'manage_options', 'customer', 'MembersHtml');
}
add_action('admin_menu', 'addMenuMembers', 1);
<?php
if ( ! class_exists('WP_List_Table') ) {
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
}
/**
* Class memberLists Handle Table Lists
*/
class memberLists extends WP_List_Table
{
public function __construct()