Ejemplo n.º 1
0
 public static function getConfig($controllerName, $controllerAction, $viewName)
 {
     /*Init*/
     $options = XenForo_Application::get('options');
     $visitor = XenForo_Visitor::getInstance();
     if (!empty($options->bbm_debug_tinymcehookdisable)) {
         return self::_fallBack(1);
     }
     $language = $visitor->getLanguage();
     if (!empty($language['text_direction'])) {
         self::$textDirection = $language['text_direction'];
     }
     self::$controllerName = $controllerName;
     self::$controllerAction = $controllerAction;
     self::$viewName = $viewName;
     //Check if Quattro is enable
     $quattroEnable = BBM_Helper_Bbm::checkIfAddonActive('sedo_tinymce_quattro', true);
     //Which editor is being used? $options->quattro_iconsize is only use to check if the addon is installed or enable
     $editor = empty($visitor->permissions['sedo_quattro']['display']) || !$quattroEnable ? 'xen' : 'mce';
     if (XenForo_Application::get('options')->get('currentVersionId') < 1020031) {
         $editor = 'mce';
     }
     self::$editor = $editor;
     //Get buttons config
     $myConfigs = BBM_Helper_Bbm::getBbmButtons();
     if (empty($myConfigs)) {
         return self::_fallBack(2);
     }
     //Only use the configuration for the current editor
     $myConfigs = $myConfigs['bbm_buttons'];
     //Check which Editor type must be used
     list($config_ed, $config_type) = self::_bakeEditorConfig($myConfigs, $editor);
     if (empty($myConfigs[$config_ed][$config_type]['config_buttons_order'])) {
         return self::_fallBack(3);
     }
     $extraParams = self::_bakeExtraParams($myConfigs[$config_ed][$config_type]['config_buttons_full'], $options, $visitor);
     if ($editor == 'mce' && $editor != $config_ed || $editor == 'xen') {
         $extraParams['loadQuattro'] = false;
     } else {
         $extraParams['loadQuattro'] = true;
     }
     return $extraParams;
 }