コード例 #1
0
 /**
  * Insert buttonbar resources
  * 
  * This method is abstracted because it is invoked by two different 
  * controllers.
  * 
  * @param Gdn_Controller $Sender 
  */
 protected function AttachButtonBarResources($Sender, $Formatter)
 {
     $Sender->AddCssFile('buttonbar.css', 'plugins/ButtonBar');
     $Sender->AddJsFile('buttonbar.js', 'plugins/ButtonBar');
     $Sender->AddJsFile('jquery.hotkeys.js', 'plugins/ButtonBar');
     $Sender->AddDefinition('InputFormat', $Formatter);
 }
コード例 #2
0
 /**
  * Insert buttonbar resources
  * 
  * This method is abstracted because it is invoked by multiple controllers.
  * 
  * @param Gdn_Controller $Sender 
  */
 protected function AttachButtonBarResources($Sender, $Formatter)
 {
     if (!in_array($Formatter, $this->Formats)) {
         return;
     }
     $Sender->AddJsFile('buttonbar.js', 'plugins/ButtonBar');
     $Sender->AddJsFile('jquery.hotkeys.js', 'plugins/ButtonBar');
     $Sender->AddDefinition('ButtonBarLinkUrl', T('ButtonBar.LinkUrlText', 'Enter your URL:'));
     $Sender->AddDefinition('ButtonBarImageUrl', T('ButtonBar.ImageUrlText', 'Enter image URL:'));
     $Sender->AddDefinition('ButtonBarBBCodeHelpText', T('ButtonBar.BBCodeHelp', 'You can use <b><a href="http://en.wikipedia.org/wiki/BBCode" target="_new">BBCode</a></b> in your post.'));
     $Sender->AddDefinition('ButtonBarHtmlHelpText', T('ButtonBar.HtmlHelp', 'You can use <b><a href="http://htmlguide.drgrog.com/cheatsheet.php" target="_new">Simple Html</a></b> in your post.'));
     $Sender->AddDefinition('ButtonBarMarkdownHelpText', T('ButtonBar.MarkdownHelp', 'You can use <b><a href="http://en.wikipedia.org/wiki/Markdown" target="_new">Markdown</a></b> in your post.'));
     $Sender->AddDefinition('InputFormat', $Formatter);
 }
コード例 #3
0
 /**
  * @param Gdn_Controller $Sender
  * @param args $Args
  */
 public function DiscussionController_AfterBodyField_Handler($Sender, $Args)
 {
     $Sender->AddJsFile('whispers.js', 'plugins/Whispers', array('hint' => 'inline'));
     $Sender->AddJsFile('jquery.autogrow.js');
     $Sender->AddJsFile('jquery.autocomplete.js');
     $this->Form = $Sender->Form;
     include $Sender->FetchViewLocation('WhisperForm', '', 'plugins/Whispers');
 }
コード例 #4
0
 /**
  * 
  * @param Gdn_Controller $Controller
  */
 public function AddPasswordStrength($Controller)
 {
     $Controller->AddJsFile('password.js');
     $Controller->AddDefinition('MinPassLength', C('Garden.Registration.MinPasswordLength'));
     $Controller->AddDefinition('PasswordTranslations', T('Password Translations', 'Too Short,Contains Username,Very Weak,Weak,Ok,Good,Strong'));
 }
コード例 #5
0
   /**
    *
    * @param Gdn_Controller $Sender
    */
	private function _Emotify($Sender) {
		$Sender->AddJsFile('plugins/Emotify/emotify.js');   
      $Sender->AddCssFile('plugins/Emotify/emotify.css');
      $Sender->AddDefinition('FormatEmoticons', C('Plugins.Emotify.FormatEmoticons', TRUE));
	}
コード例 #6
0
 /**
  * Add Wysihtml5 resources
  *
  * @param Gdn_Controller $Sender
  */
 private function _AddWysihtml5($Sender)
 {
     $Sender->AddCssFile('wysihtml5.css', 'plugins/Wysihtml5');
     $Sender->AddCssFile('sprites12.css', 'plugins/Wysihtml5');
     $Sender->AddJsFile('advanced.js', 'plugins/Wysihtml5');
     $Sender->AddJsFile('wysihtml5.js', 'plugins/Wysihtml5');
     $Sender->AddJsFile('initialize.js', 'plugins/Wysihtml5');
     $Sender->AddJsFile('underscore.js', 'plugins/Wysihtml5');
 }
