本文整理汇总了PHP中JHtmlBehavior类的典型用法代码示例。如果您正苦于以下问题:PHP JHtmlBehavior类的具体用法?PHP JHtmlBehavior怎么用?PHP JHtmlBehavior使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JHtmlBehavior类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = null)
{
if (JVERSION < 3.0) {
JHTML::_('behavior.mootools');
} else {
JHtmlBehavior::framework();
}
$this->_setToolBar();
$this->setLayout('settings');
$model = $this->getModel('settings');
$gatewayplugin = $this->get('APIpluginData');
$this->assignRef('gatewayplugin', $gatewayplugin);
$model->refreshUpdateSite();
$geotable_list = $model->checkgeotables();
if (!empty($geotable_list)) {
$geotablepresent = 0;
} else {
$geotablepresent = 1;
}
$this->assignRef('geotablepresent', $geotablepresent);
if (JVERSION >= 3.0) {
$this->sidebar = JHtmlSidebar::render();
}
parent::display($tpl);
}
示例2: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
*/
protected function getInput()
{
$plugin = JPluginHelper::isEnabled('system', 'ezset');
if (!$plugin) {
return print_r($plugin, 1) . '需要先啟動外掛!';
}
$name = str_replace('jform_params_', '', $this->id);
\JHtmlBehavior::framework(true);
$token = JFactory::getSession()->getFormToken();
$ajaxUrl = JURI::root() . 'index.php?cmd=ajax.overlay.' . $name;
$ajaxCode = <<<AJAX
window.addEvent('domready', function() {
\t\$('{$name}').addEvent('click', function(e) {
\t\tvar myRequest = new Request({
\t\t\tmethod: 'post',
\t\t\tdata: {
\t\t\t\t'{$token}': 1
\t\t\t},
\t\t\turl: '{$ajaxUrl}',
\t\t\tonSuccess: function(responseText) {
\t\t\t\t\$('{$name}_response').set('html', '<input class="btn btn-default" disabled="true" type="button" value="'+responseText+'">');
\t\t\t}
\t\t});
\t\tmyRequest.send();
\t});
});
AJAX;
$doc = JFactory::getDocument();
$doc->addScriptDeclaration($ajaxCode);
$link = '<div id="' . $name . '_response" ><input class="btn btn-default" id="' . $name . '" type="button" value="按此覆蓋"></div>';
return $link;
}
示例3: fetchButton
function fetchButton($type = 'Wizard', $namekey = '', $id = 'wizard')
{
if (version_compare(JVERSION, '3.0.0', '<')) {
JHTML::_('behavior.mootools');
} else {
JHtmlBehavior::framework();
}
$defaultPage = 'jnewsdoc_glossary';
if (empty($namekey)) {
$namekey = $defaultPage;
} else {
$namekey = 'jnewsdoc_' . $namekey;
}
$langID = substr(JNEWS_CONFIG_LANG, 0, 2);
$link = 'http://www.joobi.co/index.php?option=com_jlinks&controller=redirect&link=' . $namekey . '&alt=' . $defaultPage . '&lang=' . $langID;
//.'&Itemid=312';
$iFrame = "'<iframe src=\\'{$link}\\' width=\\'100%\\' height=\\'100%\\' scrolling=\\'auto\\'></iframe>'";
$js = "var wizardOn = true; function showWizard(){\n\t\tvar box=\$('jNewsWizard');\n\t\tif(wizardOn){box.innerHTML = " . $iFrame . ";box.style.display = 'block';box.style.height = '0';}";
$js .= "try{\n var fx = box.effects({duration: 2500, transition:\n\t\t\t\t\tFx.Transitions.Quart.easeOut});\n\t\t\t\t\tif(wizardOn){\n\t\t\t\t\t\tfx.start({'height': 500});\n\t\t\t\t\t}else{\n\t\t\t\t\t\tfx.start({'height': 0}).chain(function() {\n\t\t\t\t\t\t\tbox.innerHTML='';\n\t\t\t\t\t\t\tbox.setStyle('display','none');\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}catch(err){\n\t\t\t\t\tbox.style.height = '500px';\n\t\t\t\t\tvar myVerticalSlide = new Fx.Slide('jNewsWizard');\n \t\t\t\t\tif(wizardOn){\n\t\t\t\t\t\tmyVerticalSlide.slideIn();\n\t\t\t\t\t}else{\n\t\t\t\t\t\tmyVerticalSlide.slideOut().chain(function() {\n\t\t\t\t\t\tbox.innerHTML='';\n\t\t\t\t\t\tbox.setStyle('display','none');\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} wizardOn = !wizardOn;}";
$doc = JFactory::getDocument();
$doc->addScriptDeclaration($js);
if (version_compare(JVERSION, '3.0.0', '<')) {
return '<a href="' . $link . '" target="_blank" onclick="showWizard();return false;" class="toolbar"><span class="icon-32-wizard" title="' . _JNEWS_WIZARD . '"></span>' . _JNEWS_WIZARD . '</a>';
} else {
return '<a class="btn btn-small" href="' . $link . '" target="_blank" onclick="showWizard();return false;" class="toolbar"><span style="float:left;" class="icon-16-wizard" title="' . _JNEWS_WIZARD . '"></span><span style="float:left; margin-left:8px;">' . _JNEWS_WIZARD . '</span></a>';
}
}
示例4: __construct
/**
* Constructor
*
* @access protected
* @return void
* @since 1.5.5
*/
function __construct($config = array())
{
parent::__construct($config);
$this->_ambit = JoomAmbit::getInstance();
$this->_config = JoomConfig::getInstance();
$this->_mainframe = JFactory::getApplication('administrator');
$this->_user = JFactory::getUser();
$this->_doc = JFactory::getDocument();
$this->_doc->addStyleSheet($this->_ambit->getStyleSheet('admin.joomgallery.css'));
JHtmlBehavior::framework();
$this->_doc->addScript($this->_ambit->getScript('admin.js'));
JoomHelper::addSubmenu();
JHTML::addIncludePath(JPATH_COMPONENT . '/helpers/html');
// Check for available updates
if (!($checked = $this->_mainframe->getUserState('joom.update.checked'))) {
$controller = JRequest::getCmd('controller');
if ($this->_config->get('jg_checkupdate') && $controller && $controller != 'control') {
$dated_extensions = JoomExtensions::checkUpdate();
if (count($dated_extensions)) {
$this->_mainframe->enqueueMessage(JText::_('COM_JOOMGALLERY_ADMENU_SYSTEM_NOT_UPTODATE'), 'warning');
$this->_mainframe->setUserState('joom.update.checked', -1);
} else {
$this->_mainframe->setUserState('joom.update.checked', 1);
}
}
} else {
if ($checked == -1) {
$controller = JRequest::getCmd('controller');
if ($controller && $controller != 'control') {
$this->_mainframe->enqueueMessage(JText::_('COM_JOOMGALLERY_ADMENU_SYSTEM_NOT_UPTODATE'), 'warning');
}
}
}
}
示例5: display
/**
* Display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*/
public function display($tpl = null)
{
$objJSNUtils = JSNISFactory::getObj('classes.jsn_is_utils');
$objJSNXML = JSNISFactory::getObj('classes.jsn_is_readxmldetails');
$objJSNMsg = JSNISFactory::getObj('classes.jsn_is_message');
// Get config parameters
$config = JSNConfigHelper::get();
$this->_document = JFactory::getDocument();
JHtmlBehavior::framework();
// Set the toolbar
JToolBarHelper::title(JText::_('JSN_IMAGESHOW') . ': ' . JText::_('HELP_HELP_AND_SUPPORT'), 'help');
$shortEdition = '';
$xml = array();
// Get messages
$msgs = '';
$msgs = $objJSNMsg->getList('HELP_AND_SUPPORT');
$msgs = count($msgs) ? JSNUtilsMessage::showMessages($msgs) : '';
$xml = $objJSNXML->parserXMLDetails();
$shortEdition = $objJSNUtils->getShortEdition();
// Assign variables for rendering
$this->assignRef('msgs', $msgs);
$this->assignRef('xml', $xml);
$this->assignRef('shortEdition', $shortEdition);
$this->_addAssets();
$this->addToolbar();
// Display the template
parent::display($tpl);
}
示例6: autoThumb
/**
* autoThumb
*
* @param string $context
* @param object $article
* @param \JRegistry $params
*
* @return void
*/
public static function autoThumb($context, $article, $params = null)
{
\JHtmlBehavior::modal();
$minimal = 30;
$es = \Ezset::getInstance();
include_once EZSET_ROOT . '/lib/dom/simple_html_dom.php';
$html = str_get_html($article->text);
$imgs = $html->find('img');
foreach ($imgs as $img) {
$classes = explode(' ', $img->class);
$imgUrl = UriHelper::pathAddHost($img->src);
// Has class nothumb, skip to next.
if (in_array('nothumb', $classes)) {
continue;
}
// If is anchor already, skip to next.
if ($img->parent->tag == 'a') {
continue;
}
// If img tag has no width and height attrs, skip.
if (!$img->width && !$img->height) {
continue;
}
// If not localhost image, skip.
if (!strpos('-' . $imgUrl, \JURI::root()) && $es->params->get('onlyLocalhostThumb', 1)) {
continue;
}
// Get img path and size
$imgPath = \JPath::clean(str_replace(\JURI::root(), JPATH_ROOT . '/', $imgUrl));
$size = getimagesize($imgPath);
// Manul size
$imgW = $img->width;
$imgH = $img->height;
// Original size
$oriW = $size[0];
$oriH = $size[1];
// If too small, skip.
if ($oriW <= $minimal || $oriH <= $minimal) {
continue;
}
// If large ten origin, skip.
if ($oriW <= $imgW || $oriW <= $imgW) {
continue;
}
// Get thumb url
$thumb = new \Windwalker\Image\Thumb();
$img->src = $thumb->resize($imgUrl, $imgW, $imgH);
$imgtext = $img->outertext;
$imgtext = \JHtml::link($imgUrl, $imgtext, array('class' => 'modal'));
$img->outertext = $imgtext;
$classes = null;
}
$article->text = $html->save();
}
示例7: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
*/
public function getInput()
{
// Load the modal behavior script.
JHtml::_('behavior.modal', 'a.modal');
JHtmlBehavior::framework(true);
$this->setElement();
// Build the script.
$script = array();
$script[] = ' function jSelect' . ucfirst($this->component) . '_' . $this->id . '(id, title) {';
$script[] = ' document.id("jform_link").value = id;';
$script[] = ' document.id("jform_link").highlight();';
$script[] = ' SqueezeBox.close();';
$script[] = ' }';
// Add the script to the document head.
JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
// Setup variables for display.
$html = array();
$link = $this->getLink();
$title = $this->getTitle();
if (empty($title)) {
$title = JText::_('COM_' . strtoupper($this->component) . '_SELECT_ITEM');
}
$title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
if (JVERSION >= 3) {
// The current user display field.
$html[] = '<span class="">';
$html[] = '<a class="modal btn" title="' . JText::_('COM_' . strtoupper($this->component) . '_CHANGE_ITEM_BUTTON') . '" href="' . $link . '&' . JSession::getFormToken() . '=1" rel="{handler: \'iframe\', size: {x: 800, y: 450}}"><i class="icon-file"></i> ' . JText::_('JSELECT') . '</a>';
$html[] = '</span>';
} else {
// The user select button.
$html[] = '<div class="button2-left">';
$html[] = ' <div class="blank">';
$html[] = ' <a class="modal" title="' . JText::_('COM_' . strtoupper($this->component) . '_CHANGE_ITEM') . '" href="' . $link . '&' . JSession::getFormToken() . '=1" rel="{handler: \'iframe\', size: {x: 800, y: 450}}">' . JText::_('JSELECT') . '</a>';
$html[] = ' </div>';
$html[] = '</div>';
}
// The active article id field.
if (0 == (int) $this->value) {
$value = '';
} else {
$value = (int) $this->value;
}
// class='required' for client side validation
$class = '';
if ($this->required) {
$class = ' class="required modal-value"';
}
$html[] = '<input type="hidden" id="' . $this->id . '_id"' . $class . ' name="' . $this->name . '" value="' . $value . '" />';
return implode("\n", $html);
}
示例8: display
/**
* Display method
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*/
public function display($tpl = null)
{
// Get config parameters
$config = JSNConfigHelper::get();
$this->_document = JFactory::getDocument();
JHtmlBehavior::framework();
// Set the toolbar
JToolBarHelper::title(JText::_('JSN_IMAGESHOW') . ': ' . JText::_('MAINTENANCE_CONFIGURATION_AND_MAINTENANCE'), 'maintenance');
// Get messages
$msgs = '';
if (!$config->get('disable_all_messages')) {
$msgs = JSNUtilsMessage::getList('CONFIGURATION_AND_MAINTENANCE');
$msgs = count($msgs) ? JSNUtilsMessage::showMessages($msgs) : '';
}
// Assign variables for rendering
$this->assignRef('msgs', $msgs);
$this->_addAssets();
$this->addToolbar();
// Type of screen
$type = JRequest::getWord('type', 'backup');
$themeName = JRequest::getWord('theme_name');
$sourceType = JRequest::getString('source_type');
switch ($type) {
case 'themeparameters':
$this->addTemplatePath(JPATH_PLUGINS . DS . 'jsnimageshow' . DS . $themeName . DS . 'views' . DS . 'maintenance' . DS . 'tmpl');
echo $this->loadTemplate('theme_config');
break;
case 'profileparameters':
$this->addTemplatePath(JPATH_PLUGINS . DS . 'jsnimageshow' . DS . $sourceType . DS . 'views' . DS . 'maintenance' . DS . 'tmpl');
echo $this->loadTemplate('source_config');
break;
case 'editprofile':
$sourceID = JRequest::getInt('external_source_id');
$countShowlist = JRequest::getInt('count_showlist');
$imageSource = JSNISFactory::getSource($sourceType, 'external');
$imageSource->_source['sourceTable']->load($sourceID);
$this->assignRef('sourceInfo', $imageSource->_source['sourceTable']);
$this->assignRef('countShowlist', $countShowlist);
$this->addTemplatePath(JPATH_PLUGINS . DS . 'jsnimageshow' . DS . 'source' . $sourceType . DS . 'views' . DS . 'maintenance' . DS . 'tmpl');
echo $this->loadTemplate('edit_source_profile');
break;
default:
// Display the template
parent::display($tpl);
break;
}
}
示例9: getInput
/**
* Method to get the field options.
*
* @return array The field option objects.
* @since 1.6
*/
public function getInput()
{
// load core and extra mootools
JHTML::_('behavior.framework');
JHtmlBehavior::framework();
JHtmlBehavior::framework(true);
// Must load admin language files
$lang = JFactory::getLanguage();
$lang->load("com_jevents", JPATH_ADMINISTRATOR);
$node = $this->element;
$value = $this->value;
$name = $this->name;
$control_name = $this->type;
$help = $node['help'];
if (!is_null($help) && version_compare(JVERSION, '1.6.0', ">=")) {
if (is_object($help)) {
$help = (string) $help;
}
$help = isset($help) && JString::strlen($help) <= 0 ? null : $help;
}
if (!is_null($help)) {
$parts = explode(",", $value);
$helps = explode(",", $help);
foreach ($parts as $key => $valuepart) {
$help = $helps[$key];
list($helpfile, $varname, $part) = explode("::", $help);
$lang = JFactory::getLanguage();
$langtag = $lang->getTag();
if (file_exists(JPATH_COMPONENT_ADMINISTRATOR . '/help/' . $langtag . '/' . $helpfile)) {
$jeventHelpPopup = JPATH_COMPONENT_ADMINISTRATOR . '/help/' . $langtag . '/' . $helpfile;
} else {
$jeventHelpPopup = JPATH_COMPONENT_ADMINISTRATOR . '/help/en-GB/' . $helpfile;
}
if (!file_exists($jeventHelpPopup)) {
return "";
}
include $jeventHelpPopup;
$help = $this->help(${$varname}, $part);
$parts[$key] = JText::_($valuepart) . $help;
}
$value = implode(", ", $parts);
}
JLoader::register('JEVHelper', JPATH_SITE . "/components/com_jevents/libraries/helper.php");
JEVHelper::ConditionalFields($this->element, $this->form->getName());
return "<strong style='color:#993300'>" . JText::_($value) . "</strong>";
}
示例10: register
/**
* register
*
* @return void
*/
public static function register()
{
/** @var $doc \JDocumentHtml */
$doc = \JFactory::getDocument();
$es = \Ezset::getInstance();
$input = \JFactory::getApplication()->input;
if ($doc->getType() !== 'html') {
return;
}
$uri = \JUri::getInstance();
$root = $uri::root();
$base = $uri::base();
$host = $uri->toString(array('scheme', 'host')) . '/';
if ($smoothScroll = $es->params->get('smoothScroll', 0)) {
\JHtmlBehavior::framework(true);
}
$smoothScroll = $smoothScroll ? 'true' : 'false';
$confirmLeave = $es->params->get('confirmLeave', 0) && UriChecker::isArticleEdit() ? 'true' : 'false';
$logoLink = \JFactory::getApplication()->isAdmin() ? 'true' : 'false';
$script = <<<SCRIPT
<script type="text/javascript">
\tvar ezsetOption = {
\t\tsmoothScroll: {$smoothScroll},
\t\tconfirmLeave: {$confirmLeave},
\t\tlogoLink: {$logoLink}
\t};
\tvar ezsetConfig = {
\t\troot : '{$root}',
\t\tbase : '{$base}',
\t\thost : '{$host}'
\t};
\tEzset.init(ezsetOption, ezsetConfig);
</script>
SCRIPT;
$doc->addCustomTag($script);
$doc->addScript(\JUri::root(true) . '/plugins/system/ezset/asset/js/ezset.js');
$doc->addScript(\JUri::root(true) . '/ezset/js/ezset-custom.js');
}
示例11: defined
<?php
/**
* Part of Component Akquickicons files.
*
* @copyright Copyright (C) 2014 Asikart. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
use Windwalker\Data\Data;
use Windwalker\Html\HtmlElement;
// No direct access
defined('_JEXEC') or die;
// Prepare script
JHtmlBehavior::multiselect('adminForm');
/**
* Prepare data for this template.
*
* @var $container Windwalker\DI\Container
* @var $data Windwalker\Data\Data
* @var $asset Windwalker\Helper\AssetHelper
* @var $grid Windwalker\View\Helper\GridHelper
* @var $date \JDate
*/
$container = $this->getContainer();
$asset = $container->get('helper.asset');
$grid = $data->grid;
$date = $container->get('date');
$asset->addCss('akicons.css');
$asset->addCss('font-awesome.css');
// Set order script.
$grid->registerTableSort();
示例12: onAfterDispatch
/**
* Plugin that registers the jQuery javascript framework
*/
public function onAfterDispatch()
{
jimport('joomla.html.html.behavior');
JHtmlBehavior::register('jquery', array('script' => array('media/jquery/jquery.js' => array())));
}
示例13: onContentPrepare
//.........这里部分代码省略.........
}
$posPercentageWidth = strpos($width, '%');
if ($posPercentageWidth) {
$width = substr($width, 0, $posPercentageWidth + 1);
} else {
$width = (int) $width;
}
$height = (int) $height;
$object = new stdClass();
$object->width = $width;
$object->height = $height;
$object->showlist_id = $showListID;
$object->showcase_id = $showCaseID;
$object->item_id = 0;
$object->random_number = $objUtils->randSTR(8);
$object->language = $language;
$object->edition = $shortEdition;
$object->images = $imagesData;
$object->showlist = $showlistInfo;
$object->showcase = $showcaseInfo;
$object->theme_id = $themeProfile->theme_id;
$object->theme_name = $themeProfile->theme_name;
$object->plugin = true;
$html .= $editionVersion;
$html .= '<div class="jsn-container">';
$html .= '<div class="jsn-gallery">';
$result = $objJSNTheme->displayTheme($object);
if ($result !== false) {
$html .= $result;
}
$html .= '</div>';
$html .= '</div>';
if ($display) {
$row->text = str_replace("{imageshow " . $matches[$i][1] . "/}", $html, $row->text);
} else {
if ($showlistInfo['authorization_status']) {
$row->text = str_replace("{imageshow " . $matches[$i][1] . "/}", '<div>' . $articleAuth['introtext'] . $articleAuth['fulltext'] . '</div>', $row->text);
} else {
$row->text = str_replace("{imageshow " . $matches[$i][1] . "/}", ' ', $row->text);
}
}
}
}
}
preg_match_all('/\\{imageshow (.*)\\}(.*)\\{\\/imageshow\\}/U', $row->text, $matchesLink, PREG_SET_ORDER);
if (count($matchesLink)) {
for ($z = 0; $z < count($matchesLink); $z++) {
$dataLink = explode(' ', $matchesLink[$z][1]);
$width = '';
$height = '';
$showCaseID = 0;
$showListID = 0;
foreach ($dataLink as $values) {
$value = $values;
if (stristr($values, 'sl')) {
$showListValue = explode('=', $values);
$showList = str_replace($values, 'showlist_id=' . $showListValue[1], $values);
$showListID = $showListValue[1];
} elseif (stristr($values, 'sc')) {
$showCaseValue = explode('=', $values);
$showCase = str_replace($values, 'showcase_id=' . $showCaseValue[1], $values);
$showCaseID = $showCaseValue[1];
} elseif (stristr($values, 'w')) {
$widthValue = explode('=', $values);
$width = str_replace($values, $widthValue[1], $values);
} elseif (stristr($values, 'h')) {
$heightValue = explode('=', $values);
$height = str_replace($values, $heightValue[1], $values);
}
}
$showlistInfo = $objJSNShowlist->getShowListByID($showListID);
$showcaseInfo = $objJSNShowcase->getShowCaseByID($showCaseID, true, 'loadAssoc');
if ($width != '') {
$width = $width;
} else {
$width = $showcaseInfo['general_overall_width'];
}
if ($height != '') {
$height = $height;
} else {
$height = $showcaseInfo['general_overall_height'];
}
if (strpos($width, '%')) {
$width = '650';
}
$width = (int) $width;
$height = (int) $height;
$sefRewrite = JFactory::getConfig()->get('sef_rewrite');
$link = $sefRewrite ? '' : 'index.php';
$link .= '?option=com_imageshow&tmpl=component&view=show&' . $showList . '&' . $showCase . '&w=' . $width . '&h=' . $height;
$html = '<a rel="{handler: \'iframe\', size: {x: ' . $width . ', y: ' . $height . '}}" href="' . $link . '" class="modal">' . $matchesLink[$z][2] . '</a>';
$row->text = str_replace("{imageshow " . $matchesLink[$z][1] . "}" . $matchesLink[$z][2] . "{/imageshow}", $html, $row->text);
}
}
if (count($matchesLink) || count($matches)) {
JHtmlBehavior::framework();
JHTML::_('behavior.modal', 'a.modal');
}
return true;
}
示例14: getPreview
/**
* Get Preview Image.
*
* @return string Preview image html.
*/
public function getPreview()
{
// The Preview.
$preview = (string) $this->element['preview'];
$showPreview = true;
$showAsTooltip = false;
switch ($preview) {
case 'no':
// Deprecated parameter value
// Deprecated parameter value
case 'false':
case 'none':
$showPreview = false;
break;
case 'yes':
// Deprecated parameter value
// Deprecated parameter value
case 'true':
case 'show':
break;
case 'tooltip':
default:
$this->showAsTooltip = $showAsTooltip = true;
$options = array('onShow' => 'AKFinderRefreshPreviewTip(this)');
JHtmlBehavior::tooltip('.hasTipPreview', $options);
break;
}
if ($showPreview) {
if ($this->value && file_exists(JPATH_ROOT . '/' . $this->value)) {
$src = JURI::root() . $this->value;
} else {
$src = '';
}
$width = (int) XmlHelper::get($this->element, 'preview_width', 300);
$height = (int) XmlHelper::get($this->element, 'preview_height', 200);
$style = '';
$style .= $width > 0 ? 'max-width:' . $width . 'px;' : '';
$style .= $height > 0 ? 'max-height:' . $height . 'px;' : '';
$style .= !$showAsTooltip ? 'margin: 10px 0;' : '';
$imgattr = array('id' => $this->id . '_preview', 'class' => 'media-preview', 'style' => $style);
$imgattr['class'] = $showAsTooltip ? $imgattr['class'] : $imgattr['class'] . ' img-polaroid';
$img = JHtml::image($src, JText::_('JLIB_FORM_MEDIA_PREVIEW_ALT'), $imgattr);
$previewImg = '<div id="' . $this->id . '_preview_img"' . ($src ? '' : ' style="display:none"') . '>' . $img . '</div>';
$previewImgEmpty = '<div id="' . $this->id . '_preview_empty"' . ($src ? ' style="display:none"' : '') . '>' . JText::_('JLIB_FORM_MEDIA_PREVIEW_EMPTY') . '</div>';
$html[] = '<div class="media-preview add-on fltlft">';
if ($showAsTooltip) {
$tooltip = $previewImgEmpty . $previewImg;
$options = array('title' => JText::_('JLIB_FORM_MEDIA_PREVIEW_SELECTED_IMAGE'), 'text' => '<i class="icon-eye"></i>', 'class' => 'hasTipPreview');
$options['text'] = JVERSION >= 3 ? $options['text'] : JText::_('JLIB_FORM_MEDIA_PREVIEW_TIP_TITLE');
$html[] = JHtml::tooltip($tooltip, $options);
} else {
$html[] = ' ' . $previewImgEmpty;
$html[] = ' ' . $previewImg;
$html[] = '<script type="text/javascript">AKFinderRefreshPreview("' . $this->id . '");</script>';
}
$html[] = '</div>';
}
return implode("\n", $html);
}
示例15: mootools
/**
* Method to load the MooTools & More framework into the document head
*
* If debugging mode is on an uncompressed version of MooTools is included for easier debugging.
*
* @param mixed $debug Is debugging mode on? [optional]
*
* @return AssetManager Return self to support chaining.
*/
public function mootools($debug = null)
{
\JHtmlBehavior::framework(true, $debug);
return $this;
}