| 1 |
<?php |
| 2 |
|
| 3 |
namespace BitCode\BitForm\Core\Util; |
| 4 |
|
| 5 |
final class Utilities |
| 6 |
{ |
| 7 |
public static function isPro() |
| 8 |
{ |
| 9 |
$integrateData = get_option('bitformpro_integrate_key_data'); |
| 10 |
$isProLicenseActivated = !empty($integrateData) && is_array($integrateData) && 'success' === $integrateData['status']; |
| 11 |
return class_exists('BitCode\\BitFormPro\\Plugin') && $isProLicenseActivated; |
| 12 |
} |
| 13 |
|
| 14 |
public static function getRealPath($dir, $name) |
| 15 |
{ |
| 16 |
if (!isset($dir)) return false; |
| 17 |
$directories = array_diff(scandir($dir), array('..', '.')); |
| 18 |
$name = strtolower($name); |
| 19 |
|
| 20 |
foreach ($directories as $directory) { |
| 21 |
$dirLower = strtolower($directory); |
| 22 |
if ($dirLower === $name) { |
| 23 |
return $directory; |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
return false; |
| 28 |
} |
| 29 |
|
| 30 |
public static function getFileNameExceptExtension($filename) |
| 31 |
{ |
| 32 |
$path_parts = pathinfo($filename); |
| 33 |
return $path_parts['filename']; |
| 34 |
} |
| 35 |
} |
| 36 |
|