本文整理汇总了PHP中XenForo_Application::getOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Application::getOptions方法的具体用法?PHP XenForo_Application::getOptions怎么用?PHP XenForo_Application::getOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Application
的用法示例。
在下文中一共展示了XenForo_Application::getOptions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getDefaultOptions
/**
* Gets the default set of options for this data writer.
*
* @return array
*/
protected function _getDefaultOptions()
{
$options = parent::_getDefaultOptions();
$options[self::OPTION_MAX_MESSAGE_LENGTH] = XenForo_Application::getOptions()->Teams_commentLength;
$options[self::OPTION_MAX_TAGGED_USERS] = 0;
return $options;
}
示例2: _getProfilePosts
protected function _getProfilePosts(array $widget, $positionCode, array $params, XenForo_Template_Abstract $renderTemplateObject)
{
if ($positionCode == 'forum_list' and $widget['options']['limit'] == XenForo_Application::getOptions()->get('forumListNewProfilePosts')) {
if (!empty($params['profilePosts'])) {
return $params['profilePosts'];
}
}
$core = WidgetFramework_Core::getInstance();
$visitor = XenForo_Visitor::getInstance();
/** @var WidgetFramework_XenForo_Model_ProfilePost $profilePostModel */
$profilePostModel = $core->getModelFromCache('XenForo_Model_ProfilePost');
$profilePosts = $profilePostModel->WidgetFramework_getLatestProfilePosts(array('deleted' => false, 'moderated' => false), array('limit' => $widget['options']['limit'] * 3, 'join' => XenForo_Model_ProfilePost::FETCH_USER_POSTER | XenForo_Model_ProfilePost::FETCH_USER_RECEIVER | XenForo_Model_ProfilePost::FETCH_USER_RECEIVER_PRIVACY, 'permissionCombinationId' => $visitor->get('permission_combination_id')));
foreach ($profilePosts as $id => &$profilePost) {
$receivingUser = $profilePostModel->getProfileUserFromProfilePost($profilePost);
if (!$profilePostModel->canViewProfilePostAndContainer($profilePost, $receivingUser)) {
unset($profilePosts[$id]);
}
$profilePost = $profilePostModel->prepareProfilePost($profilePost, $receivingUser);
if (!empty($profilePost['isIgnored'])) {
unset($profilePosts[$id]);
}
}
$profilePosts = array_slice($profilePosts, 0, $widget['options']['limit'], true);
return $profilePosts;
}
示例3: actionShopping
public function actionShopping()
{
$xenOptions = XenForo_Application::getOptions();
$cameraPortion = $this->_input->filterSingle('camera_url', XenForo_Input::STRING);
$cameraPortion = sonnb_XenGallery_Model_Gallery::getTitleForUrl($cameraPortion);
if (!$cameraPortion || !$xenOptions->sonnbXG_amazonEnable || !class_exists('SoapClient')) {
return $this->responseReroute(__CLASS__, 'index');
}
$cameraModel = $this->_getCameraModel();
$page = max(1, $this->_input->filterSingle('page', XenForo_Input::UINT));
$camera = $cameraModel->getCamerasByCameraUrl($cameraPortion);
$camera = reset($camera);
if ($camera) {
$camera = $cameraModel->getDataCameras(array('camera_name' => $camera['camera_name']));
$camera = reset($camera);
}
$response = array();
if ($camera) {
$camera['camera_url'] = $cameraPortion;
$amazonEcs = new sonnb_XenGallery_Model_AmazonECS($xenOptions->sonnbXG_amazonAccessKey, $xenOptions->sonnbXG_amazonSecretKey, $xenOptions->sonnbXG_amazonSite, $xenOptions->sonnbXG_amazonAssociateTag);
$amazonEcs->returnType(sonnb_XenGallery_Model_AmazonECS::RETURN_TYPE_ARRAY);
$amazonEcs->page($page);
try {
$response = $amazonEcs->category('Electronics')->responseGroup('Large')->search($camera['camera_name']);
} catch (Exception $e) {
}
}
return $this->responseView('sonnb_XenGallery_ViewPublic_Camera_Shopping', 'sonnb_xengallery_camera_shopping', array('camera' => $camera, 'items' => empty($response['Items']['Item']) ? array() : $response['Items']['Item'], 'page' => $page, 'perPage' => 10, 'totalItems' => empty($response['Items']['TotalResults']) ? 0 : $response['Items']['TotalResults'], 'totalPages' => empty($response['Items']['TotalPages']) ? 0 : $response['Items']['TotalPages'], 'breadCrumbs' => $cameraModel->getCameraBreadCrumbs()));
}
示例4: _postSave
/**
* Post-save handling.
*
* Note: not run when importing
*/
protected function _postSave()
{
parent::_postSave();
if ($this->isInsert() && !empty(XenForo_Application::getOptions()->dpAnalyticsEvents['registration']) && !empty(XenForo_Application::getOptions()->dpAnalyticsInternal['v'])) {
if (XenForo_Application::isRegistered('fc')) {
$action = preg_split('/\\b/', strtolower(trim(XenForo_Application::getFc()->route()->getAction())));
switch ($action[1]) {
case 'facebook':
$label = 'Facebook';
break;
case 'google':
$label = 'Google';
break;
case 'twitter':
$label = 'Twitter';
break;
default:
$label = 'Standard';
// would have preferred to leave this blank, but a null value causes it to be omitted from certain reports in Analytics
}
} else {
$label = null;
}
$user = $this->getMergedData();
if (XenForo_Application::isRegistered('fc')) {
$analyticsClientId = XenForo_Application::getFc()->getRequest()->getCookie('_ga');
} else {
$analyticsClientId = null;
}
DigitalPointBetterAnalytics_Helper_Analytics::getInstance()->event(XenForo_Application::getOptions()->googleAnalyticsWebPropertyId, $analyticsClientId, $user['user_id'], @$_SERVER['REMOTE_ADDR'], 'User', 'Registration', $label);
}
}
示例5: actionTrash
public function actionTrash()
{
if (!XenForo_Visitor::getInstance()->hasPermission('forum', 'trashThreads')) {
throw $this->getErrorOrNoPermissionResponseException(false);
}
if (!($targetNode = XenForo_Application::getOptions()->nixfifty_trash_can)) {
return $this->responseError(new XenForo_Phrase('trash_can_node_not_set'));
}
$threadId = $this->_input->filterSingle('thread_id', XenForo_Input::UINT);
list($thread, $forum) = $this->getHelper('ForumThreadPost')->assertThreadValidAndViewable($threadId);
if ($this->isConfirmedPost()) {
$softDelete = $this->_input->filterSingle('trash_type', XenForo_Input::UINT);
$trashType = $softDelete ? 'move' : 'soft';
$options = array('reason' => $this->_input->filterSingle('reason', XenForo_Input::STRING));
$dw = XenForo_DataWriter::create('XenForo_DataWriter_Discussion_Thread');
$dw->setExistingData($threadId);
$dw->set('node_id', $targetNode);
$dw->save();
if ($trashType == 'soft' && XenForo_Visitor::getInstance()->hasPermission('forum', 'softDeleteTrashedThreads')) {
$this->_getThreadModel()->deleteThread($threadId, $trashType, $options);
XenForo_Model_Log::logModeratorAction('thread', $thread, 'delete_' . $trashType, array('reason' => $options['reason']));
}
XenForo_Model_Log::logModeratorAction('thread', $thread, 'move', array('from' => $forum['title']));
$this->_updateModeratorLogThreadEdit($thread, $dw, array('node_id'));
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildPublicLink('forums', $forum));
} else {
return $this->responseView('', 'trash_thread', array('thread' => $thread));
}
}
示例6: template_hook
public static function template_hook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
{
switch ($hookName) {
case 'attached_file_thumbnail':
$xenOptions = XenForo_Application::getOptions();
$cdnEnable = $xenOptions->Tinhte_AIO_CDNEnable;
$cdnDomain = $xenOptions->Tinhte_AIO_CDNDomain;
if (isset($hookParams['attachment']['thumbnailUrl'])) {
if ($cdnEnable) {
$hookParams['attachment_link'] = XenForo_Link::buildPublicLink('attachments', $hookParams['attachment']);
$hookParams['attachment_thumbnail'] = $hookParams['attachment']['thumbnailUrl'];
if (substr($hookParams['attachment_link'], 0, 7) != 'http://' && substr($hookParams['attachment_link'], 0, 8) != 'https://') {
$hookParams['attachment_link'] = self::_getValidUrl($cdnDomain) . $hookParams['attachment_link'];
}
if (substr($hookParams['attachment_thumbnail'], 0, 7) != 'http://' && substr($hookParams['attachment_thumbnail'], 0, 8) != 'https://') {
$hookParams['attachment_thumbnail'] = self::_getValidUrl($cdnDomain) . $hookParams['attachment_thumbnail'];
}
$hookParams['cdnDomain'] = self::_getValidUrl($cdnDomain);
} else {
$hookParams['attachment_link'] = XenForo_Link::buildPublicLink('full:attachments', $hookParams['attachment']);
$hookParams['attachment_thumbnail'] = $hookParams['attachment']['thumbnailUrl'];
}
$hookTemplate = $template->create('TinhTe_AIO_Attached', $hookParams);
$contents = $hookTemplate->render();
}
break;
}
}
示例7: _sendEmail
protected function _sendEmail(array $email, array $user, Zend_Mail_Transport_Abstract $transport)
{
if (!$user['email']) {
return;
}
$phraseTitles = XenForo_Helper_String::findPhraseNamesFromStringSimple($email['email_title'] . $email['email_body']);
/** @var XenForo_Model_Phrase $phraseModel */
$phraseModel = XenForo_Model::create('XenForo_Model_Phrase');
$phrases = $phraseModel->getPhraseTextFromPhraseTitles($phraseTitles, $user['language_id']);
foreach ($phraseTitles as $search => $phraseTitle) {
if (isset($phrases[$phraseTitle])) {
$email['email_title'] = str_replace($search, $phrases[$phraseTitle], $email['email_title']);
$email['email_body'] = str_replace($search, $phrases[$phraseTitle], $email['email_body']);
}
}
$mailObj = new Zend_Mail('utf-8');
$mailObj->setSubject($email['email_title'])->addTo($user['email'], $user['username'])->setFrom($email['from_email'], $email['from_name']);
$options = XenForo_Application::getOptions();
$bounceEmailAddress = $options->bounceEmailAddress;
if (!$bounceEmailAddress) {
$bounceEmailAddress = $options->defaultEmailAddress;
}
$toEmail = $user['email'];
$bounceHmac = substr(hash_hmac('md5', $toEmail, XenForo_Application::getConfig()->globalSalt), 0, 8);
$mailObj->addHeader('X-To-Validate', "{$bounceHmac}+{$toEmail}");
if ($options->enableVerp) {
$verpValue = str_replace('@', '=', $toEmail);
$bounceEmailAddress = str_replace('@', "+{$bounceHmac}+{$verpValue}@", $bounceEmailAddress);
}
$mailObj->setReturnPath($bounceEmailAddress);
if ($email['email_format'] == 'html') {
$replacements = array('{name}' => htmlspecialchars($user['username']), '{email}' => htmlspecialchars($user['email']), '{id}' => $user['user_id']);
$email['email_body'] = strtr($email['email_body'], $replacements);
$text = trim(htmlspecialchars_decode(strip_tags($email['email_body'])));
$mailObj->setBodyHtml($email['email_body'])->setBodyText($text);
} else {
$replacements = array('{name}' => $user['username'], '{email}' => $user['email'], '{id}' => $user['user_id']);
$email['email_body'] = strtr($email['email_body'], $replacements);
$mailObj->setBodyText($email['email_body']);
}
if (!$mailObj->getMessageId()) {
$mailObj->setMessageId();
}
$thisTransport = XenForo_Mail::getFinalTransportForMail($mailObj, $transport);
try {
$mailObj->send($thisTransport);
} catch (Exception $e) {
if (method_exists($thisTransport, 'resetConnection')) {
XenForo_Error::logException($e, false, "Email to {$user['email']} failed: ");
$thisTransport->resetConnection();
try {
$mailObj->send($thisTransport);
} catch (Exception $e) {
XenForo_Error::logException($e, false, "Email to {$user['email']} failed (after retry): ");
}
} else {
XenForo_Error::logException($e, false, "Email to {$user['email']} failed: ");
}
}
}
示例8: applyCover
public function applyCover($teamId, $fileName, $imageType = false, $width = false, $height = false, $existingCoverDate = 0)
{
if (!$imageType || !$width || !$height) {
$imageInfo = @getimagesize($fileName);
if (!$imageInfo) {
throw new Nobita_Teams_Exception_Abstract('Non-image passed in to applyCover');
}
$width = $imageInfo[0];
$height = $imageInfo[1];
$imageType = $imageInfo[2];
}
if (!in_array($imageType, array(IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
throw new Nobita_Teams_Exception_Abstract('Invalid image type passed in to applyCover');
}
if (!XenForo_Image_Abstract::canResize($width, $height)) {
throw new Nobita_Teams_Exception_Abstract(new XenForo_Phrase('uploaded_image_is_too_big'), true);
}
$maxFileSize = XenForo_Application::getOptions()->Teams_coverFileSize;
if ($maxFileSize && filesize($fileName) > $maxFileSize) {
@unlink($fileName);
throw new XenForo_Exception(new XenForo_Phrase('Teams_your_cover_file_size_large_smaller_x', array('size' => XenForo_Locale::numberFormat($maxFileSize, 'size'))), true);
}
if ($existingCoverDate) {
$existedFile = $this->getCoverCropFilePath($teamId, $existingCoverDate);
@unlink($existedFile);
}
$this->_witerCoverPhoto($teamId, $fileName);
@unlink($fileName);
$dwData = array('cover_date' => XenForo_Application::$time, 'cover_crop_details' => array('height' => $height, 'width' => $width));
$dw = XenForo_DataWriter::create('Nobita_Teams_DataWriter_Team');
$dw->setExistingData($teamId);
$dw->bulkSet($dwData);
$dw->save();
return $dwData;
}
示例9: __construct
public function __construct($message, $userPrintable = false)
{
$routePrefix = XenForo_Application::getOptions()->Teams_routePrefix;
switch ($routePrefix) {
case 'teams':
$prefix = '[Nobita] Social Teams';
break;
case 'groups':
$prefix = '[Nobita] Social Groups';
break;
case 'guilds':
$prefix = '[Nobita] Social Guilds';
break;
case 'clubs':
$prefix = '[Nobita] Social Clubs';
break;
default:
$prefix = '';
}
if (is_array($message) && count($message) > 0) {
$message = reset($message);
}
$message = $prefix . ': ' . $message;
parent::__construct($message, $userPrintable);
}
示例10: canViewAlert
/**
* Determines if the alert is viewable.
* @see XenForo_AlertHandler_Abstract::canViewAlert()
*/
public function canViewAlert(array $alert, $content, array $viewingUser)
{
if ($alert['action'] == 'trophy') {
return XenForo_Application::getOptions()->enableTrophies;
}
return true;
}
示例11: getRegSpamScore
static function getRegSpamScore(&$score, array $user, $verbose, $debug, $model)
{
$o = XenForo_Application::getOptions();
if (trim($o->TPUDetectSpamRegEmail) != '') {
$email = $user['email'];
foreach (explode("\n", $o->TPUDetectSpamRegEmail) as $entry) {
$entry = explode('|', trim($entry));
if (count($entry) != 2) {
continue;
}
list($points, $match) = $entry;
$regex = $model->buildWildcardRegex($match);
if (preg_match('/^' . $regex . '$/iU', $email)) {
$model->logScore('tpu_detectspamreg_email_fail', $points, array('email' => $match));
if (is_numeric($points)) {
$score['points'] += $points;
} else {
$score[$points] = true;
}
} else {
if ($debug) {
$model->logScore('tpu_detectspamreg_email_ok', 0, array('email' => $match));
}
}
}
}
}
示例12: get
public static function get($key, $subKey = null)
{
$options = XenForo_Application::getOptions();
switch ($key) {
case '_is120+':
return XenForo_Application::$versionId >= 1020000;
case '_is130+':
return XenForo_Application::$versionId >= 1030000;
case '_activated':
if (self::$_activated === null) {
$providers = self::getProviders();
self::$_activated = !empty($providers);
}
return self::$_activated;
case '_showButtons':
if (self::$_showButtons === null) {
self::$_showButtons = false;
if (!self::get('takeOver', 'login')) {
// no login take over, show the provider buttons
self::$_showButtons = true;
}
if (self::get('loginFacebook') or self::get('loginTwitter') or self::get('loginGoogle')) {
// show social buttons
self::$_showButtons = true;
}
}
return self::$_showButtons;
case 'providers':
if (self::$_providers === null) {
self::$_providers = $options->get('bdapi_consumer_providers');
}
return self::$_providers;
}
return $options->get('bdapi_consumer_' . $key, $subKey);
}
示例13: getRegSpamScore
static function getRegSpamScore(&$score, array $user, $verbose, $debug, $model)
{
$o = XenForo_Application::getOptions();
if (trim($o->TPUDetectSpamRegIPCountry) != '') {
$ipCountry = self::getIPCountry($user['ip']);
if ($verbose) {
$model->logScore('tpu_detectspamreg_country_detected', 0, array('country' => $ipCountry));
}
foreach (explode("\n", $o->TPUDetectSpamRegIPCountry) as $entry) {
$entry = explode('|', trim($entry));
if (count($entry) != 2) {
continue;
}
list($points, $country) = $entry;
if (strcasecmp($country, $ipCountry) == 0) {
$model->logScore('tpu_detectspamreg_country_fail', $points, array('country' => $country));
if (is_numeric($points)) {
$score['points'] += $points;
} else {
$score[$points] = true;
}
} else {
if ($debug) {
$model->logScore('tpu_detectspamreg_country_ok', 0, array('country' => $country));
}
}
}
}
}
示例14: _render
protected function _render(array $widget, $positionCode, array $params, XenForo_Template_Abstract $renderTemplateObject)
{
if (!XenForo_Visitor::getInstance()->hasPermission('modm_ajaxchat', 'ajax_chat_view')) {
return "";
}
/* @var $ajaxChatModel MODM_AJAXChat_Model_Chat */
$ajaxChatModel = XenForo_Model::create("MODM_AJAXChat_Model_Chat");
// Removes inactive users
$ajaxChatModel->checkAndRemoveInactive();
// Get online users for all accessible channels:
$channels = $ajaxChatModel->getChannels();
// Add the own private channel if allowed:
if ($ajaxChatModel->isAllowedToCreatePrivateChannel()) {
array_push($channels, $ajaxChat->getPrivateChannelID());
}
// Add the invitation channels:
foreach ($ajaxChatModel->getInvitations() as $channelID) {
if (!in_array($channelID, $channels)) {
array_push($channels, $channelID);
}
}
$userNames = $ajaxChatModel->getOnlineUsers($channels);
/* @var $userModel XenForo_Model_User */
$userModel = XenForo_Model::create("XenForo_Model_User");
$guestUsers = array();
$ajaxChat['onlineUsers'] = $userModel->getUsersByNames($userNames, array(), $guestUsers);
$ajaxChat['members'] = count($ajaxChat['onlineUsers']);
$ajaxChat['guests'] = XenForo_Application::getOptions()->get('modm_ajaxchat_options_allowguests') != "0" ? count($guestUsers) : null;
$ajaxChat['total'] = $ajaxChat['members'] + $ajaxChat['guests'];
$ajaxChat['limit'] = $ajaxChat['members'] < 10 ? $ajaxChat['members'] : 10;
$ajaxChat['recordsUnseen'] = $ajaxChat['members'] > $ajaxChat['limit'] ? true : false;
$renderTemplateObject->setParam('AjaxChat', $ajaxChat);
return $renderTemplateObject->render();
}
示例15: actionPaymentwall
public function actionPaymentwall()
{
$appKey = XenForo_Application::getOptions()->get('Paymentwall_appKey');
if (empty($appKey)) {
throw new XenForo_Exception('Project Key has not been configured');
}
}