| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
/** |
| 6 |
* Function include all files in folder |
| 7 |
* |
| 8 |
* @param $path Directory address |
| 9 |
* @param $ext array file extension what will include |
| 10 |
* @param $prefix string Class prefix |
| 11 |
*/ |
| 12 |
if ( ! function_exists( 'vi_include_folder' ) ) { |
| 13 |
function vi_include_folder( $path, $prefix = '', $ext = array( 'php' ) ) { |
| 14 |
|
| 15 |
/*Include all files in payment folder*/ |
| 16 |
if ( ! is_array( $ext ) ) { |
| 17 |
$ext = explode( ',', $ext ); |
| 18 |
$ext = array_map( 'trim', $ext ); |
| 19 |
} |
| 20 |
$sfiles = scandir( $path ); |
| 21 |
foreach ( $sfiles as $sfile ) { |
| 22 |
if ( $sfile != '.' && $sfile != '..' ) { |
| 23 |
if ( is_file( $path . "/" . $sfile ) ) { |
| 24 |
$ext_file = pathinfo( $path . "/" . $sfile ); |
| 25 |
$file_name = $ext_file['filename']; |
| 26 |
if ( $ext_file['extension'] ) { |
| 27 |
if ( in_array( $ext_file['extension'], $ext ) ) { |
| 28 |
$class = preg_replace( '/\W/i', '_', $prefix . ucfirst( $file_name ) ); |
| 29 |
|
| 30 |
if ( ! class_exists( $class ) ) { |
| 31 |
require_once $path . $sfile; |
| 32 |
if ( class_exists( $class ) ) { |
| 33 |
new $class; |
| 34 |
} |
| 35 |
} |
| 36 |
} |
| 37 |
} |
| 38 |
} |
| 39 |
} |
| 40 |
} |
| 41 |
} |
| 42 |
} |
| 43 |
if(!function_exists('woo_ctr_time')){ |
| 44 |
function woo_ctr_time($time){ |
| 45 |
if(!$time){ |
| 46 |
return 0; |
| 47 |
} |
| 48 |
$temp=explode(":",$time); |
| 49 |
if(count($temp)==2){ |
| 50 |
return (absint($temp[0])*3600+absint($temp[1])*60); |
| 51 |
}else{ |
| 52 |
return 0; |
| 53 |
} |
| 54 |
} |
| 55 |
} |
| 56 |
if(!function_exists('woo_ctr_time_revert')){ |
| 57 |
function woo_ctr_time_revert($time){ |
| 58 |
$hour=floor($time/3600); |
| 59 |
$min=floor(($time-3600*$hour)/60); |
| 60 |
return implode(':',array(zeroise($hour,2),zeroise($min,2))); |
| 61 |
} |
| 62 |
} |
| 63 |
|