本文整理汇总了PHP中nnFrameworkFunctions类的典型用法代码示例。如果您正苦于以下问题:PHP nnFrameworkFunctions类的具体用法?PHP nnFrameworkFunctions怎么用?PHP nnFrameworkFunctions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了nnFrameworkFunctions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getGeo
function getGeo($service)
{
if ($this->geo !== null) {
return $this->geo;
}
require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php';
$func = new nnFrameworkFunctions();
$ip = $_SERVER['REMOTE_ADDR'] == '127.0.0.1' ? '' : $_SERVER['REMOTE_ADDR'];
switch ($service) {
case 'geoplugin':
if (!($geo = json_decode($func->getContents('http://www.geoplugin.net/json.gp?ip=' . $ip)))) {
$this->geo = false;
return false;
}
if (isset($geo->geoplugin_status) && $geo->geoplugin_status == 404) {
$this->geo = false;
return false;
}
$this->geo = (object) array('continent' => isset($geo->geoplugin_continentCode) ? $geo->geoplugin_continentCode : '', 'country' => isset($geo->geoplugin_countryCode) ? $geo->geoplugin_countryCode : '', 'region' => isset($geo->geoplugin_regionCode) ? $geo->geoplugin_regionCode : '');
break;
case 'telize':
default:
if (!($geo = json_decode($func->getContents('http://www.telize.com/geoip/' . $ip)))) {
$this->geo = false;
return false;
}
if (isset($geo->code)) {
$this->geo = false;
return false;
}
$this->geo = (object) array('continent' => isset($geo->continent_code) ? $geo->continent_code : '', 'country' => isset($geo->country_code) ? $geo->country_code : '', 'region' => isset($geo->region_code) ? $geo->region_code : '');
break;
}
return $this->geo;
}
示例2: render
function render(&$params)
{
jimport('joomla.filesystem.file');
// Load plugin language
require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php';
nnFrameworkFunctions::loadLanguage('plg_system_nnframework');
nnFrameworkFunctions::loadLanguage('plg_editors-xtd_sourcerer');
nnFrameworkFunctions::loadLanguage('plg_system_sourcerer');
$language = 'en';
$locales = JFactory::getLanguage()->getLocale();
foreach ($locales as $locale) {
if (JFile::exists(JPATH_PLUGINS . '/editors-xtd/sourcerer/editarea/langs/' . $locale . '.js')) {
$language = $locale;
break;
}
}
// Add scripts and styles
JHtml::_('behavior.mootools');
JFactory::getDocument()->addScript(JURI::root(true) . '/plugins/editors-xtd/sourcerer/editarea/edit_area_full.js');
JHtml::script('sourcerer/script.min.js', false, true);
$script = "\n\t\t\teditAreaLoader.init({\n\t\t\t\tid: 'source',\t// id of the textarea to transform\n\t\t\t\tstart_highlight: true,\t// if start with highlight\n\t\t\t\tallow_resize: 'y',\n\t\t\t\tallow_toggle: false,\n\t\t\t\tword_wrap: true,\n\t\t\t\tlanguage: '" . $language . "',\n\t\t\t\tsyntax: 'php',\n\t\t\t\ttoolbar: 'fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, highlight, reset_highlight, word_wrap',\n\t\t\t\tsyntax_selection_allow: 'css,html,js,php'\n\t\t\t});\n\n\t\t\tvar sourcerer_syntax_word = '" . $params->syntax_word . "';\n\t\t\tvar sourcerer_editorname = '" . JFactory::getApplication()->input->getString('name', 'text') . "';\n\t\t\tvar sourcerer_default_addsourcetags = " . (int) $params->addsourcetags . ";\n\t\t\tvar sourcerer_root = '" . JURI::root(true) . "';\n\n\t\t\twindow.addEvent( 'domready', function() { sourcerer_init(); });\n\t\t";
JFactory::getDocument()->addScriptDeclaration($script);
JHtml::stylesheet('nnframework/style.min.css', false, true);
JHtml::stylesheet('nnframework/popup.min.css', false, true);
JHtml::stylesheet('sourcerer/popup.min.css', false, true);
$params->code = '<!-- You can place html anywhere within the source tags --><br /><br /><br /><script language="javascript" type="text/javascript"><br /> // You can place JavaScript like this<br /> <br /></script><br /><?php<br /> // You can place PHP like this<br /> <br />?>';
$params->code = str_replace('<br />', "\n", $params->code);
echo $this->getHTML($params);
}
示例3: getInput
protected function getInput()
{
if (!nnFrameworkFunctions::extensionInstalled('flexicontent'))
{
return '<fieldset class="radio"><label class="nn_label nn_label_error">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_FLEXICONTENT')) . '</label></fieldset>';
}
$this->params = $this->element->attributes();
$this->db = JFactory::getDBO();
$group = $this->get('group', 'categories');
$tables = $this->db->getTableList();
if (!in_array($this->db->getPrefix() . 'flexicontent_' . $group, $tables))
{
return '<fieldset class="radio"><label class="nn_label nn_label_error">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_FLEXICONTENT')) . '</label></fieldset>';
}
if (!is_array($this->value))
{
$this->value = explode(',', $this->value);
}
$options = $this->{'get' . $group}();
$size = (int) $this->get('size');
$multiple = $this->get('multiple');
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
}
示例4: getInput
protected function getInput()
{
if (!nnFrameworkFunctions::extensionInstalled('akeebasubs')) {
return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_AKEEBASUBS')) . '</fieldset>';
}
$this->params = $this->element->attributes();
$this->db = JFactory::getDBO();
$group = $this->get('group', 'categories');
$tables = $this->db->getTableList();
if (!in_array($this->db->getPrefix() . 'akeebasubs_' . $group, $tables)) {
return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_AKEEBASUBS')) . '</fieldset>';
}
if (!is_array($this->value)) {
$this->value = explode(',', $this->value);
}
$options = $this->{'get' . $group}();
$size = (int) $this->get('size');
$multiple = $this->get('multiple');
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
switch ($group) {
case 'categories':
return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
default:
return nnHtml::selectlistsimple($options, $this->name, $this->value, $this->id, $size, $multiple);
}
}
示例5: getInput
protected function getInput()
{
if (!nnFrameworkFunctions::extensionInstalled('mijoshop')) {
return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_MIJOSHOP')) . '</fieldset>';
}
$this->params = $this->element->attributes();
$this->db = JFactory::getDBO();
$group = $this->get('group', 'categories');
$tables = $this->db->getTableList();
if (!in_array($this->db->getPrefix() . 'mijoshop_' . ($group == 'products' ? 'product' : 'category'), $tables)) {
return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_MIJOSHOP')) . '</fieldset>';
}
$parameters = nnParameters::getInstance();
$params = $parameters->getPluginParams('nnframework');
$this->max_list_count = $params->max_list_count;
if (!class_exists('MijoShop')) {
require_once JPATH_ROOT . '/components/com_mijoshop/mijoshop/mijoshop.php';
}
$this->store_id = (int) MijoShop::get('opencart')->get('config')->get('config_store_id');
$this->language_id = (int) MijoShop::get('opencart')->get('config')->get('config_language_id');
if (!is_array($this->value)) {
$this->value = explode(',', $this->value);
}
$options = $this->{'get' . $group}();
$size = (int) $this->get('size');
$multiple = $this->get('multiple');
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
switch ($group) {
case 'categories':
return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
default:
return nnHtml::selectlistsimple($options, $this->name, $this->value, $this->id, $size, $multiple);
}
}
示例6: render
/**
* Display the button
*
* @return array A two element array of ( imageName, textToInsert )
*/
function render($name)
{
$button = new JObject();
if (JFactory::getApplication()->isSite() && !$this->params->enable_frontend) {
return $button;
}
require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php';
nnFrameworkFunctions::loadLanguage('plg_editors-xtd_articlesanywhere');
JHtml::_('behavior.modal');
JHtml::stylesheet('nnframework/style.min.css', false, true);
$class = 'nonumber icon-articlesanywhere';
$link = 'index.php?nn_qp=1' . '&folder=plugins.editors-xtd.articlesanywhere' . '&file=articlesanywhere.inc.php' . '&name=' . $name;
$text_ini = strtoupper(str_replace(' ', '_', $this->params->button_text));
$text = JText::_($text_ini);
if ($text == $text_ini) {
$text = JText::_($this->params->button_text);
}
$button->modal = true;
$button->class = 'btn';
$button->link = $link;
$button->text = trim($text);
$button->name = $class;
$button->options = "{handler: 'iframe', size: {x:window.getSize().x-100, y: window.getSize().y-100}}";
return $button;
}
示例7: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
JHtml::_('jquery.framework');
nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/script.min.js');
$file = $this->get('file');
if (!$file) {
$path = $this->get('path') == 'site' ? '' : '/administrator';
$label = $this->get('label');
$file = $this->get('alias', $label);
$file = preg_replace('#[^a-z-]#', '', strtolower($file));
$extension = $this->get('extension');
switch ($extension) {
case 'com':
$file = $path . '/components/com_' . $file . '/com_' . $file . '.xml';
break;
case 'mod':
$file = $path . '/modules/mod_' . $file . '/mod_' . $file . '.xml';
break;
case 'plg_editors-xtd':
$file = '/plugins/editors-xtd/' . $file . '.xml';
break;
default:
$file = '/plugins/system/' . $file . '.xml';
break;
}
$label = JText::_($label) . ' (' . JText::_('NN_' . strtoupper($extension)) . ')';
} else {
$label = $this->get('label', 'the main extension');
}
nnFieldDependency::setMessage($file, $label);
return '';
}
示例8: getInput
protected function getInput()
{
if (!nnFrameworkFunctions::extensionInstalled('virtuemart')) {
return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>';
}
$this->params = $this->element->attributes();
$this->db = JFactory::getDBO();
$group = $this->get('group', 'categories');
$tables = $this->db->getTableList();
if (!in_array($this->db->getPrefix() . 'virtuemart_' . $group, $tables)) {
return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>';
}
$parameters = nnParameters::getInstance();
$params = $parameters->getPluginParams('nnframework');
$this->max_list_count = $params->max_list_count;
if (!is_array($this->value)) {
$this->value = explode(',', $this->value);
}
$options = $this->{'get' . $group}();
$size = (int) $this->get('size');
$multiple = $this->get('multiple');
if ($group == 'categories') {
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
}
$size = $size ? 'style="width:' . $size . 'px"' : '';
$attr = $size;
$attr .= $multiple ? ' multiple="multiple"' : '';
return JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
}
示例9: clean
function clean()
{
if (!($type = $this->getCleanType())) {
return;
}
// Load language for messaging
nnFrameworkFunctions::loadLanguage('mod_cachecleaner');
$this->purgeCache($type);
$error = $this->helpers->getParams()->error;
if ($error) {
$message = JText::_('CC_NOT_ALL_CACHE_COULD_BE_REMOVED');
$message .= $this->helpers->getParams()->error !== true ? '<br />' . $this->helpers->getParams()->error : '';
} else {
$message = $this->helpers->getParams()->message ?: JText::_('CC_CACHE_CLEANED');
if ($this->params->show_size && $this->helpers->getParams()->size) {
$message .= ' (' . $this->helpers->get('cache')->getSize() . ')';
}
}
if (JFactory::getApplication()->input->getInt('break')) {
echo (!$error ? '+' : '') . str_replace('<br />', ' - ', $message);
die;
}
if ($this->show_message && $message) {
JFactory::getApplication()->enqueueMessage($message, $error ? 'error' : 'message');
}
}
示例10: isPro
private static function isPro($element)
{
require_once __DIR__ . '/functions.php';
if (!($version = nnFrameworkFunctions::getXMLValue('version', $element))) {
return false;
}
return stripos($version, 'PRO') !== false;
}
示例11: render
function render()
{
$url = JFactory::getApplication()->input->getString('url', '');
$func = new nnFrameworkFunctions();
if ($url) {
echo $func->getByUrl($url);
die;
}
$allowed = array('administrator/components/com_dbreplacer/dbreplacer.inc.php', 'administrator/components/com_nonumbermanager/details.inc.php', 'administrator/modules/mod_addtomenu/addtomenu.inc.php', 'media/rereplacer/images/image.inc.php', 'plugins/editors-xtd/articlesanywhere/articlesanywhere.inc.php', 'plugins/editors-xtd/contenttemplater/contenttemplater.inc.php', 'plugins/editors-xtd/dummycontent/dummycontent.inc.php', 'plugins/editors-xtd/modulesanywhere/modulesanywhere.inc.php', 'plugins/editors-xtd/snippets/snippets.inc.php', 'plugins/editors-xtd/sourcerer/sourcerer.inc.php');
$file = JFactory::getApplication()->input->getString('file', '');
$folder = JFactory::getApplication()->input->getString('folder', '');
if ($folder) {
$file = implode('/', explode('.', $folder)) . '/' . $file;
}
if (!$file || in_array($file, $allowed) === false) {
die;
}
jimport('joomla.filesystem.file');
if (JFactory::getApplication()->isSite()) {
JFactory::getApplication()->setTemplate('../administrator/templates/isis');
}
$_REQUEST['tmpl'] = 'component';
JFactory::getApplication()->input->set('option', '1');
header('Content-Type: text/html; charset=utf-8');
JHtml::_('bootstrap.framework');
JFactory::getDocument()->addScript(JURI::root(true) . '/administrator/templates/isis/js/template.js');
JFactory::getDocument()->addStyleSheet(JURI::root(true) . '/administrator/templates/isis/css/template.css');
JHtml::stylesheet('nnframework/popup.min.css', false, true);
$file = JPATH_SITE . '/' . $file;
$html = '';
if (JFile::exists($file)) {
ob_start();
include $file;
$html = ob_get_contents();
ob_end_clean();
}
JFactory::getDocument()->setBuffer($html, 'component');
nnApplication::render();
$html = JResponse::toString(JFactory::getApplication()->getCfg('gzip'));
$html = preg_replace('#\\s*<' . 'link [^>]*href="[^"]*templates/system/[^"]*\\.css[^"]*"[^>]* />#s', '', $html);
$html = preg_replace('#(<' . 'body [^>]*class=")#s', '\\1nnpopup ', $html);
$html = str_replace('<' . 'body>', '<' . 'body class="nnpopup"', $html);
echo $html;
die;
}
示例12: onAfterRoute
public function onAfterRoute()
{
$this->_pass = 0;
jimport('joomla.filesystem.file');
if (JFile::exists(JPATH_PLUGINS . '/system/nnframework/helpers/protect.php')) {
require_once JPATH_PLUGINS . '/system/nnframework/helpers/protect.php';
// return if page should be protected
if (nnProtect::isProtectedPage('', 1)) {
return;
}
}
// load the admin language file
require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php';
nnFrameworkFunctions::loadLanguage('plg_' . $this->_type . '_' . $this->_name);
// return if NoNumber Framework plugin is not installed
if (!JFile::exists(JPATH_PLUGINS . '/system/nnframework/nnframework.php')) {
if (JFactory::getApplication()->isAdmin() && JFactory::getApplication()->input->get('option') != 'com_login') {
$msg = JText::_('SRC_NONUMBER_FRAMEWORK_NOT_INSTALLED') . ' ' . JText::sprintf('SRC_EXTENSION_CAN_NOT_FUNCTION', JText::_('SOURCERER'));
$mq = JFactory::getApplication()->getMessageQueue();
foreach ($mq as $m) {
if ($m['message'] == $msg) {
$msg = '';
break;
}
}
if ($msg) {
JFactory::getApplication()->enqueueMessage($msg, 'error');
}
}
return;
}
if (JFile::exists(JPATH_PLUGINS . '/system/nnframework/helpers/protect.php')) {
require_once JPATH_PLUGINS . '/system/nnframework/helpers/protect.php';
// return if current page is an admin page
if (nnProtect::isAdmin()) {
return;
}
} else {
if (JFactory::getApplication()->isAdmin()) {
return;
}
}
// load the site language file
require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php';
nnFrameworkFunctions::loadLanguage('plg_' . $this->_type . '_' . $this->_name, JPATH_SITE);
// Load plugin parameters
require_once JPATH_PLUGINS . '/system/nnframework/helpers/parameters.php';
$parameters = nnParameters::getInstance();
$params = $parameters->getPluginParams($this->_name);
// Include the Helper
require_once JPATH_PLUGINS . '/' . $this->_type . '/' . $this->_name . '/helper.php';
$class = get_class($this) . 'Helper';
$this->_helper = new $class($params);
$this->_pass = 1;
}
示例13: getInput
function getInput($params)
{
$this->params = $params;
$option = JFactory::getApplication()->input->get('option');
// do not place toggler stuff on JoomFish pages
if ($option == 'com_joomfish') {
return '';
}
$param = $this->get('param');
$value = $this->get('value');
$nofx = $this->get('nofx');
$method = $this->get('method');
$div = $this->get('div', 0);
JHtml::_('jquery.framework');
nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/script.min.js');
nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/toggler.min.js');
$param = preg_replace('#^\\s*(.*?)\\s*$#', '\\1', $param);
$param = preg_replace('#\\s*\\|\\s*#', '|', $param);
$html = array();
if ($param != '') {
$param = preg_replace('#[^a-z0-9-\\.\\|\\@]#', '_', $param);
$param = str_replace('@', '_', $param);
$set_groups = explode('|', $param);
$set_values = explode('|', $value);
$ids = array();
foreach ($set_groups as $i => $group) {
$count = $i;
if ($count >= count($set_values)) {
$count = 0;
}
$value = explode(',', $set_values[$count]);
foreach ($value as $val) {
$ids[] = $group . '.' . $val;
}
}
if (!$div) {
$html[] = '</div></div>';
}
$html[] = '<div id="' . rand(1000000, 9999999) . '___' . implode('___', $ids) . '" class="nntoggler';
if ($nofx) {
$html[] = ' nntoggler_nofx';
}
if ($method == 'and') {
$html[] = ' nntoggler_and';
}
$html[] = '">';
if (!$div) {
$html[] = '<div><div>';
}
} else {
$html[] = '</div>';
}
return implode('', $html);
}
示例14: getInput
function getInput($name, $id, $value, $params)
{
$this->name = $name;
$this->id = $id;
$this->value = $value;
$this->params = $params;
$class = trim('nn_color minicolors ' . $this->get('class'));
$disabled = $this->get('disabled') ? ' disabled="disabled"' : '';
nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/color.min.js');
$this->value = strtolower(strtoupper(preg_replace('#[^a-z0-9]#si', '', $this->value)));
return '<input type="text" name="' . $this->name . '" id="' . $this->id . '" class="' . $class . '" value="' . $this->value . '"' . $disabled . '>';
}
示例15: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
JHtml::_('jquery.framework');
nnFrameworkFunctions::addScriptVersion(JURI::root(true) . '/media/nnframework/js/script.min.js');
$loading = "jQuery(\"#" . $this->id . "\").find(\"span\").attr(\"class\", \"icon-refresh icon-spin\")";
$success = "jQuery(\"#" . $this->id . "\").find(\"span\").attr(\"class\", \"icon-ok\")";
$error = "jQuery(\"#" . $this->id . "\").find(\"span\").attr(\"class\", \"icon-warning\");" . "jQuery(\"#message_" . $this->id . "\").addClass(\"alert alert-danger alert-inline\").html(data);";
$script = "\n\t\t\tfunction loadAjax" . $this->id . "() {\n\t\t\t\t" . $loading . ";\n\t\t\t\tjQuery(\"#message_" . $this->id . "\").attr(\"class\", \"\").html(\"\");\n\t\t\t\tnnScripts.loadajax(\n\t\t\t\t\t'" . addslashes($this->get('url')) . "',\n\t\t\t\t\t'if(data == \"\") { " . $success . " } else { " . $error . " }',\n\t\t\t\t\t'" . $error . "'\n\t\t\t\t);\n\t\t\t}\n\t\t";
JFactory::getDocument()->addScriptDeclaration($script);
return '<button id="' . $this->id . '" class="btn" title="' . JText::_($this->get('description')) . '" onclick="loadAjax' . $this->id . '();return false;">' . '<span class="' . $this->get('icon', '') . '"></span> ' . JText::_($this->get('text', $this->get('label'))) . '</button>' . '<div id="message_' . $this->id . '"></div>';
}