Skip to content

Instantly share code, notes, and snippets.

@ryandemmer
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryandemmer/46ff99c9e05cea2fea75 to your computer and use it in GitHub Desktop.
Save ryandemmer/46ff99c9e05cea2fea75 to your computer and use it in GitHub Desktop.
Example WFCustomFileSystem extension
<?php
/**
* @package JCE
* @copyright Copyright (c) 2009-2015 Ryan Demmer. All rights reserved.
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* JCE is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
*/
defined('_JEXEC') or die('RESTRICTED');
require_once(__DIR__ . '/joomla.php');
class WFCustomFileSystem extends WFJoomlaSystem {
public function getRootDir() {
static $root;
if (!isset($root)) {
// Get base directory as shared parameter
$dir = $this->get('dir', '');
// get custom variable to replace
$custom = JRequest::getVar('custom_var', '');
// replace value
$dir = str_replace('$custom', $custom, $dir);
// set dir variable with custom
$this->set('dir', $dir);
// use parent class to process root directory
$root = parent::getRootDir();
}
return $root;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment