本文整理汇总了PHP中XenForo_Application::resolveDynamicClass方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Application::resolveDynamicClass方法的具体用法?PHP XenForo_Application::resolveDynamicClass怎么用?PHP XenForo_Application::resolveDynamicClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Application
的用法示例。
在下文中一共展示了XenForo_Application::resolveDynamicClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createFromFileDirect
/**
* Creates an image from an existing file.
*
* @param string $fileName
* @param integer $inputType IMAGETYPE_XYZ constant representing image type
*
* @return XenForo_Image_Gd|false
*/
public static function createFromFileDirect($fileName, $inputType)
{
$invalidType = false;
try {
switch ($inputType) {
case IMAGETYPE_GIF:
if (!function_exists('imagecreatefromgif')) {
return false;
}
$image = imagecreatefromgif($fileName);
break;
case IMAGETYPE_JPEG:
if (!function_exists('imagecreatefromjpeg')) {
return false;
}
$image = imagecreatefromjpeg($fileName);
break;
case IMAGETYPE_PNG:
if (!function_exists('imagecreatefrompng')) {
return false;
}
$image = imagecreatefrompng($fileName);
break;
default:
$invalidType = true;
}
} catch (Exception $e) {
return false;
}
if ($invalidType) {
throw new XenForo_Exception('Invalid image type given. Expects IMAGETYPE_XXX constant.');
}
$class = XenForo_Application::resolveDynamicClass(__CLASS__);
return new $class($image);
}
示例2: actionIndex
/**
* Single-stage logout procedure
*/
public function actionIndex()
{
$csrfToken = $this->_input->filterSingle('_xfToken', XenForo_Input::STRING);
$redirectResponse = $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $this->getDynamicRedirect(false, false));
$userId = XenForo_Visitor::getUserId();
if (!$userId) {
return $redirectResponse;
}
if ($this->_noRedirect() || !$csrfToken) {
// request is likely from JSON, probably XenForo.OverlayTrigger, so show a confirmation dialog
return $this->responseView('XenForo_ViewPublic_LogOut', 'log_out');
} else {
$this->_checkCsrfFromToken($csrfToken);
// remove an admin session if we're logged in as the same person
if (XenForo_Visitor::getInstance()->get('is_admin')) {
$class = XenForo_Application::resolveDynamicClass('XenForo_Session');
$adminSession = new $class(array('admin' => true));
$adminSession->start();
if ($adminSession->get('user_id') == $userId) {
$adminSession->delete();
}
}
$this->getModelFromCache('XenForo_Model_Session')->processLastActivityUpdateForLogOut(XenForo_Visitor::getUserId());
XenForo_Application::get('session')->delete();
XenForo_Helper_Cookie::deleteAllCookies($this->_getRetainedCookies(), array('user' => array('httpOnly' => false)));
XenForo_Visitor::setup(0);
return $redirectResponse;
}
}
示例3: actionErrorNotFound
public function actionErrorNotFound()
{
$controllerName = $this->_request->getParam('_controllerName');
$action = $this->_request->getParam('_action');
if (substr($action, 0, 3) === 'Get') {
// try to suggest POST entry point if available
$newControllerName = XenForo_Application::resolveDynamicClass($controllerName, 'controller');
if (method_exists($newControllerName, 'actionPost' . substr($action, 3))) {
return $this->responseError(new XenForo_Phrase('bdapi_only_accepts_post_requests'), 400);
}
}
if (is_callable(array($this, 'getNotFoundResponse'))) {
// XenForo 1.2.0+ has this
return $this->getNotFoundResponse();
}
if (XenForo_Application::debugMode()) {
$controllerName = $this->_request->getParam('_controllerName');
if (empty($controllerName)) {
return $this->responseError(new XenForo_Phrase('controller_for_route_not_found', array('routePath' => $this->_request->getParam('_origRoutePath'))), 404);
} else {
return $this->responseError(new XenForo_Phrase('controller_x_does_not_define_action_y', array('controller' => $controllerName, 'action' => $this->_request->getParam('_action'))), 404);
}
} else {
return $this->responseError(new XenForo_Phrase('requested_page_not_found'), 404);
}
}
示例4: actionTest
public function actionTest()
{
$this->assertAdminPermission('user');
$this->_routeMatch->setSections('testPermissions');
$class = XenForo_Application::resolveDynamicClass('XenForo_Session');
$publicSession = new $class();
$publicSession->start();
if ($publicSession->get('user_id') != XenForo_Visitor::getUserId()) {
return $this->responseError(new XenForo_Phrase('please_login_via_public_login_page_before_testing_permissions'));
}
if ($this->_request->isPost()) {
$username = $this->_input->filterSingle('username', XenForo_Input::STRING);
/* @var $userModel XenForo_Model_User */
$userModel = $this->getModelFromCache('XenForo_Model_User');
$user = $userModel->getUserByName($username);
if (!$user) {
return $this->responseError(new XenForo_Phrase('requested_user_not_found'), 404);
}
$publicSession->set('permissionTest', array('user_id' => $user['user_id'], 'username' => $user['username']));
$publicSession->save();
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildPublicLink('index'));
} else {
return $this->responseView('XenForo_ViewAdmin_Permission_Test', 'permission_test');
}
}
示例5: buildLink
/**
*
* @see XenForo_Route_Prefix_Forums::buildLink()
*/
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
if (isset($data['social_forum_id'])) {
if (ThemeHouse_SocialGroups_SocialForum::hasInstance()) {
$socialForum = ThemeHouse_SocialGroups_SocialForum::getInstance()->toArray();
} else {
$socialForum = $data;
}
$class = XenForo_Application::resolveDynamicClass('ThemeHouse_SocialGroups_Route_Prefix_SocialForums', 'route_prefix');
$router = new $class();
$link = $router->buildLink('social-forums', 'social-forums', $action, $extension, $socialForum, $extraParams);
if (XenForo_Application::isRegistered('routeFiltersOut')) {
$routeFilters = XenForo_Application::get('routeFiltersOut');
if (isset($routeFilters['social-forums'])) {
foreach ($routeFilters['social-forums'] as $filter) {
if (array_key_exists('find_route', $filter) && array_key_exists('replace_route', $filter)) {
list($from, $to) = XenForo_Link::translateRouteFilterToRegex($filter['find_route'], $filter['replace_route']);
$newLink = preg_replace($from, $to, $link);
} else {
$newLink = $link;
}
if ($newLink != $link) {
$link = $newLink;
break;
}
}
}
}
return $link;
}
return parent::buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, $extraParams);
}
示例6: create
/**
* Factory method to get the named container params listener.
* The class must exist or be autoloadable or an exception will be thrown.
*
* @param string Class to load
* @param array $params
* @param XenForo_Dependencies_Abstract $dependencies
*
* @return ThemeHouse_Listener_ContainerPublicParams
*/
public static function create($class, array &$params, XenForo_Dependencies_Abstract $dependencies)
{
$createClass = XenForo_Application::resolveDynamicClass($class, 'listener_th');
if (!$createClass) {
throw new XenForo_Exception("Invalid listener '{$class}' specified");
}
return new $createClass($params, $dependencies);
}
示例7: create
/**
* Factory method to get the named navigation tabs listener.
* The class must exist or be autoloadable or an exception will be thrown.
*
* @param string $className Class to load
* @param array $extraTabs
* @param $selectedTabId
*
* @return ThemeHouse_Listener_NavigationTabs
*/
public static function create($className, array &$extraTabs, $selectedTabId)
{
$createClass = XenForo_Application::resolveDynamicClass($className, 'listener_th');
if (!$createClass) {
throw new XenForo_Exception("Invalid listener '{$className}' specified");
}
return new $createClass($extraTabs, $selectedTabId);
}
示例8: getInstance
/**
* @return bdApi_Template_Helper_Core
*/
public static function getInstance()
{
if (self::$_instance === null) {
$templateHelperClass = XenForo_Application::resolveDynamicClass(__CLASS__, 'bdapi_template_helper');
self::$_instance = new $templateHelperClass();
}
return self::$_instance;
}
示例9: _getHelper
/**
* @return XenForo_Helper_UserChangeLog
*/
protected function _getHelper()
{
if ($this->_helperObject === null) {
$class = XenForo_Application::resolveDynamicClass('XenForo_Helper_UserChangeLog');
$this->_helperObject = new $class();
}
return $this->_helperObject;
}
示例10: create
public static function create($class)
{
$class = XenForo_Application::resolveDynamicClass($class);
$object = new $class();
if (!$object instanceof XenGallery_Thumbnail_Abstract) {
return false;
}
return $object;
}
示例11: _resolveClass
/**
* Need to put this method in the abstract class unfortunately because PHP 5.2 doesn't support late static binding
*/
protected static function _resolveClass()
{
if (class_exists('XenForo_Application')) {
$class = XenForo_Application::resolveDynamicClass('DigitalPointBetterAnalytics_Helper_Reporting');
self::$_instance = new $class();
} else {
self::$_instance = new DigitalPointBetterAnalytics_Helper_Reporting();
}
}
示例12: match
/**
* Match a specific route for an already matched prefix.
*
* @see XenForo_Route_Interface::match()
*/
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
$action = $router->resolveActionWithIntegerParam($routePath, $request, 'node_id');
if (!class_exists('XFCP_ThemeHouse_SocialGroups_ControllerAdmin_SocialCategory', false)) {
$createClass = XenForo_Application::resolveDynamicClass('XenForo_ControllerAdmin_Forum', 'controller');
eval('class XFCP_ThemeHouse_SocialGroups_ControllerAdmin_SocialCategory extends ' . $createClass . ' {}');
}
return $router->getRouteMatch('ThemeHouse_SocialGroups_ControllerAdmin_SocialCategory', $action, 'nodeTree');
}
示例13: getImporter
/**
* Gets the specified importer.
*
* @param string $key Name of importer (key); just last part of name, not full path.
*
* @return XenForo_Importer_Abstract
*/
public function getImporter($key)
{
if (strpos($key, '_') && !in_array($key, self::$extraImporters)) {
throw new XenForo_Exception('Trying to load a non-registered importer.');
}
$class = strpos($key, '_') ? $key : 'XenForo_Importer_' . $key;
$createClass = XenForo_Application::resolveDynamicClass($class, 'importer');
return new $createClass();
}
示例14: actionLogin
public function actionLogin()
{
if (!$this->_request->isPost()) {
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::RESOURCE_CANONICAL, XenForo_Link::buildAdminLink('index'));
}
$data = $this->_input->filter(array('login' => XenForo_Input::STRING, 'password' => XenForo_Input::STRING, 'redirect' => XenForo_Input::STRING, 'cookie_check' => XenForo_Input::UINT));
$redirect = $data['redirect'] ? $data['redirect'] : XenForo_Link::buildAdminLink('index');
$loginModel = $this->_getLoginModel();
if ($data['cookie_check'] && count($_COOKIE) == 0) {
// login came from a page, so we should at least have a session cookie.
// if we don't, assume that cookies are disabled
return $this->responseError(new XenForo_Phrase('cookies_required_to_log_in_to_site'));
}
$needCaptcha = $loginModel->requireLoginCaptcha($data['login']);
if ($needCaptcha) {
// just block logins here instead of using the captcha
return $this->responseError(new XenForo_Phrase('your_account_has_temporarily_been_locked_due_to_failed_login_attempts'));
}
$userModel = $this->_getUserModel();
$userId = $userModel->validateAuthentication($data['login'], $data['password'], $error);
if (!$userId) {
$loginModel->logLoginAttempt($data['login']);
if ($loginModel->requireLoginCaptcha($data['login'])) {
return $this->responseError(new XenForo_Phrase('your_account_has_temporarily_been_locked_due_to_failed_login_attempts'));
}
if ($this->_input->filterSingle('upgrade', XenForo_Input::UINT)) {
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $redirect);
} else {
// note - JSON view will return responseError($text)
return $this->responseView('XenForo_ViewAdmin_Login_Error', 'login_form', array('text' => $error, 'defaultLogin' => $data['login'], 'redirect' => $redirect), array('containerTemplate' => 'LOGIN_PAGE'));
}
}
$loginModel->clearLoginAttempts($data['login']);
XenForo_Model_Ip::log($userId, 'user', $userId, 'login_admin');
$visitor = XenForo_Visitor::setup($userId);
XenForo_Application::getSession()->userLogin($userId, $visitor['password_date']);
// if guest on front-end, login there too
$class = XenForo_Application::resolveDynamicClass('XenForo_Session');
$publicSession = new $class();
$publicSession->start();
if (!$publicSession->get('user_id')) {
$publicSession->userLogin($userId, $visitor['password_date']);
$publicSession->save();
}
// now check that the user will be able to get into the ACP (is_admin)
if (!$visitor->is_admin) {
return $this->responseError(new XenForo_Phrase('your_account_does_not_have_admin_privileges'));
}
if ($this->_input->filterSingle('repost', XenForo_Input::UINT)) {
$postVars = $this->_input->filterSingle('postVars', XenForo_Input::JSON_ARRAY);
$postVars['_xfToken'] = $visitor['csrf_token_page'];
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $redirect, '', array('repost' => 1, 'postVars' => $postVars));
} else {
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $redirect);
}
}
示例15: match
/**
* Match a specific route for an already matched prefix.
*
* @see XenForo_Route_Interface::match()
*/
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
$action = $router->resolveActionWithIntegerOrStringParam($routePath, $request, 'social_forum_id', 'url_portion');
$action = $router->resolveActionAsPageNumber($action, $request);
if (!class_exists('XFCP_ThemeHouse_SocialGroups_ControllerPublic_SocialForum', false)) {
$createClass = XenForo_Application::resolveDynamicClass('XenForo_ControllerPublic_Forum', 'controller');
eval('class XFCP_ThemeHouse_SocialGroups_ControllerPublic_SocialForum extends ' . $createClass . ' {}');
}
return $router->getRouteMatch('ThemeHouse_SocialGroups_ControllerPublic_SocialForum', $action, 'forums');
}