本文整理汇总了PHP中nnText::html_entity_decoder方法的典型用法代码示例。如果您正苦于以下问题:PHP nnText::html_entity_decoder方法的具体用法?PHP nnText::html_entity_decoder怎么用?PHP nnText::html_entity_decoder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nnText
的用法示例。
在下文中一共展示了nnText::html_entity_decoder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
JHtml::stylesheet('nnframework/style.min.css', false, true);
require_once __DIR__ . '/toggler.php';
$toggler = new nnFieldToggler();
$this->value = (int) $this->value;
$label = $this->get('label');
$param_name = $this->get('name');
$noshow = $this->get('noshow', 0);
$showclose = $this->get('showclose', 0);
$html = array();
if ($label) {
$label = nnText::html_entity_decoder(JText::_($label));
$html[] = '</div>';
if (!$noshow) {
$html[] = $toggler->getInput(array('div' => 1, 'param' => 'show_assignments|' . $param_name, 'value' => '1|1,2'));
}
$class = 'well well-small nn_well';
if ($this->value === 1) {
$class .= ' alert-success';
} else {
if ($this->value === 2) {
$class .= ' alert-error';
}
}
$html[] = '<div class="' . $class . '">';
if ($showclose && JFactory::getUser()->authorise('core.admin')) {
$html[] = '<button type="button" class="close nn_remove_assignment">×</button>';
}
$html[] = '<div class="control-group">';
$html[] = '<div class="control-label">';
$html[] = '<label><h4 class="nn_assignmentselection-header">' . $label . '</h4></label>';
$html[] = '</div>';
$html[] = '<div class="controls">';
$html[] = '<fieldset id="' . $this->id . '" class="radio btn-group">';
$onclick = ' onclick="nnScripts.setToggleTitleClass(this, 0)"';
$html[] = '<input type="radio" id="' . $this->id . '0" name="' . $this->name . '" value="0"' . (!$this->value ? ' checked="checked"' : '') . $onclick . '/>';
$html[] = '<label class="nn_btn-ignore" for="' . $this->id . '0">' . JText::_('NN_IGNORE') . '</label>';
$onclick = ' onclick="nnScripts.setToggleTitleClass(this, 1)"';
$html[] = '<input type="radio" id="' . $this->id . '1" name="' . $this->name . '" value="1"' . ($this->value === 1 ? ' checked="checked"' : '') . $onclick . '/>';
$html[] = '<label class="nn_btn-include" for="' . $this->id . '1">' . JText::_('NN_INCLUDE') . '</label>';
$onclick = ' onclick="nnScripts.setToggleTitleClass(this, 2)"';
$onclick .= ' onload="nnScripts.setToggleTitleClass(this, ' . $this->value . ', 7)"';
$html[] = '<input type="radio" id="' . $this->id . '2" name="' . $this->name . '" value="2"' . ($this->value === 2 ? ' checked="checked"' : '') . $onclick . '/>';
$html[] = '<label class="nn_btn-exclude" for="' . $this->id . '2">' . JText::_('NN_EXCLUDE') . '</label>';
$html[] = '</fieldset>';
$html[] = '</div>';
$html[] = '</div>';
$html[] = '<div class="clearfix"> </div>';
$html[] = $toggler->getInput(array('div' => 1, 'param' => $param_name, 'value' => '1,2'));
$html[] = '<div><div>';
} else {
if (!$noshow) {
$html[] = $toggler->getInput(array('div' => 1));
}
$html[] = $toggler->getInput(array('div' => 1));
}
return '</div>' . implode('', $html);
}
示例2: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
require_once __DIR__ . '/toggler.php';
$toggler = new nnFieldToggler;
$this->value = (int) $this->value;
$label = $this->get('label');
$param_name = $this->get('name');
$html = array();
if ($label)
{
$label = nnText::html_entity_decoder(JText::_($label));
$html[] = '<div style="clear: both;"></div>';
$class = 'nn_panel nn_panel_title nn_panel_toggle';
$checked = '';
if ($this->value === 1)
{
$class .= ' nn_panel_include';
$checked = ' checked="checked"';
}
else if ($this->value === 2)
{
$class .= ' nn_panel_exclude';
$checked = ' checked="checked"';
}
$html[] = '<div class="' . $class . '"><label class="nn_block nn_title" for="cb_' . $param_name . '">';
$html[] = '<input id="' . $this->id . '" name="' . $this->name . '" value="1" type="checkbox" class="checkbox"'
. ' onclick="nnScripts.setToggleTitleClass(this, this.checked, 2);"' . $checked . '>';
$html[] = $label;
$html[] = '<div style="clear: both;"></div>';
$html[] = '</label></div>';
$html[] = $toggler->getInput(array('div' => 1, 'param' => $param_name, 'value' => '1,2'));
$html[] = '<div class="nn_panel nn_panel"><div class="nn_block">';
$html[] = '<ul class="adminformlist"><li>';
}
else
{
$html[] = '<div style="clear: both;"></div>';
$html[] = '</li></ul>';
$html[] = '<div style="clear: both;"></div>';
$html[] = '</div></div>';
$html[] = $toggler->getInput(array('div' => 1));
}
return implode($html);
}
示例3: getLabel
protected function getLabel()
{
$this->params = $this->element->attributes();
$label = nnText::html_entity_decoder(JText::_($this->get('label')));
$html = '<label id="' . $this->id . '-lbl" for="' . $this->id . '"';
if ($this->description) {
$html .= ' class="hasTooltip" title="<strong>' . $label . '</strong><br />' . JText::_($this->description) . '">';
} else {
$html .= '>';
}
$html .= $label . '</label>';
return $html;
}
示例4: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
JHtml::stylesheet('nnframework/style.min.css', false, true);
$label = nnText::html_entity_decoder(JText::_($this->get('label')));
$description = $this->prepareText($this->get('description'));
$lang_file = $this->get('language_file');
$html = '</td></tr></table></div></div>';
$html .= '<div class="panel"><h3 class="jpane-toggler title" id="advanced-page"><span>';
$html .= $label;
$html .= '</span></h3>';
$html .= '<div class="jpane-slider content"><table width="100%" class="paramlist admintable" cellspacing="1"><tr><td colspan="2" class="paramlist_value">';
if ($lang_file) {
jimport('joomla.filesystem.file');
// Include extra language file
$lang = str_replace('_', '-', JFactory::getLanguage()->getTag());
$inc = '';
$lang_path = 'language/' . $lang . '/' . $lang . '.' . $lang_file . '.inc.php';
if (JFile::exists(JPATH_ADMINISTRATOR . '/' . $lang_path)) {
$inc = JPATH_ADMINISTRATOR . '/' . $lang_path;
} else {
if (JFile::exists(JPATH_SITE . '/' . $lang_path)) {
$inc = JPATH_SITE . '/' . $lang_path;
}
}
if (!$inc && $lang != 'en-GB') {
$lang = 'en-GB';
$lang_path = 'language/' . $lang . '/' . $lang . '.' . $lang_file . '.inc.php';
if (JFile::exists(JPATH_ADMINISTRATOR . '/' . $lang_path)) {
$inc = JPATH_ADMINISTRATOR . '/' . $lang_path;
} else {
if (JFile::exists(JPATH_SITE . '/' . $lang_path)) {
$inc = JPATH_SITE . '/' . $lang_path;
}
}
}
if ($inc) {
include $inc;
}
}
if ($description) {
if ($description['0'] != '<') {
$description = '<p>' . $description . '</p>';
}
$class = 'nn_panel nn_panel_description';
$html .= '<div class="' . $class . '"><div class="nn_block nn_title">';
$html .= $description;
$html .= '<div style="clear: both;"></div></div></div>';
}
return $html;
}
示例5: getTitleBlock
private function getTitleBlock($title = '', $description = '', $start = 0)
{
$nostyle = $this->get('nostyle', 0);
if ($title) {
$title = nnText::html_entity_decoder(JText::_($title));
}
if ($description) {
// variables
$v1 = JText::_($this->get('var1'));
$v2 = JText::_($this->get('var2'));
$v3 = JText::_($this->get('var3'));
$v4 = JText::_($this->get('var4'));
$v5 = JText::_($this->get('var5'));
$description = nnText::html_entity_decoder(trim(JText::sprintf($description, $v1, $v2, $v3, $v4, $v5)));
$description = str_replace('span style="font-family:monospace;"', 'span class="nn_code"', $description);
}
$html = array();
if ($title) {
if ($nostyle) {
$html[] = '<div style="clear:both;"><div>';
} else {
$class = 'nn_panel nn_panel_title';
if ($start || $description) {
$class .= ' nn_panel_top';
}
$html[] = '<div class="' . $class . '"><div class="nn_block nn_title">';
}
$html[] = $title;
$html[] = '<div style="clear: both;"></div>';
$html[] = '</div></div>';
}
if ($description) {
if ($nostyle) {
$html[] = '<div style="clear:both;"><div>';
} else {
$class = 'nn_panel nn_panel_description';
if ($start) {
$class .= ' nn_panel_top';
}
if ($title) {
$class .= ' nn_panel_hastitle';
}
$html[] = '<div class="' . $class . '"><div class="nn_block nn_title">';
}
$html[] = $description;
$html[] = '<div style="clear: both;"></div>';
$html[] = '</div></div>';
}
return implode('', $html);
}
示例6: prepareText
private function prepareText($string = '')
{
if ($string == '') {
return '';
}
// variables
$var1 = JText::_($this->get('var1'));
$var2 = JText::_($this->get('var2'));
$var3 = JText::_($this->get('var3'));
$var4 = JText::_($this->get('var4'));
$var5 = JText::_($this->get('var5'));
$string = JText::sprintf(JText::_($string), $var1, $var2, $var3, $var4, $var5);
$string = trim(nnText::html_entity_decoder($string));
$string = str_replace('"', '"', $string);
$string = str_replace('span style="font-family:monospace;"', 'span class="nn_code"', $string);
return $string;
}
示例7: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
JHtml::stylesheet('nnframework/style.min.css', false, true);
$title = $this->get('label');
$description = $this->get('description');
$class = $this->get('class');
$showclose = $this->get('showclose', 0);
$start = $this->get('start', 0);
$end = $this->get('end', 0);
$html = array();
if ($start || !$end) {
$html[] = '</div>';
if (strpos($class, 'alert') !== false) {
$html[] = '<div class="alert ' . $class . '">';
} else {
$html[] = '<div class="well well-small ' . $class . '">';
}
if ($showclose && JFactory::getUser()->authorise('core.admin')) {
$html[] = '<button type="button" class="close nn_remove_assignment">×</button>';
}
if ($title) {
$title = nnText::html_entity_decoder(JText::_($title));
$html[] = '<h4>' . $title . '</h4>';
}
if ($description) {
// variables
$v1 = JText::_($this->get('var1'));
$v2 = JText::_($this->get('var2'));
$v3 = JText::_($this->get('var3'));
$v4 = JText::_($this->get('var4'));
$v5 = JText::_($this->get('var5'));
$description = nnText::html_entity_decoder(trim(JText::sprintf($description, $v1, $v2, $v3, $v4, $v5)));
$description = str_replace('span style="font-family:monospace;"', 'span class="nn_code"', $description);
$html[] = '<div>' . $description . '</div>';
}
$html[] = '<div><div>';
}
if (!$start && !$end) {
$html[] = '</div>';
}
return '</div>' . implode('', $html);
}
示例8: processModule
function processModule($id, $chrome = 'none', $ignores = array(), $overrides = array(), $area = 'articles')
{
$ignore_access = isset($ignores['ignore_access']) ? $ignores['ignore_access'] : $this->params->ignore_access;
$ignore_state = isset($ignores['ignore_state']) ? $ignores['ignore_state'] : $this->params->ignore_state;
$ignore_assignments = isset($ignores['ignore_assignments']) ? $ignores['ignore_assignments'] : $this->params->ignore_assignments;
$ignore_caching = isset($ignores['ignore_caching']) ? $ignores['ignore_caching'] : $this->params->ignore_caching;
$db = JFactory::getDBO();
$query = $db->getQuery(true)->select('m.*')->from('#__modules AS m')->where('m.client_id = 0');
if (is_numeric($id)) {
$query->where('m.id = ' . (int) $id);
} else {
$query->where('m.title = ' . $db->quote(nnText::html_entity_decoder($id)));
}
if (!$ignore_access) {
$query->where('m.access IN (' . implode(',', $this->aid) . ')');
}
if (!$ignore_state) {
$query->where('m.published = 1')->join('LEFT', '#__extensions AS e ON e.element = m.module AND e.client_id = m.client_id')->where('e.enabled = 1');
}
if (!$ignore_assignments) {
$date = JFactory::getDate();
$now = $date->toSql();
$nullDate = $db->getNullDate();
$query->where('(m.publish_up = ' . $db->quote($nullDate) . ' OR m.publish_up <= ' . $db->quote($now) . ')')->where('(m.publish_down = ' . $db->quote($nullDate) . ' OR m.publish_down >= ' . $db->quote($now) . ')');
}
$query->order('m.ordering');
$db->setQuery($query);
$module = $db->loadObject();
if ($module && !$ignore_assignments) {
$this->applyAssignments($module);
}
if (empty($module)) {
if ($this->params->place_comments) {
return $this->params->message_start . JText::_('MA_OUTPUT_REMOVED_NOT_PUBLISHED') . $this->params->message_end;
}
return '';
}
//determine if this is a custom module
$module->user = substr($module->module, 0, 4) == 'mod_' ? 0 : 1;
// set style
$module->style = $chrome;
if ($area == 'articles' && !$ignore_caching || !empty($overrides)) {
$json = $module->params && substr(trim($module->params), 0, 1) == '{';
if ($json) {
$params = json_decode($module->params);
} else {
// Old ini style. Needed for crappy old style modules like swMenuPro
$params = JRegistryFormat::getInstance('INI')->stringToObject($module->params);
}
// override module parameters
if (!empty($overrides)) {
foreach ($overrides as $key => $val) {
if (isset($module->{$key})) {
$module->{$key} = $val;
} else {
if ($val && $val['0'] == '[' && $val[strlen($val) - 1] == ']') {
$val = json_decode('{"val":' . $val . '}');
$val = $val->val;
} else {
if (isset($params->{$key}) && is_array($params->{$key})) {
$val = explode(',', $val);
}
}
$params->{$key} = $val;
}
}
if ($json) {
$module->params = json_encode($params);
} else {
$registry = new JRegistry();
$registry->loadObject($params);
$module->params = $registry->toString('ini');
}
}
}
if (isset($module->access) && !in_array($module->access, $this->aid)) {
if ($this->params->place_comments) {
return $this->params->message_start . JText::_('MA_OUTPUT_REMOVED_ACCESS') . $this->params->message_end;
}
return '';
}
$document = clone JFactory::getDocument();
$document->_type = 'html';
$renderer = $document->loadRenderer('module');
$html = $renderer->render($module, array('style' => $chrome, 'name' => ''));
// don't return html on article level when caching is set
if ($area == 'articles' && !$ignore_caching && (isset($params->cache) && !$params->cache || isset($params->owncache) && !$params->owncache)) {
return 'MA_IGNORE';
}
return $html;
}
示例9: cleanText
function cleanText(&$string)
{
// Load common functions
require_once JPATH_PLUGINS . '/system/nnframework/helpers/text.php';
// replace chr style enters with normal enters
$string = str_replace(array(chr(194) . chr(160), ' ', ' '), ' ', $string);
// replace linbreak tags with normal linebreaks (paragraphs, enters, etc).
$enter_tags = array('p', 'br');
$regex = '#</?((' . implode(')|(', $enter_tags) . '))+[^>]*?>\\n?#si';
$string = preg_replace($regex, " \n", $string);
// replace indent characters with spaces
$string = preg_replace('#<' . 'img [^>]*/sourcerer/images/tab\\.png[^>]*>#si', ' ', $string);
// strip all other tags
$regex = '#<(/?\\w+((\\s+\\w+(\\s*=\\s*(?:".*?"|\'.*?\'|[^\'">\\s]+))?)+\\s*|\\s*)/?)>#si';
$string = preg_replace($regex, "", $string);
// reset htmlentities
$string = nnText::html_entity_decoder($string);
// convert protected html entities &_...; -> &...;
$string = preg_replace('#&_([a-z0-9\\#]+?);#i', '&\\1;', $string);
}
示例10: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
JHtml::stylesheet('nnframework/style.min.css', false, true);
$label = nnText::html_entity_decoder(JText::_($this->get('label')));
$description = $this->get('description');
$lang_file = $this->get('language_file');
$show_apply = $this->get('show_apply');
$html = '</td></tr></table></div></div>';
$html .= '<div class="panel"><h3 class="jpane-toggler title" id="advanced-page"><span>';
$html .= $label;
$html .= '</span></h3>';
$html .= '<div class="jpane-slider content"><table width="100%" class="paramlist admintable" cellspacing="1"><tr><td colspan="2" class="paramlist_value">';
if ($description) {
// variables
$v1 = $this->get('var1');
$v2 = $this->get('var2');
$v3 = $this->get('var3');
$v4 = $this->get('var4');
$v5 = $this->get('var5');
$description = nnText::html_entity_decoder(trim(JText::sprintf($description, $v1, $v2, $v3, $v4, $v5)));
}
if ($lang_file) {
jimport('joomla.filesystem.file');
// Include extra language file
$language = JFactory::getLanguage();
$lang = str_replace('_', '-', $language->getTag());
$inc = '';
$lang_path = 'language/' . $lang . '/' . $lang . '.' . $lang_file . '.inc.php';
if (JFile::exists(JPATH_ADMINISTRATOR . '/' . $lang_path)) {
$inc = JPATH_ADMINISTRATOR . '/' . $lang_path;
} else {
if (JFile::exists(JPATH_SITE . '/' . $lang_path)) {
$inc = JPATH_SITE . '/' . $lang_path;
}
}
if (!$inc && $lang != 'en-GB') {
$lang = 'en-GB';
$lang_path = 'language/' . $lang . '/' . $lang . '.' . $lang_file . '.inc.php';
if (JFile::exists(JPATH_ADMINISTRATOR . '/' . $lang_path)) {
$inc = JPATH_ADMINISTRATOR . '/' . $lang_path;
} else {
if (JFile::exists(JPATH_SITE . '/' . $lang_path)) {
$inc = JPATH_SITE . '/' . $lang_path;
}
}
}
if ($inc) {
include $inc;
}
}
if ($description) {
$description = str_replace('span style="font-family:monospace;"', 'span class="nn_code"', $description);
if ($description['0'] != '<') {
$description = '<p>' . $description . '</p>';
}
$class = 'nn_panel nn_panel_description';
$html .= '<div class="' . $class . '"><div class="nn_block nn_title">';
if ($show_apply) {
$apply_button = '<a href="#" onclick="submitbutton( \'apply\' );" title="' . JText::_('Apply') . '"><img align="right" border="0" alt="' . JText::_('Apply') . '" src="images/tick.png"/></a>';
$html .= $apply_button;
}
$html .= $description;
$html .= '<div style="clear: both;"></div></div></div>';
}
return $html;
}
示例11: html_entity_decoder
static function html_entity_decoder($given_html, $quote_style = ENT_QUOTES, $charset = 'UTF-8')
{
require_once __DIR__ . '/text.php';
return nnText::html_entity_decoder($given_html, $quote_style, $charset);
}
示例12: processArticle
private function processArticle($id, $art, $text = '', $type = 'article', $ignores = array(), &$count = 0, $first = 0, $last = 0, $firstpass = 0)
{
if ($firstpass) {
// first pass: search for normal tags and tags around tags
$regex = '#\\{(/?(?:[^\\}]*\\{[^\\}]*\\})*[^\\}]*)\\}#si';
} else {
// do second pass
$text = $this->processArticle($id, $art, $text, $type, $ignores, $count, $first, $last, 1);
$regex_close = '#\\{/' . $this->params->tags . '\\}#si';
if (preg_match($regex_close, $text)) {
return $text;
}
// second pass: only search for normal tags
$regex = '#\\{(/?[^\\{\\}]+)\\}#si';
}
if (!preg_match_all($regex, $text, $matches, PREG_SET_ORDER)) {
return $text;
}
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$type = $type == 'k2' && !$this->params->dbselects_k2 ? '' : $type;
$selects = $type == 'k2' ? $this->params->dbselects_k2 : $this->params->dbselects_content;
if (in_array($id, array('current', 'self', '{id}', '{title}', '{alias}'), true)) {
if (isset($art->id)) {
$id = $art->id;
} else {
if (isset($art->link) && preg_match('#&id=([0-9]*)#', $art->link, $match)) {
$id = $match['1'];
} else {
if ($this->params->option == 'com_content' && JFactory::getApplication()->input->get('view') == 'article') {
$id = JFactory::getApplication()->input->getInt('id', 0);
}
}
}
}
foreach ($matches as $match) {
$data = trim($match['1']);
switch (true) {
case strpos($data, 'intro') !== false:
$selects[] = 'introtext';
break;
case strpos($data, 'full') !== false:
$selects[] = 'fulltext';
break;
case strpos($data, 'text') !== false:
$selects[] = 'introtext';
$selects[] = 'fulltext';
break;
}
}
$selects = array_unique($selects);
$selects = 'a.`' . implode('`, a.`', $selects) . '`';
$query->select($selects);
if ($type == 'article') {
$query->select('CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END AS slug')->select('CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(":", c.id, c.alias) ELSE c.id END AS catslug')->select('c.parent_id AS parent')->join('LEFT', '#__categories AS c ON c.id = a.catid');
}
$table = 'content';
$query->from('#__' . $table . ' as a');
$where = 'a.title = ' . $db->quote(nnText::html_entity_decoder($id));
$where .= ' OR a.alias = ' . $db->quote(nnText::html_entity_decoder($id));
if (is_numeric($id)) {
$where .= ' OR a.id = ' . $id;
}
$query->where('(' . $where . ')');
$ignore_language = isset($ignores['ignore_language']) ? $ignores['ignore_language'] : $this->params->ignore_language;
if (!$ignore_language) {
$query->where('a.language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')');
}
$ignore_state = isset($ignores['ignore_state']) ? $ignores['ignore_state'] : $this->params->ignore_state;
if (!$ignore_state) {
$jnow = JFactory::getDate();
$now = $jnow->toSQL();
$nullDate = $db->getNullDate();
$where = 'a.state = 1';
$query->where($where)->where('( a.publish_up = ' . $db->quote($nullDate) . ' OR a.publish_up <= ' . $db->quote($now) . ' )')->where('( a.publish_down = ' . $db->quote($nullDate) . ' OR a.publish_down >= ' . $db->quote($now) . ' )');
}
$ignore_access = isset($ignores['ignore_access']) ? $ignores['ignore_access'] : $this->params->ignore_access;
if (!$ignore_access) {
$query->where('a.access IN(' . implode(', ', $this->aid) . ')');
}
$query->order('a.ordering');
$db->setQuery($query);
$article = $db->loadObject();
if (!$article) {
return '<!-- ' . JText::_('AA_ACCESS_TO_ARTICLE_DENIED') . ' -->';
}
self::addParams($article, json_decode(isset($article->attribs) ? $article->attribs : $article->params));
if (isset($article->images)) {
self::addParams($article, json_decode($article->images));
}
if (isset($article->urls)) {
self::addParams($article, json_decode($article->urls));
}
$helper = 'tags';
$this->helpers->get($helper)->handleIfStatements($text, $article, $count, $first, $last);
if (!preg_match_all($regex, $text, $matches, PREG_SET_ORDER)) {
return $text;
}
$this->helpers->get($helper)->replaceTags($text, $matches, $article, $count);
return $text;
//.........这里部分代码省略.........
示例13: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
JHtml::stylesheet('nnframework/style.min.css', false, true);
$title = $this->get('label');
$description = $this->get('description');
$xml = $this->get('xml');
$url = $this->get('url');
if ($description) {
// variables
$v1 = $this->get('var1');
$v2 = $this->get('var2');
$v3 = $this->get('var3');
$v4 = $this->get('var4');
$v5 = $this->get('var5');
$description = nnText::html_entity_decoder(trim(JText::sprintf($description, $v1, $v2, $v3, $v4, $v5)));
}
if ($title) {
$title = JText::_($title);
}
if ($description) {
$description = str_replace('span style="font-family:monospace;"', 'span class="nn_code"', $description);
if ($description['0'] != '<') {
$description = '<p>' . $description . '</p>';
}
}
if (!$xml && $this->form->getValue('element')) {
if ($this->form->getValue('folder')) {
$xml = 'plugins/' . $this->form->getValue('folder') . '/' . $this->form->getValue('element') . '/' . $this->form->getValue('element') . '.xml';
} else {
$xml = 'administrator/modules/' . $this->form->getValue('element') . '/' . $this->form->getValue('element') . '.xml';
}
}
if ($xml) {
$xml = JApplicationHelper::parseXMLInstallFile(JPATH_SITE . '/' . $xml);
$version = 0;
if ($xml && isset($xml['version'])) {
$version = $xml['version'];
}
if ($version) {
if (strpos($version, 'PRO') !== false) {
$version = str_replace('PRO', '', $version);
$version .= ' <small style="color:green">[PRO]</small>';
} else {
if (strpos($version, 'FREE') !== false) {
$version = str_replace('FREE', '', $version);
$version .= ' <small style="color:green">[FREE]</small>';
}
}
if ($title) {
$title .= ' v';
} else {
$title = JText::_('Version') . ' ';
}
$title .= $version;
}
}
$html = array();
if ($title) {
if ($url) {
$title = '<a href="' . $url . '" target="_blank" title="' . preg_replace('#<[^>]*>#', '', $title) . '">' . $title . '</a>';
}
$html[] = '<h4>' . nnText::html_entity_decoder($title) . '</h4>';
}
if ($description) {
$html[] = $description;
}
if ($url) {
$html[] = '<p><a href="' . $url . '" target="_blank" title="' . JText::_('NN_MORE_INFO') . '">' . JText::_('NN_MORE_INFO') . '...</a></p>';
}
return '</div><div>' . implode('', $html);
}
示例14: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
JHtml::stylesheet('nnframework/style.min.css', false, true);
require_once __DIR__ . '/toggler.php';
$toggler = new nnFieldToggler;
$this->value = (int) $this->value;
$label = $this->get('label');
$param_name = $this->get('name');
$noshow = $this->get('noshow', 0);
$showclose = $this->get('showclose', 0);
$html = array();
if ($label)
{
$label = nnText::html_entity_decoder(JText::_($label));
$html[] = '<div style="clear: both;"></div>';
if (!$noshow)
{
$html[] = $toggler->getInput(array('div' => 1, 'param' => 'show_assignments|' . $param_name, 'value' => '1|1,2'));
}
$class = 'nn_panel nn_panel_title nn_panel_toggle';
if ($this->value === 1)
{
$class .= ' nn_panel_include';
}
else if ($this->value === 2)
{
$class .= ' nn_panel_exclude';
}
$html[] = '<div class="' . $class . '">';
if ($showclose && JFactory::getUser()->authorise('core.admin'))
{
$html[] = '<button type="button" class="nn_close nn_remove_assignment">×</button>';
}
$html[] = '<label class="nn_block nn_title" for="cb_' . $param_name . '">';
$html[] = '<input id="cb_' . $param_name . '" type="checkbox" class="checkbox" ' . ($this->value ? 'checked="checked"' : '') . ' onchange="nnScripts.setRadio(\'' . $param_name . '\', this.checked);">';
$html[] = $label;
$html[] = '<div style="clear: both;"></div>';
$html[] = '</label></div>';
$html[] = $toggler->getInput(array('div' => 1, 'param' => $param_name, 'value' => '1,2'));
$html[] = '<div class="nn_panel nn_panel"><div class="nn_block">';
$html[] = '<ul class="adminformlist"><li>';
$label = JText::_('NN_SELECTION');
$tip = htmlspecialchars(trim($label, ':') . '::' . JText::_('NN_SELECTION_DESC'), ENT_COMPAT, 'UTF-8');
$html[] = '<label id="' . $this->id . '-lbl" for="' . $this->id . '" class="hasTip" title="' . $tip . '">' . $label . '</label>';
$html[] = '<fieldset id="' . $this->id . '" class="radio">';
$html[] = '<div style="display:none;">';
$onclick = ' onclick="nnScripts.setToggleTitleClass(this, 0, 8)"';
$html[] = '<input type="radio" id="' . $this->id . '0" name="' . $this->name . '" value="0"' . ((!$this->value) ? ' checked="checked"' : '') . $onclick . '/>';
$html[] = '</div>';
$onclick = ' onclick="nnScripts.setToggleTitleClass(this, 1, 7)"';
$html[] = '<input type="radio" id="' . $this->id . '1" name="' . $this->name . '" value="1"' . (($this->value === 1) ? ' checked="checked"' : '') . $onclick . '/>';
$html[] = '<label for="' . $this->id . '1">' . JText::_('NN_INCLUDE') . '</label>';
$onclick = ' onclick="nnScripts.setToggleTitleClass(this, 2, 7)"';
$onclick .= ' onload="nnScripts.setToggleTitleClass(this, ' . $this->value . ', 7)"';
$html[] = '<input type="radio" id="' . $this->id . '2" name="' . $this->name . '" value="2"' . (($this->value === 2) ? ' checked="checked"' : '') . $onclick . '/>';
$html[] = '<label for="' . $this->id . '2">' . JText::_('NN_EXCLUDE') . '</label>';
$html[] = '</fieldset>';
}
else
{
$html[] = '<div style="clear: both;"></div>';
$html[] = '</li></ul>';
$html[] = '<div style="clear: both;"></div>';
$html[] = '</div></div>';
if (!$noshow)
{
$html[] = $toggler->getInput(array('div' => 1));
}
$html[] = $toggler->getInput(array('div' => 1));
}
return implode($html);
}
示例15: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
jimport('joomla.filesystem.file');
JHtml::stylesheet('nnframework/style.min.css', false, true);
$title = $this->get('label');
$description = $this->get('description');
$xml = $this->get('xml');
$lang_file = $this->get('language_file');
$image = $this->get('image');
$image_w = $this->get('image_w', 120);
$image_h = $this->get('image_h', 160);
$url = $this->get('url');
if (!$image && preg_match('#([^/]*)\.xml#', $xml, $name))
{
$image = '/media/' . $name['1'] . '/images/logo.png';
}
if ($description)
{
// variables
$v1 = $this->get('var1');
$v2 = $this->get('var2');
$v3 = $this->get('var3');
$v4 = $this->get('var4');
$v5 = $this->get('var5');
$description = nnText::html_entity_decoder(trim(JText::sprintf($description, $v1, $v2, $v3, $v4, $v5)));
}
if ($lang_file)
{
// Include extra language file
$language = JFactory::getLanguage();
$lang = str_replace('_', '-', $language->getTag());
$inc = '';
$lang_path = 'language/' . $lang . '/' . $lang . '.' . $lang_file . '.inc.php';
if (JFile::exists(JPATH_ADMINISTRATOR . '/' . $lang_path))
{
$inc = JPATH_ADMINISTRATOR . '/' . $lang_path;
}
else if (JFile::exists(JPATH_SITE . '/' . $lang_path))
{
$inc = JPATH_SITE . '/' . $lang_path;
}
if (!$inc && $lang != 'en-GB')
{
$lang = 'en-GB';
$lang_path = 'language/' . $lang . '/' . $lang . '.' . $lang_file . '.inc.php';
if (JFile::exists(JPATH_ADMINISTRATOR . '/' . $lang_path))
{
$inc = JPATH_ADMINISTRATOR . '/' . $lang_path;
}
else if (JFile::exists(JPATH_SITE . '/' . $lang_path))
{
$inc = JPATH_SITE . '/' . $lang_path;
}
}
if ($inc)
{
include $inc;
}
}
if ($title)
{
$title = JText::_($title);
}
if ($description)
{
$description = str_replace('span style="font-family:monospace;"', 'span class="nn_code"', $description);
if ($description['0'] != '<')
{
$description = '<p>' . $description . '</p>';
}
}
if (!$xml && $this->form->getValue('element'))
{
if ($this->form->getValue('folder'))
{
$xml = 'plugins/' . $this->form->getValue('folder') . '/' . $this->form->getValue('element') . '/' . $this->form->getValue('element') . '.xml';
}
else
{
$xml = 'administrator/modules/' . $this->form->getValue('element') . '/' . $this->form->getValue('element') . '.xml';
}
}
if ($xml)
{
$xml = JApplicationHelper::parseXMLInstallFile(JPATH_SITE . '/' . $xml);
$version = 0;
if ($xml && isset($xml['version']))
{
//.........这里部分代码省略.........