| 1 |
<?php |
| 2 |
/** |
| 3 |
* Helper Class |
| 4 |
* |
| 5 |
* @package CTC |
| 6 |
* @since 5.0.0 |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace CTC; |
| 10 |
|
| 11 |
/** |
| 12 |
* Helper Class |
| 13 |
* |
| 14 |
* @since 5.0.0 |
| 15 |
*/ |
| 16 |
class Helper { |
| 17 |
|
| 18 |
/** |
| 19 |
* Check if the plugin is Pro version |
| 20 |
* |
| 21 |
* Uses Freemius or can be filtered by Pro add-on plugin. |
| 22 |
* |
| 23 |
* @since 5.0.0 |
| 24 |
* @return bool |
| 25 |
*/ |
| 26 |
public static function is_pro() { |
| 27 |
/** |
| 28 |
* Filter to enable Pro features. |
| 29 |
* |
| 30 |
* Pro add-on plugin can hook into this to enable Pro features. |
| 31 |
* |
| 32 |
* @since 5.0.0 |
| 33 |
* @param bool $is_pro Whether Pro is active. Default false. |
| 34 |
*/ |
| 35 |
return apply_filters( 'ctc/is_pro', function_exists( 'ctc_fs' ) && ctc_fs()->is__premium_only() ); |
| 36 |
} |
| 37 |
|
| 38 |
/** |
| 39 |
* Minify CSS: strip comments and collapse whitespace. |
| 40 |
* |
| 41 |
* @since 5.0.2 |
| 42 |
* @param string $css Raw CSS. |
| 43 |
* @return string Minified CSS. |
| 44 |
*/ |
| 45 |
public static function minify_css( $css ) { |
| 46 |
$css = (string) preg_replace( '/\/\*[\s\S]*?\*\//', '', $css ); |
| 47 |
$css = (string) preg_replace( '/\s+/', ' ', $css ); |
| 48 |
return trim( $css ); |
| 49 |
} |
| 50 |
} |
| 51 |
|