| 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 Custom_CSS_JS_Admin_Area extends AdminSettingsModel { |
| 13 |
|
| 14 |
public function __construct() { |
| 15 |
$this->general_post_settings(); |
| 16 |
} |
| 17 |
|
| 18 |
public function get_defaults() { |
| 19 |
return [ |
| 20 |
'custom_css' => '', |
| 21 |
'custom_js' => '', |
| 22 |
]; |
| 23 |
} |
| 24 |
|
| 25 |
|
| 26 |
/** |
| 27 |
* Post Status Columns |
| 28 |
*/ |
| 29 |
|
| 30 |
public function custom_css_js_fields( &$fields ) { |
| 31 |
$fields[] = array( |
| 32 |
'type' => 'subheading', |
| 33 |
'content' => Utils::adminfiy_help_urls( |
| 34 |
__( 'Custom CSS/JS Settings', 'adminify' ), |
| 35 |
'https://wpadminify.com/kb/wp-adminify-options-panel/#custom-css-js', |
| 36 |
'https://www.youtube.com/playlist?list=PLqpMw0NsHXV-EKj9Xm1DMGa6FGniHHly8', |
| 37 |
'https://www.facebook.com/groups/jeweltheme', |
| 38 |
'https://wpadminify.com/support/' |
| 39 |
), |
| 40 |
); |
| 41 |
|
| 42 |
$fields[] = array( |
| 43 |
'id' => 'custom_css', |
| 44 |
'type' => 'code_editor', |
| 45 |
'title' => __( 'Custom CSS (Admin Area)', 'adminify' ), |
| 46 |
'subtitle' => __( 'Write your own <strong>Custom CSS</strong> for WordPress Admin.', 'adminify' ), |
| 47 |
'desc' => __( 'Don\'t place <style></style> tag inside editor.', 'adminify' ), |
| 48 |
'settings' => array( |
| 49 |
'theme' => 'monokai', |
| 50 |
'mode' => 'css', |
| 51 |
), |
| 52 |
'sanitize' => false, |
| 53 |
'default' => $this->get_default_field( 'custom_css' ), |
| 54 |
); |
| 55 |
|
| 56 |
$fields[] = array( |
| 57 |
'id' => 'custom_js', |
| 58 |
'type' => 'code_editor', |
| 59 |
'title' => __( 'Custom JavaScript (Admin Area)', 'adminify' ), |
| 60 |
'subtitle' => __( 'Write your own <strong>Custom Script</strong> for WordPress Admin.', 'adminify' ), |
| 61 |
'desc' => __( 'Don\'t place <script></script> tag inside editor.', 'adminify' ), |
| 62 |
'settings' => array( |
| 63 |
'theme' => 'dracula', |
| 64 |
'mode' => 'javascript', |
| 65 |
), |
| 66 |
'sanitize' => false, |
| 67 |
'default' => $this->get_default_field( 'custom_js' ), |
| 68 |
); |
| 69 |
} |
| 70 |
|
| 71 |
public function general_post_settings() { |
| 72 |
if ( ! class_exists( 'ADMINIFY' ) ) { |
| 73 |
return; |
| 74 |
} |
| 75 |
|
| 76 |
$fields = array(); |
| 77 |
$this->custom_css_js_fields( $fields ); |
| 78 |
|
| 79 |
// Custom CSS Settings |
| 80 |
\ADMINIFY::createSection( |
| 81 |
$this->prefix, |
| 82 |
array( |
| 83 |
'title' => __( 'Custom CSS/JS', 'adminify' ), |
| 84 |
'icon' => 'fas fa-code', |
| 85 |
'fields' => $fields, |
| 86 |
) |
| 87 |
); |
| 88 |
} |
| 89 |
} |
| 90 |
|