本文整理汇总了PHP中NNFrameworkFunctions类的典型用法代码示例。如果您正苦于以下问题:PHP NNFrameworkFunctions类的具体用法?PHP NNFrameworkFunctions怎么用?PHP NNFrameworkFunctions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NNFrameworkFunctions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
$attr = '';
$attr .= ' size="' . (int) $size . '"';
$attr .= $multiple ? ' multiple="multiple"' : '';
return JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
}
示例2: 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;
}
示例3: getGeo
function getGeo()
{
if (!$this->geo) {
require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php';
$func = new NNFrameworkFunctions();
$this->geo = json_decode($func->getContents('http://www.geoplugin.net/json.gp?ip=' . $_SERVER['REMOTE_ADDR']));
}
return $this->geo;
}
示例4: __construct
function __construct()
{
$url = JFactory::getApplication()->input->getString('url', '');
require_once JPATH_PLUGINS . '/system/nnframework/helpers/functions.php';
$func = new NNFrameworkFunctions();
if ($url) {
echo $func->getByUrl($url);
die;
}
$file = JFactory::getApplication()->input->getString('file', '');
// only allow files that have .inc.php in the file name
if (!$file || strpos($file, '.inc.php') === false) {
die;
}
$folder = JFactory::getApplication()->input->getString('folder', '');
if ($folder) {
$file = implode('/', explode('.', $folder)) . '/' . $file;
}
$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/modulesanywhere/modulesanywhere.inc.php', 'plugins/editors-xtd/snippets/snippets.inc.php', 'plugins/editors-xtd/sourcerer/sourcerer.inc.php');
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');
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');
if (version_compare(JVERSION, '3.2', 'l')) {
JFactory::getApplication()->render();
} else {
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;
}
示例5: install
/**
* Download and install
*/
function install($id, $url)
{
if (!is_string($url)) {
return JText::_('NNEM_ERROR_NO_VALID_URL');
}
$url = 'http://' . str_replace('http://', '', $url);
if (!($target = JInstallerHelper::downloadPackage($url))) {
return JText::_('NNEM_ERROR_CANNOT_DOWNLOAD_FILE');
}
$target = JFactory::getConfig()->get('tmp_path') . '/' . $target;
NNFrameworkFunctions::loadLanguage('com_installer', JPATH_ADMINISTRATOR);
jimport('joomla.installer.installer');
jimport('joomla.installer.helper');
// Get an installer instance
$installer = JInstaller::getInstance();
// Unpack the package
$package = JInstallerHelper::unpack($target);
// Cleanup the install files
if (!is_file($package['packagefile'])) {
$config = JFactory::getConfig();
$package['packagefile'] = $config->get('tmp_path') . '/' . $package['packagefile'];
}
JInstallerHelper::cleanupInstall($package['packagefile'], $package['packagefile']);
// Install the package
if (!$installer->install($package['dir'])) {
// There was an error installing the package
return JText::sprintf('COM_INSTALLER_INSTALL_ERROR', JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type'])));
}
return true;
}
示例6: 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);
}
示例7: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
if (!NNFrameworkFunctions::extensionInstalled('flexicontent')) {
return '<fieldset class="radio">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_FLEXICONTENT')) . '</fieldset>';
}
$group = $this->def('group', 'categories');
$this->db = JFactory::getDBO();
$tables = $this->db->getTableList();
if (!in_array($this->db->getPrefix() . 'flexicontent_' . $group, $tables)) {
return '<fieldset class="radio">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_FLEXICONTENT')) . '</fieldset>';
}
if (!is_array($this->value)) {
$this->value = explode(',', $this->value);
}
$options = $this->{'get' . $group}();
$size = (int) $this->def('size');
$multiple = $this->def('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);
} else {
$attr = '';
$attr .= ' size="' . (int) $size . '"';
$attr .= $multiple ? ' multiple="multiple"' : '';
return JHtml::_('select.genericlist', $options, $this->name . '[]', trim($attr), 'value', 'text', $this->value, $this->id);
}
}
示例8: getInput
protected function getInput()
{
if (!NNFrameworkFunctions::extensionInstalled('mijoshop')) {
return '<fieldset class="radio">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_MIJOSHOP')) . '</fieldset>';
}
$this->params = $this->element->attributes();
$group = $this->def('group', 'categories');
$this->db = JFactory::getDBO();
$tables = $this->db->getTableList();
if (!in_array($this->db->getPrefix() . 'mijoshop_' . ($group == 'products' ? 'product' : 'category'), $tables)) {
return '<fieldset class="radio">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_MIJOSHOP')) . '</fieldset>';
}
$this->params = $this->element->attributes();
$parameters = NNParameters::getInstance();
$params = $parameters->getPluginParams('nnframework');
$this->max_list_count = $params->max_list_count;
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->def('size');
$multiple = $this->def('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);
} else {
$attr = '';
$attr .= ' size="' . (int) $size . '"';
$attr .= $multiple ? ' multiple="multiple"' : '';
return JHtml::_('select.genericlist', $options, $this->name . '[]', trim($attr), 'value', 'text', $this->value, $this->id);
}
}
示例9: loadLanguage
function loadLanguage($extension, $admin = 1)
{
if (!$extension) {
return;
}
NNFrameworkFunctions::loadLanguage($extension, $admin ? JPATH_ADMINISTRATOR : JPATH_SITE);
}
示例10: getInput
protected function getInput()
{
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');
$this->params = $this->element->attributes();
$size = (int) $this->get('size');
$attr = $this->get('onchange') ? ' onchange="' . $this->get('onchange') . '"' : '';
$categories = $this->getOptions();
$options = parent::getOptions();
if ($this->get('show_none', 1)) {
$options[] = JHtml::_('select.option', '', '- ' . JText::_('JNONE') . ' -', 'value', 'text');
}
if ($this->get('show_new', 1)) {
$options[] = JHtml::_('select.option', '-1', '- ' . JText::_('NN_NEW_CATEGORY') . ' -', 'value', 'text', false);
}
$options = array_merge($options, $categories);
if (!$this->get('show_new', 1)) {
return JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
}
NNFrameworkFunctions::addScriptVersion(JUri::root(true) . '/media/nnframework/js/simplecategories.min.js');
$html = array();
$html[] = '<div class="nn_simplecategory">';
$html[] = '<input type="hidden" class="nn_simplecategory_value" id="' . $this->id . '" name="' . $this->name . '" value="' . $this->value . '" checked="checked" />';
$html[] = '<div class="nn_simplecategory_select">';
$html[] = NNHtml::selectlistsimple($options, $this->getName($this->fieldname . '_select'), $this->value, $this->getId('', $this->fieldname . '_select'), $size, false);
$html[] = '</div>';
$html[] = '<div id="' . rand(1000000, 9999999) . '___' . $this->fieldname . '_select.-1" class="nntoggler nntoggler_nofx" style="display:none;">';
$html[] = '<div class="nn_simplecategory_new">';
$html[] = '<input type="text" id="' . $this->id . '_new" value="" placeholder="' . JText::_('NN_NEW_CATEGORY_ENTER') . '" />';
$html[] = '</div>';
$html[] = '</div>';
$html[] = '</div>';
return implode('', $html);
}
示例11: 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;
}
$user = JFactory::getUser();
if ($user->get('guest') || !$user->authorise('core.edit', 'com_content') && !$user->authorise('core.create', 'com_content')) {
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=popup.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;
}
示例12: clean
function clean()
{
if (!($type = $this->getCleanType())) {
return;
}
// Load language for messaging
NNFrameworkFunctions::loadLanguage('mod_cachecleaner');
$this->purgeCache($type);
// only handle messages in html
if (JFactory::getDocument()->getType() != 'html') {
return false;
}
$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');
}
}
示例13: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
JHtml::_('jquery.framework');
NNFrameworkFunctions::addScriptVersion(JUri::root(true) . '/media/nnframework/js/script.min.js');
if ($file = $this->get('file')) {
$label = $this->get('label', 'the main extension');
NNFieldDependency::setMessage($file, $label);
return '';
}
$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)) . ')';
NNFieldDependency::setMessage($file, $label);
return '';
}
示例14: getInput
protected function getInput()
{
$this->params = $this->element->attributes();
if (!NNFrameworkFunctions::extensionInstalled('virtuemart')) {
return '<fieldset class="radio">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>';
}
$group = $this->def('group', 'categories');
$this->db = JFactory::getDBO();
$tables = $this->db->getTableList();
if (!in_array($this->db->getPrefix() . 'virtuemart_' . $group, $tables)) {
return '<fieldset class="radio">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_VIRTUEMART')) . '</fieldset>';
}
$query = $this->db->getQuery(true);
$query->select('config')->from('#__virtuemart_configs')->where('virtuemart_config_id = 1');
$this->db->setQuery($query);
$config = $this->db->loadResult();
$lang = substr($config, strpos($config, 'vmlang='));
$lang = substr($lang, 0, strpos($lang, '|'));
if (preg_match('#"([^"]*_[^"]*)"#', $lang, $lang)) {
$this->lang = $lang['1'];
} else {
$this->lang = 'en_gb';
}
if (!is_array($this->value)) {
$this->value = explode(',', $this->value);
}
$options = $this->{'get' . $group}();
$size = (int) $this->def('size');
$multiple = $this->def('multiple');
require_once JPATH_PLUGINS . '/system/nnframework/helpers/html.php';
return nnHtml::selectlist($options, $this->name, $this->value, $this->id, $size, $multiple);
}
示例15: getInput
protected function getInput()
{
if (!NNFrameworkFunctions::extensionInstalled('hikashop')) {
return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_FILES_NOT_FOUND', JText::_('NN_HIKASHOP')) . '</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() . 'hikashop_' . ($group == 'products' ? 'product' : 'category'), $tables)) {
return '<fieldset class="alert alert-danger">' . JText::_('ERROR') . ': ' . JText::sprintf('NN_TABLE_NOT_FOUND', JText::_('NN_HIKASHOP')) . '</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');
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);
}
}