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


PHP JFolder::makeSafe方法代码示例

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


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

示例1: setGalleryPath

 private function setGalleryPath($galleryPath)
 {
     // TODO handle if absolute path is used as input
     $this->relativeGalleryPath = JFolder::makeSafe($galleryPath);
     // TODO safe enough?
     $this->galleryPath = JPATH_BASE . DS . $this->relativeGalleryPath;
 }
开发者ID:beingsane,项目名称:joomla-gallery,代码行数:7,代码来源:gallery.php

示例2: get

 public function get()
 {
     $app = JFactory::getApplication();
     jimport('joomla.filesystem.folder');
     JPluginHelper::importPlugin('api');
     $result = $app->triggerEvent('register_api_plugin');
     $plugins = array();
     foreach ($result as $plugin) {
         if (!isset($plugin->title) || !isset($plugin->plugin)) {
             continue;
         }
         $path = JFolder::makeSafe(JPATH_ROOT . "/plugins/api/{$plugin->plugin}/html");
         if (!JFolder::exists($path)) {
             continue;
         }
         $files = JFolder::files($path, '.', true, true);
         // Remove absolute path
         foreach ($files as &$file) {
             $file = str_replace(JPATH_ROOT . '/', '', $file);
         }
         $plugins[$plugin->plugin] = array('title' => $plugin->title, 'type' => $plugin->plugin, 'version' => $plugin->version, 'files' => $files);
     }
     ksort($plugins);
     $this->plugin->setResponse($plugins);
 }
开发者ID:rcorral,项目名称:com_jm-plugins,代码行数:25,代码来源:extensions.php

示例3: save

 function save($data)
 {
     $row =& JTable::getInstance('categories', 'Table');
     $id = $data['id'];
     if (!$row->bind($data)) {
         JError::raiseError(500, $row->getError());
         return false;
     }
     if (!$row->check()) {
         JError::raiseError(500, $row->getError());
     }
     if (!$row->store()) {
         JError::raiseError(500, $row->getError());
         return false;
     }
     if (!$id) {
         $row->load($row->{$id});
         jimport('joomla.filesystem.file');
         $baseFolder = JPATH_SITE . DS . 'codefile';
         $baseFolder = JFolder::makeSafe($path);
         if (!JFolder::exists($baseFolder)) {
             JFolder::create($baseFolder);
             echo "<br>" . $baseFolder;
         }
         $codeFolder = JPATH_SITE . DS . 'codefile' . DS . 'category_' . $row->id;
         echo "<br>" . $codeFolder;
         JFolder::create($codeFolder);
     } else {
         echo "The old row" . $id;
     }
     return true;
 }
开发者ID:hrishikesh-kumar,项目名称:NBSNIP,代码行数:32,代码来源:categories.php

示例4: __construct

 function __construct($name, $type)
 {
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $this->_name = JFolder::makeSafe($name);
     $this->_type = JFolder::makeSafe($type);
     $model =& JModel::getInstance('Configuration', 'JDefenderModel');
     $this->_params = new JParameter($model->getIni());
     $this->_rules =& JD_Rule_Manager::getRules($name);
 }
开发者ID:alphashuro,项目名称:audeprac,代码行数:10,代码来源:jd_validator.php

示例5: splitPath

 public static function splitPath($path, $makeRelative = true)
 {
     if ($makeRelative) {
         $path = GalleryHelper::makeRelative($path);
     }
     $parts = explode('/', $path);
     $object = new ArrayObject();
     $object->filename = JFile::makeSafe(array_pop($parts));
     // last element is filename
     $object->folderPath = JFolder::makeSafe(implode(DS, $parts));
     // use rest as path
     return $object;
 }
开发者ID:beingsane,项目名称:joomla-gallery,代码行数:13,代码来源:helper.php

示例6: loadHandlers

 /**
  * Load the handlers :)
  * @static
  * @return void
  */
 function loadHandlers($type)
 {
     static $loaded = array();
     if (!empty($loaded[$type])) {
         return;
     }
     $type = JFolder::makeSafe($type);
     $basePath = JPATH_COMPONENT_ADMINISTRATOR . DS . 'lib' . DS . 'handlers' . DS . $type;
     $files = JFolder::files($basePath, 'jd_.+handler\\.php', false, false);
     foreach ($files as $file) {
         $path = $basePath . DS . $file;
         if (JFile::exists($path)) {
             require_once $path;
         }
     }
     $loaded[$type] = true;
 }
