当前位置: 首页>>代码示例>>PHP>>正文


PHP N2Request类代码示例

本文整理汇总了PHP中N2Request的典型用法代码示例。如果您正苦于以下问题:PHP N2Request类的具体用法?PHP N2Request怎么用?PHP N2Request使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了N2Request类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的N2Request类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。