| @@ -7,32 +7,11 @@ | ||
| 7 | 7 | final class Utilities |
| 8 | 8 | { |
| 9 | 9 | public static function isPro() |
| 10 | 10 | { |
| 11 | - // IMPORTANT: | |
| 12 | - // For wp.org (free) distribution we treat "Pro" as "Pro addon is installed/active". | |
| 13 | - // License enforcement must live inside the Pro addon, not in the free plugin. | |
| 14 | - return class_exists('BitCode\\BitFormPro\\Plugin'); | |
| 15 | - } | |
| 16 | - | |
| 17 | - /** | |
| 18 | - * Kept for backward compatibility where the free plugin needs to know if a Pro | |
| 19 | - * license is marked active. Prefer checking license inside the Pro addon. | |
| 20 | - */ | |
| 21 | - public static function isProLicensed(): bool | |
| 22 | - { | |
| 23 | - if (!self::isPro()) { | |
| 24 | - return false; | |
| 25 | - } | |
| 26 | - if (class_exists('BitCode\\BitFormPro\\Core\\Util\\LicenseHelper')) { | |
| 27 | - return \BitCode\BitFormPro\Core\Util\LicenseHelper::hasValidLicense(); | |
| 28 | - } | |
| 29 | 11 | $integrateData = get_option('bitformpro_integrate_key_data'); |
| 30 | - | |
| 31 | - return !empty($integrateData) | |
| 32 | - && is_array($integrateData) | |
| 33 | - && !empty($integrateData['status']) | |
| 34 | - && 'success' === $integrateData['status']; | |
| 12 | + $isProLicenseActivated = !empty($integrateData) && is_array($integrateData) && 'success' === $integrateData['status']; | |
| 13 | + return class_exists('BitCode\\BitFormPro\\Plugin') && $isProLicenseActivated; | |
| 35 | 14 | } |
| 36 | 15 | |
| 37 | 16 | public static function getRealPath($dir, $name) |
| 38 | 17 | { |
| @@ -88,35 +67,8 @@ | ||
| 88 | 67 | |
| 89 | 68 | return $css; |
| 90 | 69 | } |
| 91 | 70 | |
| 92 | - public static function convertToCSS(array $styles): string | |
| 93 | - { | |
| 94 | - $css = ''; | |
| 95 | - | |
| 96 | - foreach ($styles as $selector => $properties) { | |
| 97 | - $css .= "$selector{"; | |
| 98 | - | |
| 99 | - // Check if the properties are an array, meaning it's a nested rule (e.g., media queries, keyframes) | |
| 100 | - if (is_array($properties)) { | |
| 101 | - // If it's a nested array (media query or keyframe), recursively handle it | |
| 102 | - foreach ($properties as $property => $value) { | |
| 103 | - if (is_array($value)) { | |
| 104 | - // Recursively process nested arrays (media queries, keyframes, etc.) | |
| 105 | - $css .= self::convertToCSS([$property => $value]); | |
| 106 | - } else { | |
| 107 | - // Regular CSS property | |
| 108 | - $css .= "$property:$value;"; | |
| 109 | - } | |
| 110 | - } | |
| 111 | - } | |
| 112 | - | |
| 113 | - $css .= '}'; | |
| 114 | - } | |
| 115 | - | |
| 116 | - return $css; | |
| 117 | - } | |
| 118 | - | |
| 119 | 71 | public static function appendCSS($formId, $css, $mode = 'a') |
| 120 | 72 | { |
| 121 | 73 | $fileName = ''; |
| 122 | 74 | $path = ''; |
| @@ -131,9 +83,16 @@ | ||
| 131 | 83 | { |
| 132 | 84 | global $wpdb; |
| 133 | 85 | $oldTable = "{$wpdb->prefix}bitforms_{$oldTableName}"; |
| 134 | 86 | $newTable = "{$wpdb->prefix}bitforms_{$newTableName}"; |
| 135 | - // Schema operation: table name interpolation only (no user input). $wpdb->prepare() cannot parameterize DDL statements. | |
| 136 | - $wpdb->query("CREATE TABLE IF NOT EXISTS `{$newTable}` LIKE `{$oldTable}`"); | |
| 137 | - $wpdb->query("INSERT INTO `{$newTable}` SELECT * FROM `{$oldTable}`"); | |
| 87 | + $wpdb->query( | |
| 88 | + $wpdb->prepare( | |
| 89 | + "CREATE TABLE IF NOT EXISTS $newTable LIKE $oldTable" | |
| 90 | + ) | |
| 91 | + ); | |
| 92 | + $wpdb->query( | |
| 93 | + $wpdb->prepare( | |
| 94 | + "INSERT $newTable SELECT * FROM $oldTable" | |
| 95 | + ) | |
| 96 | + ); | |
| 138 | 97 | } |
| 139 | 98 | } |