datepicker-rtl.php
4 years ago
gutenberg-jalali-calendar.php
4 years ago
lists-fix.php
4 years ago
styles-fix.php
4 years ago
widgets.php
4 years ago
gutenberg-jalali-calendar.php
62 lines
| 1 | <?php |
| 2 | |
| 3 | defined( 'ABSPATH' ) or exit( 'No direct script access allowed' ); |
| 4 | |
| 5 | /** |
| 6 | * Gutenberg Jalali Calendar |
| 7 | * |
| 8 | * This package, will add a Jalali calendar to WordPress Gutenberg editor |
| 9 | * introduced from version v5.0. |
| 10 | * |
| 11 | * @author Alireza Dabiri Nejad / Alirdn |
| 12 | * @package WP-Parsidate |
| 13 | * @subpackage Admin/Gutenber_Jalali_Calendar |
| 14 | */ |
| 15 | |
| 16 | /** |
| 17 | * Enqueue Gutenberg Jalali Calendar assets for backend editor. |
| 18 | * |
| 19 | * @uses {wp-plugins} |
| 20 | * @uses {wp-i18n} to internationalize the block's text. |
| 21 | * @uses {wp-compose} |
| 22 | * @uses {wp-components} |
| 23 | * @uses {wp-element} for WP Element abstraction — structure of blocks. |
| 24 | * @uses {wp-editor} for WP editor styles. |
| 25 | * @uses {wp-edit-post} to internationalize the block's text. |
| 26 | * @uses {wp-data} |
| 27 | * @uses {wp-date} |
| 28 | * @since 3.0.0 |
| 29 | */ |
| 30 | if ( ! function_exists( 'wpp_gutenberg_jalali_calendar_editor_assets' ) ) { |
| 31 | function wpp_gutenberg_jalali_calendar_editor_assets() { |
| 32 | wp_enqueue_script( |
| 33 | 'wpp_gutenberg_jalali_calendar_editor_scripts', |
| 34 | WP_PARSI_URL . 'assets/js/gutenberg-jalali-calendar.build.js', |
| 35 | array( |
| 36 | 'wp-plugins', |
| 37 | 'wp-i18n', |
| 38 | 'wp-compose', |
| 39 | 'wp-components', |
| 40 | 'wp-element', |
| 41 | 'wp-editor', |
| 42 | 'wp-edit-post', |
| 43 | 'wp-data', |
| 44 | 'wp-date' |
| 45 | ), |
| 46 | true |
| 47 | ); |
| 48 | |
| 49 | // Styles. |
| 50 | wp_enqueue_style( |
| 51 | 'wpp_gutenberg_jalali_calendar_editor_styles', |
| 52 | WP_PARSI_URL . 'assets/css/gutenberg-jalali-calendar.build.css', |
| 53 | array( 'wp-edit-blocks' ) |
| 54 | ); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | // Hook: Editor assets. |
| 59 | if ( version_compare( get_bloginfo( 'version' ), '5.0.0', '>=' ) && wpp_is_active( 'persian_date' ) ) { |
| 60 | add_action( 'enqueue_block_editor_assets', 'wpp_gutenberg_jalali_calendar_editor_assets' ); |
| 61 | } |
| 62 |