styles-fix.php
58 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Fix admin styles & TinyMCE editor |
| 4 | * |
| 5 | * @author Mobin Ghasempoor |
| 6 | * @package WP-Parsidate |
| 7 | * @subpackage Admin/Styles |
| 8 | */ |
| 9 | |
| 10 | /** |
| 11 | * Fixes themes and plugins RTL style, they should be LTR |
| 12 | * |
| 13 | * @since 2.0 |
| 14 | * @return void |
| 15 | */ |
| 16 | function wpp_fix_editor_rtl() |
| 17 | { |
| 18 | wp_enqueue_style('functions', WP_PARSI_URL . 'assets/css/admin-fix.css', false, WP_PARSI_VER, 'all'); |
| 19 | } |
| 20 | |
| 21 | add_action('admin_print_styles-plugin-editor.php', 'wpp_fix_editor_rtl', 10); |
| 22 | add_action('admin_print_styles-theme-editor.php', 'wpp_fix_editor_rtl', 10); |
| 23 | |
| 24 | /** |
| 25 | * Fixes TinyMCE font |
| 26 | * |
| 27 | * @since 2.0 |
| 28 | * @return void |
| 29 | */ |
| 30 | function wpp_fix_tinymce_font() |
| 31 | { |
| 32 | global $wpp_settings; |
| 33 | |
| 34 | add_editor_style(WP_PARSI_URL . 'assets/css/editor.css'); |
| 35 | if (isset($wpp_settings['droidsans_editor']) && $wpp_settings['droidsans_editor'] != 'disable') { |
| 36 | add_editor_style(WP_PARSI_URL . 'assets/css/editor-font.css'); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | add_filter('init', 'wpp_fix_tinymce_font', 9); |
| 41 | |
| 42 | /** |
| 43 | * Style for whole Admin side |
| 44 | * |
| 45 | * @since 2.1.5 |
| 46 | * @return void |
| 47 | */ |
| 48 | function wpp_enqueue_admin() |
| 49 | { |
| 50 | global $wpp_settings; |
| 51 | |
| 52 | if (!isset($wpp_settings['droidsans_admin']) || $wpp_settings['droidsans_admin'] != 'disable') { |
| 53 | wp_enqueue_style('wp-parsi-fonts', WP_PARSI_URL . 'assets/css/admin-fonts.css', false, WP_PARSI_VER, 'all'); |
| 54 | wp_enqueue_style('wp-parsi-admin', WP_PARSI_URL . 'assets/css/admin-styles.css', false, WP_PARSI_VER, 'all'); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | add_action('admin_enqueue_scripts', 'wpp_enqueue_admin'); |