Server IP : 104.21.93.192 / Your IP : 216.73.216.84 Web Server : LiteSpeed System : Linux premium900.web-hosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 User : redwjova ( 1790) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/redwjova/clevorio.com/wp-content/plugins/smartmag-core/lib/ |
Upload File : |
<?php /** * Initialize widgets from the plugin with a fallback path to theme if set. * * @package Bunyad */ class Bunyad_Widgets { public $active = []; public $path = ''; public $prefix = 'Bunyad_'; public function __construct() { add_action('widgets_init', array($this, 'setup')); } /** * Initialize the widgets */ public function setup() { $widgets = apply_filters('bunyad_active_widgets', $this->active); // Activate widgets foreach ($widgets as $widget) { $file = $this->path . 'widgets/widget-'. sanitize_file_name($widget) .'.php'; // Try from theme if widget file doesn't exist in specified path. if (!file_exists($file)) { $file = locate_template('inc/widgets/widget-'. sanitize_file_name($widget) .'.php'); } $class = $this->prefix. implode('', array_map('ucfirst', explode('-', $widget))); // Skip if already included or if file is missing. if (class_exists($class) OR !file_exists($file)) { continue; } // Include the widget class require_once $file; // Escaped above. if (!class_exists($class)) { continue; } /** * Use register widget method of the Bunyad_XYZ_Widget class if available. * Fallback to register_widget. * * @see register_widget() */ if (method_exists($class, 'register_widget')) { $caller = new $class; $caller->register_widget(); } else { register_widget($class); } } } }