开发者ID:alphashuro,项目名称:audeprac,代码行数:22,代码来源:jd_handler.php

示例7: display

 function display($tpl = null)
 {
     // params
     $params = JFactory::getApplication()->getParams();
     $galleryPath = $params->get('gallery_path');
     // TODO not safe
     // validate
     $folderPath = JFolder::makeSafe(JRequest::getString('path'));
     $filename = JFile::makeSafe(JRequest::getString('filename'));
     // ---
     $folder = new Folder($galleryPath, $folderPath);
     $photo = new Photo($folder, $filename);
     // add css
     $document =& JFactory::getDocument();
     $document->addStyleSheet('media/com_gallery/css/gallery.style.css');
     // assign Variables
     $this->assignRef('photo', $photo);
     parent::display($tpl);
 }
开发者ID:beingsane,项目名称:joomla-gallery,代码行数:19,代码来源:view.html.php

示例8: getFiles

 public function getFiles($fullPath, $path)
 {
     $path = JFolder::makeSafe($path);
     $data = array();
     $extensions = $this->_config->get('file_types');
     if (!$extensions) {
         $extensions = 'jpeg,gif,png,jpg';
     }
     $arrayExtension = explode(',', $extensions);
     $results = JFolder::files($fullPath, '.', false, false);
     foreach ($results as $result) {
         //get file's extension
         $extension = JFile::getExt($result);
         if (in_array($extension, $arrayExtension) && JFile::exists($fullPath . '/' . $result)) {
             array_push($data, array('filename' => basename($result), 'type' => 'file', 'url' => preg_replace('!/+!', '/', JSNES_IMAGES_URL . $path . '/' . basename($result))));
         }
     }
     return $data;
 }
开发者ID:densem-2013,项目名称:exikom,代码行数:19,代码来源:selectimages.php

示例9: array

 /**
  * @static
  * @param unknown_type $type
  * @return JD_Action instance :0
  */
 function &getInstance($type = null)
 {
     static $instances = array();
     if (empty($type)) {
         return $instances;
     }
     $type = JFolder::makeSafe($type);
     if (empty($instances[$type])) {
         JD_Action::_loadActions();
         $className = 'JD_' . $type . '_Action';
         if (class_exists($className)) {
             $instances[$type] = new $className();
         } else {
             JError::raiseWarning(0, JText::_('Cannot instanciate action class') . ': ' . 'jd_' . $type . '_action');
             return null;
         }
     }
     return $instances[$type];
 }
开发者ID:alphashuro,项目名称:audeprac,代码行数:24,代码来源:jd_action.php

示例10: execute

 public function execute()
 {
     $this->out('Hello. What do you want to build today:' . "\n" . '1 - Component; 2 - Plugin; 3 - Module');
     $choice = $this->in();
     switch ($choice) {
         case 1:
         case 2:
             $this->out('Sorry but we can offer you only Modules :)');
             break;
         case 3:
         default:
             $this->type = 'module';
     }
     $this->out('Please enter an extension name in lower case e.g. "testmodule"');
     $extName = JFolder::makeSafe($this->in());
     $this->out('Do you want to install the extension on completion?');
     $this->out("1 - Yes\n2 - No\n");
     $install = $this->in();
     $extInstall = $install == 1 ? true : false;
     $manifestPath = 'scaffold/module/';
     $this->builder = new JBuilder($extName, 'module', $extInstall);
     $this->builder->build();
 }
开发者ID:beingsane,项目名称:cli-builder,代码行数:23,代码来源:service.php

