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


PHP N2Filesystem::toLinux方法代码示例

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


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

示例1: render

 public function render($xmlpath, $data)
 {
     N2Loader::import('libraries.form.form');
     $form = new N2Form(N2Base::getApplication('smartslider')->getApplicationType('backend'));
     $form->loadArray($data);
     $form->loadXMLFile($xmlpath);
     echo $form->render('settings');
     N2JS::addFirstCode('
         new NextendForm("smartslider-form", ' . json_encode($form->_data) . ', null, "' . N2Filesystem::toLinux(N2Filesystem::pathToRelativePath($xmlpath)) . '", "settings", "' . N2Uri::ajaxUri('nextend', 'smartslider') . '");
     ');
 }
开发者ID:RenatoToasa,项目名称:Pagina-Web,代码行数:11,代码来源:Settings.php

示例2: fetchElement

 function fetchElement()
 {
     $this->setfolder();
     $files = N2Filesystem::files($this->_folder);
     if (N2XmlHelper::getAttribute($this->_xml, 'required') == '') {
         $this->_xml->addChild('option', n2_('No image'))->addAttribute('value', -1);
     }
     for ($i = 0; $i < count($files); $i++) {
         $ext = pathinfo($files[$i], PATHINFO_EXTENSION);
         if ($ext == 'jpg' || $ext == 'jpeg' || $ext == 'png' || $ext == 'svg' || $ext == 'gif') {
             $this->_xml->addChild('option', htmlspecialchars(ucfirst($files[$i])))->addAttribute('value', N2Filesystem::toLinux(N2Filesystem::pathToRelativePath($this->_folder . $files[$i])));
         }
     }
     $html = N2Html::openTag("div", array('class' => 'n2-imagelist', 'style' => N2XmlHelper::getAttribute($this->_xml, 'style')));
     $html .= parent::fetchElement();
     $html .= N2Html::closeTag('div');
     return $html;
 }
开发者ID:MBerguer,项目名称:wp-demo,代码行数:18,代码来源:imagelist.php

示例3: 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 = N2Filesystem::toLinux($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:MBerguer,项目名称:wp-demo,代码行数:43,代码来源:Browse.php

示例4: makeUrl

 private function makeUrl($matches)
 {
     if (substr($matches[1], 0, 5) == 'data:') {
         return $matches[0];
     }
     if (substr($matches[1], 0, 4) == 'http') {
         return $matches[0];
     }
     if (substr($matches[1], 0, 2) == '//') {
         return $matches[0];
     }
     $exploded = explode('?', $matches[1]);
     $realPath = realpath($this->basePath . '/' . $exploded[0]);
     if ($realPath === false) {
         return 'url(' . str_replace(array('http://', 'https://'), '//', $this->baseUrl) . '/' . $matches[1] . ')';
     }
     $realPath = N2Filesystem::fixPathSeparator($realPath);
     $assetPath = N2Filesystem::fixPathSeparator($this->getAssetFileFolder());
     return 'url(' . N2Filesystem::toLinux($this->find_relative_path($assetPath, $realPath)) . (isset($exploded[1]) ? '?' . $exploded[1] : '') . ')';
 }
开发者ID:MBerguer,项目名称:wp-demo,代码行数:20,代码来源:cache.php


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