本文整理汇总了PHP中N2Request类的典型用法代码示例。如果您正苦于以下问题:PHP N2Request类的具体用法?PHP N2Request怎么用?PHP N2Request使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了N2Request类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: actionSearch
public function actionSearch()
{
$this->validateToken();
N2Loader::import('libraries.models.content', 'platform');
$keyword = N2Request::getVar('keyword', '');
$this->response->respond(N2ModelsContent::search($keyword));
}
开发者ID:vicpril,项目名称:rep_bidqa,代码行数:7,代码来源:Content.php
示例2: 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));
}
}
开发者ID:RenatoToasa,项目名称:Pagina-Web,代码行数:33,代码来源:Settings.php
示例3: actionEnd
public function actionEnd()
{
$this->validateToken();
$this->validatePermission('smartslider_edit');
$key = N2Request::getCmd('key');
N2SmartSliderSettings::set('guide-' . $key, 0);
N2Message::notice('The ' . $key . ' guide completed. If you need it again, you can turn it on in the "Settings"!');
$this->response->respond();
}
开发者ID:RenatoToasa,项目名称:Pagina-Web,代码行数:9,代码来源:Guide.php
示例4: 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);
}
开发者ID:RenatoToasa,项目名称:Pagina-Web,代码行数:11,代码来源:Ajax.php
示例5: renderFontsConfigurationForm
public function renderFontsConfigurationForm()
{
$values = N2Fonts::loadSettings();
$form = new N2Form($this->appType);
$form->loadArray($values);
$form->loadArray($values['plugins']->toArray());
$form->loadXMLFile(N2Loader::getPath('models', 'system') . '/forms/fonts.xml');
echo N2Html::openTag("form", array("id" => "nextend-config", "method" => "post", "action" => N2Request::getRequestUri()));
$form->render('fonts');
echo N2Html::closeTag("form");
}
开发者ID:vicpril,项目名称:rep_bidqa,代码行数:11,代码来源:_view.php
示例6: actionDuplicate
public function actionDuplicate()
{
if ($this->validateToken() && $this->validatePermission('smartslider_edit')) {
$slidersModel = new N2SmartsliderSlidersModel();
if (($sliderid = N2Request::getInt('sliderid')) && $slidersModel->get($sliderid)) {
$newSliderId = $slidersModel->duplicate($sliderid);
N2Message::success(n2_('Slider duplicated.'));
$this->redirect(array("slider/edit", array("sliderid" => $newSliderId)));
}
$this->redirectToSliders();
}
}
开发者ID:vicpril,项目名称:rep_bidqa,代码行数:12,代码来源:Slider.php
示例7: 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();
}
开发者ID:MBerguer,项目名称:wp-demo,代码行数:12,代码来源:Image.php
示例8: parseRequest
public function parseRequest()
{
$mode = N2Request::getVar('mode');
switch ($mode) {
case 'pluginmethod':
$this->pluginmethod();
break;
default:
return;
break;
}
}
开发者ID:MBerguer,项目名称:wp-demo,代码行数:12,代码来源:ajax.php
示例9: 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();
}
}
}
开发者ID:RenatoToasa,项目名称:Pagina-Web,代码行数:14,代码来源:Preview.php
示例10: 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();
}
}
开发者ID:RenatoToasa,项目名称:Pagina-Web,代码行数:18,代码来源:Settings.php
示例11: 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();
}
}
开发者ID:MBerguer,项目名称:wp-demo,代码行数:18,代码来源:Settings.php
示例12: 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);
}
开发者ID:RenatoToasa,项目名称:Pagina-Web,代码行数:43,代码来源:Browse.php
示例13: 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();
}
}
开发者ID:vicpril,项目名称:rep_bidqa,代码行数:40,代码来源:Aviary.php
示例14: 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);
}
}
开发者ID:RenatoToasa,项目名称:Pagina-Web,代码行数:23,代码来源:Generator.php
示例15: actionUnPublish
public function actionUnPublish()
{
if ($this->validateToken() && $this->validatePermission('smartslider_edit')) {
if ($slideId = N2Request::getInt('slideid')) {
$slidesModel = new N2SmartsliderSlidesModel();
$slidesModel->unpublish($slideId);
$this->redirect(N2Request::getUrlReferrer());
}
$this->redirect(array("sliders/index"));
}
}
开发者ID:RenatoToasa,项目名称:Pagina-Web,代码行数:11,代码来源:Slides.php
示例16: array
<?php
/**
* @var $slidesModel N2SmartsliderSlidesModel
*/
$slide = $slidesModel->get(N2Request::getInt('slideid', 0));
$actions = array(N2Html::tag('a', array('href' => $this->appType->router->createUrl(array("slider/edit", array("sliderid" => $sliderId))), 'class' => 'n2-button n2-button-red n2-button-big n2-h4 n2-b n2-uc', 'onclick' => 'return nextend.cancel(this.href);'), n2_('Cancel')));
if ($slide && $slide['generator_id'] > 0) {
$actions[] = N2Html::tag('a', array('href' => '#', 'class' => 'n2-button n2-button-blue n2-button-big n2-h4 n2-b n2-uc', 'onclick' => 'nextend.askToSave = false;setTimeout(function() {var static = n2("<input name=\'static\' value=\'1\' />"); n2(\'#smartslider-form\').append(static).submit(); static.remove();}, 300); return false;'), n2_('Static save'));
}
$actions[] = N2Html::tag('a', array('href' => '#', 'class' => 'n2-button n2-button-green n2-button-big n2-h4 n2-b n2-uc', 'onclick' => 'return NextendForm.submit("#smartslider-form");'), n2_('Save'));
$this->widget->init('topbar', array('back' => N2Html::tag('a', array('class' => 'n2-h4 n2-uc', 'href' => $this->appType->router->createUrl(array("slider/edit", array("sliderid" => $sliderId)))), n2_('Slider settings')), "actions" => $actions, 'menu' => array(N2Html::tag('a', array('id' => 'n2-ss-preview', 'href' => '#', 'class' => 'n2-h3 n2-uc n2-has-underline n2-button n2-button-blue n2-button-big', 'style' => 'font-size: 12px;'), n2_('Preview')), N2Html::tag('a', array('id' => 'n2-ss-undo', 'href' => '#', 'class' => 'n2-h3 n2-uc n2-has-underline n2-button n2-button-grey n2-button-big n2-icon-button', 'style' => 'font-size: 12px;'), '<i class="n2-i n2-it n2-i-16 n2-i-undo"></i>'), N2Html::tag('a', array('id' => 'n2-ss-redo', 'href' => '#', 'class' => 'n2-h3 n2-uc n2-has-underline n2-button n2-button-grey n2-button-big n2-icon-button', 'style' => 'font-size: 12px;'), '<i class="n2-i n2-it n2-i-16 n2-i-redo"></i>')), "hideSidebar" => true));
?>
<script type="text/javascript">
nextend.isPreview = false;
nextend.ready(
function ($) {
var form = $('#smartslider-form'),
formAction = form.attr('action');
var modal = new NextendSimpleModal('<iframe name="n2-tab-preview" src="" style="width: 100%;height:100%;"></iframe>');
modal.modal.on('ModalHide', function () {
modal.modal.find('iframe').attr('src', 'about:blank');
$(window).trigger('SSPreviewHide');
});
$('#n2-ss-preview').on('click', function (e) {
nextend.isPreview = true;
e.preventDefault();
开发者ID:rfulwell,项目名称:transitionalresources.org,代码行数:31,代码来源:edit.php
示例17: defined
<?php
/**
* @author Roland Soos
* @copyright (C) 2015 Nextendweb.com
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
**/
defined('_JEXEC') or die('Restricted access');
$action = N2Request::getCmd('nextendaction', 'default');
$settings = array(array('id' => 'index', 'title' => n2_('General settings')));
$settings[] = array('id' => 'fonts', 'title' => n2_('Fonts'));
$dl = array();
foreach ($settings as $setting) {
$dl[] = array('title' => $setting['title'], 'link' => $this->appType->router->createUrl("settings/{$setting['id']}"), 'class' => $setting['id'] == $action ? 'active ' : '');
}
echo $this->widget->init("definitionlist", array("dl" => $dl));
开发者ID:RenatoToasa,项目名称:Pagina-Web,代码行数:16,代码来源:settings.php
示例18: defined
<?php
/**
* @author Roland Soos
* @copyright (C) 2015 Nextendweb.com
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
**/
defined('_JEXEC') or die('Restricted access');
/* @var $this N2Layout */
?>
<div id="n2-admin" class="n2 n2-border-radius">
<?php
$cmd = N2Request::getVar("nextendcontroller", "sliders");
/**
* @see Nav
*/
$views = array(N2Html::tag('a', array('href' => $this->appType->router->createUrl("sliders/index"), 'class' => 'n2-h4 n2-uc ' . ($cmd == "sliders" ? "n2-active" : "")), n2_('Sliders')), N2Html::tag('a', array('href' => $this->appType->router->createUrl("settings/default"), 'class' => 'n2-h4 n2-uc ' . ($cmd == "settings" ? "n2-active" : "")), n2_('Settings')), N2Html::tag('a', array('href' => N2Base::getApplication('system')->router->createUrl("dashboard/index"), 'class' => 'n2-h4 n2-uc ' . ($cmd == "settings" ? "n2-active" : "")), n2_('Nextend')));
$views[] = N2Html::tag('a', array('href' => N2SS3::getProUrlPricing(), 'target' => '_blank', 'class' => 'n2-h4 n2-uc '), n2_('Go Pro!'));
$this->widget->init('nav', array('logoUrl' => $this->appType->router->createUrl("sliders/index"), 'logoImageUrl' => $this->appType->app->getLogo(), 'views' => $views, '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 n2-border-radius-bl">
<?php
$this->renderFragmentBlock('nextend_sidebar', '_sliders');
?>
</div>
开发者ID:RenatoToasa,项目名称:Pagina-Web,代码行数:30,代码来源:default.php
示例19: array
<?php
$this->widget->init('topbar', array("menu" => array(N2Html::tag('a', array('id' => 'n2-ss-preview', 'href' => '#', 'class' => 'n2-h3 n2-uc n2-has-underline n2-button n2-button-blue n2-button-big', 'style' => 'font-size: 12px;'), n2_('Preview'))), "actions" => array(N2Html::tag('a', array('href' => $this->appType->router->createUrl(array("slider/edit", array("sliderid" => N2Request::getInt('sliderid')))), 'class' => 'n2-button n2-button-red n2-button-big n2-h4 n2-b n2-uc'), n2_('Cancel')), N2Html::tag('a', array('href' => '#', 'class' => 'n2-button n2-button-green n2-button-big n2-h4 n2-b n2-uc', 'onclick' => 'return NextendForm.submit("#smartslider-form");'), n2_('Save')))));
?>
<form id="smartslider-form" action="" method="post">
<?php
$params = new N2Data($generator['params'], true);
$group = $generator['group'];
$type = $generator['type'];
$generatorModel = new N2SmartsliderGeneratorModel();
$info = $generatorModel->getGeneratorInfo($group, $type);
$this->widget->init('heading', array('title' => $info->group . ' - ' . $info->title));
$xml = $generatorModel->generatorSpecificForm($group, $type, $params->toArray());
$slideParams = new N2Data($slide['params'], true);
$params->set('record-slides', $slideParams->get('record-slides', 1));
$generatorModel->generatorEditForm($params->toArray());
?>
<input name="save" value="1" type="hidden"/>
</form>
<style>
#generatorrecords {
overflow: auto;
width: 100%;
}
#generatorrecords table div {
max-width: 200px;
max-height: 200px;
overflow: auto;
}
开发者ID:vicpril,项目名称:rep_bidqa,代码行数:31,代码来源:edit.php
示例20: 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();
}
开发者ID:RenatoToasa,项目名称:Pagina-Web,代码行数:35,代码来源:Slider.php
注:本文中的N2Request类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论