本文整理汇总了PHP中JText::script方法的典型用法代码示例。如果您正苦于以下问题:PHP JText::script方法的具体用法?PHP JText::script怎么用?PHP JText::script使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JText
的用法示例。
在下文中一共展示了JText::script方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Displays the view
*
* @param string $tpl The name of the template file to parse
*
* @return void
*
* @since 2.5
*/
public function display($tpl = null)
{
$doc = JFactory::getDocument();
$doc->addStyleSheet(JURI::root() . 'media/overrider/css/overrider.css');
JHtml::_('behavior.framework');
$doc->addScript(JURI::root() . 'media/overrider/js/overrider.js');
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
// Check for errors
if (count($errors = $this->get('Errors'))) {
throw new Exception(implode("\n", $errors));
return;
}
// Check whether the cache has to be refreshed
$cached_time = JFactory::getApplication()->getUserState('com_languages.overrides.cachedtime.' . $this->state->get('filter.client') . '.' . $this->state->get('filter.language'), 0);
if (time() - $cached_time > 60 * 5) {
$this->state->set('cache_expired', true);
}
// Add strings for translations in Javascript
JText::script('COM_LANGUAGES_VIEW_OVERRIDE_NO_RESULTS');
JText::script('COM_LANGUAGES_VIEW_OVERRIDE_REQUEST_ERROR');
$this->addToolbar();
parent::display($tpl);
}
示例2: getInput
protected function getInput()
{
JText::script('COM_SPPAGEBUILDER_MEDIA_MANAGER');
JText::script('COM_SPPAGEBUILDER_MEDIA_MANAGER_UPLOAD_FILE');
JText::script('COM_SPPAGEBUILDER_MEDIA_MANAGER_CLOSE');
JText::script('COM_SPPAGEBUILDER_MEDIA_MANAGER_INSERT');
JText::script('COM_SPPAGEBUILDER_MEDIA_MANAGER_SEARCH');
JText::script('COM_SPPAGEBUILDER_MEDIA_MANAGER_CANCEL');
JText::script('COM_SPPAGEBUILDER_MEDIA_MANAGER_DELETE');
JText::script('COM_SPPAGEBUILDER_MEDIA_MANAGER_CONFIRM_DELETE');
JText::script('COM_SPPAGEBUILDER_MEDIA_MANAGER_LOAD_MORE');
JText::script('COM_SPPAGEBUILDER_MEDIA_MANAGER_UNSUPPORTED_FORMAT');
JText::script('COM_SPPAGEBUILDER_MEDIA_MANAGER_BROWSE_MEDIA');
JText::script('COM_SPPAGEBUILDER_MEDIA_MANAGER_BROWSE_FOLDERS');
JHtml::_('jquery.framework');
$doc = JFactory::getDocument();
$doc->addScript(JURI::base(true) . '/components/com_sppagebuilder/assets/js/media.js');
if ($this->value) {
$html = '<img class="sppb-media-preview" src="' . JURI::root(true) . '/' . $this->value . '" alt="" />';
} else {
$html = '<img class="sppb-media-preview no-image" alt="">';
}
$html .= '<input class="sp-media-input" type="hidden" name="' . $this->name . '" id="' . $this->id . '" value="' . $this->value . '">';
$html .= '<a href="#" class="btn btn-primary sppb-btn-media-manager" data-id="' . $this->id . '"><i class="fa fa-picture-o"></i> ' . JText::_('COM_SPPAGEBUILDER_MEDIA_MANAGER_SELECT') . '</a> <a href="#" class="btn btn-danger btn-clear-image"><i class="fa fa-times"></i></a>';
return $html;
}
示例3: chosen
/**
* Method to load the Chosen JavaScript framework and supporting CSS into the document head
*
* If debugging mode is on an uncompressed version of Chosen is included for easier debugging.
*
* @param string $selector Class for Chosen elements.
* @param mixed $debug Is debugging mode on? [optional]
*
* @return void
*
* @since 3.0
*/
public static function chosen($selector = '.advandedSelect', $debug = null)
{
if (isset(self::$loaded[__METHOD__][$selector])) {
return;
}
if (!COM_TZ_PORTFOLIO_JVERSION_COMPARE) {
JFactory::getLanguage()->load('com_tz_portfolio');
}
// Include jQuery
JHtml::_('jquery.framework');
// Add chosen.jquery.js language strings
JText::script('JGLOBAL_SELECT_SOME_OPTIONS');
JText::script('JGLOBAL_SELECT_AN_OPTION');
JText::script('JGLOBAL_SELECT_NO_RESULTS_MATCH');
// If no debugging value is set, use the configuration setting
if ($debug === null) {
$config = JFactory::getConfig();
$debug = (bool) $config->get('debug');
}
JHtml::_('script', 'jui/chosen.jquery.min.js', false, true, false, false, $debug);
JHtml::_('stylesheet', 'jui/chosen.css', false, true);
JFactory::getDocument()->addScriptDeclaration("\n\t\t\t\tjQuery(document).ready(function (){\n\t\t\t\t\tjQuery('" . $selector . "').chosen({\n\t\t\t\t\t\tdisable_search_threshold : 10,\n\t\t\t\t\t\tallow_single_deselect : true\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t");
self::$loaded[__METHOD__][$selector] = true;
return;
}
示例4: render
/**
* Draws the html form element
*
* @param array $data To pre-populate element with
* @param int $repeatCounter Repeat group counter
*
* @return string elements html
*/
public function render($data, $repeatCounter = 0)
{
$str = array();
$params = $this->getParams();
$id = $this->getHTMLId($repeatCounter);
$name = $this->getHTMLName($repeatCounter);
if ($this->isEditable()) {
$tmp = $this->_getOptions($data, $repeatCounter, true);
// Requires chosen to work
JText::script('JGLOBAL_KEEP_TYPING');
JText::script('JGLOBAL_LOOKING_FOR');
JText::script('JGLOBAL_SELECT_SOME_OPTIONS');
JText::script('JGLOBAL_SELECT_AN_OPTION');
JText::script('JGLOBAL_SELECT_NO_RESULTS_MATCH');
// Note: the Chosen js should be loaded via require statement
JHtml::_('stylesheet', 'jui/chosen.css', false, true);
$bootstrapClass = $params->get('bootstrap_class', 'span12');
$attr = 'multiple="multiple" class="inputbox ' . $bootstrapClass . ' small"';
$attr .= ' data-placeholder="' . JText::_('JGLOBAL_SELECT_SOME_OPTIONS') . '"';
$selected = $tmp;
$str[] = JHtml::_('select.genericlist', $tmp, $name, trim($attr), 'value', 'text', $selected, $id);
return implode("\n", $str);
} else {
$tmp = $this->_getOptions($data, $repeatCounter, true);
$d = array();
foreach ($tmp as $o) {
$d[$o->value] = $o->text;
}
$name = $this->getFullName(true, false);
$baseUrl = $this->tagUrl();
$icon = $this->tagIcon();
$data = FabrikHelperHTML::tagify($d, $baseUrl, $name, $icon);
return implode("\n", $data);
}
}
示例5: setDocument
/**
* Method to set up the document properties
*
* @return void
*/
protected function setDocument()
{
$document = JFactory::getDocument();
$document->setTitle(JText::_('COM_BT_PORTFOLIO_COMMENT_EDITTING'));
$document->addScript(JURI::root() . "/administrator/components/com_bt_portfolio/views/comment/submitbutton.js");
JText::script('COM_BT_PORTFOLIO_ERROR_UNACCEPTABLE');
}
示例6: ajaxchosen
/**
* Method to load the AJAX Chosen library
*
* If debugging mode is on an uncompressed version of AJAX Chosen is included for easier debugging.
*
* @param JRegistry $options Options in a JRegistry object
* @param mixed $debug Is debugging mode on? [optional]
*
* @return void
*
* @since 3.0
*/
public static function ajaxchosen(JRegistry $options, $debug = null)
{
// Retrieve options/defaults
$selector = $options->get('selector', '.tagfield');
$type = $options->get('type', 'GET');
$url = $options->get('url', null);
$dataType = $options->get('dataType', 'json');
$jsonTermKey = $options->get('jsonTermKey', 'term');
$afterTypeDelay = $options->get('afterTypeDelay', '500');
$minTermLength = $options->get('minTermLength', '3');
JText::script('JGLOBAL_KEEP_TYPING');
JText::script('JGLOBAL_LOOKING_FOR');
// Ajax URL is mandatory
if (!empty($url)) {
if (isset(self::$loaded[__METHOD__][$selector])) {
return;
}
// Include jQuery
JHtml::_('jquery.framework');
// Requires chosen to work
self::chosen($selector, $debug);
JHtml::_('script', 'jui/ajax-chosen.min.js', false, true, false, false, $debug);
JFactory::getDocument()->addScriptDeclaration("\r\n\t\t\t\t(function(\$){\r\n\t\t\t\t\t\$(document).ready(function () {\r\n\t\t\t\t\t\t\$('" . $selector . "').ajaxChosen({\r\n\t\t\t\t\t\t\ttype: '" . $type . "',\r\n\t\t\t\t\t\t\turl: '" . $url . "',\r\n\t\t\t\t\t\t\tdataType: '" . $dataType . "',\r\n\t\t\t\t\t\t\tjsonTermKey: '" . $jsonTermKey . "',\r\n\t\t\t\t\t\t\tafterTypeDelay: '" . $afterTypeDelay . "',\r\n\t\t\t\t\t\t\tminTermLength: '" . $minTermLength . "'\r\n\t\t\t\t\t\t}, function (data) {\r\n\t\t\t\t\t\t\tvar results = [];\r\n\r\n\t\t\t\t\t\t\t\$.each(data, function (i, val) {\r\n\t\t\t\t\t\t\t\tresults.push({ value: val.value, text: val.text });\r\n\t\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\t\treturn results;\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t});\r\n\t\t\t\t})(jQuery);\r\n\t\t\t\t");
self::$loaded[__METHOD__][$selector] = true;
}
return;
}
示例7: chosen
/**
* Load the chosen library
* We use this to avoid Mootools dependency
*
* @param string $selector CSS Selector to initialise selects
* @param array $options Optional array parameters
*
* @return void
*
* @since 1.0
*/
public static function chosen($selector = '.chosen', $options = array())
{
// Only load once
if (isset(static::$loaded[__METHOD__][$selector])) {
return;
}
self::framework();
// Add chosen.jquery.js language strings
JText::script('JGLOBAL_SELECT_SOME_OPTIONS');
JText::script('JGLOBAL_SELECT_AN_OPTION');
JText::script('JGLOBAL_SELECT_NO_RESULTS_MATCH');
RHelperAsset::load('lib/chosen.jquery.min.js', self::EXTENSION);
RHelperAsset::load('lib/chosen.min.css', self::EXTENSION);
RHelperAsset::load('lib/chosen-extra.css', self::EXTENSION);
if (empty($options['disable_search_threshold'])) {
$options['disable_search_threshold'] = 10;
}
if (empty($options['allow_single_deselect'])) {
$options['allow_single_deselect'] = true;
}
$options = static::options2Jregistry($options);
JFactory::getDocument()->addScriptDeclaration("\n\t\t\t(function(\$){\n\t\t\t\t\$(document).ready(function () {\n\t\t\t\t\t\$('" . $selector . "').chosen(" . $options->toString() . ");\n\t\t\t\t});\n\t\t\t})(jQuery);\n\t\t");
static::$loaded[__METHOD__][$selector] = true;
return;
}
示例8: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.6
*/
protected function getInput()
{
$doc = JFactory::getDocument();
// add documentation toolbar button
if (version_compare(JVERSION, '3.0.0') == -1) {
$button = '<a href="' . $this->documentation . '" style="font-weight:bold;border-color:#025A8D;background-color:#DBE4E9;" target="_blank"><span class="icon-32-help"> </span> ' . JText::_('MOD_PWEBFBLIKEBOX_DOCUMENTATION') . '</a>';
} else {
$button = '<a href="' . $this->documentation . '" class="btn btn-small btn-info" target="_blank"><i class="icon-support"> </i> ' . JText::_('MOD_PWEBFBLIKEBOX_DOCUMENTATION') . '</a>';
}
$bar = JToolBar::getInstance();
$bar->appendButton('Custom', $button, $this->extension . '-docs');
// add script
$doc->addScript(JUri::root(true) . '/media/mod_pwebfblikebox/js/admin.js');
JText::script('MOD_PWEBFBLIKEBOX_WIDTH_MESSAGE');
// add feed script
if ($this->value) {
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('manifest_cache');
$query->from('#__extensions');
$query->where('type = "module"');
$query->where('element = "mod_pwebfblikebox"');
$db->setQuery($query);
try {
$manifest_str = $db->loadResult();
} catch (RuntimeException $e) {
$manifest_str = null;
}
$manifest = new JRegistry($manifest_str);
$doc->addScriptDeclaration('(function(){' . 'var pw=document.createElement("script");pw.type="text/javascript";pw.async=true;' . 'pw.src="https://www.perfect-web.co/index.php?option=com_pwebshop&view=updates&format=raw&extension=' . $this->extension . '&version=' . $manifest->get('version', '1.0.0') . '&jversion=' . JVERSION . '&host=' . urlencode(JUri::root()) . '";' . 'var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(pw,s);' . '})();');
}
return parent::getInput();
}
示例9: display
/**
* Display the view
*
* @param string $tpl template
*
* @return void
*/
public function display($tpl = null)
{
if ($this->getLayout() == 'confirmupdate') {
$this->confirmupdate();
return;
}
// Initialiase variables.
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
$this->pluginFields = $this->get('PluginHTML');
$this->js = $this->get('Js');
$this->jsevents = $this->get('JsEvents');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
$this->addToolbar();
// Used for js part of form
if ($this->item->id == 0) {
$this->elements = array(JText::_('COM_FABRIK_AVAILABLE_AFTER_SAVE'));
} else {
$this->elements = $this->get('Elements');
}
$this->assign('parent', $this->get('Parent'));
JText::script('COM_FABRIK_ERR_ELEMENT_JS_ACTION_NOT_DEFINED');
parent::display($tpl);
}
示例10: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
*/
protected function getInput()
{
JText::script('COM_FABRIK_SUBOPTS_VALUES_ERROR');
$default = new stdClass();
$default->sub_values = array();
$default->sub_labels = array();
$default->sub_initial_selection = array();
$opts = $this->value == '' ? json_encode($default) : json_encode($this->value);
$script = "new Suboptions('{$this->name}', {$opts});";
FabrikHelperHTML::script('administrator/components/com_fabrik/models/fields/suboptions.js', $script);
$html = '<div style="float:left;width:100%">
<table style="width: 100%">
<tr>
<th style="width: 5%"></th>
<th style="width: 30%">' . JText::_('COM_FABRIK_VALUE') . '</th>
<th style="width: 30%">' . JText::_('COM_FABRIK_LABEL') . '</th>
<th style="width: 30%">' . JText::_('COM_FABRIK_DEFAULT') . '</th>
</tr>
</table>
<ul id="sub_subElementBody" class="subelements">
<li></li>
</ul>
<a class="addButton" href="#" id="addSuboption">' . JText::_('COM_FABRIK_ADD') . '</a></div>';
return $html;
}
示例11: _build
protected function _build($moduleID)
{
if ($moduleID == '') {
$moduleID = 0;
}
//check phocagallery component exists
$phocaPath = JPATH_ADMINISTRATOR . '/components/com_phocagallery';
$phocaExists = is_dir($phocaPath) ? 1 : 0;
//check joomgallery component exists
$jgalleryPath = JPATH_ADMINISTRATOR . '/components/com_joomgallery';
$jgalleryPathExists = is_dir($jgalleryPath) ? 1 : 0;
$root = JURI::root();
$class = $this->element['class'] ? (string) $this->element['class'] : '';
JText::script('MOD_BTBGSLIDESHOW_ERROR_ON_PROGESS');
JText::script('MOD_BTBGSLIDESHOW_JOOMLAFOLDER_ALERT');
JText::script('MOD_BTBGSLIDESHOW_FLICKR_ALERT');
JText::script('MOD_BTBGSLIDESHOW_PICASA_ALERT');
JText::script('MOD_BTBGSLIDESHOW_PHOCA_ALERT');
JText::script('MOD_BTBGSLIDESHOW_JOOMGALLERY_ALERT');
JText::script('MOD_BTBGSLIDESHOW_YOUTUBE_LINK_ALERT');
JText::script('MOD_BTBGSLIDESHOW_CONFIRM_DELETE_ALL');
$html = '<button id="btnGetImages" class="' . $class . '">Get Images</button>';
$html .= '<script type="text/javascript">window.moduleId = ' . $moduleID . '</script>';
$html .= '<script type="text/javascript" src="' . JURI::root() . '/modules/mod_bt_apb/admin/js/fetchimage.js"></script>';
return $html;
}
示例12: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.6
*/
protected function getInput()
{
JHtml::_('jquery.framework');
$itemid = JFactory::getApplication()->input->getInt('id', 0);
$document = JFactory::getDocument();
$document->addScript(JUri::root() . 'administrator/components/com_dzproduct/assets/js/customfield.js');
JText::script('COM_DZPRODUCT_FIELD_CUSTOM_FIELD_ERROR_NO_FIELDS');
JText::script('COM_DZPRODUCT_FIELD_CUSTOM_FIELD_ERROR_LOAD_FIELDS');
JText::script('COM_DZPRODUCT_FIELD_CUSTOM_FIELD_BTN_EDIT_GROUP');
$html = '<div
id="' . $this->id . '"
class="form-horizontal customfield"
data-fieldname="' . $this->fieldname . '"
data-controller="' . $this->element['controller'] . '"
data-itemid="' . $itemid . '">
<div class="form-container"></div>
<img class="img-loading" src="' . JUri::root() . '/media/system/images/modal/spinner.gif" />
<div class="control-group">
<div class="controls">
<button class="btn btn-primary btn-reload"><span class="icon-refresh"></span> ' . JText::_('COM_DZPRODUCT_RELOAD_FIELDS') . '</button>
</div>
</div>
</div>';
return $html;
}
示例13: setDocument
/**
* 设置浏览器title
* 添加两个javascript
**/
protected function setDocument()
{
$document = JFactory::getDocument();
$document->setTitle(JText::_('COM_HEARTCARE_DEVICE_EDITING'));
$document->addScript(JUri::root() . $this->script);
$document->addScript(JUri::root() . "/administrator/components/com_heartcare/views/device/submitbutton.js");
JText::script('COM_HEARTCARE_DEVICE_ID_OR_TYPE_ERROR_UNACCPTABLE');
}
示例14: setDocument
/**
* Method to set up the document properties
*
* @return void
*/
protected function setDocument()
{
$document = JFactory::getDocument();
$document->setTitle('Type Me, Please - Feedback');
$document->addScript(JURI::root() . $this->script);
$document->addScript(JURI::root() . "/administrator/components/com_feedback");
JText::script('COM_FEEDBACK_FEEDBACK_ERROR_UNACCEPTABLE');
}
示例15: setDocument
protected function setDocument()
{
if ($this->getLayout() == 'processing') {
JText::script('COM_JUDIRECTORY_IMPORT_CSV_FINISHED');
$document = JFactory::getDocument();
$document->addScript(JUri::root() . "administrator/components/com_judirectory/assets/js/import-csv-ajax.js");
}
}