本文整理汇总了PHP中Gdn_Controller::AddJsFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Gdn_Controller::AddJsFile方法的具体用法?PHP Gdn_Controller::AddJsFile怎么用?PHP Gdn_Controller::AddJsFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gdn_Controller
的用法示例。
在下文中一共展示了Gdn_Controller::AddJsFile方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AttachButtonBarResources
/**
* 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: AttachButtonBarResources
/**
* 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: DiscussionController_AfterBodyField_Handler
/**
* @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: AddPasswordStrength
/**
*
* @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: _Emotify
/**
*
* @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: _AddWysihtml5
/**
* 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: SettingsController_CustomizeText_Create
/**
* 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: base_render_before
/**
* Inserts plugins JS code.
*
* @param Gdn_Controller $Sender
*/
public function base_render_before($Sender)
{
$Sender->AddJsFile('notificator.js', 'plugins/Notificator');
}
示例9: AddPasswordStrength
/**
*
* @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'))));
}