示例11: saveDocumentVersions

 public function saveDocumentVersions($dataInput, $table, $fieldsData, $isNew, $newMainCatId, $tableBeforeSave = null)
 {
     $versions = $dataInput['versions'];
     $docId = $table->id;
     $app = JFactory::getApplication();
     $params = JUDownloadHelper::getParams($newMainCatId);
     $db = JFactory::getDbo();
     $file_directory = JPATH_ROOT . "/" . JUDownloadFrontHelper::getDirectory("file_directory", "media/com_judownload/files/");
     $file_directory_tmp = $file_directory . "tmp/";
     if (!is_writable($file_directory_tmp)) {
         $file_directory_tmp = sys_get_temp_dir() . "/plupload/";
     }
     if (JUDLPROVERSION && !$isNew && $params->get('store_old_file_versions', 1)) {
         $versionField = new JUDownloadFieldCore_version();
         if (version_compare($tableBeforeSave->version, $fieldsData[$versionField->id]) != 0) {
             $query = "SELECT * FROM #__judownload_files WHERE doc_id = " . $docId;
             $db->setQuery($query);
             $fileObjectList = $db->loadObjectList();
             foreach ($fileObjectList as $fileObj) {
                 $query = $db->getQuery(true);
                 $query->select('*')->from('#__judownload_versions')->where('file_id = ' . $fileObj->id)->where('date < ' . $db->quote($table->updated))->where('file_path != ""')->order('date DESC, version DESC');
                 $db->setQuery($query, 0, 1);
                 $nearestVersion = $db->loadObject();
                 $storeFile = false;
                 if (!$nearestVersion) {
                     $storeFile = true;
                 } else {
                     $currentVersionFile = $file_directory . $docId . '/' . $fileObj->file_name;
                     $nearestVersionFile = $file_directory . $docId . '/' . $nearestVersion->file_path;
                     if (hash_file('md5', $currentVersionFile) != hash_file('md5', $nearestVersionFile)) {
                         $storeFile = true;
                     }
                 }
                 if ($storeFile) {
                     $versionFolder = JFolder::makeSafe($table->version);
                     if (!$versionFolder) {
                         $versionFolder = 'versions';
                     }
                     if (!JFolder::exists($file_directory . $docId . "/" . $versionFolder . "/")) {
                         $file_index = $file_directory . $docId . "/" . $versionFolder . "/index.html";
                         $buffer = "<!DOCTYPE html><title></title>";
                         JFile::write($file_index, $buffer);
                     }
                     $src = $file_directory . $docId . "/" . $fileObj->file_name;
                     $fileName = $fileObj->file_name;
                     $dest = $file_directory . $docId . "/" . $versionFolder . "/" . $fileName;
                     while (JFile::exists($dest)) {
                         $fileName = md5($fileObj->file_name . JUDownloadHelper::generateRandomString(10)) . "." . JFile::getExt($fileObj->file_name);
                         $dest = $file_directory . $docId . "/" . $versionFolder . "/" . $fileName;
                     }
                     JFile::copy($src, $dest);
                     $versionTable = JTable::getInstance("Version", "JUDownloadTable");
                     $version_downloads_check_arr = array('doc_id' => $docId, 'file_id' => $fileObj->id, 'version' => $table->version);
                     if ($versionTable->load($version_downloads_check_arr)) {
                         $versionTable->date = intval($table->updated) ? $table->updated : $table->created;
                         $versionTable->size = $fileObj->size;
                         $versionTable->md5_checksum = $fileObj->md5_checksum;
                         $versionTable->crc32_checksum = $fileObj->crc32_checksum;
                         $versionTable->file_path = $versionFolder . "/" . $fileName;
                         $versionTable->store();
                     } else {
                         $versionTable->bind($version_downloads_check_arr);
                         $versionTable->id = 0;
                         $versionTable->date = intval($table->updated) ? $table->updated : $table->created;
                         $versionTable->size = $fileObj->size;
                         $versionTable->md5_checksum = $fileObj->md5_checksum;
                         $versionTable->crc32_checksum = $fileObj->crc32_checksum;
                         $versionTable->file_path = $versionFolder . "/" . $fileName;
                         $versionTable->store();
                     }
                 }
             }
         }
     }
     if (JUDLPROVERSION && $app->isAdmin()) {
         $versionTable = JTable::getInstance("Version", "JUDownloadTable");
         foreach ($versions as $versionKey => $version) {
             if ($versionTable->load($versionKey)) {
                 if ($version['remove']) {
                     $srcFile = $file_directory . $versionTable->doc_id . '/' . $versionTable->file_path;
                     JFile::delete($srcFile);
                     $versionTable->delete();
                     if ($version['replace']) {
                         $filePath = $file_directory_tmp . $version['replace'];
                         if (JFile::exists($filePath)) {
                             JFile::delete($filePath);
                         }
                     }
                 } elseif ($version['replace']) {
                     $oldFile = $file_directory . $versionTable->doc_id . '/' . $versionTable->file_path;
                     JFile::delete($oldFile);
                     $versionFolder = JFolder::makeSafe($versionTable->version);
                     if (!$versionFolder) {
                         $versionFolder = 'versions';
                     }
                     if (!JFolder::exists($file_directory . $versionTable->doc_id . "/" . $versionFolder . "/")) {
                         $file_index = $file_directory . $versionTable->doc_id . "/" . $versionFolder . "/index.html";
                         $buffer = "<!DOCTYPE html><title></title>";
                         JFile::write($file_index, $buffer);
                     }
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:document.php

示例12: makeSafe

 /**
  * Helper wrapper method for makeSafe
  *
  * @param   string  $path  The full path to sanitise.
  *
  * @return  string  The sanitised string
  *
  * @see     JFolder::makeSafe()
  * @since   3.4
  */
 public function makeSafe($path)
 {
     return JFolder::makeSafe($path);
 }
开发者ID:deenison,项目名称:joomla-cms,代码行数:14,代码来源:folder.php

示例13: fileupdload

 function fileupdload($id)
 {
     if (!$_FILES['cfile']['size'] || $_FILES['cfile']['size'] > 6000000) {
         return false;
     } else {
         $permitted = array('application/zip', 'application/x-rar-compressed');
         $typeOK = false;
         foreach ($permitted as $type) {
             if ($type == $_FILES['cfile']['type']) {
                 $typeOK = true;
                 break;
             }
         }
         if ($typeOK) {
             $cate = 'category_' . JRequest::getVar('category');
             jimport('joomla.filesystem.folder');
             $folder = JPATH_SITE . DS . 'codefile';
             $folder = JFolder::makeSafe($folder);
             if (!JFolder::exists($folder)) {
                 JFolder::create($folder);
             }
             $folder = JPATH_SITE . DS . 'codefile' . DS . $cate;
             $folder = JFolder::makeSafe($folder);
             if (!JFolder::exists($folder)) {
                 JFolder::create($folder);
             }
             $name = $_FILES['cfile']['name'];
             $filename = 'devzone_' . $id . '_' . $name;
             $newname = JPATH_SITE . DS . 'codefile' . DS . $cate . DS . $filename;
             if (!move_uploaded_file($_FILES['cfile']['tmp_name'], $newname)) {
                 return false;
             } else {
                 if ($this->filenameupdate($id, $filename)) {
                     return false;
                 } else {
                     return true;
                 }
             }
         } else {
             return false;
         }
     }
 }
开发者ID:hrishikesh-kumar,项目名称:NBSNIP,代码行数:43,代码来源:developerzone.php

示例14: testMakeSafe

	/**
	 * Tests the JFolder::makeSafe method.
	 *
	 * @return  void
	 *
	 * @since   12.1
	 *
	 * @covers  JFolder::makeSafe
	 */
	public function testMakeSafe()
	{
		$actual = JFolder::makeSafe('test1/testdirectory');
		$this->assertEquals('test1/testdirectory', $actual);
	}
开发者ID:realityking,项目名称:joomla-platform,代码行数:14,代码来源:JFolderTest.php

示例15: createZipArchive

 protected function createZipArchive($archiveName = '', $filesPath = '', $files = array())
 {
     $archiveName = JPATH_TMP . $this->extPrefix . $this->extName . '.zip';
     JFolder::makeSafe($archiveName);
     if (JFile::exists($archiveName)) {
         return false;
     }
     $zipAdapter =& JArchive::getAdapter('zip');
     $result = $zipAdapter->create($archiveName, $this->filesArray);
     return $result;
 }
开发者ID:beingsane,项目名称:cli-builder,代码行数:11,代码来源:builder.php


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