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


PHP JFolder::create方法代码示例

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


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

示例1: createFolder

 /**
  * Create a folder
  *
  * @param   string   $path  Folder path
  * @param   bitmask  $mode  Permissions
  *
  * @return bool
  */
 public function createFolder($path, $mode = 0755)
 {
     if (JFolder::create($path, $mode)) {
         return $this->createIndexFile($path);
     }
     return false;
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:15,代码来源:filesystemstorage.php

示例2: js

 /**
  * Get Page JavaScript from either session or cached .js file
  *
  * @return string
  */
 public static function js()
 {
     $config = JFactory::getConfig();
     if ($config->get('caching') == 0) {
         $script = self::buildJs();
     } else {
         $uri = JURI::getInstance();
         $session = JFactory::getSession();
         $uri = $uri->toString(array('path', 'query'));
         $file = md5($uri) . '.js';
         $folder = JPATH_SITE . '/cache/com_fabrik/js/';
         if (!JFolder::exists($folder)) {
             JFolder::create($folder);
         }
         $cacheFile = $folder . $file;
         // Check for cached version
         if (!JFile::exists($cacheFile)) {
             $script = self::buildJs();
             file_put_contents($cacheFile, $script);
         } else {
             $script = JFile::read($cacheFile);
         }
     }
     self::clearJs();
     return $script;
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:31,代码来源:fabrik.php

示例3: createFolder

 /**
  * Create missing folders
  *
  * @copyright
  * @author 		RolandD
  * @todo
  * @see
  * @access 		public
  * @param
  * @return
  * @since 		3.0
  */
 public function createFolder()
 {
     $app = JFactory::getApplication();
     jimport('joomla.filesystem.folder');
     $folder = str_ireplace(JPATH_ROOT, '', JRequest::getVar('folder'));
     return JFolder::create($folder);
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:19,代码来源:about.php

示例4: __construct

 function __construct($options = array())
 {
     static $expiredCacheCleaned;
     $this->profile_db = JFactory::getDBO();
     $this->db = clone $this->profile_db;
     $this->_language = isset($options['language']) ? $options['language'] : 'en-GB';
     $this->_lifetime = isset($options['lifetime']) ? $options['lifetime'] : 60;
     $this->_now = isset($options['now']) ? $options['now'] : time();
     $config = JFactory::getConfig();
     $this->_hash = $config->get('config.secret');
     // if its not the first instance of the joomfish db cache then check if it should be cleaned and otherwise garbage collect
     if (!isset($expiredCacheCleaned)) {
         // check a file in the 'file' cache to check if we should remove all our db cache entries since cache manage doesn't handle anything other than file caches
         $conf = JFactory::getConfig();
         $cachebase = $conf->get('cache_path', JPATH_ROOT . DS . 'cache');
         $cachepath = $cachebase . DS . "falang-cache";
         if (!JFolder::exists($cachepath)) {
             JFolder::create($cachepath);
         }
         $cachefile = $cachepath . DS . "cachetest.txt";
         jimport("joomla.filesystem.file");
         if (!JFile::exists($cachefile) || JFile::read($cachefile) != "valid") {
             // clean out the whole cache
             $this->cleanCache();
             //sbou TODO uncomment write and solve problem
             JFile::write($cachefile, "valid");
         }
         $this->gc();
     }
     $expiredCacheCleaned = true;
 }
开发者ID:fur81,项目名称:zofaxiopeu,代码行数:31,代码来源:JCacheStorageJFDB.php

示例5: createFolders

 private function createFolders()
 {
     $thumbFolder = JPATH_ROOT . '/images/ariimageslider';
     if (!JFolder::exists($thumbFolder)) {
         JFolder::create($thumbFolder);
     }
 }
开发者ID:sansandeep143,项目名称:av,代码行数:7,代码来源:script.php

示例6: install

 /**
  * Called on installation
  *
  * @param   JAdapterInstance  $adapter  The object responsible for running this script
  *
  * @return  boolean  True on success
  */
 public function install(JAdapterInstance $adapter)
 {
     if (version_compare(JVERSION, '2.5.5') >= 0) {
         $db = JFactory::getDBO();
         $query = $db->getQuery(true);
         $query->update('#__extensions');
         $query->set('enabled = 1');
         $query->where('type = "plugin"');
         $query->where('folder = "system"');
         $query->where('element = "pwebj3ui"');
         $db->setQuery($query);
         try {
             $db->execute();
         } catch (Exception $e) {
         }
     }
     if (version_compare(JVERSION, '3.0.0') == -1) {
         $this->copyMedia(true);
     } else {
         if (version_compare(JVERSION, '3.1.4') == -1) {
             // Update Bootstrap to version 2.3.2
             $this->copyBootstrap();
         }
         // remove unused files from plugin
         $plugin_path = JPATH_ROOT . '/plugins/system/pwebj3ui/';
         JFolder::delete($plugin_path . 'libraries/cms');
         JFolder::delete($plugin_path . 'media');
         JFolder::create($plugin_path . 'media');
         JFile::copy($plugin_path . 'index.html', $plugin_path . 'media/index.html');
     }
 }
开发者ID:smart-one,项目名称:3kita,代码行数:38,代码来源:installer.script.php

示例7: __construct

 /**
  * Class constructor
  *
  * @param string $file Path to cache file
  * @param boolean $hash Wether the key should be hashed
  * @param int $lifetime The values lifetime
  * @since 2.0
  */
 public function __construct($file, $hash = true, $lifetime = null)
 {
     // if cache file doesn't exist, create it
     if (!JFile::exists($file)) {
         JFolder::create(dirname($file));
         $buffer = '';
         JFile::write($file, $buffer);
     }
     // set file and parse it
     $this->_file = $file;
     $this->_hash = $hash;
     $this->_parse();
     // clear out of date values
     if ($lifetime) {
         $lifetime = (int) $lifetime;
         $remove = array();
         foreach ($this->_items as $key => $value) {
             if (time() - $value['timestamp'] > $lifetime) {
                 $remove[] = $key;
             }
         }
         foreach ($remove as $key) {
             unset($this->_items[$key]);
         }
     }
 }
开发者ID:JBZoo,项目名称:Zoo-Changelog,代码行数:34,代码来源:cache.php

示例8: thumb

 public static function thumb($image, $width, $height, $ratio = false, $uniqid)
 {
     // remove any / that begins the path
     if (substr($image, 0, 1) == '/') {
         $image = substr($image, 1);
     }
     // create a thumb filename
     $file_dir = dirname($image);
     $thumb_dir = $file_dir . DS . "tzslider_thumbs";
     if (!JFolder::exists($thumb_dir)) {
         JFolder::create($thumb_dir);
     }
     $file_name = JFile::stripExt(basename($image));
     $file_ext = JFile::getExt($image);
     $thumb_path = $thumb_dir . DS . $file_name . '_' . $uniqid . "_thumb." . $file_ext;
     // check to see if this file exists, if so we don't need to create it
     if (function_exists("gd_info")) {
         //Check existing thumbnails dimensions
         if (file_exists($thumb_path)) {
             $size = GetImageSize($thumb_path);
             $currentWidth = $size[0];
             $currentHeight = $size[1];
         }
         //Creating thumbnails
         if (!file_exists($thumb_path) || $currentWidth != $width || $currentHeight != $height) {
             modTzContentSliderCommonHelper::crop($image, $width, $height, $ratio, $thumb_path);
         }
     }
     return str_replace("\\", "/", $thumb_path);
 }
开发者ID:naquib555,项目名称:quBitolgy,代码行数:30,代码来源:common.php

示例9: uploadAction

 /**
  * Method to handle upload action
  *
  * @return  void
  */
 public function uploadAction()
 {
     if ($this->request->getMethod() != 'POST') {
         return;
     }
     if (isset($_FILES['font-upload']) and $_FILES['font-upload']['error'] == 0) {
         // Verify font file
         if (!preg_match('/\\.(ttf|otf|eot|svg|woff)$/', $_FILES['font-upload']['name'])) {
             exit(JText::_('JSN_TPLFW_FONT_FILE_NOT_SUPPORTED'));
         }
         // Prepare directory to store uploaded font file
         $path = JPATH_ROOT . "/templates/{$this->template['name']}/uploads/fonts";
         if (!is_dir($path) and !JFolder::create($path)) {
             exit(JText::_('JSN_TPLFW_UPLOAD_CREATE_DIR_FAIL'));
         }
         // Check if the directory is writable
         $buffer = '<html><head></head><body></body></html>';
         if (!JFile::write("{$path}/index.html", $buffer)) {
             exit(JText::_('JSN_TPLFW_UPLOAD_CREATE_DIR_FAIL'));
         }
         // Move uploaded file to temporary folder
         $path .= '/' . str_replace(' ', '-', $_FILES['font-upload']['name']);
         if (!JFile::move($_FILES['font-upload']['tmp_name'], $path)) {
             exit(JText::_('JSN_TPLFW_UPLOAD_MOVE_FILE_FAIL'));
         }
     } else {
         exit(JText::sprintf('JSN_TPLFW_UPLOAD_FAIL', isset($_FILES['font-upload']) ? $_FILES['font-upload']['error'] : 'unknown'));
     }
     exit('OK');
 }
开发者ID:jdrzaic,项目名称:joomla-dummy,代码行数:35,代码来源:font.php

示例10: processImage

 public static function processImage($width = 0, $height = 0, $type = '', $pk = 0, $uploadname = 'default.gif')
 {
     // get what sizes we need
     list($width, $height) = static::getImageSizes($width, $height);
     // check if we have the original image
     $origpath = static::makePath($type, $pk, $uploadname);
     if (!JFile::exists(JPATH_ROOT . '/' . $origpath)) {
         return $pk ? static::processImage($width, $height) : false;
     }
     // check if we have already made the resized image
     $path = static::makePath($type, $pk, $uploadname, $width, $height);
     if (JFile::exists(JPATH_ROOT . '/' . $path)) {
         return $path;
     }
     // check if our folder exists and if not, if we can create it
     $folder = dirname(JPATH_ROOT . '/' . $path);
     if (!JFolder::exists($folder) && !JFolder::create($folder)) {
         return $pk ? static::processImage($width, $height) : false;
     }
     // create us a resized image
     $LNSimpleImage = new LNSimpleImage(JPATH_ROOT . '/' . $origpath);
     $LNSimpleImage->resizeToFit($width, $height);
     $LNSimpleImage->save(JPATH_ROOT . '/' . $path);
     return $path;
 }
开发者ID:sankam-nikolya,项目名称:FileUploadForm,代码行数:25,代码来源:image.php

示例11: uploader

 public static function uploader()
 {
     $params = modPwebcontactHelper::getParams();
     // check if upload is enabled
     if (!$params->get('show_upload', 0)) {
         if (PWEBCONTACT_DEBUG) {
             modPwebcontactHelper::setLog('Uploader disabled');
         }
         return array('status' => 402, 'files' => array());
     }
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.folder');
     $path = $params->get('upload_path');
     if (!JFolder::exists($path)) {
         JFolder::create($path, 0777);
     }
     if (!is_writable($path) and JPath::canChmod($path)) {
         JPath::setPermissions($path, null, '0777');
     }
     if (!is_writable($path)) {
         if (PWEBCONTACT_DEBUG) {
             modPwebcontactHelper::setLog('Upload dir is not writable');
         }
         return array('status' => 403, 'files' => array());
     }
     // load uploader
     $uploader = new modPWebContactUploader(array('upload_dir' => $params->get('upload_path'), 'upload_url' => $params->get('upload_url'), 'accept_file_types' => '/(\\.|\\/)(' . $params->get('upload_allowed_ext', '.+') . ')$/i', 'max_file_size' => (double) $params->get('upload_size_limit', 1) * 1024 * 1024, 'image_versions' => array(), 'delete_type' => 'POST'), false, array(1 => JText::_('MOD_PWEBCONTACT_UPLOAD_ERR_1'), 3 => JText::_('MOD_PWEBCONTACT_UPLOAD_ERR_3'), 4 => JText::_('MOD_PWEBCONTACT_UPLOAD_ERR_4'), 6 => JText::_('MOD_PWEBCONTACT_UPLOAD_ERR_6'), 7 => JText::_('MOD_PWEBCONTACT_UPLOAD_ERR_7'), 8 => JText::_('MOD_PWEBCONTACT_UPLOAD_ERR_8'), 'post_max_size' => JText::_('MOD_PWEBCONTACT_UPLOAD_ERR_1'), 'max_file_size' => JText::_('MOD_PWEBCONTACT_UPLOAD_SIZE_ERR'), 'accept_file_types' => JText::_('MOD_PWEBCONTACT_UPLOAD_TYPE_ERR')));
     $response = $uploader->handleRequest();
     if (PWEBCONTACT_DEBUG) {
         modPwebcontactHelper::setLog('Uploader exit');
     }
     return $response;
 }
开发者ID:01J,项目名称:topm,代码行数:33,代码来源:uploader.php

示例12: getOptions

 protected function getOptions()
 {
     $options = array();
     if (defined('JMF_TPL_PATH')) {
         $path = JMF_TPL_PATH . DIRECTORY_SEPARATOR . 'tpl';
         $files = JFolder::files($path, '.php');
         if (is_array($files)) {
             $app = JFactory::getApplication();
             $styleid = $app->input->get('id', null, 'int');
             $file = JPath::clean(JMF_TPL_PATH . '/assets/style/assigns-' . $styleid . '.json');
             if (!is_dir(dirname($file))) {
                 JFolder::create(dirname($file));
             }
             $assigns = new JRegistry();
             // get current layout assigns settings
             if (JFile::exists($file)) {
                 $assigns->loadString(JFile::read($file));
             } else {
                 $assigns->set(0, !empty($this->value) ? $this->value : 'default');
                 $data = $assigns->toString();
                 if (!@JFile::write($file, $data)) {
                     $app->enqueueMessage(JText::sprintf('PLG_SYSTEM_JMFRAMEWORK_CAN_NOT_WRITE_TO_FILE', $file), 'error');
                 }
             }
             $arr_assigns = $assigns->toArray();
             foreach ($files as $file) {
                 $name = JFile::stripExt($file);
                 $options[] = JHtml::_('select.option', $name, $name . ($name == $arr_assigns[0] ? ' [DEFAULT]' : ''));
             }
         }
     }
     return $options;
 }
开发者ID:kidaa30,项目名称:lojinha,代码行数:33,代码来源:jmlayout.php

示例13: extract

 /**
  * Extract a ZIP compressed file to a given path
  *
  * @param   string  $archive      Path to ZIP archive to extract
  * @param   string  $destination  Path to extract archive into
  * @param   array   $options      Extraction options [unused]
  *
  * @return  boolean  True on success
  *
  * @since   11.1
  * @throws  RuntimeException
  */
 public function extract($archive, $destination, array $options = array())
 {
     $this->_data = null;
     $this->_metadata = null;
     $this->_data = file_get_contents($archive);
     if (!$this->_data) {
         throw new RuntimeException('Unable to read archive');
     }
     $this->_getTarInfo($this->_data);
     for ($i = 0, $n = count($this->_metadata); $i < $n; $i++) {
         $type = strtolower($this->_metadata[$i]['type']);
         if ($type == 'file' || $type == 'unix file') {
             $buffer = $this->_metadata[$i]['data'];
             $path = JPath::clean($destination . '/' . $this->_metadata[$i]['name']);
             // Make sure the destination folder exists
             if (!JFolder::create(dirname($path))) {
                 throw new RuntimeException('Unable to create destination');
             }
             if (JFile::write($path, $buffer) === false) {
                 throw new RuntimeException('Unable to write entry');
             }
         }
     }
     return true;
 }
开发者ID:Rai-Ka,项目名称:joomla-cms,代码行数:37,代码来源:tar.php

示例14: createZip

 /**
  * Create ZIP archive.
  *
  * @param   array    $files  An array of files to put in archive.
  * @param   boolean  $save   Whether to save zip data to file or not?
  * @param   string   $name   Name with path to store archive file.
  *
  * @return  mixed  Zip data if $save is FALSE, or boolean value if $save is TRUE
  */
 public static function createZip($files, $save = false, $name = '')
 {
     if (is_array($files) and count($files)) {
         // Initialize variables
         $zip = new zipfile();
         $root = str_replace('\\', '/', JPATH_ROOT);
         foreach ($files as $file) {
             // Add file to zip archive
             if (is_array($file)) {
                 foreach ($file as $k => $v) {
                     $zip->create_file($v, $k);
                 }
             } elseif (is_string($file) and is_readable($file)) {
                 // Initialize file path
                 $file = str_replace('\\', '/', $file);
                 $path = str_replace($root, '', $file);
                 $zip->create_file(JFile::read($file), $path);
             }
         }
         // Save zip archive to file system
         if ($save) {
             if (!JFolder::create($dest = dirname($name))) {
                 throw new Exception(JText::sprintf('JSN_EXTFW_GENERAL_FOLDER_NOT_EXISTS', $dest));
             }
             if (!JFile::write($name, $zip->zipped_file())) {
                 throw new Exception(JText::sprintf('JSN_EXTFW_GENERAL_CANNOT_WRITE_FILE', $name));
             }
             return true;
         } else {
             return $zip->zipped_file();
         }
     }
     return false;
 }
开发者ID:jdrzaic,项目名称:joomla-dummy,代码行数:43,代码来源:archive.php

示例15: createInitialDirectories

 public function createInitialDirectories()
 {
     if (!JFolder::exists($this->gallery->getPhotosPath())) {
         // TODO error handling
         JFolder::create($this->gallery->getPhotosPath());
     }
 }
开发者ID:beingsane,项目名称:joomla-gallery,代码行数:7,代码来源:controller.php


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