| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPAdminify\Inc\Admin\Options; |
| 4 |
|
| 5 |
use WPAdminify\Inc\Admin\AdminSettingsModel; |
| 6 |
|
| 7 |
if (!defined('ABSPATH')) { |
| 8 |
die; |
| 9 |
} // Cannot access directly. |
| 10 |
|
| 11 |
if (!class_exists('Modules')) { |
| 12 |
class Modules extends AdminSettingsModel |
| 13 |
{ |
| 14 |
|
| 15 |
public function __construct() |
| 16 |
{ |
| 17 |
$this->jltwp_adminify_general_options(); |
| 18 |
} |
| 19 |
|
| 20 |
public function get_defaults() |
| 21 |
{ |
| 22 |
return [ |
| 23 |
'admin_ui' => false, |
| 24 |
'folders' => true, |
| 25 |
'admin_notices' => true, |
| 26 |
'login_customizer' => true, |
| 27 |
'admin_columns' => true, |
| 28 |
'menu_editor' => true, |
| 29 |
'dashboard_widgets' => true, |
| 30 |
'pagespeed_insights' => true, |
| 31 |
'custom_css_js' => true, |
| 32 |
'quick_menu' => true, |
| 33 |
'menu_duplicator' => true, |
| 34 |
'activity_logs' => true, |
| 35 |
'admin_pages' => true, |
| 36 |
'notification_bar' => true, |
| 37 |
'post_duplicator' => true, |
| 38 |
'post_types_order' => true, |
| 39 |
'server_info' => true, |
| 40 |
'sidebar_generator' => true, |
| 41 |
'disable_comments' => true |
| 42 |
]; |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* Module Fields |
| 47 |
* |
| 48 |
* @param [type] $modules_fields |
| 49 |
* |
| 50 |
* @return void |
| 51 |
*/ |
| 52 |
public function module_fields(&$modules_fields) |
| 53 |
{ |
| 54 |
$modules_fields[] = array( |
| 55 |
'id' => 'admin_ui', |
| 56 |
'type' => 'switcher', |
| 57 |
'title' => __('Adminify UI', WP_ADMINIFY_TD), |
| 58 |
'subtitle' => __('Choose WordPress Default or Adminify UI for your Dashboard. Default: Adminify UI', WP_ADMINIFY_TD), |
| 59 |
'text_on' => __('Enabled', WP_ADMINIFY_TD), |
| 60 |
'text_off' => __('Disabled', WP_ADMINIFY_TD), |
| 61 |
'text_width' => 100, |
| 62 |
'default' => $this->get_default_field('admin_ui'), |
| 63 |
); |
| 64 |
|
| 65 |
$modules_fields[] = array( |
| 66 |
'id' => 'folders', |
| 67 |
'type' => 'switcher', |
| 68 |
'title' => __('Folders', WP_ADMINIFY_TD), |
| 69 |
'subtitle' => __('Categorize Post/Page/Media & Custom Post Types', WP_ADMINIFY_TD), |
| 70 |
'text_on' => __('Enabled', WP_ADMINIFY_TD), |
| 71 |
'text_off' => __('Disabled', WP_ADMINIFY_TD), |
| 72 |
'text_width' => 100, |
| 73 |
'default' => $this->get_default_field('folders'), |
| 74 |
); |
| 75 |
|
| 76 |
$modules_fields[] = array( |
| 77 |
'id' => 'login_customizer', |
| 78 |
'type' => 'switcher', |
| 79 |
'title' => __('Login Customizer', WP_ADMINIFY_TD), |
| 80 |
'subtitle' => __('16 pre-built Templates, with Video,Slideshow,Gradient and many more', WP_ADMINIFY_TD), |
| 81 |
'text_on' => __('Enabled', WP_ADMINIFY_TD), |
| 82 |
'text_off' => __('Disabled', WP_ADMINIFY_TD), |
| 83 |
'text_width' => 100, |
| 84 |
'default' => $this->get_default_field('login_customizer'), |
| 85 |
); |
| 86 |
|
| 87 |
$modules_fields[] = array( |
| 88 |
'id' => 'admin_notices', |
| 89 |
'type' => 'switcher', |
| 90 |
'title' => __('Admin Notices', WP_ADMINIFY_TD), |
| 91 |
'subtitle' => __('Enable/Disable Hide All admin Notices Module', WP_ADMINIFY_TD), |
| 92 |
'text_on' => __('Enabled', WP_ADMINIFY_TD), |
| 93 |
'text_off' => __('Disabled', WP_ADMINIFY_TD), |
| 94 |
'text_width' => 100, |
| 95 |
'default' => $this->get_default_field('admin_notices'), |
| 96 |
); |
| 97 |
|
| 98 |
$modules_fields[] = array( |
| 99 |
'id' => 'admin_columns', |
| 100 |
'type' => 'switcher', |
| 101 |
'title' => __('Admin Columns', WP_ADMINIFY_TD), |
| 102 |
'subtitle' => __('Customize Column names post,page,products,media,taxonomoy etc', WP_ADMINIFY_TD), |
| 103 |
'text_on' => __('Enabled', WP_ADMINIFY_TD), |
| 104 |
'text_off' => __('Disabled', WP_ADMINIFY_TD), |
| 105 |
'text_width' => 100, |
| 106 |
'default' => $this->get_default_field('admin_columns'), |
| 107 |
); |
| 108 |
|
| 109 |
$modules_fields[] = array( |
| 110 |
'id' => 'menu_editor', |
| 111 |
'type' => 'switcher', |
| 112 |
'title' => __('Menu Editor', WP_ADMINIFY_TD), |
| 113 |
'subtitle' => __('Advanced Menu Editor with restrict users, Custom Icons etc', WP_ADMINIFY_TD), |
| 114 |
'text_on' => __('Enabled', WP_ADMINIFY_TD), |
| 115 |
'text_off' => __('Disabled', WP_ADMINIFY_TD), |
| 116 |
'text_width' => 100, |
| 117 |
'default' => $this->get_default_field('menu_editor'), |
| 118 |
); |
| 119 |
|
| 120 |
$modules_fields[] = array( |
| 121 |
'id' => 'dashboard_widgets', |
| 122 |
'type' => 'switcher', |
| 123 |
'title' => __('Dashboard & Welcome Widget', WP_ADMINIFY_TD), |
| 124 |
'subtitle' => __('Create Custom Dashboard & Sidebar Widgets', WP_ADMINIFY_TD), |
| 125 |
'text_on' => __('Enabled', WP_ADMINIFY_TD), |
| 126 |
'text_off' => __('Disabled', WP_ADMINIFY_TD), |
| 127 |
'text_width' => 100, |
| 128 |
'default' => $this->get_default_field('dashboard_widgets'), |
| 129 |
); |
| 130 |
|
| 131 |
$modules_fields[] = array( |
| 132 |
'id' => 'pagespeed_insights', |
| 133 |
'type' => 'switcher', |
| 134 |
'title' => __('Pagespeed Insights', WP_ADMINIFY_TD), |
| 135 |
'subtitle' => __('Analyze Google Pagespeed from Dashboard', WP_ADMINIFY_TD), |
| 136 |
'text_on' => __('Enabled', WP_ADMINIFY_TD), |
| 137 |
'text_off' => __('Disabled', WP_ADMINIFY_TD), |
| 138 |
'text_width' => 100, |
| 139 |
'default' => $this->get_default_field('pagespeed_insights'), |
| 140 |
); |
| 141 |
|
| 142 |
$modules_fields[] = array( |
| 143 |
'id' => 'custom_css_js', |
| 144 |
'type' => 'switcher', |
| 145 |
'title' => __('Header/Footer Scripts', WP_ADMINIFY_TD), |
| 146 |
'subtitle' => __('Inject Custom CSS/JS on Header or Footer', WP_ADMINIFY_TD), |
| 147 |
'text_on' => __('Enabled', WP_ADMINIFY_TD), |
| 148 |
'text_off' => __('Disabled', WP_ADMINIFY_TD), |
| 149 |
'text_width' => 100, |
| 150 |
'default' => $this->get_default_field('custom_css_js'), |
| 151 |
); |
| 152 |
|
| 153 |
$modules_fields[] = array( |
| 154 |
'id' => 'quick_menu', |
| 155 |
'type' => 'switcher', |
| 156 |
'title' => __('Quick Menu', WP_ADMINIFY_TD), |
| 157 |
'subtitle' => __('Quick Menu for navigating quickly', WP_ADMINIFY_TD), |
| 158 |
'text_on' => __('Enabled', WP_ADMINIFY_TD), |
| 159 |
'text_off' => __('Disabled', WP_ADMINIFY_TD), |
| 160 |
'text_width' => 100, |
| 161 |
'default' => $this->get_default_field('quick_menu'), |
| 162 |
); |
| 163 |
|
| 164 |
$modules_fields[] = array( |
| 165 |
'id' => 'menu_duplicator', |
| 166 |
'type' => 'switcher', |
| 167 |
'title' => __('Menu Duplicator', WP_ADMINIFY_TD), |
| 168 |
'subtitle' => __('Duplicate menu and Nav menu items also', WP_ADMINIFY_TD), |
| 169 |
'text_on' => __('Enabled', WP_ADMINIFY_TD), |
| 170 |
'text_off' => __('Disabled', WP_ADMINIFY_TD), |
| 171 |
'text_width' => 100, |
| 172 |
'default' => $this->get_default_field('menu_duplicator'), |
| 173 |
); |
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
$modules_fields[] = array( |
| 178 |
'id' => 'notification_bar', |
| 179 |
'type' => 'switcher', |
| 180 |
'title' => __('Notification Bar', WP_ADMINIFY_TD), |
| 181 |
'subtitle' => __('Cookie Notice, Promotional Bar on frontend', WP_ADMINIFY_TD), |
| 182 |
'text_on' => __('Enabled', WP_ADMINIFY_TD), |
| 183 |
'text_off' => __('Disabled', WP_ADMINIFY_TD), |
| 184 |
'text_width' => 100, |
| 185 |
'default' => $this->get_default_field('notification_bar'), |
| 186 |
); |
| 187 |
|
| 188 |
$modules_fields[] = array( |
| 189 |
'id' => 'activity_logs', |
| 190 |
'type' => 'switcher', |
| 191 |
'title' => __('Activity Logs', WP_ADMINIFY_TD), |
| 192 |
'subtitle' => __('Security check for all users Activity', WP_ADMINIFY_TD), |
| 193 |
'text_on' => __('Enabled', WP_ADMINIFY_TD), |
| 194 |
'text_off' => __('Disabled', WP_ADMINIFY_TD), |
| 195 |
'text_width' => 100, |
| 196 |
'default' => $this->get_default_field('activity_logs'), |
| 197 |
); |
| 198 |
|
| 199 |
$modules_fields[] = array( |
| 200 |
'id' => 'post_duplicator', |
| 201 |
'type' => 'switcher', |
| 202 |
'title' => __('Post Duplicator', WP_ADMINIFY_TD), |
| 203 |
'subtitle' => __('Duplicate Post/Page and any Custom Post Type', WP_ADMINIFY_TD), |
| 204 |
'text_on' => __('Enabled', WP_ADMINIFY_TD), |
| 205 |
'text_off' => __('Disabled', WP_ADMINIFY_TD), |
| 206 |
'text_width' => 100, |
| 207 |
'default' => $this->get_default_field('post_duplicator'), |
| 208 |
); |
| 209 |
|
| 210 |
$modules_fields[] = array( |
| 211 |
'id' => 'admin_pages', |
| 212 |
'type' => 'switcher', |
| 213 |
'title' => __('Admin Pages', WP_ADMINIFY_TD), |
| 214 |
'subtitle' => __('Custom Admin Pages hooks on Top/Sub Menu', WP_ADMINIFY_TD), |
| 215 |
'text_on' => __('Enabled', WP_ADMINIFY_TD), |
| 216 |
'text_off' => __('Disabled', WP_ADMINIFY_TD), |
| 217 |
'text_width' => 100, |
| 218 |
'default' => $this->get_default_field('admin_pages'), |
| 219 |
); |
| 220 |
|
| 221 |
|
| 222 |
$modules_fields[] = array( |
| 223 |
'id' => 'sidebar_generator', |
| 224 |
'type' => 'switcher', |
| 225 |
'title' => __('Sidebar Generator', WP_ADMINIFY_TD), |
| 226 |
'subtitle' => __('Create Custom Sidebar Widgets', WP_ADMINIFY_TD), |
| 227 |
'text_on' => __('Enabled', WP_ADMINIFY_TD), |
| 228 |
'text_off' => __('Disabled', WP_ADMINIFY_TD), |
| 229 |
'text_width' => 100, |
| 230 |
'default' => $this->get_default_field('sidebar_generator'), |
| 231 |
); |
| 232 |
|
| 233 |
$modules_fields[] = array( |
| 234 |
'id' => 'post_types_order', |
| 235 |
'type' => 'switcher', |
| 236 |
'title' => __('Post Types Order', WP_ADMINIFY_TD), |
| 237 |
'subtitle' => __('Post Types and Taxonomy Order', WP_ADMINIFY_TD), |
| 238 |
'text_on' => __('Enabled', WP_ADMINIFY_TD), |
| 239 |
'text_off' => __('Disabled', WP_ADMINIFY_TD), |
| 240 |
'text_width' => 100, |
| 241 |
'default' => $this->get_default_field('post_types_order'), |
| 242 |
); |
| 243 |
|
| 244 |
|
| 245 |
$modules_fields[] = array( |
| 246 |
'id' => 'server_info', |
| 247 |
'type' => 'switcher', |
| 248 |
'title' => __('Server Info', WP_ADMINIFY_TD), |
| 249 |
'subtitle' => __('Server Info menu Module', WP_ADMINIFY_TD), |
| 250 |
'text_on' => __('Enabled', WP_ADMINIFY_TD), |
| 251 |
'text_off' => __('Disabled', WP_ADMINIFY_TD), |
| 252 |
'text_width' => 100, |
| 253 |
'default' => $this->get_default_field('server_info'), |
| 254 |
); |
| 255 |
|
| 256 |
$modules_fields[] = array( |
| 257 |
'id' => 'disable_comments', |
| 258 |
'type' => 'switcher', |
| 259 |
'title' => __('Disable Comments', WP_ADMINIFY_TD), |
| 260 |
'subtitle' => __('Disable Comments for Post/Pages/Post Types etc', WP_ADMINIFY_TD), |
| 261 |
'text_on' => __('Enabled', WP_ADMINIFY_TD), |
| 262 |
'text_off' => __('Disabled', WP_ADMINIFY_TD), |
| 263 |
'text_width' => 100, |
| 264 |
'default' => $this->get_default_field('disable_comments'), |
| 265 |
); |
| 266 |
} |
| 267 |
|
| 268 |
public function jltwp_adminify_general_options() |
| 269 |
{ |
| 270 |
if (!class_exists('ADMINIFY')) { |
| 271 |
return; |
| 272 |
} |
| 273 |
|
| 274 |
$modules_fields = []; |
| 275 |
$this->module_fields($modules_fields); |
| 276 |
|
| 277 |
// Modules Section |
| 278 |
\ADMINIFY::createSection($this->prefix, array( |
| 279 |
'title' => __('Modules', WP_ADMINIFY_TD), |
| 280 |
'icon' => 'fas fa-layer-group', |
| 281 |
'class' => 'wp-adminify-two-columns aminify-title-width-65', |
| 282 |
'fields' => $modules_fields |
| 283 |
)); |
| 284 |
} |
| 285 |
} |
| 286 |
} |
| 287 |
|