當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。