wp-social
Last commit date
app
3 years ago
assets
3 years ago
base
5 years ago
helper
3 years ago
inc
3 years ago
languages
3 years ago
lib
3 years ago
template
3 years ago
traits
5 years ago
xs_migration
3 years ago
autoload.php
5 years ago
instruction.txt
4 years ago
keys.php
4 years ago
phpcs.xml
3 years ago
plugin.php
4 years ago
readme.txt
2 years ago
wp-social.php
3 years ago
autoload.php
85 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WP_Social; |
| 4 | |
| 5 | defined('ABSPATH') || exit; |
| 6 | |
| 7 | /** |
| 8 | * autoloader. |
| 9 | * Handles dynamically loading classes only when needed. |
| 10 | * |
| 11 | * @since 1.0.0 |
| 12 | */ |
| 13 | class Autoloader { |
| 14 | |
| 15 | /** |
| 16 | * Run autoloader. |
| 17 | * Register a function as `__autoload()` implementation. |
| 18 | * |
| 19 | * @since 1.0.0 |
| 20 | * @access public |
| 21 | */ |
| 22 | public static function run() { |
| 23 | spl_autoload_register([__CLASS__, 'autoload']); |
| 24 | } |
| 25 | |
| 26 | |
| 27 | /** |
| 28 | * Autoload. |
| 29 | * For a given class, check if it exist and load it. |
| 30 | * |
| 31 | * @since 1.0.0 |
| 32 | * @access private |
| 33 | * |
| 34 | * @param string $class Class name. |
| 35 | */ |
| 36 | private static function autoload($class_name) { |
| 37 | |
| 38 | // If the class being requested does not start with our prefix |
| 39 | // we know it's not one in our project. |
| 40 | if(0 !== strpos($class_name, __NAMESPACE__)) { |
| 41 | return; |
| 42 | } |
| 43 | |
| 44 | |
| 45 | $file_name = strtolower( |
| 46 | preg_replace( |
| 47 | ['/\b' . __NAMESPACE__ . '\\\/', '/([a-z])([A-Z])/', '/_/', '/\\\/'], |
| 48 | ['', '$1-$2', '-', DIRECTORY_SEPARATOR], |
| 49 | $class_name |
| 50 | ) |
| 51 | ); |
| 52 | |
| 53 | // Compile our path from the corosponding location. |
| 54 | $file = plugin_dir_path(__FILE__) . $file_name . '.php'; |
| 55 | |
| 56 | // If a file is found. |
| 57 | if(file_exists($file)) { |
| 58 | // Then load it up! |
| 59 | require_once($file); |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | |
| 65 | |
| 66 | require(WSLU_LOGIN_PLUGIN.'/lib/composer/vendor/autoload.php'); |
| 67 | |
| 68 | Autoloader::run(); |
| 69 | |
| 70 | // Include user custom function |
| 71 | require_once(WSLU_LOGIN_PLUGIN.'/inc/admin-custom-function.php'); |
| 72 | |
| 73 | require_once(WSLU_LOGIN_PLUGIN.'/inc/admin-social-button.php'); |
| 74 | |
| 75 | require_once(WSLU_LOGIN_PLUGIN.'/inc/admin-create-shortcode.php'); |
| 76 | |
| 77 | require_once(WSLU_LOGIN_PLUGIN.'/inc/admin-rest-api.php'); |
| 78 | |
| 79 | require_once(WSLU_LOGIN_PLUGIN.'lib/counter/counters-api.php'); |
| 80 | |
| 81 | |
| 82 | // elementor plugin |
| 83 | require_once(WSLU_LOGIN_PLUGIN.'/inc/elementor/elements.php'); // namespace different but easy to change - just need to find the references |
| 84 | |
| 85 |