本文整理汇总了PHP中XenForo_Autoloader类的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Autoloader类的具体用法?PHP XenForo_Autoloader怎么用?PHP XenForo_Autoloader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XenForo_Autoloader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:robclancy,项目名称:XenPlus,代码行数:19,代码来源:LoadClass.php
示例2: __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();
}
开发者ID:nickcuper,项目名称:xenforo-sdk,代码行数:10,代码来源:XenForoSDK.php
示例3: __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();
}
开发者ID:Troposphir,项目名称:troposphir,代码行数:10,代码来源:XenForoSDK.php
示例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);
}
开发者ID:ThemeHouse-XF,项目名称:Models,代码行数:54,代码来源:Model.php
示例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);
}
开发者ID:billyprice1,项目名称:bdApi,代码行数:14,代码来源:Asset.php
示例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));
}
开发者ID:qexyorg,项目名称:webMCR-1,代码行数:17,代码来源:xenforo.php
示例7: 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;
}
开发者ID:Sywooch,项目名称:forums,代码行数:22,代码来源:Import.php
示例8: _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;
}
}
}
开发者ID:NixFifty,项目名称:XenForo-SimplePortal,代码行数:22,代码来源:Abstract.php
示例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();*/
}
开发者ID:ngdvan,项目名称:lntguitar,代码行数:19,代码来源:XfAuthentication.php
示例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;
}
开发者ID:puneetkay,项目名称:xF_auth,代码行数:26,代码来源:xf_auth.php
示例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();
}
开发者ID:ThemeHouse-XF,项目名称:RoutePrefixes,代码行数:24,代码来源:RoutePrefix.php
示例12: fileExport
public static function fileExport(array $addOn, DevHelper_Config_Base $config, $exportPath)
{
$list = array();
$classNameByAddOnId = self::getClassName($addOn['addon_id'], false, $config);
$list['library'] = self::getClassNameInDirectory(XenForo_Autoloader::getInstance()->getRootDir(), $classNameByAddOnId, true);
if (empty($list['library'])) {
throw new XenForo_Exception(sprintf('`library` not found for %s', $addOn['addon_id']));
}
$jsPath = self::getClassNameInDirectory(realpath(XenForo_Autoloader::getInstance()->getRootDir() . '/../js'), $classNameByAddOnId, true);
if (!empty($jsPath)) {
if (is_dir($jsPath)) {
$list['js'] = $jsPath;
}
}
$stylesDefaultPath = self::getClassNameInDirectory(realpath(XenForo_Autoloader::getInstance()->getRootDir() . '/../styles/default'), $classNameByAddOnId, true);
if (!empty($stylesDefaultPath)) {
if (is_dir($stylesDefaultPath)) {
$list['styles_default'] = $stylesDefaultPath;
}
}
$exportIncludes = $config->getExportIncludes();
foreach ($exportIncludes as $exportInclude) {
$exportIncludePath = XenForo_Autoloader::getInstance()->getRootDir() . '/../' . $exportInclude;
if (file_exists($exportIncludePath)) {
$list[$exportInclude] = $exportIncludePath;
}
}
// save add-on XML
$xmlPath = self::getAddOnXmlPath($addOn, null, $config);
/** @var XenForo_Model_AddOn $addOnModel */
$addOnModel = XenForo_Model::create('XenForo_Model_AddOn');
$addOnModel->getAddOnXml($addOn)->save($xmlPath);
echo "Exported {$xmlPath} ({$addOn['version_string']}/{$addOn['version_id']})\n";
DevHelper_Helper_Phrase::parseXmlForPhraseTracking($xmlPath);
$exportAddOns = $config->getExportAddOns();
foreach ($exportAddOns as $exportAddOnId) {
$exportAddOn = $addOnModel->getAddOnById($exportAddOnId);
if (empty($exportAddOn)) {
die(sprintf("Could not find add-on %s\n", $exportAddOnId));
}
$exportAddOnPath = self::getAddOnXmlPath($addOn, $exportAddOn, $config);
$addOnModel->getAddOnXml($exportAddOn)->save($exportAddOnPath);
echo "Exported {$exportAddOnPath} ({$exportAddOn['version_string']}/{$exportAddOn['version_id']})\n";
}
$exportStyles = $config->getExportStyles();
if (!empty($exportStyles)) {
/** @var XenForo_Model_Style $styleModel */
$styleModel = $addOnModel->getModelFromCache('XenForo_Model_Style');
$styles = $styleModel->getAllStyles();
$exportedStyleCount = 0;
foreach ($styles as $style) {
if (in_array($style['title'], $exportStyles, true)) {
$stylePath = self::getStyleXmlPath($addOn, $style, $config);
$styleModel->getStyleXml($style)->save($stylePath);
echo "Exported {$stylePath}\n";
$exportedStyleCount++;
}
}
if ($exportedStyleCount < count($exportStyles)) {
die("Not all export styles could be found...\n");
}
}
// generate hashes
self::generateHashesFile($addOn, $config, $list);
// check for file_health_check event listener
/** @var XenForo_Model_CodeEvent $codeEventModel */
$codeEventModel = XenForo_Model::create('XenForo_Model_CodeEvent');
$addOnEventListeners = $codeEventModel->getEventListenersByAddOn($addOn['addon_id']);
$fileHealthCheckFound = false;
foreach ($addOnEventListeners as $addOnEventListener) {
if ($addOnEventListener['event_id'] === 'file_health_check') {
$fileHealthCheckFound = true;
}
if (!is_callable(array($addOnEventListener['callback_class'], $addOnEventListener['callback_method']))) {
die(sprintf("Callback is not callable %s::%s\n", $addOnEventListener['callback_class'], $addOnEventListener['callback_method']));
}
}
if (!$fileHealthCheckFound) {
// try to generate the file health check event listener ourselves
if (DevHelper_Generator_Code_Listener::generateFileHealthCheck($addOn, $config)) {
$fileHealthCheckFound = true;
}
}
if (!$fileHealthCheckFound) {
die("No `file_health_check` event listener found.\n");
}
/** @var XenForo_Application $application */
$application = XenForo_Application::getInstance();
$rootPath = realpath($application->getRootDir());
if (strpos($exportPath, 'upload') === false) {
$exportPath .= '/upload';
}
XenForo_Helper_File::createDirectory($exportPath);
$exportPath = realpath($exportPath);
$options = array('extensions' => array('php', 'inc', 'txt', 'xml', 'htm', 'html', 'js', 'css', 'jpg', 'jpeg', 'png', 'gif', 'swf', 'crt', 'pem', 'eot', 'svg', 'ttf', 'woff', 'woff2', 'otf', 'md'), 'filenames_lowercase' => array('license', 'readme', 'copyright', '.htaccess', 'changelog', 'composer.json', 'readme.rdoc', 'version'), 'force' => true, 'addon_id' => $addOn['addon_id'], 'excludes' => array(), 'excludeRegExs' => array());
$excludes = $config->getExportExcludes();
foreach ($excludes as $exclude) {
if (preg_match('/^#.+#$/', $exclude)) {
$options['excludeRegExs'][] = $exclude;
} else {
//.........这里部分代码省略.........
开发者ID:maitandat1507,项目名称:DevHelper,代码行数:101,代码来源:File.php
示例13: while
<?php
$rootDir = XenForo_Autoloader::getInstance()->getRootDir();
$version = 0;
if ($handle = opendir($rootDir . '/ThemeHouse/Listener/Template')) {
while (false !== ($entry = readdir($handle))) {
if (intval($entry) > $version) {
$version = intval($entry);
}
}
}
require_once $rootDir . '/ThemeHouse/Listener/Template/' . $version . '.php';
开发者ID:AndroidOS,项目名称:SocialGroups,代码行数:12,代码来源:Template.php
示例14: getRootDir
/**
* Gets the autoloader's root directory.
*
* @return string
*/
public function getRootDir()
{
return XenForo_Autoloader::getInstance()->getRootDir();
}
开发者ID:Sywooch,项目名称:forums,代码行数:9,代码来源:20150107.php
示例15: __construct
/**
* Default consturctor, instalizes XenForo classes and models.
*/
public function __construct()
{
$this->xfDir = dirname(__FILE__);
require_once $this->xfDir . '/library/XenForo/Autoloader.php';
XenForo_Autoloader::getInstance()->setupAutoloader($this->xfDir . '/library');
XenForo_Application::initialize($this->xfDir . '/library', $this->xfDir);
XenForo_Application::set('page_start_time', microtime(TRUE));
$deps = new XenForo_Dependencies_Public();
$deps->preLoadData();
// Disable XenForo's PHP error handler.
XenForo_Application::disablePhpErrorHandler();
// Enable error logging for PHP.
error_reporting(E_ALL & ~E_NOTICE);
$this->models = new Models();
// TODO: Don't create models on init, only create them if they're being used (see Models::checkModel($model_name, $model)).
$this->getModels()->setUserModel(XenForo_Model::create('XenForo_Model_User'));
$this->getModels()->setAlertModel(XenForo_Model::create('XenForo_Model_Alert'));
$this->getModels()->setUserFieldModel(XenForo_Model::create('XenForo_Model_UserField'));
$this->getModels()->setAvatarModel(XenForo_Model::create('XenForo_Model_Avatar'));
$this->getModels()->setModel('addon', XenForo_Model::create('XenForo_Model_AddOn'));
$this->getModels()->setModel('database', XenForo_Application::get('db'));
if ($this->hasAddon('XenResource') && $this->hasModel('XenResource_Model_Resource')) {
$this->getModels()->setModel('resource', XenForo_Model::create('XenResource_Model_Resource'));
}
}
开发者ID:pritcham,项目名称:XenAPI,代码行数:28,代码来源:api.php
示例16: while
<?php
/**
* Helper Brivium Addon for EventListener.
*
* @package Brivium_BriviumHelper
* Version 1.0.0
*/
$helperDir = XenForo_Autoloader::getInstance()->getRootDir() . '/Brivium/BriviumHelper/';
$helperVersion = 0;
if (is_dir($helperDir)) {
if ($dh = opendir($helperDir)) {
while (($folder = readdir($dh)) !== false) {
if ('.' == $folder || '..' == $folder || filetype($helperDir . $folder) != 'dir') {
continue;
}
if (intval($folder) > $helperVersion) {
$helperVersion = intval($folder);
}
}
closedir($dh);
}
}
require_once $helperDir . $helperVersion . '/EventListeners.php';
开发者ID:Sywooch,项目名称:forums,代码行数:24,代码来源:EventListeners.php
示例17: getCliCommand
public function getCliCommand()
{
$rootDir = XenForo_Autoloader::getInstance()->getRootDir();
$filePath = str_replace('/', DIRECTORY_SEPARATOR, $rootDir . '/XenForo/Install/run-upgrade.php');
$filePath = @escapeshellarg($filePath);
if (!$filePath) {
// I've seen servers disable this function...
return false;
}
return 'php ' . $filePath;
}
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:11,代码来源:Upgrade.php
示例18: _getLibraryListenerFileVersion
/**
*
* @param string $filename
* @param boolean $autoload
* @return number
*/
protected function _getLibraryListenerFileVersion($filename, $autoload = true)
{
$rootDir = XenForo_Autoloader::getInstance()->getRootDir();
$version = 0;
$handle = opendir($rootDir . '/Waindigo/Listener/' . $filename);
if ($handle) {
while (false !== ($entry = readdir($handle))) {
if (intval($entry) > $version) {
$version = intval($entry);
}
}
if ($autoload) {
require_once $rootDir . '/Waindigo/Listener/' . $filename . '/' . $version . '.php';
}
}
return $version;
}
开发者ID:darkearl,项目名称:projectT122015,代码行数:23,代码来源:20150212.php
示例19: 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.
开发者ID:rberrill,项目名称:XenDynamic,代码行数:31,代码来源:xf_integration.php
示例20: 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);
}
开发者ID:hahuunguyen,项目名称:DTUI_201105,代码行数:12,代码来源:Application.php
注:本文中的XenForo_Autoloader类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论