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


PHP WFToken::checkToken方法代码示例

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


在下文中一共展示了WFToken::checkToken方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: compile

 function compile()
 {
     WFToken::checkToken() or die('RESTRICTED ACCESS');
     wfimport('admin.classes.packer');
     $base = dirname(dirname(__FILE__));
     $editor = JRequest::getWord('editor', 'codemirror');
     $theme = JRequest::getWord('theme', 'textmate');
     switch (JRequest::getWord('type', 'base')) {
         case 'base':
             $files = array();
             $files[] = $base . DS . 'js' . DS . 'codemirror' . DS . 'base.js';
             $type = 'javsacript';
             break;
         case 'parser':
             $files = array();
             $files[] = $base . DS . 'js' . DS . 'codemirror' . DS . 'parser.js';
             // javascript
             $type = 'javsacript';
             break;
         case 'css':
             $path = $base . DS . 'css' . DS . 'codemirror';
             $files = array($path . DS . 'editor.css', $path . DS . 'theme' . DS . $theme . '.css');
             $type = 'css';
             break;
     }
     $packer = new WFPacker(array('type' => $type));
     // set files
     $packer->setFiles($files);
     // pack!
     $packer->pack(true, $this->getParam('editor.compress_gzip', 0));
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:31,代码来源:source.php

示例2: execute

 /**
  * Execute the theme item
  * @access public
  */
 public function execute()
 {
     WFToken::checkToken() or die('RESTRICTED ACCESS');
     $document = WFDocument::getInstance(array('title' => WFText::_('WF_' . strtoupper($this->get('dialog')) . '_TITLE'), 'version' => $this->getVersion(), 'name' => $this->get('dialog')));
     $this->display();
     // pack assets if required
     $document->pack(true, $this->getParam('editor.compress_gzip', 0));
     // get view
     $view = $this->getView();
     // set body output
     $document->setBody($view->loadTemplate());
     $document->render();
 }
开发者ID:omarmm,项目名称:MangLuoiBDS,代码行数:17,代码来源:theme.php

示例3: __construct

 /**
  * @access	protected
  */
 function __construct()
 {
     if (JRequest::getCmd('action') == 'thumbnail') {
         WFToken::checkToken() or die('RESTRICTED');
         $file = JRequest::getVar('img');
         // check file path
         WFUtility::checkPath($file);
         if ($file && preg_match('/\\.(jpg|jpeg|png|gif|tiff|bmp)$/i', $file)) {
             return $this->createCacheThumb(rawurldecode($file));
         }
     }
     parent::__construct();
     // get browser
     $browser = $this->getBrowser();
     $request = WFRequest::getInstance();
     if ($browser->getFilesystem()->get('local')) {
         $this->set('_edit', 1);
     }
     // Check GD
     if (!function_exists('gd_info')) {
         $this->set('_edit', 0);
     }
     if (JRequest::getCmd('dialog', 'plugin') == 'plugin') {
         // add browser events
         $browser->addEvent('onGetItems', array($this, 'onGetItems'));
         $browser->addEvent('onUpload', array($this, 'onUpload'));
         $browser->addEvent('onFilesDelete', array($this, 'onFilesDelete'));
         // Setup plugin XHR callback functions
         $request->setRequest(array($this, 'getDimensions'));
         $request->setRequest(array($this, 'getThumbnailDimensions'));
         $request->setRequest(array($this, 'getThumbnails'));
         if ($this->getParam('imgmanager_ext.thumbnail_editor', 1)) {
             $request->setRequest(array($this, 'createThumbnail'));
             $request->setRequest(array($this, 'deleteThumbnail'));
         }
     } else {
         $request->setRequest(array($this, 'saveEdit'));
     }
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:42,代码来源:imgmanager.php

示例4: execute

    public function execute() {
        WFToken::checkToken() or die('Access to this resource is restricted');

        // JSON request or upload action
        if ($this->isRequest()) {
            $request = WFRequest::getInstance();
            $request->process();
        } else {
            $wf = WFEditor::getInstance();

            $version = $this->getVersion();
            $name = $this->getName();

            // process javascript languages
            if (JRequest::getWord('task') == 'loadlanguages') {
                wfimport('admin.classes.language');

                $parser = new WFLanguageParser(array(
                            'plugins' => array($name),
                            'sections' => array('dlg', $name . '_dlg', 'colorpicker'),
                            'mode' => 'plugin'
                        ));

                $data = $parser->load();
                $parser->output($data);
            }

            // load core language
            WFLanguage::load('com_jce', JPATH_ADMINISTRATOR);
            // Load Plugin language
            WFLanguage::load('com_jce_' . trim($this->getName()));
            
            // set default plugin version
            $plugin_version = $this->getPluginVersion();

            // add plugin version
            if ($plugin_version && $plugin_version != $version) {
                $version .= '-' . $plugin_version;
            }

            // create the document
            $document = WFDocument::getInstance(array(
                'version'   => $version,
                'title'     => WFText::_('WF_' . strtoupper($this->getName() . '_TITLE')),
                'name'      => $name,
                'language'  => WFLanguage::getTag(),
                'direction' => WFLanguage::getDir(),
                'compress_javascript' => $this->getParam('editor.compress_javascript', 0),
                'compress_css' => $this->getParam('editor.compress_css', 0)
            ));

            // set standalone mode
            $document->set('standalone', JRequest::getInt('standalone', 0));

            // create display
            $this->display();

            // ini language
            $document->addScript(array('index.php?option=com_jce&view=editor&' . $document->getQueryString(array('task' => 'loadlanguages', 'lang' => WFLanguage::getCode()))), 'joomla');

            // pack assets if required
            $document->pack(true, $this->getParam('editor.compress_gzip', 0));

            // get the view
            $view = $this->getView();

            // set body output
            $document->setBody($view->loadTemplate());

            // render document		
            $document->render();
        }
    }
开发者ID:networksoft,项目名称:seekerplus2.com,代码行数:73,代码来源:plugin.php

示例5: saveEdit

 public function saveEdit($file, $name, $options = array(), $quality = 100)
 {
     // Check for request forgeries
     WFToken::checkToken() or die('Access to this resource is restricted');
     // check for image editor access
     if ($this->checkAccess('image_editor', 1) === false) {
         JError::raiseError(403, 'Access to this resource is restricted');
     }
     $browser = $this->getBrowser();
     $filesystem = $browser->getFileSystem();
     // check file
     self::validateImagePath($file);
     // clean temp
     $this->cleanEditorTmp($file, false);
     // check new name
     self::validateImagePath($name);
     $upload = JRequest::getVar('file', '', 'files', 'array');
     // create a filesystem result object
     $result = new WFFileSystemResult();
     if (isset($upload) && isset($upload['tmp_name']) && is_uploaded_file($upload['tmp_name'])) {
         $tmp = $upload['tmp_name'];
         self::validateImageFile($tmp);
         $exif = null;
         // get exif data from orignal file
         if (preg_match('#\\.jp(eg|g)$#i', basename($file)) && basename($file) == basename($name)) {
             // load exif classes
             require_once dirname(__FILE__) . '/pel/PelJpeg.php';
             $src = WFUtility::makePath($filesystem->getBaseDir(), $file);
             $jpeg = new PelJpeg($src);
             $exif = $jpeg->getExif();
         }
         $result = $filesystem->upload('multipart', trim($tmp), dirname($file), basename($name));
         if ($result->state === true && $exif) {
             $pel = new PelDataWindow($result->path);
             if (PelJpeg::isValid($pel)) {
                 $jpeg = new PelJpeg();
                 $jpeg->load($pel);
                 $jpeg->setExif($exif);
                 //$jpeg->saveFile($result->path);
                 // write to file
                 JFile::write($result->path, $jpeg->getBytes());
             }
         }
         @unlink($tmp);
     } else {
         // set upload as false - JSON request
         $upload = false;
         $file = WFUtility::makePath($filesystem->getBaseDir(), $file);
         $dest = dirname($file) . '/' . basename($name);
         // get extension
         $ext = WFUtility::getExtension($dest);
         // load image class
         require_once dirname(__FILE__) . '/image/image.php';
         // create image
         $image = new WFImage($file, $this->getParam('prefer_imagick', true));
         foreach ($options as $filter) {
             if (isset($filter->task)) {
                 $args = isset($filter->args) ? (array) $filter->args : array();
                 switch ($filter->task) {
                     case 'resize':
                         $w = $args[0];
                         $h = $args[1];
                         $image->resize($w, $h);
                         break;
                     case 'crop':
                         $w = $args[0];
                         $h = $args[1];
                         $x = $args[2];
                         $y = $args[3];
                         $image->crop($w, $h, $x, $y);
                         break;
                     case 'rotate':
                         $image->rotate(array_shift($args));
                         break;
                     case 'flip':
                         $image->flip(array_shift($args));
                         break;
                     default:
                         $image->filter($filter->task, $args);
                         break;
                 }
             }
         }
         // get image data
         $data = $image->toString($ext);
         // write to file
         if ($data) {
             $result->state = (bool) @JFile::write($dest, $data);
         }
         // set path
         $result->path = $dest;
     }
     if ($result->state === true) {
         // check if its a valid image
         if (@getimagesize($result->path) === false) {
             JFile::delete($result->path);
             throw new InvalidArgumentException('Invalid image file');
         } else {
             $result->path = str_replace(WFUtility::cleanPath(JPATH_SITE), '', $result->path);
             $browser->setResult(WFUtility::cleanPath($result->path, '/'), 'files');
//.........这里部分代码省略.........
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:imgmanager.php

示例6: upload

 /**
  * Upload a file.
  * @return array $error on failure or uploaded file name on success
  */
 public function upload()
 {
     // Check for request forgeries
     WFToken::checkToken() or die;
     // check for feature access
     if (!$this->checkFeature('upload')) {
         JError::raiseError(403, 'Access to this resource is restricted');
     }
     $filesystem = $this->getFileSystem();
     jimport('joomla.filesystem.file');
     header('Content-Type: text/json;charset=UTF-8');
     header("Expires: Wed, 4 Apr 1984 13:00:00 GMT");
     header("Last-Modified: " . gmdate("D, d M_Y H:i:s") . " GMT");
     header("Cache-Control: no-store, no-cache, must-revalidate");
     header("Cache-Control: post-check=0, pre-check=0", false);
     header("Pragma: no-cache");
     // get uploaded file
     $file = JRequest::getVar('file', '', 'files', 'array');
     // validate file data
     $this->validateUploadedFile($file);
     // get file name
     $name = JRequest::getVar('name', $file['name']);
     // decode name
     $name = rawurldecode($name);
     // check name
     if (WFUtility::validateFileName($name) === false) {
         throw new InvalidArgumentException('Upload Failed: The file name contains an invalid extension.');
     }
     // check file name
     WFUtility::checkPath($name);
     // get extension from file name
     $ext = WFUtility::getExtension($file['name']);
     // trim extension
     $ext = trim($ext);
     // check extension exists
     if (empty($ext) || $ext === $file['name']) {
         throw new InvalidArgumentException('Upload Failed: The file name does not contain a valid extension.');
     }
     // strip extension
     $name = WFUtility::stripExtension($name);
     // make file name 'web safe'
     $name = WFUtility::makeSafe($name, $this->get('websafe_mode', 'utf-8'), $this->get('websafe_spaces'), $this->get('websafe_textcase'));
     // check name
     if (WFUtility::validateFileName($name) === false) {
         throw new InvalidArgumentException('Upload Failed: The file name contains an invalid extension.');
     }
     // target directory
     $dir = JRequest::getVar('upload-dir');
     // deocode directory
     $dir = rawurldecode($dir);
     // check destination path
     WFUtility::checkPath($dir);
     $upload = $this->get('upload');
     // Check file number limits
     if (!empty($upload['total_files'])) {
         if ($filesystem->countFiles($dir, true) > $upload['total_files']) {
             throw new InvalidArgumentException(WFText::_('WF_MANAGER_FILE_LIMIT_ERROR'));
         }
     }
     // Check total file size limit
     if (!empty($upload['total_size'])) {
         $size = $filesystem->getTotalSize($dir);
         if ($size / 1024 / 1024 > $upload['total_size']) {
             throw new InvalidArgumentException(WFText::_('WF_MANAGER_FILE_SIZE_LIMIT_ERROR'));
         }
     }
     // add random string
     if ($upload['add_random']) {
         $name = $name . '_' . substr(md5(uniqid(rand(), 1)), 0, 5);
     }
     // rebuild file name - name + extension
     $name = $name . '.' . $ext;
     // create a filesystem result object
     $result = new WFFileSystemResult();
     $complete = false;
     $contentType = JRequest::getVar('CONTENT_TYPE', '', 'SERVER');
     // relative path
     $relative = WFUtility::makePath($dir, $name);
     // Only multipart uploading is supported for now
     if ($contentType && strpos($contentType, "multipart") !== false) {
         $result = $filesystem->upload('multipart', trim($file['tmp_name']), $dir, $name);
         if (!$result->state) {
             if (empty($result->message)) {
                 $result->message = WFText::_('WF_MANAGER_UPLOAD_ERROR');
             }
             $result->code = 103;
         }
         @unlink($file['tmp_name']);
         $complete = true;
     } else {
         $result->state = false;
         $result->code = 103;
         $result->message = WFText::_('WF_MANAGER_UPLOAD_ERROR');
         $complete = true;
     }
     // upload finished
//.........这里部分代码省略.........
开发者ID:grlf,项目名称:eyedock,代码行数:101,代码来源:browser.php

示例7: compileLess

 public function compileLess()
 {
     // check token
     WFToken::checkToken('GET') or die('RESTRICTED');
     wfimport('admin.classes.packer');
     $wf = WFEditor::getInstance();
     $files = self::getStyleSheetsList(true);
     if (!empty($files)) {
         $packer = new WFPacker(array('files' => $files, 'type' => 'css'));
         $packer->pack(false);
     }
 }
开发者ID:iFactoryDigital,项目名称:gympieradiology,代码行数:12,代码来源:editor.php

示例8: upload

 /**
  * Upload a file.
  * @return array $error on failure or uploaded file name on success
  */
 public function upload()
 {
     // Check for request forgeries
     WFToken::checkToken() or die;
     //JError::setErrorHandling(E_ALL, 'callback', array('WFError', 'raiseError'));
     // check for feature access
     if (!$this->checkFeature('upload')) {
         JError::raiseError(403, 'RESTRICTED ACCESS');
     }
     $wf = WFEditor::getInstance();
     jimport('joomla.filesystem.file');
     // HTTP headers for no cache etc
     //header('Content-type: text/plain; charset=UTF-8');
     header("Expires: Wed, 4 Apr 1984 13:00:00 GMT");
     header("Last-Modified: " . gmdate("D, d M_Y H:i:s") . " GMT");
     header("Cache-Control: no-store, no-cache, must-revalidate");
     header("Cache-Control: post-check=0, pre-check=0", false);
     header("Pragma: no-cache");
     // get uploaded file
     $file = JRequest::getVar('file', '', 'files', 'array');
     // get file name
     $name = JRequest::getVar('name', $file['name']);
     // target directory
     $dir = JRequest::getVar('upload-dir');
     // deocode directory
     $dir = rawurldecode($dir);
     // check destination path
     WFUtility::checkPath($dir);
     // decode name
     $name = rawurldecode($name);
     // get extension
     $ext = WFUtility::getExtension($name);
     // strip extension
     $name = WFUtility::stripExtension($name);
     // make file name 'web safe'
     $name = WFUtility::makeSafe($name, $this->get('websafe_mode', 'utf-8'));
     // empty name
     if ($name == '') {
         JError::raiseError(403, 'INVALID FILE NAME');
     }
     // check for extension in file name or blank file name
     if (preg_match('#\\.(php|php(3|4|5)|phtml|pl|py|jsp|asp|htm|shtml|sh|cgi)#i', $name)) {
         JError::raiseError(403, 'INVALID FILE NAME');
     }
     // create a filesystem result object
     $result = new WFFileSystemResult();
     $filesystem = $this->getFileSystem();
     $complete = false;
     $contentType = JRequest::getVar('CONTENT_TYPE', '', 'SERVER');
     // rebuild file name - name + extension
     $name = $name . '.' . $ext;
     // Only multipart uploading is supported for now
     if ($contentType && strpos($contentType, "multipart") !== false) {
         if (isset($file['tmp_name']) && is_uploaded_file($file['tmp_name'])) {
             // check for valid extension
             if (in_array(strtolower($ext), $this->getFileTypes('array')) === false) {
                 $result->state = false;
                 $result->message = WFText::_('WF_MANAGER_UPLOAD_INVALID_EXT_ERROR');
                 $complete = true;
                 @unlink($file['tmp_name']);
             } else {
                 if ($this->validateUploadedFile($file, $result) === false) {
                     $complete = true;
                     @unlink($file['tmp_name']);
                 } else {
                     $result = $filesystem->upload('multipart', trim($file['tmp_name']), $dir, $name);
                     if (!$result->state) {
                         $result->message = WFText::_('WF_MANAGER_UPLOAD_ERROR');
                         $result->code = 103;
                     }
                     @unlink($file['tmp_name']);
                     $complete = true;
                 }
             }
         }
     } else {
         $result->state = false;
         $result->code = 103;
         $result->message = WFText::_('WF_MANAGER_UPLOAD_ERROR');
         $complete = true;
     }
     // upload finished
     if ($complete) {
         if ($result instanceof WFFileSystemResult) {
             if ($result->state === true) {
                 $path = $result->path;
                 $this->setResult($this->fireEvent('onUpload', array($result->path)));
                 $this->setResult(basename($result->path), 'files');
             } else {
                 $this->setResult($result->message, 'error');
             }
         }
         die(json_encode($this->getResult()));
     }
 }
开发者ID:omarmm,项目名称:MangLuoiBDS,代码行数:99,代码来源:file.php

示例9: loadLanguages

 public function loadLanguages()
 {
     // check token
     WFToken::checkToken('GET') or die('RESTRICTED');
     wfimport('admin.classes.language');
     $parser = new WFLanguageParser(array('plugins' => $this->getPlugins()));
     $data = $parser->load();
     $parser->output($data);
 }
开发者ID:acculitx,项目名称:fleetmatrixsite,代码行数:9,代码来源:editor.php

示例10: pack

 /**
  * pack function for plugins
  */
 public function pack($minify = true, $gzip = false)
 {
     if (JRequest::getCmd('task') == 'pack') {
         // check token
         WFToken::checkToken('GET') or die('RESTRICTED');
         wfimport('admin.classes.packer');
         $component = WFExtensionHelper::getComponent();
         $params = new WFParameter($component->params);
         $type = JRequest::getWord('type', 'javascript');
         // javascript
         $packer = new WFPacker(array('type' => $type));
         $files = array();
         switch ($type) {
             case 'javascript':
                 foreach ($this->getScripts() as $script => $type) {
                     $script .= preg_match('/\\.js$/', $script) ? '' : '.js';
                     $files[] = $this->urlToPath($script);
                 }
                 break;
             case 'css':
                 foreach ($this->getStyleSheets() as $style => $type) {
                     $style .= preg_match('/\\.css$/', $style) ? '' : '.css';
                     $files[] = $this->urlToPath($style);
                 }
                 break;
         }
         $packer->setFiles($files);
         $packer->pack($minify, $gzip);
     }
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:33,代码来源:document.php

示例11: upload

 /**
  * Upload a file.
  * @return array $error on failure or uploaded file name on success
  */
 function upload()
 {
     // Check for request forgeries
     WFToken::checkToken() or die;
     // check for feature access
     if (!$this->checkFeature('upload')) {
         JError::raiseError(403, 'RESTRICTED ACCESS');
     }
     $wf = WFEditor::getInstance();
     jimport('joomla.filesystem.file');
     // HTTP headers for no cache etc
     //header('Content-type: text/plain; charset=UTF-8');
     header("Expires: Wed, 4 Apr 1984 13:00:00 GMT");
     header("Last-Modified: " . gmdate("D, d M_Y H:i:s") . " GMT");
     header("Cache-Control: no-store, no-cache, must-revalidate");
     header("Cache-Control: post-check=0, pre-check=0", false);
     header("Pragma: no-cache");
     // get uploaded file
     $file = JRequest::getVar('file', '', 'files', 'array');
     // get file name
     $name = JRequest::getVar('name', $file['name']);
     $ext = WFUtility::getExtension($name);
     // check for extension in file name
     if (preg_match('#\\.(php|php(3|4|5)|phtml|pl|py|jsp|asp|htm|shtml|sh|cgi)#i', basename($name, '.' . $ext))) {
         JError::raiseError(403, 'INVALID FILE NAME');
     }
     // get chunks
     $chunk = JRequest::getInt('chunk', 0);
     $chunks = JRequest::getInt('chunks', 1);
     // create a filesystem result object
     $result = new WFFileSystemResult();
     $filesystem = $this->getFileSystem();
     $complete = false;
     $contentType = JRequest::getVar('CONTENT_TYPE', '', 'SERVER');
     // Only multipart uploading is supported for now
     if ($contentType && strpos($contentType, "multipart") !== false) {
         if (isset($file['tmp_name']) && is_uploaded_file($file['tmp_name'])) {
             // validate file before continuing (first chunk only)
             if ($chunk == 0 && $wf->getParam('validate_mimetype', 0) && !preg_match('#(htm|html|txt)#', $ext)) {
                 $this->validateUploadedFile($file);
             }
             // make file name 'web safe'
             $name = WFUtility::makeSafe($name);
             // get current dir
             $dir = JRequest::getVar('upload-dir', '');
             // check destination path
             WFUtility::checkPath($dir);
             // Normal upload
             if ($chunks == 1) {
                 $result = $filesystem->upload('multipart', trim($file['tmp_name']), $dir, $name);
                 if (!$result->state) {
                     $result->message = WFText::_('WF_MANAGER_UPLOAD_ERROR');
                     $result->code = 103;
                 }
                 $complete = true;
                 // Chunk uploading
             } else {
                 $result = $filesystem->upload('multipart-chunking', trim($file['tmp_name']), $dir, $name, $chunks, $chunk);
                 if (!$result->state) {
                     $result->message = WFText::_('WF_MANAGER_UPLOAD_ERROR');
                     $result->code = 103;
                 }
                 $complete = $chunk == $chunks - 1;
             }
         }
     } else {
         $result->state = false;
         $result->code = 103;
         $result->message = WFText::_('WF_MANAGER_UPLOAD_ERROR');
         $complete = true;
     }
     // upload finished
     if ($complete) {
         if (is_a($result, 'WFFileSystemResult')) {
             if ($result->state === true) {
                 $this->setResult($this->fireEvent('onUpload', array($result->path)));
                 $this->setResult(basename($result->path), 'files');
             }
         }
         die(json_encode($this->getResult()));
     }
 }
开发者ID:andreassetiawanhartanto,项目名称:PDKKI,代码行数:86,代码来源:file.php

示例12: execute

 public function execute()
 {
     WFToken::checkToken() or die('RESTRICTED ACCESS');
     // JSON request or upload action
     if ($this->isRequest()) {
         $request = WFRequest::getInstance();
         $request->process();
     } else {
         $this->loadLanguage('com_jce', JPATH_ADMINISTRATOR);
         // Load Plugin language
         $this->loadPluginLanguage();
         $version = $this->getVersion();
         $name = $this->getName();
         $xml = JApplicationHelper::parseXMLInstallFile(WF_EDITOR_PLUGINS . DS . $name . DS . $name . '.xml');
         if (isset($xml['version'])) {
             $version = $xml['version'];
         }
         // create the document
         $document = WFDocument::getInstance(array('version' => $version, 'title' => WFText::_('WF_' . strtoupper($this->getName() . '_TITLE')), 'name' => $name, 'language' => $this->getLanguageTag(), 'direction' => $this->getLanguageDir(), 'compress_javascript' => $this->getParam('editor.compress_javascript', 0), 'compress_css' => $this->getParam('editor.compress_css', 0)));
         // set standalone mode
         $document->set('standalone', JRequest::getInt('standalone', 0));
         // create display
         $this->display();
         $document = WFDocument::getInstance();
         // set standalone mode (for File Browser etc)
         if ($document->get('standalone') == 1) {
             // remove some scripts
             $document->removeScript('tiny_mce_popup', 'tiny_mce');
             $document->removeScript('tiny_mce_utils', 'libraries');
         }
         // pack assets if required
         $document->pack(true, $this->getParam('editor.compress_gzip', 0));
         // get the view
         $view = $this->getView();
         // set body output
         $document->setBody($view->loadTemplate());
         // render document
         $document->render();
     }
 }
开发者ID:optimosolution,项目名称:marhk,代码行数:40,代码来源:plugin.php

示例13: pack

 /**
  * Pack / compress editor files
  */
 public function pack()
 {
     // check token
     WFToken::checkToken('GET') or die('RESTRICTED');
     $wf = WFEditor::getInstance();
     require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'classes' . DS . 'packer.php';
     $type = JRequest::getWord('type', 'javascript');
     // javascript
     $packer = new WFPacker(array('type' => $type));
     $themes = 'none';
     $plugins = array();
     $languages = $wf->getLanguage();
     $suffix = JRequest::getWord('suffix', '');
     $component_id = JRequest::getInt('component_id', 0);
     if ($wf->checkUser()) {
         $themes = 'advanced';
         $plugins = $this->getPlugins();
     }
     $languages = explode(',', $languages);
     $themes = explode(',', $themes);
     // toolbar theme
     $toolbar = explode('.', $wf->getParam('editor.toolbar_theme', 'default'));
     switch ($type) {
         case 'language':
             $files = array();
             // Add core languages
             foreach ($languages as $language) {
                 $file = WF_EDITOR . DS . "tiny_mce/langs/" . $language . ".js";
                 if (!JFile::exists($file)) {
                     $file = WF_EDITOR . DS . "tiny_mce/langs/en.js";
                 }
                 $files[] = $file;
             }
             // Add themes
             foreach ($themes as $theme) {
                 foreach ($languages as $language) {
                     $file = WF_EDITOR . DS . "tiny_mce/themes/" . $theme . "/langs/" . $language . ".js";
                     if (!JFile::exists($file)) {
                         $file = WF_EDITOR . DS . "tiny_mce/themes/" . $theme . "/langs/en.js";
                     }
                     $files[] = $file;
                 }
             }
             // Add plugins
             foreach ($plugins as $plugin) {
                 foreach ($languages as $language) {
                     $file = WF_EDITOR . DS . "tiny_mce/plugins/" . $plugin . "/langs/" . $language . ".js";
                     if (!JFile::exists($file)) {
                         $file = WF_EDITOR . DS . "tiny_mce/plugins/" . $plugin . "/langs/en.js";
                     }
                     if (JFile::exists($file)) {
                         $files[] = $file;
                     }
                 }
             }
             // reset type
             $type = 'javascript';
             break;
         case 'javascript':
             $files = array();
             // add core file
             $files[] = WF_EDITOR . DS . "tiny_mce/tiny_mce" . $suffix . ".js";
             // Add core languages
             foreach ($languages as $language) {
                 $file = WF_EDITOR . DS . "tiny_mce/langs/" . $language . ".js";
                 if (!JFile::exists($file)) {
                     $file = WF_EDITOR . DS . "tiny_mce/langs/en.js";
                 }
                 $files[] = $file;
             }
             // Add themes
             foreach ($themes as $theme) {
                 $files[] = WF_EDITOR . DS . "tiny_mce/themes/" . $theme . "/editor_template" . $suffix . ".js";
                 foreach ($languages as $language) {
                     $file = WF_EDITOR . DS . "tiny_mce/themes/" . $theme . "/langs/" . $language . ".js";
                     if (!JFile::exists($file)) {
                         $file = WF_EDITOR . DS . "tiny_mce/themes/" . $theme . "/langs/en.js";
                     }
                     $files[] = $file;
                 }
             }
             // Add plugins
             foreach ($plugins as $plugin) {
                 $files[] = WF_EDITOR . DS . "tiny_mce/plugins/" . $plugin . "/editor_plugin" . $suffix . ".js";
                 foreach ($languages as $language) {
                     $file = WF_EDITOR . DS . "tiny_mce/plugins/" . $plugin . "/langs/" . $language . ".js";
                     if (!JFile::exists($file)) {
                         $file = WF_EDITOR . DS . "tiny_mce/plugins/" . $plugin . "/langs/en.js";
                     }
                     if (JFile::exists($file)) {
                         $files[] = $file;
                     }
                 }
             }
             // add Editor file
             $files[] = WF_EDITOR . DS . 'libraries' . DS . 'js' . DS . 'editor.js';
             break;
//.........这里部分代码省略.........
开发者ID:omarmm,项目名称:MangLuoiBDS,代码行数:101,代码来源:editor.php

示例14: process

 /**
  * Process an ajax call and return result
  *
  * @access public
  * @return string
  */
 public function process($array = false)
 {
     // Check for request forgeries
     WFToken::checkToken() or die('RESTRICTED ACCESS');
     $json = JRequest::getVar('json', '', 'POST', 'STRING', 2);
     $action = JRequest::getWord('action');
     // set error handling for requests
     JError::setErrorHandling(E_ALL, 'callback', array('WFRequest', 'raiseError'));
     if ($action || $json) {
         // set request flag
         define('JCE_REQUEST', 1);
         $output = array("result" => null, "text" => null, "error" => null);
         if ($json) {
             $json = json_decode($json);
             $fn = isset($json->fn) ? $json->fn : JError::raiseError(500, 'Invalid Function Call');
             $args = isset($json->args) ? $json->args : array();
         } else {
             $fn = $action;
             $args = array();
         }
         // check query
         $this->checkQuery($args);
         // call function
         if (array_key_exists($fn, $this->request)) {
             $method = $this->request[$fn];
             // set default function call
             $call = null;
             if (!isset($method->ref)) {
                 $call = $method->fn;
                 if (!function_exists($call)) {
                     JError::raiseError(500, 'Invalid Function -  "' . $call . '"');
                 }
             } else {
                 if (!method_exists($method->ref, $method->fn)) {
                     JError::raiseError(500, 'Invalid Method "' . $method->ref . '::' . $method->fn . '"');
                 }
                 $call = array($method->ref, $method->fn);
             }
             if (!$call) {
                 JError::raiseError(500, 'Invalid Function Call');
             }
             if (!is_array($args)) {
                 $result = call_user_func($call, $args);
             } else {
                 $result = call_user_func_array($call, $args);
             }
         } else {
             if ($fn) {
                 JError::raiseError(500, 'Unregistered Function - "' . addslashes($fn) . '"');
             } else {
                 JError::raiseError(500, 'Invalid Function Call');
             }
         }
         $output = array("result" => $result);
         // set output headers
         header('Content-Type: text/json;charset=UTF-8');
         header('Content-Encoding: UTF-8');
         header("Expires: Mon, 4 April 1984 05:00:00 GMT");
         header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
         header("Cache-Control: no-store, no-cache, must-revalidate");
         header("Cache-Control: post-check=0, pre-check=0", false);
         header("Pragma: no-cache");
         exit(json_encode($output));
     }
 }
开发者ID:omarmm,项目名称:MangLuoiBDS,代码行数:71,代码来源:request.php

示例15: process

 /**
  * Process an ajax call and return result
  *
  * @access public
  * @return string
  */
 public function process($array = false)
 {
     // Check for request forgeries
     WFToken::checkToken() or die('Access to this resource is restricted');
     $filter = JFilterInput::getInstance();
     $json = JRequest::getVar('json', '', 'POST', 'STRING', 2);
     $action = JRequest::getWord('action');
     // set error handling for requests
     JError::setErrorHandling(E_ALL, 'callback', array('WFRequest', 'raiseError'));
     if ($action || $json) {
         // set request flag
         define('JCE_REQUEST', 1);
         $output = array("result" => null, "text" => null, "error" => null);
         if ($json) {
             // remove slashes
             $json = stripslashes($json);
             // convert to JSON object
             $json = json_decode($json);
             // invalid JSON
             if (is_null($json)) {
                 throw new InvalidArgumentException('Invalid JSON');
             }
             // no function call
             if (isset($json->fn) === false) {
                 throw new InvalidArgumentException('Invalid Function Call');
             }
             // get function call
             $fn = $json->fn;
             // get arguments
             $args = isset($json->args) ? $json->args : array();
         } else {
             $fn = $action;
             $args = array();
         }
         // clean function
         $fn = $filter->clean($fn, 'cmd');
         // check query
         $this->checkQuery($args);
         // call function
         if (array_key_exists($fn, $this->request)) {
             $method = $this->request[$fn];
             // set default function call
             $call = null;
             if (!isset($method->ref)) {
                 $call = $method->fn;
                 if (!function_exists($call)) {
                     throw new InvalidArgumentException('Invalid Function -  "' . $call . '"');
                 }
             } else {
                 if (!method_exists($method->ref, $method->fn)) {
                     throw new InvalidArgumentException('Invalid Method "' . $method->ref . '::' . $method->fn . '"');
                 }
                 $call = array($method->ref, $method->fn);
             }
             if (!$call) {
                 throw new InvalidArgumentException('Invalid Function Call');
             }
             if (!is_array($args)) {
                 $result = call_user_func($call, $args);
             } else {
                 $result = call_user_func_array($call, $args);
             }
         } else {
             if ($fn) {
                 throw new InvalidArgumentException('Unregistered Function - "' . addslashes($fn) . '"');
             } else {
                 throw new InvalidArgumentException('Invalid Function Call');
             }
         }
         $output = array("result" => $result);
         ob_start();
         // set output headers
         header('Content-Type: text/json;charset=UTF-8');
         header('Content-Encoding: UTF-8');
         header("Expires: Mon, 4 April 1984 05:00:00 GMT");
         header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
         header("Cache-Control: no-store, no-cache, must-revalidate");
         header("Cache-Control: post-check=0, pre-check=0", false);
         header("Pragma: no-cache");
         echo json_encode($output);
         exit(ob_get_clean());
     }
 }
开发者ID:grlf,项目名称:eyedock,代码行数:89,代码来源:request.php


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