| @@ -1,0 +1,68 @@ | ||
| 1 | +<?php | |
| 2 | + | |
| 3 | +defined('ABSPATH') || die('Restricted Access'); | |
| 4 | + | |
| 5 | +// Front-end breadcrumb for Joomla | |
| 6 | +function acym_addBreadcrumb(string $title, string $link = ''): void | |
| 7 | +{ | |
| 8 | +} | |
| 9 | + | |
| 10 | +// Page title modification for Joomla | |
| 11 | +function acym_setPageTitle(string $title): void | |
| 12 | +{ | |
| 13 | +} | |
| 14 | + | |
| 15 | +function acym_isLeftMenuNecessary(): bool | |
| 16 | +{ | |
| 17 | + // Already one in WP | |
| 18 | + return false; | |
| 19 | +} | |
| 20 | + | |
| 21 | +function acym_isPluginActive(string $plugin, string $family = 'system'): bool | |
| 22 | +{ | |
| 23 | + return true; | |
| 24 | +} | |
| 25 | + | |
| 26 | +function acym_disableCmsEditor(): void | |
| 27 | +{ | |
| 28 | + add_filter( | |
| 29 | + 'user_can_richedit', | |
| 30 | + function ($a) { | |
| 31 | + return false; | |
| 32 | + }, | |
| 33 | + 50 | |
| 34 | + ); | |
| 35 | +} | |
| 36 | + | |
| 37 | +function acym_isElementorEdition(): bool | |
| 38 | +{ | |
| 39 | + global $post; | |
| 40 | + | |
| 41 | + if (empty($post) || !class_exists('\\Elementor\\Plugin')) return false; | |
| 42 | + | |
| 43 | + return \Elementor\Plugin::$instance->db->is_built_with_elementor($post->ID); | |
| 44 | +} | |
| 45 | + | |
| 46 | +function acym_scheduleTask(array $options, int $taskId = 0): ?int | |
| 47 | +{ | |
| 48 | + if (wp_next_scheduled($options['name'])) { | |
| 49 | + return 1; | |
| 50 | + } | |
| 51 | + | |
| 52 | + return true === wp_schedule_event(time(), $options['taskFrequency'], $options['name']) ? 1 : 0; | |
| 53 | +} | |
| 54 | + | |
| 55 | +function acym_deleteScheduledTask(array $options): bool | |
| 56 | +{ | |
| 57 | + $timestamp = wp_next_scheduled($options['name']); | |
| 58 | + if ($timestamp) { | |
| 59 | + return true === wp_unschedule_event($timestamp, $options['name']); | |
| 60 | + } | |
| 61 | + | |
| 62 | + return true; | |
| 63 | +} | |
| 64 | + | |
| 65 | +function acym_rand(int $min, int $max): int | |
| 66 | +{ | |
| 67 | + return wp_rand($min, $max); | |
| 68 | +} | |