| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPAdminify\Inc\Admin\Options; |
| 4 |
|
| 5 |
use WPAdminify\Inc\Utils; |
| 6 |
use WPAdminify\Inc\Admin\AdminSettingsModel; |
| 7 |
|
| 8 |
if (!defined('ABSPATH')) { |
| 9 |
die; |
| 10 |
} // Cannot access directly. |
| 11 |
|
| 12 |
class Tweaks_Performance extends AdminSettingsModel |
| 13 |
{ |
| 14 |
public function __construct() |
| 15 |
{ |
| 16 |
$this->tweaks_performance_settings(); |
| 17 |
} |
| 18 |
|
| 19 |
public function get_defaults() |
| 20 |
{ |
| 21 |
return [ |
| 22 |
'remove_jquery_migrate' => false, |
| 23 |
'remove_gutenberg_scripts' => false, |
| 24 |
'defer_parsing_js_footer' => false, |
| 25 |
'cache_gzip_compression' => false |
| 26 |
]; |
| 27 |
} |
| 28 |
|
| 29 |
|
| 30 |
/** |
| 31 |
* Tweaks: Performance Fields |
| 32 |
* |
| 33 |
* @param [type] $performance_fields |
| 34 |
* |
| 35 |
* @return void |
| 36 |
*/ |
| 37 |
public function tweaks_performance_fields(&$performance_fields) |
| 38 |
{ |
| 39 |
$performance_fields[] = array( |
| 40 |
'type' => 'subheading', |
| 41 |
'content' => Utils::adminfiy_help_urls( |
| 42 |
__('Performance Section for speed up your website speed and other Configurations', WP_ADMINIFY_TD), |
| 43 |
'https://wpadminify.com/kb/wp-adminify-tweaks/', |
| 44 |
'https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8', |
| 45 |
'https://www.facebook.com/groups/jeweltheme', |
| 46 |
'https://wpadminify.com/support/' |
| 47 |
) |
| 48 |
); |
| 49 |
|
| 50 |
$performance_fields[] = array( |
| 51 |
'id' => 'remove_jquery_migrate', |
| 52 |
'type' => 'switcher', |
| 53 |
'title' => esc_html__('Remove jQuery Migrate', WP_ADMINIFY_TD), |
| 54 |
'subtitle' => esc_html__('Enable if you want to remove jQuery Migrate Script', WP_ADMINIFY_TD), |
| 55 |
'text_on' => __('Yes', WP_ADMINIFY_TD), |
| 56 |
'text_off' => __('No', WP_ADMINIFY_TD), |
| 57 |
'text_width' => 80, |
| 58 |
'default' => $this->get_default_field('remove_jquery_migrate'), |
| 59 |
); |
| 60 |
|
| 61 |
$performance_fields[] = array( |
| 62 |
'id' => 'remove_gutenberg_scripts', |
| 63 |
'type' => 'switcher', |
| 64 |
'title' => esc_html__('Remove Gutenberg Scripts', WP_ADMINIFY_TD), |
| 65 |
'subtitle' => esc_html__('Remove Gutenberg Blocks Scripts/Styles', WP_ADMINIFY_TD), |
| 66 |
'text_on' => __('Yes', WP_ADMINIFY_TD), |
| 67 |
'text_off' => __('No', WP_ADMINIFY_TD), |
| 68 |
'text_width' => 80, |
| 69 |
'default' => $this->get_default_field('remove_gutenberg_scripts'), |
| 70 |
); |
| 71 |
|
| 72 |
$performance_fields[] = array( |
| 73 |
'id' => 'defer_parsing_js_footer', |
| 74 |
'type' => 'switcher', |
| 75 |
'title' => esc_html__('Enable Defer Parsing JS to Footer', WP_ADMINIFY_TD), |
| 76 |
'subtitle' => esc_html__('Secure method for Defer Parsing of JavaScript moving ALL JS from Header to Footer', WP_ADMINIFY_TD), |
| 77 |
'text_on' => __('Yes', WP_ADMINIFY_TD), |
| 78 |
'text_off' => __('No', WP_ADMINIFY_TD), |
| 79 |
'text_width' => 80, |
| 80 |
'default' => $this->get_default_field('defer_parsing_js_footer'), |
| 81 |
); |
| 82 |
|
| 83 |
$performance_fields[] = array( |
| 84 |
'id' => 'cache_gzip_compression', |
| 85 |
'type' => 'switcher', |
| 86 |
'title' => esc_html__('Cache & GZIP Compressions', WP_ADMINIFY_TD), |
| 87 |
'subtitle' => esc_html__('Browser Cache Expires & GZIP Compression', WP_ADMINIFY_TD), |
| 88 |
'text_on' => __('Yes', WP_ADMINIFY_TD), |
| 89 |
'text_off' => __('No', WP_ADMINIFY_TD), |
| 90 |
'text_width' => 80, |
| 91 |
'default' => $this->get_default_field('cache_gzip_compression'), |
| 92 |
); |
| 93 |
} |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
public function tweaks_performance_settings() |
| 98 |
{ |
| 99 |
|
| 100 |
if (!class_exists('ADMINIFY')) { |
| 101 |
return; |
| 102 |
} |
| 103 |
|
| 104 |
$performance_fields = []; |
| 105 |
$this->tweaks_performance_fields($performance_fields); |
| 106 |
|
| 107 |
\ADMINIFY::createSection( |
| 108 |
$this->prefix, |
| 109 |
array( |
| 110 |
'title' => __('Performance', WP_ADMINIFY_TD), |
| 111 |
'parent' => 'tweaks_performance', |
| 112 |
'icon' => 'fas fa-rocket', |
| 113 |
'fields' => $performance_fields |
| 114 |
) |
| 115 |
); |
| 116 |
} |
| 117 |
} |
| 118 |
|