| Server IP : 185.143.234.238 / Your IP : 185.215.232.195 Web Server : LiteSpeed System : Linux saman.shetabanhost.com 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64 User : behrakir ( 1361) PHP Version : 8.1.34 Disable Function : symlink,shell_exec,show_source,exec,popen,system,passthru,proc_open,proc_close,pcntl_exec,mail MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/behrakir/tabfood.ir/wp-content/plugins/charitious-assistance/ |
Upload File : |
<?php
class Widget_Includes
{
public static $classprefix = 'Charitious';
public static $root_dir = XS_PLUGIN_DIR . 'widgets/';
// include widgets
// ----------------------------------------------------------------------------------------
public static function _action_widgets_init()
{
self::include_widget('recent-post');
self::include_widget('social');
}
// include and register widgets
// ----------------------------------------------------------------------------------------
public static function include_widget($widget_dir)
{
include self::$root_dir . $widget_dir . '/class-widget-' . $widget_dir . '.php';
register_widget(self::$classprefix . '_' . self::dirname_to_classname($widget_dir));
}
// auto load
// ----------------------------------------------------------------------------------------
public static function init()
{
add_action('widgets_init', array(__CLASS__, '_action_widgets_init'));
}
// directory name to class name, transform dynamically
// ----------------------------------------------------------------------------------------
private static function dirname_to_classname($dirname)
{
$class_name = explode('-', $dirname);
$class_name = array_map('ucfirst', $class_name);
$class_name = implode('_', $class_name);
return $class_name;
}
}
Widget_Includes::init();