コード例 #7
0
 /**
  * Add the customize text page to the dashboard.
  * 
  * @param Gdn_Controller $Sender
  */
 public function SettingsController_CustomizeText_Create($Sender)
 {
     $Sender->Permission('Garden.Settings.Manage');
     $Sender->AddSideMenu('settings/customizetext');
     $Sender->AddJsFile('jquery.autogrow.js');
     $Sender->Title('Customize Text');
     $Directive = GetValue(0, $Sender->RequestArgs, '');
     $View = 'customizetext';
     if ($Directive == 'rebuild') {
         $View = 'rebuild';
     } elseif ($Directive == 'rebuildcomplete') {
         $View = 'rebuildcomplete';
     }
     $Method = 'none';
     if ($Sender->Form->IsPostback()) {
         $Method = 'search';
         if ($Sender->Form->GetValue('Save_All')) {
             $Method = 'save';
         }
     }
     $Matches = array();
     $Keywords = NULL;
     switch ($Method) {
         case 'none':
             break;
         case 'search':
         case 'save':
             $Keywords = strtolower($Sender->Form->GetValue('Keywords'));
             if ($Method == 'search') {
                 $Sender->Form->ClearInputs();
                 $Sender->Form->SetFormValue('Keywords', $Keywords);
             }
             $Definitions = Gdn::Locale()->GetDeveloperDefinitions();
             $CountDefinitions = sizeof($Definitions);
             $Sender->SetData('CountDefinitions', $CountDefinitions);
             $Changed = FALSE;
             foreach ($Definitions as $Key => $BaseDefinition) {
                 $KeyHash = md5($Key);
                 $ElementName = "def_{$KeyHash}";
                 // Look for matches
                 $k = strtolower($Key);
                 $d = strtolower($BaseDefinition);
                 // If this key doesn't match, skip it
                 if ($Keywords != '*' && !(strlen($Keywords) > 0 && (strpos($k, $Keywords) !== FALSE || strpos($d, $Keywords) !== FALSE))) {
                     continue;
                 }
                 $Modified = FALSE;
                 // Found a definition, look it up in the real locale first, to see if it has been overridden
                 $CurrentDefinition = Gdn::Locale()->Translate($Key, FALSE);
                 if ($CurrentDefinition !== FALSE && $CurrentDefinition != $BaseDefinition) {
                     $Modified = TRUE;
                 } else {
                     $CurrentDefinition = $BaseDefinition;
                 }
                 $Matches[$Key] = array('def' => $CurrentDefinition, 'mod' => $Modified);
                 if ($CurrentDefinition[0] == "\r\n") {
                     $CurrentDefinition = "\r\n{$CurrentDefinition}";
                 } else {
                     if ($CurrentDefinition[0] == "\r") {
                         $CurrentDefinition = "\r{$CurrentDefinition}";
                     } else {
                         if ($CurrentDefinition[0] == "\n") {
                             $CurrentDefinition = "\n{$CurrentDefinition}";
                         }
                     }
                 }
                 if ($Method == 'save') {
                     $SuppliedDefinition = $Sender->Form->GetValue($ElementName);
                     // Has this field been changed?
                     if ($SuppliedDefinition != FALSE && $SuppliedDefinition != $CurrentDefinition) {
                         // Changed from what it was, but is it a change from the *base* value?
                         $SaveDefinition = $SuppliedDefinition != $BaseDefinition ? $SuppliedDefinition : NULL;
                         if (!is_null($SaveDefinition)) {
                             $CurrentDefinition = $SaveDefinition;
                             $SaveDefinition = str_replace("\r\n", "\n", $SaveDefinition);
                         }
                         Gdn::Locale()->SetTranslation($Key, $SaveDefinition, array('Save' => TRUE, 'RemoveEmpty' => TRUE));
                         $Matches[$Key] = array('def' => $SuppliedDefinition, 'mod' => !is_null($SaveDefinition));
                         $Changed = TRUE;
                     }
                 }
                 $Sender->Form->SetFormValue($ElementName, $CurrentDefinition);
             }
             if ($Changed) {
                 $Sender->InformMessage("Locale changes have been saved!");
             }
             break;
     }
     $Sender->SetData('Matches', $Matches);
     $CountMatches = sizeof($Matches);
     $Sender->SetData('CountMatches', $CountMatches);
     $Sender->Render($View, '', 'plugins/CustomizeText');
 }
コード例 #8
0
 /**
  * Inserts plugins JS code.
  *
  * @param Gdn_Controller $Sender 
  */
 public function base_render_before($Sender)
 {
     $Sender->AddJsFile('notificator.js', 'plugins/Notificator');
 }
コード例 #9
0
ファイル: class.usermodel.php プロジェクト: 3marproof/vanilla
 /**
  *
  * @param Gdn_Controller $Controller
  */
 public function AddPasswordStrength($Controller)
 {
     $Controller->AddJsFile('password.js');
     $Controller->AddDefinition('MinPassLength', C('Garden.Registration.MinPasswordLength'));
     $Controller->AddDefinition('PasswordTranslations', implode(',', array(T('Password Too Short', 'Too Short'), T('Password Contains Username', 'Contains Username'), T('Password Very Weak', 'Very Weak'), T('Password Weak', 'Weak'), T('Password Ok', 'OK'), T('Password Good', 'Good'), T('Password Strong', 'Strong'))));
 }