/**
  * Override the index of the dashboard's settings controller in the to render new statistics.
  *
  * @param SettingsController $sender Instance of the dashboard's settings controller.
  */
 public function settingsController_home_create($sender)
 {
     $statsUrl = $this->AnalyticsServer;
     if (!stringBeginsWith($statsUrl, 'http:') && !stringBeginsWith($statsUrl, 'https:')) {
         $statsUrl = Gdn::request()->scheme() . "://{$statsUrl}";
     }
     Gdn_Theme::section('DashboardHome');
     $sender->setData('IsWidePage', true);
     // Tell the page where to find the Vanilla Analytics provider
     $sender->addDefinition('VanillaStatsUrl', $statsUrl);
     $sender->setData('VanillaStatsUrl', $statsUrl);
     // Load javascript & css, check permissions, and load side menu for this page.
     $sender->addJsFile('settings.js');
     $sender->title(t('Dashboard'));
     $sender->RequiredAdminPermissions = ['Garden.Settings.View', 'Garden.Settings.Manage', 'Garden.Community.Manage'];
     $sender->fireEvent('DefineAdminPermissions');
     $sender->permission($sender->RequiredAdminPermissions, '', false);
     $sender->setHighlightRoute('dashboard/settings');
     if (!Gdn_Statistics::checkIsEnabled() && Gdn_Statistics::checkIsLocalhost()) {
         $sender->render('dashboardlocalhost', '', 'plugins/VanillaStats');
     } else {
         $sender->addCssFile('picker.css', 'plugins/VanillaStats');
         $sender->addCssFile('vendors/c3.min.css', 'plugins/VanillaStats');
         $sender->addJsFile('vanillastats.js', 'plugins/VanillaStats');
         $sender->addJsFile('picker.js', 'plugins/VanillaStats');
         $sender->addJsFile('d3.min.js');
         $sender->addJsFile('c3.min.js');
         $sender->addDefinition('VanillaID', Gdn::installationID());
         $sender->addDefinition('AuthToken', Gdn_Statistics::generateToken());
         $sender->addDefinition('ExpandText', t('more'));
         $sender->addDefinition('CollapseText', t('less'));
         // Render the custom dashboard view
         $sender->render('dashboard', '', 'plugins/VanillaStats');
     }
 }
 /**
  *
  * @param SettingsController $Sender
  * @param array $Args
  */
 public function settingsController_editor_create($Sender, $Args)
 {
     $Sender->permission('Garden.Settings.Manage');
     $Cf = new ConfigurationModule($Sender);
     $Formats = array_combine($this->Formats, $this->Formats);
     $Cf->initialize(array('Garden.InputFormatter' => array('LabelCode' => 'Post Format', 'Control' => 'DropDown', 'Description' => '<p>Select the default format of the editor for posts in the community.</p> <p><small><strong>Note:</strong> the editor will auto-detect the format of old posts when editing them and load their original formatting rules. Aside from this exception, the selected post format below will take precedence.</small></p>', 'Items' => $Formats), 'Plugins.editor.ForceWysiwyg' => array('LabelCode' => 'Reinterpret All Posts As Wysiwyg', 'Control' => 'Checkbox', 'Description' => '<p>Check the below option to tell the editor to reinterpret all old posts as Wysiwyg.</p> <p><small><strong>Note:</strong> This setting will only take effect if Wysiwyg was chosen as the Post Format above. The purpose of this option is to normalize the editor format. If older posts edited with another format, such as markdown or BBCode, are loaded, this option will force Wysiwyg.</p>'), 'Garden.MobileInputFormatter' => array('LabelCode' => 'Mobile Format', 'Control' => 'DropDown', 'Description' => '<p>Specify an editing format for mobile devices. If mobile devices should have the same experience, specify the same one as above. If users report issues with mobile editing, this is a good option to change.</p>', 'Items' => $Formats, 'DefaultValue' => c('Garden.MobileInputFormatter'))));
     // Add some JS and CSS to blur out option when Wysiwyg not chosen.
     $c = Gdn::controller();
     $c->addJsFile('settings.js', 'plugins/editor');
     $Sender->addCssFile('settings.css', 'plugins/editor');
     $Sender->addSideMenu();
     $Sender->setData('Title', t('Advanced Editor Settings'));
     $Cf->renderAll();
 }
 /**
  * Configure settings page in dashboard.
  *
  * @param SettingsController $sender
  * @param array $args
  */
 public function settingsController_emojiExtender_create($sender, $args)
 {
     $cf = new ConfigurationModule($sender);
     $items = array();
     foreach ($this->getEmojiSets() as $key => $emojiSet) {
         $manifest = $this->getManifest($emojiSet);
         $icon = isset($manifest['icon']) ? img($emojiSet['basePath'] . '/' . $manifest['icon'], array('alt' => $manifest['name'])) : '';
         $items[$key] = '@' . $icon . '<div emojiset-body>' . '<div><b>' . htmlspecialchars($manifest['name']) . '</b></div>' . (empty($manifest['author']) ? '' : '<div class="emojiset-author">' . sprintf(t('by %s'), $manifest['author']) . '</div>') . (empty($manifest['description']) ? '' : '<p class="emojiset-description">' . Gdn_Format::wysiwyg($manifest['description']) . '</p>') . '</div>';
     }
     $cf->initialize(array('Garden.EmojiSet' => array('LabelCode' => 'Emoji Set', 'Control' => 'radiolist', 'Description' => '<p>Which emoji set would you like to use?</p>', 'Items' => $items, 'Options' => array('list' => true, 'listclass' => 'emojiext-list', 'display' => 'after'))));
     $sender->addCssFile('settings.css', 'plugins/EmojiExtender');
     $sender->addSideMenu();
     $sender->setData('Title', sprintf(t('%s Settings'), 'Emoji'));
     $cf->renderAll();
 }