action
1 month ago
adapter
1 month ago
api
1 month ago
archive
1 month ago
availability
1 month ago
backup
1 month ago
banking
1 month ago
calendar
1 month ago
cart
1 month ago
cartpack
1 month ago
config
1 month ago
controllers
1 month ago
cron
1 month ago
crypt
1 month ago
currency
1 month ago
customfields
1 month ago
employee
1 month ago
event
1 month ago
helpers
1 month ago
html
1 month ago
http
1 month ago
ical
1 month ago
image
1 month ago
import
1 month ago
invoice
1 month ago
language
1 month ago
loader
1 month ago
mail
1 month ago
menu
1 month ago
models
1 month ago
mvc
1 month ago
order
1 month ago
payment
1 month ago
sef
1 month ago
statistics
1 month ago
system
1 month ago
tax
1 month ago
update
1 month ago
vendor
1 month ago
view
1 month ago
webhook
1 month ago
widget
1 month ago
wizard
1 month ago
worktime
1 month ago
autoload.php
1 month ago
composer.json
1 month ago
defines.php
1 month ago
index.html
1 month ago
autoload.php
116 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package VikAppointments |
| 4 | * @subpackage core |
| 5 | * @author E4J s.r.l. |
| 6 | * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved. |
| 7 | * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL |
| 8 | * @link https://vikwp.com |
| 9 | */ |
| 10 | |
| 11 | // No direct access |
| 12 | defined('ABSPATH') or die('No script kiddies please!'); |
| 13 | |
| 14 | // require only once the file containing all the defines |
| 15 | require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'defines.php'; |
| 16 | |
| 17 | // if VAPLoader does not exist, include it |
| 18 | if (!class_exists('VAPLoader')) |
| 19 | { |
| 20 | include VAPLIB . DIRECTORY_SEPARATOR . 'loader' . DIRECTORY_SEPARATOR . 'loader.php'; |
| 21 | // append helpers folder to the base path |
| 22 | VAPLoader::$base .= DIRECTORY_SEPARATOR . 'helpers'; |
| 23 | } |
| 24 | |
| 25 | // fix filenames with dots |
| 26 | VAPLoader::registerAlias('lib.vikappointments', 'lib_vikappointments'); |
| 27 | |
| 28 | // load factory |
| 29 | VAPLoader::import('libraries.system.factory'); |
| 30 | VAPLoader::import('libraries.system.error'); |
| 31 | |
| 32 | // load adapters |
| 33 | VAPLoader::import('libraries.adapter.version.listener'); |
| 34 | VAPLoader::import('libraries.adapter.application'); |
| 35 | VAPLoader::import('libraries.adapter.bc'); |
| 36 | |
| 37 | // load mvc |
| 38 | VAPLoader::import('libraries.mvc.controller'); |
| 39 | VAPLoader::import('libraries.mvc.table'); |
| 40 | VAPLoader::import('libraries.mvc.view'); |
| 41 | VAPLoader::import('libraries.mvc.model'); |
| 42 | |
| 43 | // load dependencies |
| 44 | VAPLoader::import('libraries.employee.auth'); |
| 45 | VAPLoader::import('libraries.helpers.date'); |
| 46 | VAPLoader::import('libraries.models.customfields'); |
| 47 | VAPLoader::import('libraries.models.locations'); |
| 48 | VAPLoader::import('libraries.models.orderstatus'); |
| 49 | VAPLoader::import('libraries.models.specialrates'); |
| 50 | |
| 51 | // load component helper |
| 52 | VAPLoader::import('lib_vikappointments'); |
| 53 | |
| 54 | $app = JFactory::getApplication(); |
| 55 | |
| 56 | // configure HTML helpers |
| 57 | if ($app->isClient('administrator')) |
| 58 | { |
| 59 | JHtml::addIncludePath(VAPADMIN . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'html'); |
| 60 | } |
| 61 | |
| 62 | if ($app->isClient('site') || $app->input->get('option') !== 'com_vikappointments') |
| 63 | { |
| 64 | // load admin models for front-end client or if we are outside the component |
| 65 | JModelLegacy::addIncludePath(VAPADMIN . DIRECTORY_SEPARATOR . 'models', 'VikAppointmentsModel'); |
| 66 | } |
| 67 | |
| 68 | JTable::addIncludePath(VAPADMIN . DIRECTORY_SEPARATOR . 'tables'); |
| 69 | JHtml::addIncludePath(VAPLIB . DIRECTORY_SEPARATOR . 'html'); |
| 70 | |
| 71 | /** |
| 72 | * Classes autoloader. |
| 73 | * |
| 74 | * The following class "VAPFooBarBaz" will be |
| 75 | * loaded from "site/helpers/libraries/foo/bar/baz.php". |
| 76 | * |
| 77 | * @since 1.7.3 |
| 78 | */ |
| 79 | spl_autoload_register(function($class) |
| 80 | { |
| 81 | $prefix = 'VAP'; |
| 82 | |
| 83 | if (strpos($class, $prefix) !== 0) |
| 84 | { |
| 85 | // ignore if we are loading an outsider |
| 86 | return false; |
| 87 | } |
| 88 | |
| 89 | // remove prefix from class |
| 90 | $tmp = preg_replace("/^{$prefix}/", '', $class); |
| 91 | // separate camel-case intersections |
| 92 | $tmp = preg_replace("/([a-z0-9])([A-Z])/", addslashes('$1' . DIRECTORY_SEPARATOR . '$2'), $tmp); |
| 93 | |
| 94 | // build path from which the class should be loaded |
| 95 | $path = dirname(__FILE__) . DIRECTORY_SEPARATOR . strtolower($tmp) . '.php'; |
| 96 | |
| 97 | // make sure the file exists |
| 98 | if (is_file($path)) |
| 99 | { |
| 100 | // include file and check if the class is now available |
| 101 | if ((include_once $path) && (class_exists($class) || interface_exists($class) || trait_exists($class))) |
| 102 | { |
| 103 | return true; |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | return false; |
| 108 | }); |
| 109 | |
| 110 | /** |
| 111 | * Composer autoloader. |
| 112 | * |
| 113 | * @since 1.7.3 |
| 114 | */ |
| 115 | VAPLoader::import('libraries.vendor.autoload'); |
| 116 |