本文整理汇总了PHP中N2Request::getVar方法的典型用法代码示例。如果您正苦于以下问题:PHP N2Request::getVar方法的具体用法?PHP N2Request::getVar怎么用?PHP N2Request::getVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类N2Request
的用法示例。
在下文中一共展示了N2Request::getVar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save()
{
$namespace = N2Request::getCmd('namespace', 'default');
$settings = N2Request::getVar('settings');
if ($namespace && $settings) {
if ($namespace == 'default') {
$namespace = 'settings';
}
if ($namespace == 'font' && N2Request::getInt('sliderid')) {
$namespace .= N2Request::getInt('sliderid');
self::markChanged(N2Request::getInt('sliderid'));
}
if ($namespace == 'joomla') {
$license = empty($settings['license']) ? '' : $settings['license'];
$updates = $this->db->queryAll("SELECT b.update_site_id FROM " . $this->db->tableAlias("extensions") . " AS a LEFT JOIN " . $this->db->tableAlias("update_sites_extensions") . " AS b ON a.extension_id = b.extension_id WHERE a.element = 'com_smartslider3'");
if (count($updates)) {
$id = $updates[0]['update_site_id'];
unset($updates[0]);
if (count($updates)) {
foreach ($updates as $u) {
$this->db->setTableName("update_sites");
$this->db->deleteByAttributes(array("update_site_id" => $u['update_site_id']));
$this->db->setTableName("update_sites_extensions");
$this->db->deleteByAttributes(array("update_site_id" => $u['update_site_id']));
}
}
$this->db->setTableName("update_sites");
$this->db->update(array("location" => 'http://www.nextendweb.com/update2/joomla/update.php?license=' . urlencode($license) . '&fake=extension.xml'), array("update_site_id" => $id));
}
}
N2SmartSliderSettings::store($namespace, json_encode($settings));
}
}
示例2: actionSearch
public function actionSearch()
{
$this->validateToken();
N2Loader::import('libraries.models.content', 'platform');
$keyword = N2Request::getVar('keyword', '');
$this->response->respond(N2ModelsContent::search($keyword));
}
示例3: sliderWidget
public function sliderWidget($appType, $name)
{
$configurationXmlFile = $this->getWidgetPath($name) . 'config.xml';
$values = (array) N2Request::getVar('values', array());
$values['widget' . $name] = N2Post::getVar('value');
$class = 'N2SSPluginWidget' . $name . N2Post::getVar('value');
if (class_exists($class, false)) {
$values = array_merge(call_user_func(array($class, 'getDefaults')), $values);
}
return $this->subform($appType, $configurationXmlFile, $values, 'slider', 'widget' . $name);
}
示例4: actionChangeVisual
public function actionChangeVisual()
{
$this->validateToken();
$visualId = N2Request::getInt('visualId');
$this->validateVariable($visualId > 0, 'image');
$model = $this->getModel();
if ($visual = $model->changeVisual($visualId, N2Request::getVar('value'))) {
$this->response->respond(array('visual' => $visual));
}
N2Message::error(n2_('Unexpected error'));
$this->response->error();
}
示例5: parseRequest
public function parseRequest()
{
$mode = N2Request::getVar('mode');
switch ($mode) {
case 'pluginmethod':
$this->pluginmethod();
break;
default:
return;
break;
}
}
示例6: actionGenerator
public function actionGenerator()
{
if ($this->validateToken() && $this->validatePermission('smartslider_edit')) {
$generator_id = N2Request::getInt('generator_id');
$generatorModel = new N2SmartsliderGeneratorModel();
$sliderId = $generatorModel->getSliderId($generator_id);
if ($sliderId) {
$generatorData = array();
$generatorData[$generator_id] = N2Request::getVar('generator');
$this->addView("generator", array('generatorData' => $generatorData, 'sliderId' => $sliderId));
$this->render();
}
}
}
示例7: actionFonts
public function actionFonts()
{
if ($this->canDo('nextend_config')) {
$fonts = N2Request::getVar('fonts', false);
if ($fonts) {
if ($this->validateToken()) {
N2Fonts::storeSettings($fonts);
N2Message::success(n2_('Saved.'));
N2Request::redirect($this->appType->router->createUrl(array("settings/fonts")));
} else {
$this->refresh();
}
}
$this->addView("../../inline/sidebar/settings", array("appObj" => $this), "sidebar");
$this->addView("fonts");
$this->render();
}
}
示例8: actionItemDefaults
public function actionItemDefaults()
{
if ($this->validatePermission('smartslider_config')) {
if (N2Request::getInt('save')) {
if ($this->validateToken()) {
$settingsModel = new N2SmartsliderSettingsModel();
if ($settingsModel->saveDefaults(N2Request::getVar('defaults', array()))) {
$this->refresh();
}
} else {
$this->refresh();
}
}
$this->addView("../../inline/_sidebar_settings", array(), "sidebar");
$this->addView("defaults");
$this->render();
}
}
示例9: actionUpload
public function actionUpload()
{
if (defined('N2_IMAGE_UPLOAD_DISABLE')) {
N2Message::error(n2_('You are not allowed to upload!'));
$this->response->error();
}
$this->validateToken();
$root = N2Filesystem::getImagesFolder();
$folder = ltrim(rtrim(N2Request::getVar('path', ''), '/'), '/');
$path = N2Filesystem::realpath($root . '/' . $folder);
if ($path === false || $path == '') {
$folder = preg_replace("/[^A-Za-z0-9]/", '', $folder);
if (empty($folder)) {
N2Message::error(n2_('Folder is missing!'));
$this->response->error();
} else {
N2Filesystem::createFolder($root . '/' . $folder);
$path = N2Filesystem::realpath($root . '/' . $folder);
}
}
$relativePath = $this->relative($path, $root);
if (!$relativePath) {
$relativePath = '';
}
$response = array('path' => $relativePath);
try {
if (isset($_FILES) && isset($_FILES['image']) && isset($_FILES['image']['name'])) {
$info = pathinfo($_FILES['image']['name']);
$fileName = preg_replace('/[^a-zA-Z0-9_-]/', '', $info['filename']);
if (strlen($fileName) == 0) {
$fileName = '';
}
$upload = new N2BulletProof();
$file = $upload->uploadDir($path)->upload($_FILES['image'], $fileName);
$response['name'] = basename($file);
$response['url'] = N2ImageHelper::dynamic(N2Filesystem::pathToAbsoluteURL($file));
}
} catch (Exception $e) {
N2Message::error($e->getMessage());
$this->response->error();
}
$this->response->respond($response);
}
示例10: actionSaveImage
public function actionSaveImage()
{
$this->validateToken();
N2Loader::import('libraries.image.aviary');
$image = N2Request::getVar('aviaryUrl');
$this->validateVariable(!empty($image), 'image');
require_once dirname(__FILE__) . '/Browse.php';
$root = N2Filesystem::getImagesFolder();
$folder = 'aviary';
$path = N2Filesystem::realpath($root . '/' . $folder);
if ($path === false || $path == '') {
N2Filesystem::createFolder($root . '/' . $folder);
$path = N2Filesystem::realpath($root . '/' . $folder);
}
$tmp = tempnam(sys_get_temp_dir(), 'image-');
file_put_contents($tmp, file_get_contents($image));
$src = null;
// Set variables for storage
// fix file filename for query strings
preg_match('/([^\\?]+)\\.(jpe?g|gif|png)\\b/i', $image, $matches);
$file_array['name'] = basename($matches[1]);
$file_array['tmp_name'] = $tmp;
$file_array['size'] = filesize($tmp);
$file_array['error'] = 0;
try {
$fileName = preg_replace('/[^a-zA-Z0-9_-]/', '', $file_array['name']);
$upload = new N2BulletProof();
$file = $upload->uploadDir($path)->upload($file_array, $fileName);
$src = N2ImageHelper::dynamic(N2Filesystem::pathToAbsoluteURL($file));
} catch (Exception $e) {
N2Message::error($e->getMessage());
$this->response->error();
}
if ($src) {
$this->response->respond(array('image' => $src));
} else {
N2Message::error(sprintf(n2_('Unexpected error: %s'), $image));
$this->response->error();
}
}
示例11: actionImportFromServer
public function actionImportFromServer()
{
if ($this->validatePermission('smartslider_edit')) {
if (N2Request::getInt('save')) {
if ($this->validateToken()) {
$data = new N2Data(N2Request::getVar('slider'));
$file = $data->get('import-file');
if (empty($file)) {
N2Message::error(n2_('Please select a file!'));
$this->refresh();
} else {
$dir = N2Platform::getPublicDir();
if (N2Filesystem::fileexists($dir . '/' . $file)) {
N2Loader::import('libraries.import', 'smartslider');
$import = new N2SmartSliderImport();
$sliderId = $import->import($dir . '/' . $file, $data->get('image-mode', 'clone'), $data->get('linked-visuals', 0));
if ($sliderId !== false) {
if ($data->get('delete')) {
@unlink($dir . '/' . $file);
}
N2Message::success(n2_('Slider imported.'));
$this->redirect(array("slider/edit", array("sliderid" => $sliderId)));
} else {
N2Message::error(n2_('Import error!'));
$this->refresh();
}
} else {
N2Message::error(n2_('The chosen file is missing!'));
$this->refresh();
}
}
} else {
$this->refresh();
}
}
$this->addView('importFromServer');
$this->render();
}
}
示例12: array
<?php
/* @var $this N2Layout */
?>
<div id="n2-admin" class="n2 n2-border-radius">
<?php
/**
* @var $widget Nav
*/
$logoUrl = N2Base::getApplication('system')->getLogo();
$cmd = N2Request::getVar("nextendcontroller", "dashboard");
echo $this->widget->init('nav', array('logoUrl' => $this->appType->router->createUrl("dashboard/index"), 'logoImageUrl' => $logoUrl, 'views' => array(N2Html::tag('a', array('href' => $this->appType->router->createUrl("dashboard/index"), 'class' => 'n2-h4 n2-uc ' . ($cmd == "dashboard" ? "n2-active" : "")), n2_('Dashboard')), N2Html::tag('a', array('href' => $this->appType->router->createUrl("settings/index"), 'class' => 'n2-h4 n2-uc ' . ($cmd == "settings" ? "n2-active" : "")), n2_('Settings')), N2Html::tag('a', array('href' => $this->appType->router->createUrl("help/index"), 'class' => 'n2-h4 n2-uc ' . ($cmd == "help" ? "n2-active" : "")), n2_('Help'))), 'actions' => $this->getFragmentValue('actions')));
?>
<div class="n2-table n2-table-fixed n2-content">
<div class="n2-tr">
<div class="n2-td n2-sidebar n2-sidebar-base-bg">
<?php
$this->renderFragmentBlock('nextend_sidebar');
?>
</div>
<div class="n2-td n2-content-base-bg">
<!-- Begin Content -->
<div class="n2-content-area n2-border-radius-br">
<?php
$this->renderFragmentBlock('nextend_content');
?>
</div>
示例13: actionFinishAuth
public function actionFinishAuth()
{
if ($this->validatePermission('smartslider_config')) {
$generatorModel = new N2SmartsliderGeneratorModel();
$group = N2Request::getVar('group');
$type = N2Request::getVar('type');
$info = $generatorModel->getGeneratorInfo($group, $type);
$configuration = $info->getConfiguration();
$result = $configuration->finishAuth();
if ($result === true) {
N2Message::success(n2_('Authentication successful.'));
echo '<script>window.opener.location.reload();self.close();</script>';
} else {
if ($result instanceof Exception) {
$message = $result->getMessage();
} else {
$message = 'Something wrong with the credentials';
}
echo '<script>window.opener.nextend.notificationCenter.error("' . htmlspecialchars($message) . '");self.close();</script>';
}
n2_exit(true);
}
}
示例14: box
/**
* @param $slide N2SmartSliderSlide
* @param $slider N2SmartSliderAbstract
* @param $widget
* @param $appType
*
* @throws Exception
*/
public static function box($slide, $slider, $widget, $appType)
{
$lt = array();
if ($slide->isStatic()) {
$lt[] = N2Html::tag('div', array('class' => 'n2-button-tag n2-button n2-button-x-small n2-sidebar-list-bg n2-uc n2-h5'), n2_('Static slide'));
} else {
$lt[] = N2Html::tag('div', array('class' => 'n2-button-tag n2-button n2-button-x-small n2-button-green n2-uc n2-h5 n2-slide-is-first'), n2_('First'));
$lt[] = N2Html::tag('a', array('class' => 'n2-button n2-button-x-small n2-sidebar-list-bg n2-uc n2-h5 n2-slide-first', 'href' => $appType->router->createUrl(array('slides/first', array('sliderid' => $slider->sliderId, 'slideid' => $slide->id) + N2Form::tokenizeUrl()))), n2_('Set First'));
}
$rt = array();
$rt[] = N2Html::tag('a', array('class' => 'n2-button n2-button-small n2-sidebar-list-bg n2-sidebar-list-bg n2-slide-duplicate', 'href' => $appType->router->createUrl(array('slides/duplicate', array('sliderid' => $slider->sliderId, 'slideid' => $slide->id) + N2Form::tokenizeUrl()))), N2Html::tag('i', array('class' => 'n2-i n2-it n2-i-duplicate'), ''));
$rt[] = N2Html::tag('a', array('class' => 'n2-button n2-button-small n2-sidebar-list-bg n2-slide-delete', 'href' => $appType->router->createUrl(array('slides/delete', array('sliderid' => $slider->sliderId, 'slideid' => $slide->id) + N2Form::tokenizeUrl()))), N2Html::tag('i', array('class' => 'n2-i n2-it n2-i-delete'), ''));
$rt[] = N2Html::tag('div', array('class' => 'n2-button n2-button-small n2-button-blue n2-slide-selected'), N2Html::tag('i', array('class' => 'n2-i n2-it n2-i-tick'), ''));
$rb = array();
if ($slide->hasGenerator()) {
$rb[] = N2Html::tag('a', array('class' => 'n2-button n2-button-x-small n2-sidebar-list-bg n2-uc n2-h5 n2-slide-generator' . (N2Request::getVar('generator_id') == $slide->generator_id ? ' n2-button-blue' : ''), 'href' => $appType->router->createUrl(array('generator/edit', array('generator_id' => $slide->generator_id)))), 'Edit generator');
}
$image = $slide->getThumbnail();
if (empty($image)) {
$image = '$system$/images/placeholder/image.png';
}
$editUrl = $appType->router->createUrl(array('slides/edit', array('sliderid' => $slider->sliderId, 'slideid' => $slide->id)));
$widget->init("box", array('attributes' => array('class' => 'n2-box-slide n2-box-overflow' . ($slide->isFirst() ? ' n2-first-slide' : '') . ($slide->isCurrentlyEdited() ? ' n2-ss-slide-active' : ''), 'data-slideid' => $slide->id, 'data-title' => $slide->getRawTitle(), 'data-description' => $slide->getRawDescription(), 'data-link' => $slide->getRawLink(), 'data-image' => N2ImageHelper::fixed($image), 'data-editUrl' => $editUrl), 'image' => N2ImageHelper::fixed($image), 'firstCol' => N2Html::link($slide->getTitle() . ($slide->hasGenerator() ? ' [' . $slide->getSlideStat() . ']' : ''), $editUrl, array('class' => 'n2-h4')), 'lt' => implode('', $lt), 'rt' => implode('', $rt), 'rtAttributes' => array('class' => 'n2-on-hover'), 'rb' => implode('', $rb), 'placeholderContent' => N2Html::tag('a', array('class' => 'n2-slide-published' . ($slide->published ? ' n2-active' : ''), 'href' => $appType->router->createUrl(array('slides/publish', array('sliderid' => $slider->sliderId, 'slideid' => $slide->id) + N2Form::tokenizeUrl()))), N2Html::tag('i', array('class' => 'n2-i n2-it n2-i-unpublished'), ''))));
}
示例15: actionImportDemo
public function actionImportDemo()
{
$this->validateToken();
$this->validatePermission('smartslider_edit');
$key = 'http:' . base64_decode(N2Request::getVar('key'));
if (strpos($key, 'http://smartslider3.com/') !== 0) {
N2Message::error(sprintf(n2_('Import url is not valid: %s'), $key));
$this->response->error();
}
$posts = array('action' => 'asset', 'asset' => $key);
$result = N2SS3::api($posts);
if (!is_string($result)) {
$hasError = N2SS3::hasApiError($result['status'], array('key' => $key));
if (is_array($hasError)) {
$this->redirect($hasError);
} else {
if ($hasError !== false) {
$this->response->error();
}
}
} else {
N2Loader::import(array('models.Sliders', 'models.Slides'), 'smartslider');
N2Loader::import('libraries.import', 'smartslider');
$import = new N2SmartSliderImport();
$sliderId = $import->import($result, 'clone', 1, false);
if ($sliderId !== false) {
N2Message::success(n2_('Slider imported.'));
$this->response->redirect(array("slider/edit", array("sliderid" => $sliderId)));
} else {
N2Message::error(n2_('Import error!'));
$this->response->error();
}
}
$this->response->respond();
}