本文整理汇总了PHP中XenForo_Autoloader::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Autoloader::getInstance方法的具体用法?PHP XenForo_Autoloader::getInstance怎么用?PHP XenForo_Autoloader::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Autoloader
的用法示例。
在下文中一共展示了XenForo_Autoloader::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getExtension
/**
* Used as a shortcut to have all classes in a directory extend.
* For example if a class XenPlus_Extend_Model_User existed and this was called with getExtension($className, 'XenPlus_Extend_')
* then it would return true when XenForo_Model_User is called, then you could add it to $extend in your listener.
*
* @param string $className
* @param string $prefix
* @param string $replace
* @return mixed false if no class, string of new class if it exists
*/
public function getExtension($className, $prefix = '', $replace = 'XenForo_')
{
$className = $prefix . $className;
if ($replace) {
$className = str_replace($replace, '', $className);
}
$filename = XenForo_Autoloader::getInstance()->autoloaderClassToFile($className);
return $filename && file_exists($filename) ? $className : false;
}
示例2: __construct
public function __construct($root = XF_ROOT)
{
$startTime = microtime(true);
$fileDir = $root;
require $fileDir . '/library/XenForo/Autoloader.php';
XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');
XenForo_Application::initialize($fileDir . '/library', $fileDir, true, array('resetOutputBuffering' => false));
XenForo_Application::set('page_start_time', $startTime);
XenForo_Session::startPublicSession();
}
示例3: __construct
public function __construct()
{
$startTime = microtime(true);
$fileDir = XF_ROOT;
require $fileDir . '/library/XenForo/Autoloader.php';
XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');
XenForo_Application::initialize($fileDir . '/library', $fileDir);
XenForo_Application::set('page_start_time', $startTime);
XenForo_Session::startPublicSession();
}
示例4: actionIndex
public function actionIndex()
{
$class = $this->_input->filterSingle('class', XenForo_Input::STRING);
if ($class) {
return $this->responseReroute(__CLASS__, 'view');
}
$addOns = $this->_getAddOnModel()->getAllAddOns();
$xenOptions = XenForo_Application::get('options');
$addOnSelected = '';
if ($xenOptions->th_models_enableAddOnChooser) {
$addOnId = $this->_input->filterSingle('addon_id', XenForo_Input::STRING);
if (!empty($GLOBALS['ThemeHouse_Models_Route_PrefixAdmin_Models']) && !$addOnId) {
$addOnId = XenForo_Helper_Cookie::getCookie('edit_addon_id');
}
if ($addOnId && !empty($addOns[$addOnId])) {
XenForo_Helper_Cookie::setCookie('edit_addon_id', $addOnId);
$addOn = $addOns[$addOnId];
$addOnSelected = $addOnId;
$this->canonicalizeRequestUrl(XenForo_Link::buildAdminLink('add-ons/models', $addOn));
} else {
$this->canonicalizeRequestUrl(XenForo_Link::buildAdminLink('add-ons/models'));
XenForo_Helper_Cookie::deleteCookie('edit_addon_id');
}
}
$addOns['XenForo'] = array('addon_id' => 'XenForo', 'active' => true, 'title' => 'XenForo');
$rootPath = XenForo_Autoloader::getInstance()->getRootDir();
$models = array();
$modelCount = 0;
$totalModels = 0;
foreach ($addOns as $addOnId => $addOn) {
$modelPath = $rootPath . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $addOnId) . DIRECTORY_SEPARATOR . 'Model';
if (!file_exists($modelPath)) {
continue;
}
$directory = new RecursiveDirectoryIterator($modelPath);
$iterator = new RecursiveIteratorIterator($directory);
$regex = new RegexIterator($iterator, '/^.+\\.php$/i', RecursiveRegexIterator::GET_MATCH);
foreach ($regex as $fileinfo) {
$classPath = str_replace($rootPath, '', $fileinfo[0]);
$classPath = pathinfo($classPath, PATHINFO_DIRNAME) . DIRECTORY_SEPARATOR . pathinfo($classPath, PATHINFO_FILENAME);
$dirs = explode(DIRECTORY_SEPARATOR, $classPath);
$dirs = array_filter($dirs);
$className = implode('_', $dirs);
if (!$xenOptions->th_models_enableAddOnChooser || !$addOnSelected || $addOnId == $addOnSelected) {
$models[$addOnId][$className] = array('class' => $className, 'filename' => pathinfo($classPath, PATHINFO_FILENAME));
$modelCount++;
}
$totalModels++;
}
}
unset($addOns['XenForo']);
$viewParams = array('addOns' => $addOns, 'addOnSelected' => $addOnSelected, 'models' => $models, 'modelCount' => $modelCount, 'totalModels' => $totalModels);
return $this->responseView('ThemeHouse_Models_ViewAdmin_Model_List', 'th_model_list_models', $viewParams);
}
示例5: actionGetSdk
public function actionGetSdk()
{
$prefix = $this->_input->filterSingle('prefix', XenForo_Input::STRING);
$prefix = preg_replace('/[^a-zA-Z0-9]/', '', $prefix);
$sdkPath = XenForo_Autoloader::getInstance()->getRootDir() . '/../js/bdApi/full/sdk.js';
$sdk = file_get_contents($sdkPath);
$sdk = str_replace('{prefix}', $prefix, $sdk);
$sdk = str_replace('{data_uri}', XenForo_Link::buildPublicLink('canonical:misc/api-data'), $sdk);
$sdk = str_replace('{request_uri}', bdApi_Data_Helper_Core::safeBuildApiLink('index'), $sdk);
header('Content-Type: application/x-javascript; charset=utf-8');
header('Cache-Control: public, max-age=31536000');
header(sprintf('Last-Modified: %s', gmstrftime("%a, %d %b %Y %T %Z", filemtime($sdkPath))));
die($sdk);
}
示例6: start
public static function start()
{
global $site_ways;
if (class_exists('XenForo_Autoloader')) {
return;
}
if (empty($site_ways['main_cms'])) {
exit('[MCMS] Не проинициализирован путь до дирректории Xenforo, проверьте опцию $site_ways[\'main_cms\'] в настройках скрипта авторизации.');
}
if (!file_exists($site_ways['main_cms'] . 'library/XenForo/Autoloader.php')) {
exit('[MCMS] Файл "' . $site_ways['main_cms'] . 'library/XenForo/Autoloader.php" отсутствует. Путь до дирректории Xenforo указан не верно, проверьте опцию $site_ways[\'main_cms\'] в настройках скрипта авторизации.');
}
require $site_ways['main_cms'] . '/library/XenForo/Autoloader.php';
XenForo_Autoloader::getInstance()->setupAutoloader($site_ways['main_cms'] . 'library');
XenForo_Application::initialize($site_ways['main_cms'] . 'library', $site_ways['main_cms']);
XenForo_Application::set('page_start_time', microtime(true));
}
示例7: _postDispatch
/**
* @param $controllerResponse
* @param $controllerName
* @param $action
*/
protected function _postDispatch($controllerResponse, $controllerName, $action)
{
parent::_postDispatch($controllerResponse, $controllerName, $action);
if ($controllerResponse instanceof XenForo_ControllerResponse_View) {
if (!XenForo_Autoloader::getInstance()->autoload('SimplePortal_BrandingFree')) {
$controllerResponse->params['show_portal_branding'] = true;
}
$portalContainer = $this->getPortalConfig();
if (isset($portalContainer->container)) {
$controllerResponse->containerParams = array('containerTemplate' => $portalContainer->container);
}
if (SimplePortal_Static::option('defaultSidebar')) {
$viewParams = $this->_getDefaultSidebarParams();
$controllerResponse->params += $viewParams;
}
}
}
示例8: getImporterList
/**
* Fetches a list of available importers
*
* @return array
*/
public function getImporterList()
{
$importerDir = XenForo_Autoloader::getInstance()->getRootDir() . '/XenForo/Importer';
$importers = array();
foreach (glob($importerDir . '/*.php') as $importerFile) {
$key = substr(basename($importerFile), 0, -4);
if ($key == 'Abstract') {
continue;
}
$importers[$key] = $this->getImporterName($key);
}
foreach (self::$extraImporters as $extra) {
$importers[$extra] = $this->getImporterName($extra);
}
natcasesort($importers);
return $importers;
}
示例9: __construct
public function __construct()
{
$startTime = microtime(true);
$xf_path = Yii::getPathOfAlias('webroot') . '/forum';
Yii::registerAutoloader(array('XenforeLoader', 'autoload'), true);
XenForo_Autoloader::getInstance()->setupAutoloader($xf_path . '/library');
XenForo_Application::initialize($xf_path . '/library', $xf_path);
XenForo_Application::set('page_start_time', $startTime);
XenForo_Application::disablePhpErrorHandler();
error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE ^ E_WARNING);
$dependencies = new XenForo_Dependencies_Public();
$dependencies->preLoadData();
XenForo_Session::startPublicSession();
$this->visitor = XenForo_Visitor::getInstance();
/*$fc = new XenForo_FrontController(new XenForo_Dependencies_Public());
ob_start();
$fc->run();
$content = ob_get_clean();*/
}
示例10: authenticateSession
/**
* Uses the XenForo_Autoloader to initialize and startPublicSession to get
* and instance of the Visitor, if there is one.
*
* @return int
*/
function authenticateSession()
{
/**
* Get the xenForo Autoloader
*/
if (is_dir($this->fileDir)) {
require $this->fileDir . '/library/XenForo/Autoloader.php';
XenForo_Autoloader::getInstance()->setupAutoloader($this->fileDir . '/library');
/**
* initialize
*/
XenForo_Application::initialize($this->fileDir . '/library', $this->fileDir);
XenForo_Session::startPublicSession();
$this->xfUser = XenForo_Visitor::getInstance();
return $this->xfUser->getUserId();
}
die('no path');
// TODO: CI error log
return false;
}
示例11: _preSave
protected function _preSave()
{
$class = $this->get('route_class');
if (!XenForo_Application::autoload($class)) {
$filename = XenForo_Autoloader::getInstance()->getRootDir() . DIRECTORY_SEPARATOR . str_replace("_", DIRECTORY_SEPARATOR, $class) . ".php";
if (!file_exists(dirname($filename))) {
XenForo_Helper_File::createDirectory(dirname($filename));
}
$options = array('title_plural' => str_replace('-', ' ', $this->get('original_prefix')));
$phpFile = null;
switch ($this->get('route_type')) {
case 'public':
$phpFile = new ThemeHouse_RoutePrefixes_PhpFile_Route_Prefix($class, $options);
break;
case 'admin':
$phpFile = new ThemeHouse_RoutePrefixes_PhpFile_Route_PrefixAdmin($class, $options);
break;
}
if (!is_null($phpFile)) {
$phpFile->export(true);
}
}
return parent::_preSave();
}
示例12: autoload
/**
* Helper method to autoload a class. Could simply call the autoloader directly
* but this method is recommended to reduce dependencies.
*
* @param string $class Class to load
*
* @return boolean
*/
public static function autoload($class)
{
return XenForo_Autoloader::getInstance()->autoload($class);
}
示例13: microtime
*
* This file will hold all code and functions for hooking the theme in with XF
*/
//******************************************************************************
// Pull instantiate and pull the template from the Xenforo system
//******************************************************************************
if (!is_admin()) {
$XenDynamic_container = true;
$startTime = microtime(true);
$XenDynamic_indexFile = "../../../.." . getThemeOption("xenforo_path");
$fileDir = dirname(__FILE__) . "/{$XenDynamic_indexFile}";
// $fileDir = ABSPATH . getThemeOption("xenforo_path");
// $fileDir = dirname(__FILE__) . "/../../../.." . getThemeOption("xenforo_path");
if (!class_exists("XenForo_Autoloader")) {
require $fileDir . '/library/XenForo/Autoloader.php';
XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');
XenForo_Application::initialize($fileDir . '/library', $fileDir);
XenForo_Application::set('page_start_time', $startTime);
XenForo_Application::disablePhpErrorHandler();
error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE ^ E_WARNING);
}
ob_start();
$XenDynamic_fc = new RCBD_XenDynamic_FrontController(new XenForo_Dependencies_Public());
$xenforoOutput = $XenDynamic_fc->runXenDynamic(ob_get_clean());
global $templateParts;
$templateParts = getTemplateParts($xenforoOutput, getThemeOption("xenforo_path"));
}
//******************************************************************************
// This function takes the raw buffer from Xenforo and breaks it into the header
// and the rest of the file it also does some jquery replacements for elements
// that need to be changed on all wordpress templates.
示例14: closedir
continue;
}
$filePath = $HELPER_DIR . '/' . $file;
if (file_exists($filePath) and strtolower(substr($file, -4)) == '.php') {
$HELPERS[substr($file, 0, -4)] = $filePath;
}
}
closedir($dh);
}
// load XenForo
@(include $PWD . '/library/XenForo/Autoloader.php');
if (!class_exists('XenForo_Autoloader')) {
echo "Could not detect XenForo\n";
exit(-1);
}
XenForo_Autoloader::getInstance()->setupAutoloader($PWD . '/library');
XenForo_Application::initialize($PWD . '/library', $PWD);
// load our functions
@(include $DIR . '/helpers_includes/common.php');
if (!class_exists('Helper_Common')) {
echo "Corrupted script\n";
exit(-1);
}
function readline_completion_impl($string, $index)
{
$readline_info = readline_info();
$line = substr($readline_info['line_buffer'], 0, $readline_info['end']);
$parts = Helper_Common::parseCommand($line);
$candidates = array();
if (empty($parts)) {
// no input yet, just return list of helper functions
示例15: getRootDir
/**
* Gets the autoloader's root directory.
*
* @return string
*/
public function getRootDir()
{
return XenForo_Autoloader::getInstance()->getRootDir();
}