Files
2026-05-15 21:06:41 +07:00

12 lines
1.2 KiB
PHP

<?php
if (!defined('ABSPATH')) exit;
function wzhf_get_option($key=null,$default=null){ $opt=get_option(WZHF_OPT,array()); if($key===null) return is_array($opt)?$opt:array(); return isset($opt[$key])?$opt[$key]:$default; }
function wzhf_update_option($key,$value){ $opt=get_option(WZHF_OPT,array()); if(!is_array($opt)) $opt=array(); $opt[$key]=$value; update_option(WZHF_OPT,$opt,false); return true; }
function wzhf_admin_cap(){ return current_user_can('manage_woocommerce'); }
function wzhf_nonce_field(){ wp_nonce_field('wzhf_save_settings','wzhf_nonce'); }
function wzhf_verified_nonce(){ return check_admin_referer('wzhf_save_settings','wzhf_nonce'); }
function wzhf_selected($a,$b){ if((string)$a===(string)$b) echo ' selected'; }
function wzhf_checked($a,$b=true){ if(!!$a===!!$b) echo ' checked'; }
function wzhf_sanitize_bool($v){ return $v==='1'||$v===1||$v===true||$v==='on'; }
add_filter('cron_schedules', function($s){ $s['wzhf_5min']=array('interval'=>300,'display'=>__('Every 5 Minutes','woozoho-fulfillment')); $s['wzhf_15min']=array('interval'=>900,'display'=>__('Every 15 Minutes','woozoho-fulfillment')); $s['wzhf_1h']=array('interval'=>3600,'display'=>__('Every hour','woozoho-fulfillment')); return $s; });