本文整理汇总了PHP中XenForo_Application::autoload方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Application::autoload方法的具体用法?PHP XenForo_Application::autoload怎么用?PHP XenForo_Application::autoload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Application
的用法示例。
在下文中一共展示了XenForo_Application::autoload方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildIndex
public function buildIndex()
{
$options = XenForo_Application::get('options');
$paths = array();
if ($options->EWRutiles_Sitemap_sources['forums']) {
$paths = array_merge($paths, $this->buildForums());
}
if ($options->EWRutiles_Sitemap_sources['threads']) {
$paths = array_merge($paths, $this->buildThreads());
}
if ($options->EWRutiles_Sitemap_sources['members']) {
$paths = array_merge($paths, $this->buildMembers());
}
if ($options->EWRutiles_Sitemap_sources['media'] && XenForo_Application::autoload('EWRmedio_Model_Media')) {
$paths = array_merge($paths, $this->buildMedia());
}
if ($options->EWRutiles_Sitemap_sources['wiki'] && XenForo_Application::autoload('EWRcarta_Model_Pages')) {
$paths = array_merge($paths, $this->buildWiki());
}
list($document, $sub_node) = $this->addDocument('sitemapindex');
foreach ($paths as $path) {
$this->addUrl($document, $sub_node, 'sitemap', $path, XenForo_Application::$time);
}
$path = XenForo_Helper_File::getExternalDataPath() . '/sitemaps/index.xml';
$file = fopen($path, 'w');
fwrite($file, $document->saveXML());
fclose($file);
if ($options->EWRutiles_Sitemap_pings['bing']) {
$this->pingUrl('http://www.bing.com/webmaster/ping.aspx?sitemap=');
}
if ($options->EWRutiles_Sitemap_pings['google']) {
$this->pingUrl('http://www.google.com/webmasters/tools/ping?sitemap=');
}
return true;
}
示例2: getPromoteIcons
public function getPromoteIcons($input)
{
$post = $this->getModelFromCache('XenForo_Model_Post')->getPostById($input['first_post_id']);
$icons = array('attachments' => array(), 'imageEmbeds' => array(), 'medioEmbeds' => array());
if ($post['attachments'] = $this->getModelFromCache('XenForo_Model_Attachment')->getAttachmentsByContentId('post', $input['first_post_id'])) {
$post['attachments'] = $this->getModelFromCache('XenForo_Model_Attachment')->prepareAttachments($post['attachments']);
foreach ($post['attachments'] as $attach) {
if (!empty($attach['thumbnailUrl'])) {
$icons['attachments'][] = $attach;
}
}
}
if (preg_match_all('#\\[img\\](.+?)\\[/img\\]#i', $post['message'], $matches)) {
foreach ($matches[1] as $match) {
$url = str_ireplace('http://', '', $match);
$url = explode('/', $url);
$icons['imageEmbeds'][] = array('server' => reset($url), 'filename' => end($url), 'imageurl' => $match);
}
}
if (XenForo_Application::autoload('EWRmedio_Model_Media')) {
if (preg_match_all('#\\[medio\\](\\d+)\\[/medio\\]#i', $post['message'], $matches)) {
$icons['medioEmbeds'] = $this->getModelFromCache('EWRmedio_Model_Media')->getMediasByIDs($matches[1]);
}
}
return $icons;
}
示例3: renderXml
public function renderXml()
{
$nameSuffix = str_replace(' ', '-', utf8_romanize(utf8_deaccent(ucfirst($this->_params['name']))));
XenForo_Application::autoload('Zend_Debug');
$this->setDownloadFileName('BBM_BbCode_' . $nameSuffix . '.xml');
return $this->_params['xml']->saveXml();
}
示例4: _validateValidationClassAndMethod
protected function _validateValidationClassAndMethod($class, $method)
{
if ($class && !XenForo_Application::autoload($class)) {
$this->error(new XenForo_Phrase('callback_class_x_for_option_y_is_not_valid', array('option' => $this->get('option_id'), 'class' => $class)), 'validation');
return false;
}
return true;
}
示例5: create
/**
* Factory method to get the named alert handler. The class must exist and be autoloadable
* or an exception will be thrown.
*
* @param string Class to load
*
* @return XenForo_AlertHandler_Abstract
*/
public static function create($class)
{
if (XenForo_Application::autoload($class)) {
$obj = new $class();
if ($obj instanceof XenForo_AlertHandler_Abstract) {
return $obj;
}
}
throw new XenForo_Exception("Invalid user alert handler '{$class}' specified");
}
示例6: _preSave
/**
* Pre-save handling.
*/
protected function _preSave()
{
if ($this->isChanged('callback_class') || $this->isChanged('callback_method')) {
$class = $this->get('callback_class');
$method = $this->get('callback_method');
if (!XenForo_Application::autoload($class) || !method_exists($class, $method)) {
$this->error(new XenForo_Phrase('please_enter_valid_callback_method'), 'callback_method');
}
}
}
示例7: verifyOption
/**
* Verifies and prepares the censor option to the correct format.
*
* @param array $words List of words to censor (from input). Keys: word, exact, replace
* @param XenForo_DataWriter $dw Calling DW
* @param string $fieldName Name of field/option
*
* @return true
*/
public static function verifyOption(array &$options, XenForo_DataWriter $dw, $fieldName)
{
if (!XenForo_Application::autoload('EWRmedio_ControllerPublic_Media')) {
$options['media'] = 0;
}
if (!XenForo_Application::autoload('EWRcarta_ControllerPublic_Wiki')) {
$options['wiki'] = 0;
}
return true;
}
示例8: _preDelete
protected function _preDelete()
{
if ($this->get('uninstall_callback_class') && $this->get('uninstall_callback_method')) {
$class = $this->get('uninstall_callback_class');
$method = $this->get('uninstall_callback_method');
if (!XenForo_Application::autoload($class) || !method_exists($class, $method)) {
$this->error(new XenForo_Phrase('files_necessary_uninstallation_addon_not_found'));
}
}
}
示例9: _loadAndRunSubRule
/**
* Loads the specified sub-rule and then tries to match it.
*
* @param string Route class name
* @param string Route path to pass to match
* @param Zend_Controller_Request_Http
* @param XenForo_Router
*
* @return XenForo_RouteMatch|false
*/
protected function _loadAndRunSubRule($routeClass, $newRoutePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
if (XenForo_Application::autoload($routeClass)) {
$routeClass = XenForo_Application::resolveDynamicClass($routeClass, 'route_prefix');
$route = new $routeClass();
return $route->match($newRoutePath, $request, $router);
} else {
return false;
}
}
示例10: actionRebuild
public function actionRebuild()
{
if (!$this->perms['admin']) {
return $this->responseNoPermission();
}
if (XenForo_Application::autoload('EWRmedio_XML_Premium')) {
XenForo_Model::create('EWRmedio_XML_Premium')->rebuildServices();
}
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildPublicLink('media/admin/services'));
}
示例11: create
/**
* Factory method to get the named news feed handler. The class must exist and be autoloadable
* or an exception will be thrown.
*
* @param string Class to load
*
* @return XenForo_NewsFeedHandler_Abstract
*/
public static function create($class)
{
if (XenForo_Application::autoload($class)) {
$class = XenForo_Application::resolveDynamicClass($class);
$obj = new $class();
if ($obj instanceof XenForo_NewsFeedHandler_Abstract) {
return $obj;
}
}
throw new XenForo_Exception("Invalid news feed handler '{$class}' specified");
}
示例12: _getMediaKeyFromCallback
protected function _getMediaKeyFromCallback($url, $matchedId, array $site, $siteId)
{
if (!empty($site['match_callback_class']) && !empty($site['match_callback_method'])) {
$class = $site['match_callback_class'];
$method = $site['match_callback_method'];
if (XenForo_Application::autoload($class) && method_exists($class, $method)) {
return call_user_func_array(array($class, $method), array($url, $matchedId, $site, $siteId));
}
}
return null;
}
示例13: create
/**
* factory method to get the content itemhandler
* @param $class
* @return SimplePortal_ItemHandler_Abstract
* @throws XenForo_Exception
*/
public static function create($class)
{
$classResolved = XenForo_Application::resolveDynamicClass($class);
if (XenForo_Application::autoload($classResolved)) {
$obj = new $classResolved();
if ($obj instanceof SimplePortal_ItemHandler_Abstract) {
return $obj;
}
}
throw new XenForo_Exception("Invalid extraportal_handler '{$class}' specified");
}
示例14: _render
protected function _render(array $widget, $positionCode, array $params, XenForo_Template_Abstract $renderTemplateObject)
{
if (empty($widget['options']['callback_class']) or empty($widget['options']['callback_method'])) {
return '';
}
$class = $widget['options']['callback_class'];
$method = $widget['options']['callback_method'];
if (XenForo_Application::autoload($class) && method_exists($class, $method)) {
return call_user_func(array($class, $method), $widget, $positionCode, $params, $renderTemplateObject);
} else {
return '';
}
}
示例15: actionTest
public function actionTest()
{
$method = $this->_input->filterSingle('method', XenForo_Input::STRING);
$url = $this->_input->filterSingle('url', XenForo_Input::STRING);
if (empty($url) || empty($method)) {
return $this->responseError('Both Method and URL needs to be supplied!');
}
XenForo_Application::autoload('Shorten_URL');
$Details = array();
$Details['name'] = $method;
$Details['url'] = Shorten_URL::shorten($url, $method);
if (!$Details['url']) {
$Details['url'] = 'ERROR';
}
return $this->responseView('XenForo_ViewAdmin_Sutest_Method_Test', 'sutest_method_test', array('details' => $Details));
}