本文整理汇总了PHP中XenForo_Template_Helper_Core::callHelper方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Template_Helper_Core::callHelper方法的具体用法?PHP XenForo_Template_Helper_Core::callHelper怎么用?PHP XenForo_Template_Helper_Core::callHelper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Template_Helper_Core
的用法示例。
在下文中一共展示了XenForo_Template_Helper_Core::callHelper方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionGames
/**
* Section that lists all games and individual game stats
*/
public function actionGames()
{
$sHelper = new Steam_Helper_Steam();
$gameId = $this->_input->filterSingle('game_id', XenForo_Input::UINT);
if ($gameId) {
$userModel = XenForo_Model::create('XenForo_Model_User');
$sHelper = new Steam_Helper_Steam();
$users = $sHelper->getGameOwners($gameId);
$owners = array();
$hours = 0;
foreach ($users as $user) {
$u = $userModel->getUserById($user['user_id']);
$user['avatar_url'] = XenForo_Template_Helper_Core::callHelper('avatar', array($u, 's', null, true));
$owners[] = $user;
$hours += $user['hours'];
}
if (count($owners) == 0) {
$hoursAvgMath = 0;
} else {
$hoursAvgMath = round($hours / count($owners));
}
$viewParams = array('count' => count($owners), 'game' => $sHelper->getGameInfo($gameId), 'users' => $owners, 'hours' => $hours, 'hoursAvg' => $hoursAvgMath);
$template = 'steam_stats_game_view';
} else {
$steamModel = new Steam_Model_Steam();
$gamesPerPage = 25;
$page = $this->_input->filterSingle('page', XenForo_Input::UINT);
$viewParams = array('page' => $page, 'totalGames' => $sHelper->getAvailableGamesCount(), 'gamesPerPage' => $gamesPerPage, 'games' => $steamModel->getAvailableGames(array('perPage' => $gamesPerPage, 'page' => $page)));
$template = 'steam_stats_games';
}
return $this->responseView('XenForo_ViewAdmin_Steam_Games', $template, $viewParams);
}
示例2: actionEdit
public function actionEdit()
{
$id = $this->_input->filterSingle('tag_id', XenForo_Input::UINT);
$tag = $this->_getTagOrError($id);
if ($this->isConfirmedPost()) {
$dwInput = $this->_input->filter(array('tag_text' => XenForo_Input::STRING, 'tag_title' => XenForo_Input::STRING, 'tag_description' => XenForo_Input::STRING, 'is_staff' => XenForo_Input::UINT));
$dw = $this->_getTagDataWriter();
$dw->setExistingData($id);
$dw->bulkSet($dwInput);
// process link target_type
// since 1.8
$link = $this->_input->filterSingle('link', XenForo_Input::STRING);
if (!empty($link)) {
$existingLink = $this->_getTagModel()->getTagLink($tag);
if ($link != $existingLink) {
$dw->bulkSet(array('target_type' => 'link', 'target_id' => 0, 'target_data' => array('link' => $link)));
}
} else {
$dw->bulkSet(array('target_type' => '', 'target_id' => 0, 'target_data' => array()));
}
$dw->save();
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildAdminLink('xentag-tags') . '#' . XenForo_Template_Helper_Core::callHelper('listitemid', array($tag['tag_id'])));
} else {
$viewParams = array('tag' => $tag, 'tagLink' => $this->_getTagModel()->getTagLink($tag));
return $this->responseView('Tinhte_XenTag_ViewAdmin_Tag_Edit', 'tinhte_xentag_tag_edit', $viewParams);
}
}
示例3: helperSnippet
public static function helperSnippet($string, $maxLength = 0, array $options = array())
{
// TODO: smart stripping of tags with options
$string = self::stripTag('ismemberofusergroup', $string);
$string = self::stripTag('isnotmemberofusergroup', $string);
$string = self::stripTag('isuserid', $string);
$string = self::stripTag('isusername', $string);
$string = self::stripTag('isnotuserid', $string);
$string = self::stripTag('isnotusername', $string);
$visitor = XenForo_Visitor::getInstance();
/* @var $userModel XenForo_Model_User */
$userModel = XenForo_Model::create('XenForo_Model_User');
if (!$userModel->isMemberOfUserGroup($visitor->toArray(), 1)) {
$string = self::stripTag('guest', $string);
} else {
$string = self::stripTag('notguest', $string);
}
if (!$userModel->isMemberOfUserGroup($visitor->toArray(), 2)) {
$string = self::stripTag('registered', $string);
} else {
$string = self::stripTag('notregistered', $string);
}
if (!$userModel->isMemberOfUserGroup($visitor->toArray(), 3)) {
$string = self::stripTag('admin', $string);
} else {
$string = self::stripTag('notadmin', $string);
}
if (!$userModel->isMemberOfUserGroup($visitor->toArray(), 4)) {
$string = self::stripTag('mod', $string);
} else {
$string = self::stripTag('notmod', $string);
}
return XenForo_Template_Helper_Core::callHelper('th_usergroupbbcodes_snippet', array($string, $maxLength, $options));
}
示例4: renderJson
public function renderJson()
{
$results = array();
foreach ($this->_params['users'] as $user) {
$results[$user['username']] = array('avatar' => XenForo_Template_Helper_Core::callHelper('avatar', array($user, 's')), 'username' => htmlspecialchars($user['username']));
}
return array('results' => $results);
}
示例5: helperAvatarHtml
/**
*
* @see XenForo_Template_Helper_Core::helperAvatarHtml()
*/
public static function helperAvatarHtml(array $user, $img, array $attributes = array(), $content = '')
{
$returnLink = XenForo_Template_Helper_Core::callHelper('th_unlinkbanned_avatarhtml', array($user, $img, $attributes, $content));
if ($user['is_banned']) {
return preg_replace('#(<a )href="[^"]*"([^>]*>.*<\\/a>)#Us', '$1$2', $returnLink);
}
return $returnLink;
}
示例6: renderJson
public function renderJson()
{
$output = $this->_renderer->getDefaultOutputArray(get_class($this), $this->_params, $this->_templateName);
if ($this->_params['isStatus']) {
$output['statusHtml'] = XenForo_Template_Helper_Core::callHelper('bodytext', array($this->_params['profilePost']['message'])) . ' ' . XenForo_Template_Helper_Core::callHelper('datetimehtml', array($this->_params['profilePost']['post_date']));
}
return XenForo_ViewRenderer_Json::jsonEncodeForOutput($output);
}
示例7: getImage
public function getImage(XenForo_Model $model)
{
$resource = $this->_resourceDw->getMergedData();
if (isset(XenForo_Template_Helper_Core::$helperCallbacks['resourceiconurl'])) {
$iconUrl = XenForo_Template_Helper_Core::callHelper('resourceiconurl', array($resource));
return XenForo_Link::convertUriToAbsoluteUri($iconUrl, true);
}
return parent::getImage($model);
}
示例8: renderHtml
public function renderHtml()
{
if (isset($this->_params['scopes'])) {
$scopes = array();
foreach ($this->_params['scopes'] as $scope) {
$scopes[$scope] = XenForo_Template_Helper_Core::callHelper('api_scopeGetText', array($scope));
}
$this->_params['scopes'] = $scopes;
}
}
示例9: getData
public function getData(array $entry)
{
$result = array('loc' => XenForo_Link::buildPublicLink('canonical:xengallery/users/albums', $entry), 'priority' => 0.3);
if ($entry['gravatar'] || $entry['avatar_date']) {
$avatarUrl = htmlspecialchars_decode(XenForo_Template_Helper_Core::callHelper('avatar', array($entry, 'l')));
$avatarUrl = XenForo_Link::convertUriToAbsoluteUri($avatarUrl, true, $this->getCanonicalPaths());
$result['image'] = $avatarUrl;
}
return $result;
}
示例10: prepareApiDataForComment
public function prepareApiDataForComment(array $comment, array $profilePost, array $user)
{
$comment = $this->prepareProfilePostComment($comment, $profilePost, $user);
$publicKeys = array('profile_post_comment_id' => 'comment_id', 'profile_post_id' => 'profile_post_id', 'user_id' => 'comment_user_id', 'username' => 'comment_username', 'comment_date' => 'comment_create_date', 'message' => 'comment_body');
$data = bdApi_Data_Helper_Core::filter($comment, $publicKeys);
$data['timeline_user_id'] = $profilePost['profile_user_id'];
$data['links'] = array('detail' => bdApi_Data_Helper_Core::safeBuildApiLink('profile-posts/comments', $profilePost, array('comment_id' => $comment['profile_post_comment_id'])), 'profile_post' => bdApi_Data_Helper_Core::safeBuildApiLink('profile-posts', $profilePost), 'timeline' => bdApi_Data_Helper_Core::safeBuildApiLink('users/timeline', $user), 'timeline_user' => bdApi_Data_Helper_Core::safeBuildApiLink('users', $user), 'poster' => bdApi_Data_Helper_Core::safeBuildApiLink('users', $comment), 'poster_avatar' => XenForo_Template_Helper_Core::callHelper('avatar', array($comment, 'm', false, true)));
$data['permissions'] = array('view' => $this->canViewProfilePost($profilePost, $user), 'delete' => $this->canDeleteProfilePostComment($comment, $profilePost, $user));
return $data;
}
示例11: helperAvatarUrl
public static function helperAvatarUrl($user, $size, $forceType = null, $canonical = false)
{
if (!empty($user['gravatar'])) {
$avatarUrl = self::parseGravatar($user['gravatar']);
if (!empty($avatarUrl)) {
return XenForo_Template_Helper_Core::callHelper('bdapiconsumer_avatarresize', array($avatarUrl, $size));
}
}
return call_user_func(self::$_helperOriginal, $user, $size, $forceType, $canonical);
}
示例12: actionAddEntry
public function actionAddEntry()
{
// this action must be called via POST
$this->_assertPostOnly();
// guests not allowed
$this->_assertRegistrationRequired();
$permissions = XenForo_Visitor::getInstance()->getPermissions();
$actionAllowed = XenForo_Permission::hasPermission($permissions, "forum", "postThread");
if (!$actionAllowed) {
return $this->responseError('You do not have permissions to do this');
}
# Grab user info/model/array from db
$userModel = XenForo_Model::create('XenForo_Model_User');
// get donor id and also get the receiver's name
$dbtc_donor_id = $this->_input->filterSingle('dbtc_donor_id', XenForo_Input::STRING);
$dbtc_receiver_name = $this->_input->filterSingle('dbtc_receiver_name', XenForo_Input::STRING);
// get transaction id if it exists
$dbtc_transaction_id = $this->_input->filterSingle('dbtc_transaction_id', XenForo_Input::UINT);
// get parent transaction id if it exists
$dbtc_parent_transaction_id = $this->_input->filterSingle('dbtc_parent_transaction_id', XenForo_Input::UINT);
$donorModel = $userModel->getUserById($dbtc_donor_id);
$receiverModel = $userModel->getUserByNameOrEmail($dbtc_receiver_name);
// get user id
$dbtc_receiver_id = $receiverModel['user_id'];
// get the user based on id or error
// $user = $this->_getUserOrError($dbtc_receiver_id);
// get status id
$dbtc_status_id = $this->_input->filterSingle('dbtc_status_id', XenForo_Input::UINT);
// get date and make sure we have a 'human' versino of the date
$dbtc_date = $this->_input->filterSingle('dbtc_date', XenForo_Input::DATE_TIME);
$dbtc_human_date = gmdate("m/d/Y", $dbtc_date);
# Grab avatar and link
$avatar = XenForo_Template_Helper_Core::callHelper('avatarhtml', array($receiverModel, TRUE, array('size' => 's'), ''));
// get all necessary inputs from this form
$dbtc_thread_id = $this->_input->filterSingle('dbtc_thread_id', XenForo_Input::UINT);
// $data = array($dbtc_thread_id, $dbtc_donor_id, $dbtc_receiver_id, $dbtc_status_id, $dbtc_date, $avatar);
// create a new DataWriter and set user_id and message fields
$writer = XenForo_DataWriter::create('DBTC_DataWriter_DBTCNodeEntry');
// if we're editing a transaction
if ($dbtc_transaction_id != 0) {
$writer->setExistingData($dbtc_transaction_id);
}
$writer->set('dbtc_thread_id', $dbtc_thread_id);
$writer->set('dbtc_donor_id', $dbtc_donor_id);
$writer->set('dbtc_receiver_id', $dbtc_receiver_id);
$writer->set('dbtc_status_id', $dbtc_status_id);
$writer->set('dbtc_date', $dbtc_date);
$writer->set('dbtc_parent_transaction_id', $dbtc_parent_transaction_id);
$writer->save();
// get the data that was saved
$nodeData = $writer->getMergedData();
$data = array('dbtc_transaction_id' => $nodeData['dbtc_transaction_id'], 'dbtc_thread_id' => $dbtc_thread_id, 'dbtc_donor_id' => $dbtc_donor_id, 'dbtc_receiver_id' => $dbtc_receiver_id, 'dbtc_receiver_name' => $dbtc_receiver_name, 'dbtc_status_id' => $dbtc_status_id, 'dbtc_date' => $dbtc_human_date, 'dbtc_receiver_avatar_html' => $avatar, 'dbtc_parent_transaction_id', $dbtc_parent_transaction_id);
// redirect back to the normal scratchpad index page
return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildPublicLink('dbtc-node-entry'), null, $data);
}
示例13: renderTagSigPic
public function renderTagSigPic(array $tag, array $user)
{
$user = false;
if (array_key_exists('0', $tag['children'])) {
$user = XenForo_Model::create('XenForo_Model_User')->getUserById($tag['children'][0], array('join' => XenForo_Model_User::FETCH_USER_PERMISSIONS));
} else {
$user = XenForo_Visitor::getInstance()->toArray();
}
// For signature preview to not fail
if ($user) {
$user['permissions'] = XenForo_Permission::unserializePermissions($user['global_permission_cache']);
if (XenForo_Permission::hasPermission($user['permissions'], 'signature', 'sigpic')) {
return XenForo_Template_Helper_Core::callHelper('sigpic', array($user));
}
}
return '';
}
示例14: helperUserNameHtml
public static function helperUserNameHtml(array $user, $username = '', $rich = false, array $attributes = array())
{
if ($username == '') {
$username = htmlspecialchars($user['username']);
}
if (!$rich and XenForo_Application::getOptions()->get("3ps_cmfu_overridePlainUsernameHelper") == 1) {
$rich = true;
}
if ($rich) {
$username = XenForo_Template_Helper_Core::callHelper('richusername', array($user, $username));
}
$href = self::getUserHref($user, $attributes);
$class = empty($attributes['class']) ? '' : ' ' . htmlspecialchars($attributes['class']);
unset($attributes['href'], $attributes['class']);
$attribs = self::getAttributes($attributes);
return "<a{$href} class=\"username{$class}\"{$attribs}>{$username}</a>";
}
示例15: getPlainText
public static function getPlainText($bbCode)
{
$config = XenForo_Application::getConfig();
$useSnippet = $config->get('bdApi_useSnippet');
if (!empty($useSnippet)) {
return XenForo_Template_Helper_Core::callHelper('snippet', array($bbCode, 0, array('stripQuote' => true, 'stripHtml' => false)));
} else {
// from XenForo_Helper_String::bbCodeStrip
$string = $bbCode;
$string = preg_replace('#\\[(attach|media|img)[^\\]]*\\].*\\[/\\1\\]#siU', '', $string);
while ($string != ($newString = preg_replace('#\\[([a-z0-9]+)(=[^\\]]*)?\\](.*)\\[/\\1\\]#siU', '\\3', $string))) {
$string = $newString;
}
$string = str_replace('[*]', '', $string);
$string = trim($string);
$string = XenForo_Helper_String::censorString($string);
return htmlspecialchars($string);
}
}