widget-google-reviews
Last commit date
assets
2 years ago
build
2 years ago
includes
2 years ago
languages
2 years ago
autoloader.php
4 years ago
block.json
2 years ago
grw.php
2 years ago
index.php
4 years ago
readme.txt
2 years ago
autoloader.php
34 lines
| 1 | <?php |
| 2 | |
| 3 | if (!defined('ABSPATH')) { |
| 4 | exit; |
| 5 | } |
| 6 | |
| 7 | spl_autoload_register(function ($filename) { |
| 8 | |
| 9 | $file_path = explode('\\', $filename); |
| 10 | |
| 11 | if (isset($file_path[count($file_path) - 1 ])) { |
| 12 | $class_file = strtolower( |
| 13 | $file_path[count($file_path) - 1] |
| 14 | ); |
| 15 | |
| 16 | $class_file = str_ireplace('_', '-', $class_file); |
| 17 | $class_file = "class-$class_file.php"; |
| 18 | } |
| 19 | |
| 20 | $fully_qualified_path = trailingslashit( |
| 21 | dirname(__FILE__) |
| 22 | ); |
| 23 | |
| 24 | for ($i = 1; $i < count($file_path) - 1; $i ++) { |
| 25 | $dir = strtolower($file_path[$i]); |
| 26 | $dir = str_ireplace('_', '-', $dir); |
| 27 | $fully_qualified_path .= trailingslashit($dir); |
| 28 | } |
| 29 | $fully_qualified_path .= $class_file; |
| 30 | |
| 31 | if (file_exists($fully_qualified_path)) { |
| 32 | include_once($fully_qualified_path); |
| 33 | } |
| 34 | }); |