本文整理汇总了PHP中XenForo_View::createOwnTemplateObject方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_View::createOwnTemplateObject方法的具体用法?PHP XenForo_View::createOwnTemplateObject怎么用?PHP XenForo_View::createOwnTemplateObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_View
的用法示例。
在下文中一共展示了XenForo_View::createOwnTemplateObject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addRedactorButtons
public static function addRedactorButtons(XenForo_View $view, $formCtrlName, &$message, array &$editorOptions, &$showWysiwyg)
{
if (!$showWysiwyg) {
return false;
}
$xenOptions = XenForo_Application::get('options');
if ($xenOptions->bbm_debug_tinymcehookdisable) {
return false;
}
$template = $view->createOwnTemplateObject();
$controllerName = $template->getParam('controllerName');
$controllerAction = $template->getParam('controllerAction');
$viewName = $template->getParam('viewName');
$bbmParams = BBM_Helper_Buttons::getConfig($controllerName, $controllerAction, $viewName);
if (empty($bbmParams['bbmButtonsJsGridArray'])) {
//We must be here with Quattro
return false;
}
$bbmButtonsJsGrid = $bbmParams['bbmButtonsJsGridArray'];
$bbmCustomButtons = $bbmParams['bbmCustomButtons'];
if (!isset($editorOptions['json']['buttons'])) {
//Make this as an array to avoid any errors below
$editorOptions['json']['buttons'] = array();
}
$jsonButtons =& $editorOptions['json']['buttons'];
$extendedButtonsBackup = array();
/**
* Filter buttons grid
*/
$allGridButtons = array();
if (!empty($bbmButtonsJsGrid)) {
foreach ($bbmButtonsJsGrid as &$buttonGroup) {
foreach ($buttonGroup as $key => $button) {
if (!self::filterButton($button, $editorOptions, $editorOptions, $showWysiwyg)) {
unset($buttonGroup[$key]);
continue;
}
array_push($allGridButtons, $button);
}
}
}
/**
* XenForo Custom BbCodes Manager Buttons
*/
if (!empty($editorOptions['json']['bbCodes'])) {
$customBbCodesButtons = array();
foreach ($editorOptions['json']['bbCodes'] as $k => $v) {
$customTag = "custom_{$k}";
if (!in_array($customTag, $allGridButtons) && self::filterButton($customTag, $editorOptions, $editorOptions, $showWysiwyg)) {
$customBbCodesButtons[] = $customTag;
}
}
if (!empty($customBbCodesButtons)) {
$bbmButtonsJsGrid[] = $customBbCodesButtons;
}
}
/**
* Other addons Buttons Backup
*/
if (!empty($jsonButtons)) {
$extendedButtonsBackup = $jsonButtons;
}
/**
* Get BBM Custom Buttons
*/
if (is_array($bbmCustomButtons)) {
foreach ($bbmCustomButtons as $button) {
$tag = preg_replace('#^at_#', '', $button['tag']);
$code = $button['code'];
$desc = XenForo_Template_Helper_Core::jsEscape($button['description']);
$opts = XenForo_Template_Helper_Core::jsEscape($button['tagOptions']);
$content = XenForo_Template_Helper_Core::jsEscape($button['tagContent']);
$separator = XenForo_Template_Helper_Core::jsEscape($button['separator']);
$textButton = XenForo_Template_Helper_Core::jsEscape($button['textButton']);
$faButton = XenForo_Template_Helper_Core::jsEscape($button['faButton']);
$jsonButtons[$code] = array('title' => $desc, 'tag' => $tag, 'bbCodeOptions' => $opts, 'bbCodeOptionsSeparator' => $separator, 'bbCodeContent' => $content, 'textButton' => $textButton, 'faButton' => $faButton);
}
}
/**
* Let's put back the buttons from other addons at the end of the editor with the backup
* Also check if some of these buttons have a bbm configuration to delete them from the backup
*/
if (!empty($extendedButtonsBackup) && is_array($extendedButtonsBackup)) {
foreach ($jsonButtons as $buttonCode => $jsonButton) {
if (isset($extendedButtonsBackup[$buttonCode])) {
$jsonButtons[$buttonCode] = array_merge($jsonButtons[$buttonCode], $extendedButtonsBackup[$buttonCode]);
unset($extendedButtonsBackup[$buttonCode]);
}
}
if (!empty($extendedButtonsBackup)) {
//Extend custom buttons
$jsonButtons += $extendedButtonsBackup;
//Extend buttons grid
$extendedgrid = array();
foreach ($extendedButtonsBackup as $buttonCode => $extendedButton) {
$extendedgrid[] = $buttonCode;
}
array_push($bbmButtonsJsGrid, $extendedgrid);
}
}
//.........这里部分代码省略.........
示例2: editor_setup
/**
* @param XenForo_View $view
* @param $formCtrlName
* @param $message
* @param array $editorOptions
* @param $showWysiwyg
*/
public static function editor_setup(XenForo_View $view, $formCtrlName, &$message, array &$editorOptions, &$showWysiwyg)
{
if ($showWysiwyg && XenForo_Application::getOptions()->sonnbXG_editorButtons) {
$view->createOwnTemplateObject()->addRequiredExternal('css', 'sonnb_xengallery_editor');
$time = XenForo_Application::$time;
$visitor = XenForo_Visitor::getInstance();
if ($formCtrlName !== 'signature' || $formCtrlName === 'signature' && $visitor->hasPermission('signature', 'sonnbXG_album')) {
$editorOptions['json']['buttons']['insertAlbum'] = array('title' => new XenForo_Phrase('sonnb_xengallery_insert_album'), 'dialogUrl' => XenForo_Link::buildPublicLink('gallery/editor', null, array('type' => 'album', 'time' => $time)));
}
if ($formCtrlName !== 'signature' || $formCtrlName === 'signature' && ($visitor->hasPermission('signature', 'sonnbXG_photo') || $visitor->hasPermission('signature', 'sonnbXG_video'))) {
$editorOptions['json']['buttons']['insertContent'] = array('title' => new XenForo_Phrase('sonnb_xengallery_insert_content'), 'dialogUrl' => XenForo_Link::buildPublicLink('gallery/editor', null, array('type' => 'content', 'time' => $time)));
}
}
}