Skip to content

Instantly share code, notes, and snippets.

View mlbd's full-sized avatar
🏠
Working from home

Mohammad Limon mlbd

🏠
Working from home
View GitHub Profile
/**
* Validate the editorial checklist condition.
*
* @param array $validation_result The validation result array passed by the filter.
* @param array $workflow_action_params The workflow action parameters array passed by the filter.
*
* @return array The validation result array with the error message and type.
*/
function owf_ediotrial_checklist_validate_condition( $validation_result, $workflow_action_params ) {
/**
* Filter to modify the 'oasiswf_placeholders' site option after it's retrieved.
* This ensures that our custom placeholder (%post_id%) is always available
* alongside the existing ones.
*
* @param array $value The existing array of placeholders.
* @return array Modified array with the additional %post_id% placeholder.
*/
add_filter( 'site_option_oasiswf_placeholders', 'modify_existing_oasiswf_placeholders' );
<?php
// Function to generate a random encryption key
function generateEncryptionKey($length = 32)
{
return bin2hex(random_bytes($length));
}
// Function to encrypt credit card information
function encryptCreditCard($creditCardNumber, $encryptionKey)
/**
* Get shipping info by using chosen method from cart
*
* @param string $type
* @return string
*/
function ml_get_shipping_data($type = '') {
$current_shipping_method = WC()->session->get( 'chosen_shipping_methods' );
if( ! is_array($current_shipping_method) ) {
return '';
/**
* Hide shipping rates when free shipping is available.
* Updated to support WooCommerce 2.6 Shipping Zones.
*
* @param array $rates Array of rates found for the package.
* @return array
*/
function allaround_hide_shipping_when_free_is_available( $rates ) {
// Here your free shipping rate Id
/**
* get percentage by quantity
*/
function sakib_get_discount( $quantity ) {
switch ($quantity) {
case 6:
$discount = 20;
break;
case 10:
$discount = 30;
C:\xampp\mysql\bin\mysql.exe -u root -p -v portal < "C:\Users\marsh\Downloads\yourdb.sql"
for more info https://thecodedeveloper.com/import-large-sql-files-xampp/
/**
* Download multiples files at once in WordPress
*/
function vdm_files_downloads() {
if (
! isset( $_POST['vdm_download_nonce'] )
|| ! wp_verify_nonce( $_POST['vdm_download_nonce'], 'vdm_download_action' )
|| !isset($_POST['vdm_download_files'])
|| empty($_POST['vdm_download_files'])
----------------------------------------------------------------------
// C:\xampp\php\php.ini
----------------------------------------------------------------------
[mail function]
smtp_port=587
sendmail_from = [email protected]
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
----------------------------------------------------------------------
// C:\xampp\sendmail\sendmail.ini
<?xml version="1.0"?>
<ruleset name="WordPress Theme Coding Standards">
<!-- See https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
<!-- See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards -->
<!-- See https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki -->
<!-- See https://github.com/wimg/PHPCompatibility -->
<!-- Set a description for this ruleset. -->
<description>A custom set of code standard rules to check for WordPress themes.</description>