API
2 days ago
Admin
2 weeks ago
Ajax
2 days ago
ExportImport
2 days ago
FormValidator
2 months ago
Frontend
2 days ago
Manager
1 week ago
API.php
2 days ago
Admin.php
2 months ago
Ajax.php
2 days ago
Apps.php
2 weeks ago
ContentManager.php
2 months ago
DbQueryUtils.php
2 months ago
ElementVisibilityConditions.php
2 months ago
Frontend.php
2 months ago
HelperFunctions.php
2 days ago
KirkiBase.php
2 weeks ago
PostsQueryUtils.php
2 months ago
Staging.php
2 days ago
View.php
1 month ago
KirkiBase.php
87 lines
| 1 | <?php |
| 2 | |
| 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | exit; |
| 5 | } |
| 6 | |
| 7 | use Kirki\Ajax; |
| 8 | use Kirki\API; |
| 9 | use Kirki\Apps; |
| 10 | use Kirki\ContentManager; |
| 11 | use Kirki\Customizer; |
| 12 | use Kirki\ElementVisibilityConditions; |
| 13 | use Kirki\HelperFunctions; |
| 14 | use Kirki\Manager\PluginActiveEvents; |
| 15 | use Kirki\Manager\PluginDeactivateEvents; |
| 16 | use Kirki\Manager\PluginInitEvents; |
| 17 | use Kirki\Manager\PluginLoadedEvents; |
| 18 | use Kirki\Manager\PluginShortcode; |
| 19 | |
| 20 | if ( ! class_exists( 'KirkiBase' ) ) { |
| 21 | abstract class KirkiBase { |
| 22 | /** |
| 23 | * Class constructor |
| 24 | */ |
| 25 | protected function __construct() { |
| 26 | $current_limit = ini_get( 'memory_limit' ); |
| 27 | if ( HelperFunctions::convertToBytes( $current_limit ) < 512 * 1024 * 1024 ) { |
| 28 | if ( function_exists( 'wp_raise_memory_limit' ) ) { |
| 29 | wp_raise_memory_limit( '512M' ); |
| 30 | } |
| 31 | } |
| 32 | register_activation_hook( $this->get_plugin_file(), array( $this, 'activate' ) ); |
| 33 | register_deactivation_hook( $this->get_plugin_file(), array( $this, 'deactivate' ) ); |
| 34 | add_action( 'init', array( $this, 'plugin_init' ) ); |
| 35 | new PluginLoadedEvents(); |
| 36 | new PluginInitEvents(); |
| 37 | new PluginShortcode(); |
| 38 | |
| 39 | |
| 40 | Customizer::init(); |
| 41 | } |
| 42 | |
| 43 | protected static $instance = false; |
| 44 | /** |
| 45 | * Initializes a singleton instance |
| 46 | * |
| 47 | * @return static |
| 48 | */ |
| 49 | public static function init() { |
| 50 | |
| 51 | if ( ! self::$instance ) { |
| 52 | self::$instance = new static(); |
| 53 | } |
| 54 | |
| 55 | new Ajax(); |
| 56 | new API(); |
| 57 | new ContentManager(); |
| 58 | new ElementVisibilityConditions(); |
| 59 | |
| 60 | return self::$instance; |
| 61 | } |
| 62 | |
| 63 | public function plugin_init() { |
| 64 | new Apps(); |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Do stuff upon plugin activation |
| 69 | * |
| 70 | * @return void |
| 71 | */ |
| 72 | public function activate() { |
| 73 | new PluginActiveEvents(); |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Do stuff upon plugin deactivation |
| 78 | * |
| 79 | * @return void |
| 80 | */ |
| 81 | public function deactivate() { |
| 82 | new PluginDeactivateEvents(); |
| 83 | } |
| 84 | |
| 85 | } |
| 86 | } |
| 87 |